Contribute
Register

USB-C Hotplug Questions

Status
Not open for further replies.
Hi,

I updated this to work with BIOS 1.3.3 on the XPS 15 because Dell did this:
Code:
Method (XTBT, 2, Serialized)
        {
            ADBG ("XTBT")
            If (LEqual (CF2T, One))
            {
                ADBG ("Clear")
                ADBG ("GPI_GPE_STS")
                \_SB.CAGS (Arg1)
            }

            WWAK ()
            WSUB (Arg0)
            If (LEqual (TNAT, One))
            {
                Store (RSMI (Arg0), Local0)
                If (LNot (Local0))
                {
                    Return (Zero)
                }

                If (DMSI (Arg0))
                {
                    Return (Zero)
                }
            }

            If (GNIS (Arg0))
            {
                Return (Zero)
            }

            OperationRegion (SPRT, SystemIO, 0xB2, 0x02)
            Field (SPRT, ByteAcc, Lock, Preserve)
            {
                SSMP,   8
            }

            ADBG ("TBT-HP-Handler")
            ADBG ("PEG WorkAround")
            PGWA (Arg0)
            Acquire (OSUM, 0xFFFF)
            Store (TBFF (Arg0), Local1)
            If (LEqual (Local1, One))
            {
                Sleep (0x10)
                Release (OSUM)
                ADBG ("OS_Up_Received")
                If (LAnd (LEqual (DPTF, One), LEqual (DDDR, One)))
                {
                    If (LEqual (_REV, 0x05))
                    {
                        Return (Zero)
                    }

                    XTBT (TBSE, CPGN)
                }

                Return (Zero)
            }

            If (LEqual (Local1, 0x02))
            {
                ADBG ("Disconnect")
                If (LEqual (OHPN, One))
                {
                    NTFY (Arg0)
                }

                If (LEqual (GHPN, One))
                {
                    NFYG ()
                }

                Sleep (0x10)
                Release (OSUM)
                P8XH (Zero, 0x7D)
                ADBG ("Disconnect")
                Return (Zero)
            }

            If (LEqual (SOHP, One))
            {
                ADBG ("TBT SW SMI")
                Store (TBEF, TBSF)
                Store (TBSW, SSMP)
                Store (TEC0, TBSF)
                Store (TBSW, SSMP)
            }

            If (LEqual (OHPN, One))
            {
                NTFY (Arg0)
            }

            If (LEqual (GHPN, One))
            {
                NFYG ()
            }

            If (LEqual (S0ID, One))
            {
                Notify (\_SB.LID0, 0x80)
            }

            Sleep (0x10)
            Release (OSUM)
            ADBG ("End-of-XTBT")
        }

        Method (_E42, 0, NotSerialized)  // _Exx: Edge-Triggered GPE
        {
            ADBG ("_E42")
            XTBT (TBSE, CPGN)
            ADBG ("End-of-_E42")
        }
I believe the "SSDT-TB" file @dpassmor made will still work with my patch (below) + SSDT (attached):

Code:
<dict>
                    <key>Comment</key>
                    <string>Rename XTBT to YTBT, XTBT call redirect to solve recursion issue for USB-C hotplug, pair with SSDT-YTBT (credit dpassmor)</string>
                    <key>Disabled</key>
                    <false/>
                    <key>Find</key>
                    <data>
                        pABYVEJUVEJTRUNQR04=
                    </data>
                    <key>Replace</key>
                    <data>
                        pABZVEJUVEJTRUNQR04=
                    </data>
                </dict>

I'm currently making my own equivalent to SSDT-TB, which I hope will eventually enable full thunderbolt hotplug support (right now just the NHI shows up when a thunderbolt device is plugged in. USB Type-C works perfectly, though). I think I have an idea of how to do it....

Also, the XRMV rename makes the SD Card reader disappear from OS X. I think it might be related to \_SB.PCI0.PEMC.CARD, which has an _RMV method. Does macOS only support one ExpressCard device at a time?

EDIT: Here's a cool pic of how it's going so far:
VrYXgwP.jpg
Why do forum spoiler tags not work?
 

Attachments

  • SSDT-YTBT.dsl
    330 bytes · Views: 238
Last edited:
Hi,

