Contribute
Register

HowTo: Real Thunderbolt HotPlug/HotSwap on the fly

Joined
Dec 28, 2012
Messages
154
Motherboard
ASRock X299 CREATOR
CPU
i9-7920X
Graphics
RX 6900 XT
Mac
  1. MacBook Pro
Mobile Phone
  1. iOS
Want real Thunderbolt HotPlug/HotSwap on the fly while your Hackintosh is running? Well, than this might be your solution:

I have tested a lot of so promising Thunderbolt HotPlug SSDTs out there and none of them provide a working solution for me, so I decided to spend some time on a working solution for real Thunderbolt HotPlug/HotSwap, where you can change your Thunderbolt devices on the fly w/o restarting your Hackintosh every time you connect/change a device. Also this tutorial will work for motherboards with onboard Thunderbolt as well as for motherboards with Thunderbolt Header connector.

OK, lets start how to make it work

As in many other threads, the first thing you have to know is where your Thunderbolt hardware belongs in your ACPI path. To find out where it belongs, just open "IORegistryExlorer" while booting normally into macOS. Than search for some entrys like this:

Sample of ASRock Z270 Super Carrier​
Sample of ASRock Z370 Professional Gaming i7​
Z270_TB_default.jpg
Z370_TB_default.jpg


Just for explanation: ASRock Z270 Super Carrier used builtin/onboard Thunderbolt 3, while ASRock Z370 Professional Gaming i7 uses Thunderbolt Header and a GC Gigabyte Titan Ridge PCIe card for Thunderbolt 3. As you can see for the Z270 the ACPI path looks like RP01/PXSX, while ACPI path for Z370 looks like PEG2/PEGP. Remember these entries for later modification when it comes to edit the Thunderbolt SSDT file.

Second: lets set the right BIOS settings for working Thunderbolt HotPlug/HotSwitch.
Lets take a look at the default BIOS settings for the given two sample motherboards ASRock Z270/370. The following screenshots shows their default settings for Thunderbolt when you install their latest BIOS revisions:


ASRock Z270 Super Carrier BIOS 2.40​
ASRock Z370 Professional Gaming i7 BIOS 4.00​
Z270_TB_default.jpg
Z370_TB_default.jpg


These are all settings for Thunderbolt given by default from ASRock on their Motherboards. But there are even more settings for Thunderbolt within their BIOS files, which need to be "unlocked" first. After doing so, there might be a lot of more settings, like this:

ASRock Z270 Super Carrier all settings unlocked​
ASRock Professional Gaming i7 all settings unlocked​
Z270_TB_modified_1.jpg
Z270_TB_modified_2.jpg
Z370_TB_modified_1.jpg
Z370_TB_modified_2.jpg


To make HotPlug/HotSwap working for your motherboard, just look for similar settings in your BIOS for Thunderbolt and set them as shown in the above screens. Sorry, I could only provide screenshots from ASRock machines, cause I do not have any other manufacturer. The most impotent settings you need are "Thunderbolt (TM) Force Power" (which not all boards will have) and "GPIO3 Force Pwr" (which I recognized allmost every manufacturer will have in their BIOS settings for Thunderbolt). Just set these two settings to "ENABLED". <--- otherwise HotPlug/HotSwap will not work as expected. Also, it is important to switch a setting called "AIC Location" from "NB PCIE D01F0" to "NB PCIE D01F2". Notice: on Z270 Super Carrier I had to set this setting from NB PCIE D01F0 to NB PCIE D01F2, while on the Z370 Professional Gaming i7 it was set to NB PCIE D01F02 by default. If all settings set as described, save your settings and restart your Hackintosh.

Third: prepare an SSDT for Thunderbolt to use with your Hackintosh. Place the SSDT file in the following location:


EFI/CLOVER/ACPI/patched

Attached to this tutorial you will find a sample SSDT (SSDT-10-TbtOnPch.aml), which we use to modify for our needs. Lets take a look at its code:

