Contribute
Register

USB-C Hotplug Questions

Status
Not open for further replies.
@jhax01,

Thanks for the examples ... very useful in understand what the io tree should look like .



@RehabMan,

Ok i now think i understand what your referring too ... this is a io reg dump of the port (after usb2 memory stick removed)

View attachment 275968

If i understand you correctly i need to inject device identities from the indicated position onwards ..

So pci8086,15bd@0 needs to be TXHC@0

Is that all i need to do or will i also need to inject device names so that the AppleUSBXXXXX entries below that become HSXX@00X00000, SSXX@00X00000 ... etc

Is this correct ? ...

Cheers
Jay

Before you can add an identity for pci8086,15bd@0, you will need an identity for the parent node pci-bridge@2.
 
Ok ... think i'm getting somewhere ...

In jhax01 DSDT there is code to create Device EP02 (TB device i think) and then the USB ports associated with it :-

Code:
  If (LAnd (LEqual (TBTS, One), LEqual (TBSE, One)))
    {
        Scope (_SB.PCI0.RP01.PXSX)
        {
            Method (_RMV, 0, NotSerialized)  // _RMV: Removal Status
            {
                Return (One)
            }

            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)
            }
        }

My DSDT has no such code .... which would account for why i do not have any AHCI identities associated with the combo TB/USB port .. I've also checked all the SSDT's and i cant find anything .... could it be in one of the dynamic SSDT's ?

So i assume i somehow need to create a SSDT that does the same.. i know i'll need to change the scope def at the top of the code to Scope (_SB.PCI0.RP05.PXSX) but i assume it will need a load of external defs in order for it to work ... waht would be your advice on how to implement this ...

Cheers
Jay