I updated this to work with BIOS 1.3.3 on the XPS 15 because Dell did this:
Code:
Method (XTBT, 2, Serialized)
        {
            ADBG ("XTBT")
            If (LEqual (CF2T, One))
            {
                ADBG ("Clear")
                ADBG ("GPI_GPE_STS")
                \_SB.CAGS (Arg1)
            }

            WWAK ()
            WSUB (Arg0)
            If (LEqual (TNAT, One))
            {
                Store (RSMI (Arg0), Local0)
                If (LNot (Local0))
                {
                    Return (Zero)
                }

                If (DMSI (Arg0))
                {
                    Return (Zero)
                }
            }

            If (GNIS (Arg0))
            {
                Return (Zero)
            }

            OperationRegion (SPRT, SystemIO, 0xB2, 0x02)
            Field (SPRT, ByteAcc, Lock, Preserve)
            {
                SSMP,   8
            }

            ADBG ("TBT-HP-Handler")
            ADBG ("PEG WorkAround")
            PGWA (Arg0)
            Acquire (OSUM, 0xFFFF)
            Store (TBFF (Arg0), Local1)
            If (LEqual (Local1, One))
            {
                Sleep (0x10)
                Release (OSUM)
                ADBG ("OS_Up_Received")
                If (LAnd (LEqual (DPTF, One), LEqual (DDDR, One)))
                {
                    If (LEqual (_REV, 0x05))
                    {
                        Return (Zero)
                    }

                    XTBT (TBSE, CPGN)
                }

                Return (Zero)
            }

            If (LEqual (Local1, 0x02))
            {
                ADBG ("Disconnect")
                If (LEqual (OHPN, One))
                {
                    NTFY (Arg0)
                }

                If (LEqual (GHPN, One))
                {
                    NFYG ()
                }

                Sleep (0x10)
                Release (OSUM)
                P8XH (Zero, 0x7D)
                ADBG ("Disconnect")
                Return (Zero)
            }

            If (LEqual (SOHP, One))
            {
                ADBG ("TBT SW SMI")
                Store (TBEF, TBSF)
                Store (TBSW, SSMP)
                Store (TEC0, TBSF)
                Store (TBSW, SSMP)
            }

            If (LEqual (OHPN, One))
            {
                NTFY (Arg0)
            }

            If (LEqual (GHPN, One))
            {
                NFYG ()
            }

            If (LEqual (S0ID, One))
            {
                Notify (\_SB.LID0, 0x80)
            }

            Sleep (0x10)
            Release (OSUM)
            ADBG ("End-of-XTBT")
        }

        Method (_E42, 0, NotSerialized)  // _Exx: Edge-Triggered GPE
        {
            ADBG ("_E42")
            XTBT (TBSE, CPGN)
            ADBG ("End-of-_E42")
        }
I believe the "SSDT-TB" file @dpassmor made will still work with my patch (below) + SSDT (attached):

Code:
<dict>
                    <key>Comment</key>
                    <string>Rename XTBT to YTBT, XTBT call redirect to solve recursion issue for USB-C hotplug, pair with SSDT-YTBT (credit dpassmor)</string>
                    <key>Disabled</key>
                    <false/>
                    <key>Find</key>
                    <data>
                        pABYVEJUVEJTRUNQR04=
                    </data>
                    <key>Replace</key>
                    <data>
                        pABZVEJUVEJTRUNQR04=
                    </data>
                </dict>

I'm currently making my own equivalent to SSDT-TB, which I hope will eventually enable full thunderbolt hotplug support (right now just the NHI shows up when a thunderbolt device is plugged in. USB Type-C works perfectly, though). I think I have an idea of how to do it....

Also, the XRMV rename makes the SD Card reader disappear from OS X. I think it might be related to \_SB.PCI0.PEMC.CARD, which has an _RMV method. Does macOS only support one ExpressCard device at a time?

I'm not sure what you're trying to accomplish, but your SSDT-YTBT.dsl can be reduced to this:
Code:
DefinitionBlock("", "SSDT", 2, "hack", "YTBT", 0)
{
    Method(YTBT, 2) { }
}
(default method return value is zero)

Because the construct 'If (Arg0 == Arg1) { Return(0) } Else { Return(0) }', always returns zero.
 
Gets rid of a warning to have Arg0 and Arg1 do something, and I have no idea what values they actually are, so that's the most harmless thing I could think of.
 
Gets rid of a warning to have Arg0 and Arg1 do something, and I have no idea what values they actually are, so that's the most harmless thing I could think of.

You don't have to fix warnings...
 
I'm currently making my own equivalent to SSDT-TB, which I hope will eventually enable full thunderbolt hotplug support (right now just the NHI shows up when a thunderbolt device is plugged in. USB Type-C works perfectly, though). I think I have an idea of how to do it....

Hi @KNNSpeed,

Sounds like your making good progress with this ...