Code:
/*
* Intel ACPI Component Architecture
* AML/ASL+ Disassembler version 20161210-64(RM)
* Copyright (c) 2000 - 2016 Intel Corporation
*
* Disassembling to non-symbolic legacy ASL operators
*
* Disassembly of iASLI5x7qz.aml, Sun Sep  1 21:42:58 2019
*
* Original Table Header:
*     Signature        "SSDT"
*     Length           0x000002C8 (712)
*     Revision         0x02
*     Checksum         0x40
*     OEM ID           "APPLE "
*     OEM Table ID     "TbtOnPCH"
*     OEM Revision     0x00001000 (4096)
*     Compiler ID      "INTL"
*     Compiler Version 0x20161210 (538317328)
*/
DefinitionBlock ("", "SSDT", 2, "APPLE ", "TbtOnPCH", 0x00001000)
{
    External (_SB_.PCI0.RP01, DeviceObj)    // (from opcode)
    External (_SB_.PCI0.RP01.PXSX, DeviceObj)    // (from opcode)
    External (_SB_.PCI0.XHC_, DeviceObj)    // (from opcode)
    External (DTGP, MethodObj)    // 5 Arguments (from opcode)
    External (PXSX, DeviceObj)    // (from opcode)

    Scope (_SB.PCI0.RP01)
    {
        Scope (PXSX)
        {
            Name (_STA, Zero)  // _STA: Status
            Method (NTFY, 2, NotSerialized)
            {
                If (LEqual (Arg0, 0x02))
                {
                    Notify (\_SB.PCI0.RP01.UPSB.DSB0.NHI0, 0x02)
                }
            }
        }

        Device (UPSB)
        {
            Name (_ADR, Zero)  // _ADR: Address
            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                Return (0x0F)
            }

            Device (DSB0)
            {
                Name (_ADR, Zero)  // _ADR: Address
                Method (_STA, 0, NotSerialized)  // _STA: Status
                {
                    Return (0x0F)
                }

                Device (NHI0)
                {
                    Name (_ADR, Zero)  // _ADR: Address
                    Name (_STR, Unicode ("Thunderbolt"))  // _STR: Description String
                    Method (_STA, 0, NotSerialized)  // _STA: Status
                    {
                        Return (0x0F)
                    }

                    Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                    {
                        If (LEqual (Arg0, ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b")))
                        {
                            Store (Package (0x0B)
                                {
                                    "AAPL,slot-name",
                                    Buffer (0x09)
                                    {
                                        "Built In"
                                    },

                                    "device_type",
                                    Buffer (0x19)
                                    {
                                        "Thunderbolt 3 Controller"
                                    },

                                    "model",
                                    Buffer (0x1E)
                                    {
                                        "GC Titan Ridge TB3 Controller"
                                    },

                                    "name",
                                    Buffer (0x0F)
                                    {
                                        "UPSB-DSB0-NHI0"
                                    },

                                    "power-save",
                                    One,
                                    Buffer (One)
                                    {
                                         0x00                                   
                                    }
                                }, Local0)
                            DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                            Return (Local0)
                        }

                        Return (Zero)
                    }
                }

                Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
                {
                    If (LEqual (Arg0, ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b")))
                    {
                        Store (Package (0x06)
                            {
                                "model",
                                Buffer (0x0A)
                                {
                                    "UPSB-DSB0"
                                },

                                "name",
                                Buffer (0x0A)
                                {
                                    "UPSB-DSB0"
                                },

                                "PCIHotplugCapable",
                                One
                            }, Local0)
                        DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                        Return (Local0)
                    }

                    Return (Zero)
                }
            }

            Method (_DSM, 4, NotSerialized)  // _DSM: Device-Specific Method
            {
                If (LEqual (Arg0, ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b")))
                {
                    Store (Package (0x06)
                        {
                            "model",
                            Buffer (0x0A)
                            {
                                "UPSB"
                            },

                            "name",
                            Buffer (0x0A)
                            {
                                "UPSB"
                            },

                            "PCI-Thunderbolt",
                            One
                        }, Local0)
                    DTGP (Arg0, Arg1, Arg2, Arg3, RefOf (Local0))
                    Return (Local0)
                }

                Return (Zero)
            }
        }
    }
}

Remember your ACPI values from part one of this tutorial? These values are now needed to make this SSDT work for your personal machine. You might notice that the sample SSDT file is from my ASRock Z270 Super Carrier, cause the used ACPI values are RP01/PXSX within our sample. So all you need to do, is to change the values RP01/PXSX used in this sample SSDT to your values. If you open the sample SSDT within "MaciASL" you will get line numbers, so I tell you, for which line you have to edit the given values:

Line 23: External (_SB_.PCI0.RP01, DeviceObj)
Line 24: External (_SB_.PCI0.RP01.PXSX, DeviceObj)
Line 27: External (PXSX, DeviceObj) // (from opcode)
Line 29: Scope (_SB.PCI0.RP01)
Line 31: Scope (PXSX)
Line 38: Notify (\_SB.PCI0.RP01.UPSB.DSB0.NHI0, 0x02)

After you change these values to the values you found for your ACPI path, just save the so modified SSDT to the above given path, restart your Hackintosh and enjoy full working
HotPlug/HotSwap for all your Thunderbolt devices (also working for USB-C devices connected to your Thunderbolt ports).

Feedback on how it works for you is welcome. I might help as long as i can.

Regards,
Mork vom Ork
 

Attachments

  • SSDT-10-TbtOnPch.aml.zip
    1.1 KB · Views: 906
Last edited:
I can’t wait to see if I can get this to work on Z170x-ud5 TH :)

edit: Have tried it. Required BIOS options not present (F22g). SSDT alone is not enough to enable it. I'll try and see if they are hidden options that can be patched with a grub shell (Like the MSR Ex02 patch).
 
Last edited:
Gigabyte Z170X-UD5 TH seems to have all of the required BIOS settings in the BIOS (F22g), but hidden. I don't have time to deep-dive it right now, but here is the extracted BIOS section converted to txt. Search for the OP's bios settings and you'll find them. The right hex settings will need to be figured out of course.

Edit: At a glance in the BIOS at offset 0x37F7C, the AIC Location MFG default seems to be D01F0, with the options of D01F1 and D01F2. More later.
 

Attachments

  • setup.txt
    1.8 MB · Views: 756
Last edited:
Ok, I don't have time to mess with all the settings until I have finished a job I'm doing, but I've compared the settings recommended by @Mork_vom_Ork with the configurable AND hidden bios settings available in the Gigabyte GA-Z170X-UD5 TH. 'Thunderbolt Force Power' is not available at all, and might be the dead end for this board. I'm not sure what other settings might be critical to getting hotplug to work so I've compared them all.

See this table I made (relevant ONLY to BIOS F22g):

EDIT: It occured to me that some of these setting (including hidden ones) might change when visible options are changed, so I set all configurable options as close to the recommended settings, then checked all of the hidden settings with a grub shell. comparison below updated:

The top line is settings recommended by @Mork_vom_Ork
The bottom line is the VarOffset of the hidden setting and the default setting

Intel Thunderbolt Technology: Enabled
(Bios configurable)

Thunderbolt Force Power: Enabled
(NOT AVAILABLE)

Security Level: No Security
(Bios configurable)

Thunderbolt PCIe Support: disabled
0x45A (hidden, disabled)

Thunderbolt USB Support: Enabled
0x45C (hidden, enabled)

Thunderbolt Boot Support: Enabled
(bios configurable)

Thunderbolt Detachable Graphics Support: Disabled
(bios configurable)

Select card for Egfx: Select AMD dgpu
(bios configurable)

Wake from Thunderbolt Devices: Disabled
0x454 (hidden, enabled)

GPIO3 Force Pwr: Enabled
0x461 (hidden, enabled)

Skip PCI enumeration: Enabled
0x490 (hidden, enabled)

Skip PCI OptionRom: Disabled
(bios configurable)

Skip PCI Interrupt Assignment: Enabled
0x492 (hidden, Enabled)

ACPI Removal Object Support: Disabled
0x493 (hidden, disabled)

Call Pre boot SMI Handler: Reset and Enumerate
0x465 (Hidden, Disabled (0x0))
(Reset and enumerate is 0x3)

Native OS Hot Plug: Disabled
0x47B (Hidden, Disabled)

SW SMI On TBT hot-plug: Disabled
0x47C (Hidden, Enabled)

GPIO Filter: Enabled
0x47D (Hidden, Enabled)

ACPI Notify On TBT Hot-plug: disabled
0x47E (Hidden, Enabled)

MSI enabled in FADT: Enabled
0x47F (Hidden, Enabled)

Enable CLK REQ: Disabled
0x484 (Hidden, Disabled)

Enable ASPM: Disabled
0x485 (Hidden, Disabled)

Enable LTR: Disabled
0x486 (Hidden, Disabled)

AIC Location: 1
0x480 (Hidden, ‘Thunderbolt AIC Location’ 0x5)

AIC Location Group: SB PCIE Slot
0x481 (Hidden, SB PCIE Slot)

AIC Location SB PCIE: D28F0
0x482 (Hidden, D28F3)

AIC Location NB PCIE: D01F2
0x483 (Hidden, D01F0)

AR AIC Support: Enabled
0x45E (Hidden, Disabled)

TBT Host Router: Two Port
0X487 (Hidden, Two-Port)


Reserved I/O 32
0x48B (Hidden)


Edit: I couldn't help myself so I used the grub shell to modify all the settings to match the OP's bios settings as closely as I could, and nothing could enable hotplug. I tried both north bridge and south bridge locations for the AIC. Maybe there is a different combination of settings, but I do believe the absence of Thunderbolt Force Power might be the brick wall on Z170x-UD5 TH.
 
Last edited:
@canyondust
please tell me more on how to set hidden biossettings through the shell. Sounds interesting to me, cause if i can change them through shell, i would be able to save such a midified BIOS as a file.
 
@canyondust
please tell me more on how to set hidden biossettings through the shell. Sounds interesting to me, cause if i can change them through shell, i would be able to save such a midified BIOS as a file.

Here's a detailed walkthough. I used this to change the CFG Lock setting on my MB originally, but you can use the same approach to edit all of the available bios settings, including Thunderbolt settings.

 
Okay, here's a dumb question. Using the MacIASL tool, do I need to change the UUID value
If ((Arg0 == ToUUID ("a0b5b7c6-1318-441c-b0c9-fe695eaf949b")))

...to something else -like my Hardware UUID?

As it is, just modifying RP01 to RP21 for (my sig) didn't do the trick for power off/on/off/on for the UAD Apollo 8 (the tricky UAD driver and/or Thunderbolt 3 to Thunderbolt 2 may be a problem here) -but I'm building an Asus X299 system with built-in TB3 this week and I'll try it on that one if @kgp 's hot-swap doesn't already work out of the box, so to speak... @jb007
 
Last edited:
Does this work with Thunderbolt 2?
 
@Mork_vom_Ork So if I have a good understanding for your first post, If I don't have that kind of BIOS options, I literally can't have a hot plug on Dell Latitude 7490 Laptop? I can't see those options in my BIOS...
 
Back
Top