I started with the attached SSDT (@KNNSpeed 's) which, when adjusted for the path of my device, overrode the native device names and allowed USB C hot plugging. After examining the SSDT and my DSDT further I realized I might be able to enable it with a simple DSDT patch. I tried it and it worked, but since your DSDT is pretty bare, you may have better luck by just using the work that @KNNSpeed has already done. I've already changed it for RP05 and even if it doesn't work for you, it gives you a more generic example, though I would suggest that rather than using the included methods(TPLD, GPLD, etc), I would delete them and reference those externally...

Edit**removed wrong quote.
 

Attachments

  • SSDT-TYPC.aml.zip
    1.5 KB · Views: 195
@jhaz01,

Many thanks for the SSDT ..... will take a look and have a go ....

Cheers
Jay
 
@jhaz01,

I tried using the SSDT you posted (already modified for RP05) it's loading Ok via clover ...

Screen Shot 2017-09-01 at 22.27.31.png

But Looking at the I/O reg none of the device names have taken ... so i need to work on it bit more ...

With regards to the methods you mentioned .. I assume your talking about the four methods defined in the RHUB Device in the SSDT ...

Method (GPLD, 2, Serialized)
Method (GUPC, 1, Serialized)
Method (TPLD, 2, Serialized)
Method (TUPC, 1, Serialized)

All four of those methods do exist in my DSDT defined under Device RHUB (_SB.PCI0.XHC.RHUB) ... the methods code looks identical to that in ssdt ... you suggested externalising those methods ... I'm no DDST or SSDT expert but i know enough to do some basic patching ...

I declared the external RHUB device and associated methods and then deleted the RHUB device from the TBTU device (at bottom of the SSDT code) and in its place added a scope to the external RHUB device (and methods) ...

Code:
/*

DefinitionBlock ("", "SSDT", 2, "hack", "TYPC", 0x00000000)
{
    External (_SB_.PCI0.XHC.RHUB, DeviceObj)  // Externalise Device
    External (_SB_.PCI0.XHC.RHUB.GPLD, MethodObj)  // Externalise Method
    External (_SB_.PCI0.XHC.RHUB.GUPC, MethodObj)  // Externalise Method
    External (_SB_.PCI0.XHC.RHUB.TPLD, MethodObj)   // Externalise Method
    External (_SB_.PCI0.XHC.RHUB.TUPC, MethodObj)   // Externalise Method

   
    External (_SB_.PCI0.RP05, DeviceObj)    // (from opcode)
    External (_SB_.PCI0.RP05.PXSX, DeviceObj)    // (from opcode)

    Scope (\_SB.PCI0.RP05)
    {
        Name (RTBT, One)
    }
   
    . . . . . . . 

            Device (TBTU)
            {
                Name (_ADR, Zero)  // _ADR: Address
                Name (_PRW, Package (0x02)  // _PRW: Power Resources for Wake
                {
                    0x6D,
                    Zero
                })
               
                Scope (\_SB_.PCI0.XHC.RHUB)   // <<<<<-------- Scope to External Device and Methods

                 {
                    Device (UB31)
                    {
                        Name (_ADR, 0x03)  // _ADR: Address
                        Method (_UPC, 0, NotSerialized)  // _UPC: USB Port Capabilities
                        {
                            Return (TUPC (0x09))
                        }

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

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

                        Method (_PLD, 0, NotSerialized)  // _PLD: Physical Location of Device
                        {
                            Return (GPLD (Zero, Zero))
                        }
                    }
                }
            }
        }
    }
}

It compiles (amazingly) but does not seem to do any more than the version you sent ....

Where to go from here ?

Cheers
Jay
 
@jhaz01,

I tried using the SSDT you posted (already modified for RP05) it's loading Ok via clover ...

View attachment 276151

But Looking at the I/O reg none of the device names have taken ... so i need to work on it bit more ...

With regards to the methods you mentioned .. I assume your talking about the four methods defined in the RHUB Device in the SSDT ...

Method (GPLD, 2, Serialized)
Method (GUPC, 1, Serialized)
Method (TPLD, 2, Serialized)
Method (TUPC, 1, Serialized)

All four of those methods do exist in my DSDT defined under Device RHUB (_SB.PCI0.XHC.RHUB) ... the methods code looks identical to that in ssdt ... you suggested externalising those methods ... I'm no DDST or SSDT expert but i know enough to do some basic patching ...

I declared the external RHUB device and associated methods and then deleted the RHUB device from the TBTU device (at bottom of the SSDT code) and in its place added a scope to the external RHUB device (and methods) ...

Code:
/*

DefinitionBlock ("", "SSDT", 2, "hack", "TYPC", 0x00000000)
{
    External (_SB_.PCI0.XHC.RHUB, DeviceObj)  // Externalise Device
    External (_SB_.PCI0.XHC.RHUB.GPLD, MethodObj)  // Externalise Method
    External (_SB_.PCI0.XHC.RHUB.GUPC, MethodObj)  // Externalise Method
    External (_SB_.PCI0.XHC.RHUB.TPLD, MethodObj)   // Externalise Method
    External (_SB_.PCI0.XHC.RHUB.TUPC, MethodObj)   // Externalise Method

  
    External (_SB_.PCI0.RP05, DeviceObj)    // (from opcode)
    External (_SB_.PCI0.RP05.PXSX, DeviceObj)    // (from opcode)

    Scope (\_SB.PCI0.RP05)
    {
        Name (RTBT, One)
    }
  
    . . . . . . .

            Device (TBTU)
            {
                Name (_ADR, Zero)  // _ADR: Address
                Name (_PRW, Package (0x02)  // _PRW: Power Resources for Wake
                {
                    0x6D,
                    Zero
                })
              
                Scope (\_SB_.PCI0.XHC.RHUB)   // <<<<<-------- Scope to External Device and Methods

                 {
                    Device (UB31)
                    {
                        Name (_ADR, 0x03)  // _ADR: Address
                        Method (_UPC, 0, NotSerialized)  // _UPC: USB Port Capabilities
                        {
                            Return (TUPC (0x09))
                        }

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

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

                        Method (_PLD, 0, NotSerialized)  // _PLD: Physical Location of Device
                        {
                            Return (GPLD (Zero, Zero))
                        }
                    }
                }
            }
        }
    }
}

It compiles (amazingly) but does not seem to do any more than the version you sent ....

Where to go from here ?

Cheers
Jay

If you want me to look at what you are doing, attach "Problem Reporting" files.
 
Hi Rehabman ...

Debug files attached (Clover folder with F2 log & F4 dump) + I O Reg
I rebooted with a USB memory stick in the port so that it shows up in the PCI/RP05 IO Reg device tree :-

Screen Shot 2017-09-01 at 23.50.10.png

Once ejected the port becomes unusable .... :banghead:

As previously stated i'm not that bothered about getting TB hot swap working (i believe thats still something thats being worked on) but i think it should be possible to get the USB port working correctly on PCI/RP05 based on the success @jhaz01 and @KNNSpeed have had ... Do you have the same issue on the TB/USBC on your latest NUC Hack .. ?

One thing to note is that i get an icon on the menu which i think is to do with PCI Express Card ... as it gives me the option to power off the card .. maybe the device needs to be defined as 'Bulit-in' ???

I find it very strange that the HP-X360 DSDT has no AHCI names for the whole PCI/RP05 device tree, and yet all the other USB ports do have SSXX/HSXX ... etc devices defined ... The TB/USBC combo port works fine in windows but device manager does not have any "BIOS Names" for it ?, I guess the Windows HP/Intel driver is ataching via its PID/VID ?

Screen Shot 2017-09-02 at 00.11.52.png

Any Help or advice much appreciated ..

Cheers
Jay
 
Last edited:
Hi Rehabman ...

Debug files attached (Clover folder with F2 log & F4 dump) + I O Reg
I rebooted with a USB 2 memory stick in the port so that it shows up in the RP05 IO Reg device tree :-

View attachment 276162
Any Help or advice much appreciated ..

Cheers
Jay

Too much code for now in your SSDT-TYPC.aml.
Start with just trying to establish the ACPI identities.

For example, this code will establish an identity for pci-bridge@2 node:

Code:
External(_SB.PCI0.RP05.PXSX, DeviceObj)
Scope(_SB.PCI0.RP05.PXSX)
{
    Device(EP02)
    {
        Name(_ADR, 0x00020000)
    }
}

And for example if you wanted identities for pci-bridge@0, and @1:
Code:
Scope(_SB.PCI0.RP05.PXSX)
{
    Device(EP00)
    {
        Name(_ADR, 0)
    }
    Device(EP01)
    {
        Name(_ADR, 0x00010000)
    }
}

So... once you have the identity established for pci-bridge@2 (as EP02), you can use it to get an identity for pci8086,15db@0 underneath it:
Code:
Scope(_SB.PCI0.RP05.PXSX.EP02)
{
    // just assuming Apple wants this called NIH0... you should check in Apple ioreg
    Device(NIH0)
    {
        Name(_ADR,0)
    }
}

There is a variety of ways you can arrange the related sections of code. This is one way:
Code:
DefinitionBlock("", "SSDT", 2, "hack", "TYPC", 0)
{
    External(_SB.PCI0.RP05.PXSX, DeviceObj)
    Scope(_SB.PCI0.RP05.PXSX)
    {
        Device(EP00) { Name(_ADR, 0) }
        Device(EP01) { Name(_ADR, 0x00010000) }
        Device(EP02)
        {
            Name(_ADR, 0x00020000)
            Device(NIH0) { Name(_ADR,0) }
        }
    }
}

Or:
Code:
DefinitionBlock("", "SSDT", 2, "hack", "TYPC", 0)
{
    External(_SB.PCI0.RP05.PXSX, DeviceObj)
    Scope(_SB.PCI0.RP05.PXSX)
    {
        Device(EP00) { Name(_ADR, 0) }
        Device(EP01) { Name(_ADR, 0x00010000) }
        Device(EP02) { Name(_ADR, 0x00020000) }
   }
   Scope(_SB.PCI0.RP05.PXSX.EP02)
   {
       Device(NIH0) { Name(_ADR,0) }
    }
}

eg. Start simple, then build on it.
Don't try to do too much at one time.

Once you establish your basic ACPI identities, confirmed in ioreg, then you can begin adding code (_RMV, _DSM, etc) that you think you may need.
 
@jhaz01,

I tried using the SSDT you posted (already modified for RP05) it's loading Ok via clover ...

View attachment 276151

But Looking at the I/O reg none of the device names have taken ... so i need to work on it bit more ...

With regards to the methods you mentioned .. I assume your talking about the four methods defined in the RHUB Device in the SSDT ...

Method (GPLD, 2, Serialized)
Method (GUPC, 1, Serialized)
Method (TPLD, 2, Serialized)
Method (TUPC, 1, Serialized)

All four of those methods do exist in my DSDT defined under Device RHUB (_SB.PCI0.XHC.RHUB) ... the methods code looks identical to that in ssdt ... you suggested externalising those methods ... I'm no DDST or SSDT expert but i know enough to do some basic patching ...

I declared the external RHUB device and associated methods and then deleted the RHUB device from the TBTU device (at bottom of the SSDT code) and in its place added a scope to the external RHUB device (and methods) ...

Code:
/*

DefinitionBlock ("", "SSDT", 2, "hack", "TYPC", 0x00000000)
{
    External (_SB_.PCI0.XHC.RHUB, DeviceObj)  // Externalise Device
    External (_SB_.PCI0.XHC.RHUB.GPLD, MethodObj)  // Externalise Method
    External (_SB_.PCI0.XHC.RHUB.GUPC, MethodObj)  // Externalise Method
    External (_SB_.PCI0.XHC.RHUB.TPLD, MethodObj)   // Externalise Method
    External (_SB_.PCI0.XHC.RHUB.TUPC, MethodObj)   // Externalise Method

  
    External (_SB_.PCI0.RP05, DeviceObj)    // (from opcode)
    External (_SB_.PCI0.RP05.PXSX, DeviceObj)    // (from opcode)

    Scope (\_SB.PCI0.RP05)
    {
        Name (RTBT, One)
    }
  
    . . . . . . .

            Device (TBTU)
            {
                Name (_ADR, Zero)  // _ADR: Address
                Name (_PRW, Package (0x02)  // _PRW: Power Resources for Wake
                {
                    0x6D,
                    Zero
                })
              
                Scope (\_SB_.PCI0.XHC.RHUB)   // <<<<<-------- Scope to External Device and Methods

                 {
                    Device (UB31)
                    {
                        Name (_ADR, 0x03)  // _ADR: Address
                        Method (_UPC, 0, NotSerialized)  // _UPC: USB Port Capabilities
                        {
                            Return (TUPC (0x09))
                        }

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

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

                        Method (_PLD, 0, NotSerialized)  // _PLD: Physical Location of Device
                        {
                            Return (GPLD (Zero, Zero))
                        }
                    }
                }
            }
        }
    }
}

It compiles (amazingly) but does not seem to do any more than the version you sent ....

Where to go from here ?

Cheers
Jay


If they're truly identical, no harm in leaving them in. They are *not* identical on my device and not knowing their purpose fully it seems better to let them do their thing in native form.

I'll reiterate that the controller needs a couple seconds to change states so after I've ejected something and pulled the cable, I'll wait until the express card icon disappears before trying to insert another cable/device.
 
I'll reiterate that the controller needs a couple seconds to change states so after I've ejected something and pulled the cable, I'll wait until the express card icon disappears before trying to insert another cable/device.

Does a real Mac show the "express card icon" for TB devices?
 
Does a real Mac show the "express card icon" for TB devices?

No clue at all. My real macs are a few years old so they have TB but not TB3.
 
Status
Not open for further replies.
Back
Top