I have the issue where the USB C / TB3 port is powered down on bootup unless i have a usb C device plugged in before booting OSX ... see this post for a bit more info :-

https://www.tonymacx86.com/threads/usb-c-hotplug-not-working.223534/page-5#post-1573017

Right now i'm only really in getting the usb c on that port usable (hot pluggable) ... which from you seem to have success with if i read your post correct ... I have HP X360 Kaby lake (see WIP in sig and above link) so objects are likely to be different but i do have ... can you explain or do you have any links to the guides you used in modifying ssdt-ytbt or ssdt-usbc to get the port working in OSX ...

Many thanks
Cheers
Jay
 
Hi @KNNSpeed,

Sounds like your making good progress with this ...

I have the issue where the USB C / TB3 port is powered down on bootup unless i have a usb C device plugged in before booting OSX ... see this post for a bit more info :-

https://www.tonymacx86.com/threads/usb-c-hotplug-not-working.223534/page-5#post-1573017

Right now i'm only really in getting the usb c on that port usable (hot pluggable) ... which from you seem to have success with if i read your post correct ... I have HP X360 Kaby lake (see WIP in sig and above link) so objects are likely to be different but i do have ... can you explain or do you have any links to the guides you used in modifying ssdt-ytbt or ssdt-usbc to get the port working in OSX ...

Many thanks
Cheers
Jay

If all you're after is the USB C side of things, a simple find/replace patch in clover may be all that you need. The magic appears to be contained in the removal method for your specific device. For instance, on my KabyLake Elite X2, the USB C portion of the TB3 port is structured like so -

Code:
        Scope (_SB.PCI0.RP01.PXSX)
        {
            Method (_RMV, 0, NotSerialized)  // _RMV: Removal Status
            {
                Return (TARS)
            }

            Device (EP02)
            {
                Name (_ADR, 0x00020000)  // _ADR: Address
                Device (TXHC)
                {
                    Name (_ADR, Zero)  // _ADR: Address
                    Method (_PRW, 0, NotSerialized)  // _PRW: Power Resources for Wake
                    {
                        Store (Package (0x02)
                            {
                                Zero,
                                Zero
                            }, Local0)
                        Store (0x6D, Index (Local0, Zero))
                        If (LEqual (USWE, One))
                        {
                            Store (0x03, Index (Local0, One))
                        }

                        Return (Local0)
                    }

                    Device (RHUB)
                    {
                        Name (_ADR, Zero)  // _ADR: Address
                        Device (HS01)
                        {
                            Name (_ADR, One)  // _ADR: Address
                            Method (_UPC, 0, Serialized)  // _UPC: USB Port Capabilities
                            {
                                Return (GUPC (0xFF, 0x09))
                            }

                            Method (_PLD, 0, Serialized)  // _PLD: Physical Location of Device
                            {
                                Return (TPLD (One, 0x14))
                            }
                        }

                        Device (HS02)
                        {
                            Name (_ADR, 0x02)  // _ADR: Address
                            Method (_UPC, 0, Serialized)  // _UPC: USB Port Capabilities
                            {
                                Return (GUPC (Zero, 0xFF))
                            }

                            Method (_PLD, 0, Serialized)  // _PLD: Physical Location of Device
                            {
                                Return (TPLD (Zero, 0x15))
                            }
                        }

                        Device (SS01)
                        {
                            Name (_ADR, 0x03)  // _ADR: Address
                            Method (_UPC, 0, Serialized)  // _UPC: USB Port Capabilities
                            {
                                Return (GUPC (0xFF, 0x09))
                            }

                            Method (_PLD, 0, Serialized)  // _PLD: Physical Location of Device
                            {
                                Return (TPLD (One, 0x14))
                            }
                        }

                        Device (SS02)
                        {
                            Name (_ADR, 0x04)  // _ADR: Address
                            Method (_UPC, 0, Serialized)  // _UPC: USB Port Capabilities
                            {
                                Return (GUPC (Zero, 0xFF))
                            }

                            Method (_PLD, 0, Serialized)  // _PLD: Physical Location of Device
                            {
                                Return (TPLD (Zero, 0x15))
                            }
                        }
                    }
                }
            }

            Method (_PS0, 0, Serialized)  // _PS0: Power State 0
            {
            }

            Method (_PS3, 0, Serialized)  // _PS3: Power State 3
            {
                Store (" Host router Upstream port _PS3", Debug)
                Acquire (OSUM, 0xFFFF)
                Store (MMTB (), Local0)
                \_GPE.SXST (Local0)
                Release (OSUM)
            }
        }

