86CCFD48-205E-4A77-9C48-2021CBEDE341
which lets the OS power on the TB3 controller._PS0
method before restoring the device. The first attempt was to add the following:PXSX
device (the Thunderbolt NHI). Originally the code waited on just RP05
to start up and that worked 50% of the time because PXSX
takes a little bit longer to settle and we only made the race closer._GPE._L33
calls AMPE
which calls Notify (_SB.PCI0.RP09.UPSB.DSB0.NHI0, Zero)
. We know (from reading the ACPI specifications) that _GPE._Lxx
are level-triggered events (in order words an interrupt wire is tripped). We know that Notify
with the second argument of zero means that it's notifying a change in the bus state. So from this we deduce that the OSX kernel expects a notification on the NHI0
device when the hotplug wire is tripped. Notify
calls into the kernel itself and the hotplug is handled.RP05
. We look for any _GPE
that triggers a Notify
on RP05
with the second argument of zero because we know that the code will be related in some way to bus state changes. There is only one candidate:_GPE._E20
calls the local method XTBT
which calls NTFY
which eventually calls Notify (_SB.PCI0.RP05, Zero)
. It seems like the reason why hot-plug doesn't work is that OSX expects an notification on the NHI device (RP05.UPSB.DSB0.NHI0
) while the NUC notifes the root device (RP05
). To resolve this disconnect (haha get it) in the understanding, we can patch NTFY
to alert the right device.RP05.PXSX.DSB0.NHI0
), we can refer to it with Notify
. Since we can only add, not replace, ACPI objects, we need to use Clover's patching capabilities. We rename the original NTFY
implementation to XTFY
as the name is unused, and we get it out of the way. Then we implement NTFY
as followsNotify
that happens in _WAK
(called on wakeup)._WAK
calls local method RWAK
which eventually wakes up the right port if there is a device connected:RWAK
to XWAK
. Now we can re-write RWAK
into our own implementation with the right changes but it's a lot of code (and a lot unrelated to TB3) and we might mess up something else. Instead what we do is call the original RWAK
in our new RWAK
first and then do the TB3 notification stuff as well.