At the very beginning, the TARS FieldUnitObj in the removal status method is the problem. I have no idea what it currently returns, but changing it to return 'One' gets USB C hotplug on the TB3 port working without issue for me. A simple find/replace is all that's needed -- a4544152 53 to a4010000 00. (This is specific to your DSDT, of course, so don't assume my patch will work for you.) I don't have any thunderbolt 3 devices to test with so I don't know if there are any adverse effects with TB3 devices from doing this but USB C hotplug on the port works without issue. You do have to give it a second for the PCI device to appear in the menubar but I believe that is the way the controller is designed.

So for you, I would suggest booting with a device plugged in so you can identify the device name and see if your situation is similar. If you're already hotpatching, then you should know how to add the correct patch. Otherwise, if you're static patching, just change it in your dsdt.

Hope that helps!
 
@jhax01,

Many Thanks for the info gringo ....
I'll find out what the device name is and give it go and let you know how things go ...

Cheers
Jay
 
@jhax01,

Ok booting up with a USB C device plugged in to the combined TB/USBC .. (Corsair 750GB SSD in USBC external Enclosure) the device shows up as a USB 3.1 in Sys Info ...

Screen Shot 2017-08-31 at 22.02.10.png
And looking for the device in IO Explorer shows that its connected to _SB/PCI0/RP05 ...

Screen Shot 2017-08-31 at 21.45.10.png

The only place i can find a reference to 'Return (TARS)' for RP05 in my DSDT is in this _RMV method :-

Screen Shot 2017-08-31 at 21.59.54.png
The method is more more complex due to the conditional 'If' .. 'Else' ... but if i read your post correct your suggesting to patch the _RMV method to look as follows :-

Code:
 Method (_RMV, 0, NotSerialized)  // _RMV: Removal Status
                    {
                        If (LAnd (LEqual (TBTS, One), LEqual (SBNR, TBUS)))
                        {
                            Return (One)
                        }
                        Else
                        {
                            Return (HPCE)
                        }
                    }

Do you think i should remove the 'Else' part of the If condition or leave it as is ...

Cheers
Jay
 
Last edited:
@jhax01,

Ok booting up with a USB C device plugged in to the combined TB/USBC .. (Corsair 750GB SSD in USBC external Enclosure) the device shows up as a USB 3.1 in Sys Info ...

View attachment 275846
And looking for the device in IO Explorer shows that its connected to _SB/PCI0/RP05 ...

View attachment 275844

The only place i can find a reference to Returns (TARS) for RP05 in my DSDT is here :-

View attachment 275845
The method looks very different to your example ...

If i read your post correct your suggesting to patch the _RMV method to look as follows :-

Code:
 Method (_RMV, 0, NotSerialized)  // _RMV: Removal Status
                    {
                        If (LAnd (LEqual (TBTS, One), LEqual (SBNR, TBUS)))
                        {
                            Return (One)
                        }
                        Else
                        {
                            Return (HPCE)
                        }
                    }

Do you think i should remove the 'Else' part of the If condition or leave it as is ...

Cheers
Jay

Your TB controller is without an ACPI identity (you will probably need to add one).

What does your ioreg look like when you boot with nothing plugged to the USB type-C?
 
@jhax01,

Ok booting up with a USB C device plugged in to the combined TB/USBC .. (Corsair 750GB SSD in USBC external Enclosure) the device shows up as a USB 3.1 in Sys Info ...

View attachment 275846
And looking for the device in IO Explorer shows that its connected to _SB/PCI0/RP05 ...

View attachment 275844

The only place i can find a reference to 'Return (TARS)' for RP05 in my DSDT is in this _RMV method :-

View attachment 275845
The method is more more complex due to the conditional 'If' .. 'Else' ... but if i read your post correct your suggesting to patch the _RMV method to look as follows :-

Code:
 Method (_RMV, 0, NotSerialized)  // _RMV: Removal Status
                    {
                        If (LAnd (LEqual (TBTS, One), LEqual (SBNR, TBUS)))
                        {
                            Return (One)
                        }
                        Else
                        {
                            Return (HPCE)
                        }
                    }

Do you think i should remove the 'Else' part of the If condition or leave it as is ...

Cheers
Jay

Though it is structured quite differently, I have the same If condition. I believe you can leave it in and just change the TARS. If for some reason that doesn't get you there, then try removing everything but the Return (One) from that method.

If neither of those work, then @RehabMan is probably right about the ACPI identity. TBH, I don't think you're enabling hot plug, per se, so much as making sure the controller is in a condition that OS X expects.
 
Status
Not open for further replies.
Back
Top