A layman's guide to creating a custom SSDT

A layman's guide to creating a custom SSDT

Introduction: Anyone can do this!

There seems to be this general idea that creating a custom SSDT is a very complicated process and it is admittedly one of the more complicated things you can do Hackintoshing but it is simply only complicated because it involves user input in the form of inserting and removing flash drives. After doing this myself I firmly believe this is well within the capabilities of everyone who managed to get a Mackintosh up and running. Ideally with this guide handy this entire process should take no more than 30 minutes max.

Credits

I would like to put the credits at the beginning of this post because I am no genius and I came up with literally none of this on my own. That credit goes nearly entirely to RehabMan and his incredibly detailed post here. Another source that helped me with visualizing exactly what was happening at points was this video by Traveler Techie. It's essentially just a recap of RehabMan's article but helped me see exactly which windows to open.

Disclaimers

This is in no way a complete guide. If parts of your computer's internal naming schemes are different than mine, or an unknown error is occurring, I'm sorry but I'm not the person to ask. I performed this guide with the following build and cannot guarantee your build will work the same, however as far as I've seen at least all Z370s seem to work identically and I imagine other boards will be barely different.

PCPartPicker Part List

Type Item
CPU Intel - Core i7-8700K 3.7 GHz 6-Core Processor
Motherboard ASRock - Z370M Pro4 Micro ATX LGA1151 Motherboard
Video Card Asus - Radeon RX VEGA 64 8 GB ROG STRIX Video Card

Why this guide?

The point of this guide is not to be completely exhaustive, it's not going to replace any of RehabMan's amazing guides, its goal is to provide an easier way for everybody to learn how to make their own custom SSDT. The issues is that some of the other guides, exhaustive and detailed as they are, are quite complex and hard for someone to read for the first time. Additionally every guide I have seen was not written with a Vanilla build in mind and mentions MultiBeast or something else you should stay away from that can confuse a reader from this sub. Having a custom SSDT has numerous benefits, especially sleep related, but those are mentioned elsewhere so I won't get into that.

Beginning

Please use the Vanilla Guide on your Hackintosh before attempting this. It's pinned at the top of the sidebar for a reason, it's a super good guide that gives you the best setup for your computer. I can't say what will and won't be the same if you don't follow that guide but you really should be following that guide to ensure consistency.

All you will need to complete this guide are the following:

  • A usb 3 device
    • Most devices nowadays
  • A device with only USB 2 support
    • Somewhat rare but you should be able to find one.
    • Old or really cheap USB drives work well.
    • Personally used a cheap mechanical keyboard.
    • More information follows later on how to make sure a device only has USB 2 support.
  • IORegistryExplorer
    • Available free from the apple developer site without a paid account.
    • Contained in the "Additional Tools for Xcode" download.
  • MaciASL
    • Downloaded from RehabMan's public BitBucket for free.
  • USBInjectAll.kext installed
    • This can be installed via the Kexts Installer in clover.
    • This is the only thing you should have different in you Clover setup than the Vanilla guide.
    • The Vanilla guide doesn't include this by default because it causes instability issues. Having a custom SSDT nullifies those issues.
  • SSDT-UIAC-ALL.dsl
    • This is on RehabMan's GitHub and is linked in his article I linked above.

The hardest part of these steps is finding a device with only USB 2 support. The surefire way to check this is to plug a device into a port you know has working USB 3, go to About this Mac > System Report > USB > Click on the device and see what speed it is listed at. If the device only supports USB 2 it should display as around 12 Mb/sec. If it supports USB 3 this number will be much much greater, mine was 5 Gb/sec. I have made a short video on this step below.

Determining whether a device only has USB 2 support.

Port Naming: Planning

For a short explanation on how this works, with the newer OSX versions generally all of your USB ports don't work out of the box. If they do and you're not experiencing any sleep issues whatsoever good for you, you don't need this guide. If you're experiencing any issues whatsoever though I would highly recommend you follow this. The fix for these ports not loading is USBInjectAll.kext. This discovers all ports on your computer and injects them all. The downside is it also injects a lot of ports that don't exist causing instability issues. A custom SSDT map is essentially telling USBInjectAll exactly which ports to connect.

The main goal of this guide is really to assign the internal name of a USB port mentally to each port on your computer so you know which port names you actually need. The way I kept track of this is "drawing" my ports like so in google sheets.

Port \"drawing\"

As you can see I color coded my ports in a clear way and included the ports on the top of my computer and the back. As we discover the names of these ports we will fill them in the boxes. The "secondary" ports all marked in gray for USB 2 represent the USB 2 controller in a USB 3 port. All USB 3 ports have two controllers so that they are backwards compatible and these ports are given a different name internally. Once you have finished this section of the guide your drawing should look something like this.

Port \"drawing\" filled in

As you can see I have filled in the names of all these ports. All USB 3 controllers on my computer begin with SS, all USB 2 controllers begin with HS. This is not a coincidence. These naming conventions should be pretty much the same for all modern motherboards but I can really only make a guarantee for a Z370. Another thing you may notice is the internal port I added to the left. This is an internal USB port I plugged my bluetooth into inside my computer. If you have an internal USB usage remember it for later although it's generally quite easy to identify this as the one that never disconnects later on.

Port Naming: Doing

Start by unplugging any USB device you can, ideally you'll only have a keyboard and a mouse plugged in, maybe an internal one as well. After doing that open IORegistryExplorer, it might be super slow just live with it, and navigate to Root > Computer Model > AppleACPIPlatformExpert > PCI0@0 > AppleACPIPCI > XHC@14. This contains all of the usb devices for the computer. If only 15 are listed USBInjectAll.kext probably isn't working right, you should have a ton, I had almost 30. Look at the names of devices that are plugged in here. If you can identify the name of your keyboard and look at what port it's plugged into you now have the name for those ports and you can write it in your spreadsheet. Here's a quick video showing that step.

Navigating to USB controllers

Once you've figured this out start plugging in your USB devices one at a time and taking note of the internal port being added and add it to your spreadsheet. Make sure to use your USB 2 only device as well as the USB 3 device on USB 3 ports so you get both the USB 2 and USB 3 controllers mapped. Do this until your spreadsheet is completely filled. If you have any ports that persist even when all devices are unplugged it's probably an internal port and you'll need to include it. If you have a USB C port make sure to try it with the device plugged in both ways, it might be the same, it might be different. This will be important later. If it's different record them both.

One last thing

Grab the "subsystem-id" under XHC@14 in IORegistryExplorer and write it down somewhere. Here's an image of where to find it.

subsystem-id

Writing the custom SSDT

Open SSDT-UIAC-ALL.dsl in MaciASL. It's in a bracketed text language. Essentially this file contains all possible USB ports for all possible machines. Of all of this we're only interested in the section titled "8086_****" where the stars are the two hexadecimal pairs in the subsystem-id we found earlier reversed. For example my subsystem id was <af a2 00 00> so I only care about the "8086_a2af" section. If you have a Z370 board this will probably be the same section for you. Delete all other sections, we don't need them. Then within this section you will probably recognize sub blocks for different USB device names that you've been dealing with. Essentially what we're going to do is delete every port we didn't put into our spreadsheet earlier. Afterwards to can comment this file with // so in the future if you edit this for some reason you remember which ports are which. Finally, we will change the "UsbConnector" field in each port to represent what kind of physical port this connector is on. 3 means it's part of a USB 3 port, whether its the USB 2 or USB 3 controller for that port doesn't matter. 255 means it's an internal port. If it's a USB C port it depends whether it's a different port in both orientations. If it's the same name in both orientations it will be 9, if it's different both controllers will be 10. For example here's my final SSDT, with comments.

DefinitionBlock ("", "SSDT", 2, "hack", "_UIAC", 0) { Device(UIAC) { Name(_HID, "UIA00000") Name(RMCF, Package() { "8086_a2af", Package() { "port-count", Buffer() { 26, 0, 0, 0 }, "ports", Package() { "HS04", Package() // USB 2 for the upper right hand port in the back { "UsbConnector", 3, "port", Buffer() { 4, 0, 0, 0 }, }, "HS05", Package() // Internal port for the bluetooth { "UsbConnector", 255, "port", Buffer() { 5, 0, 0, 0 }, }, "HS07", Package() // The external USB 2 port on the back bottom right { "UsbConnector", 0, "port", Buffer() { 7, 0, 0, 0 }, }, "HS08", Package() // USB 2 for the bottom left port in the back { "UsbConnector", 3, "port", Buffer() { 8, 0, 0, 0 }, }, "HS11", Package() // USB 2 for the middle right port in the back { "UsbConnector", 3, "port", Buffer() { 11, 0, 0, 0 }, }, "HS12", Package() // USB 2 for the middle left port in the back { "UsbConnector", 3, "port", Buffer() { 12, 0, 0, 0 }, }, "HS13", Package() // USB 2 for the left hand port on the front { "UsbConnector", 3, "port", Buffer() { 13, 0, 0, 0 }, }, "HS14", Package() // USB 2 for the right hand port on the front { "UsbConnector", 3, "port", Buffer() { 14, 0, 0, 0 }, }, "SS01", Package() // USB 3 for the USB C port in both directions { "UsbConnector", 9, "port", Buffer() { 17, 0, 0, 0 }, }, "SS02", Package() // USB 3 for the upper right port in the back { "UsbConnector", 3, "port", Buffer() { 18, 0, 0, 0 }, }, "SS03", Package() // USB 3 for the middle left port in the back { "UsbConnector", 3, "port", Buffer() { 19, 0, 0, 0 }, }, "SS04", Package() // USB 3 for the middle right port in the back { "UsbConnector", 3, "port", Buffer() { 20, 0, 0, 0 }, }, "SS07", Package() // USB 3 for the left hand port on the front { "UsbConnector", 3, "port", Buffer() { 23, 0, 0, 0 }, }, "SS08", Package() // USB 3 for the right hand port on the front { "UsbConnector", 3, "port", Buffer() { 24, 0, 0, 0 }, }, "SS09", Package() // USB 3 for the bottom left port in the back { "UsbConnector", 3, "port", Buffer() { 25, 0, 0, 0 }, }, }, }, }) } } 

When you've finished, save this file away somewhere in case you need it in the future and hit File > Save As > ACPI Machine Language Binary into the EFI/CLOVER/ACPI/patched folder on your drive's EFI. This will allow USBInjectAll.kext to only load these ports and get the enhanced performance. If you reboot and open IORegistryExplorer you should see only the ports you want listed.

Conclusion

Hopefully this guide helps a few people who thought this was too complicated get a custom SSDT setup, it made a big difference on my computer. If there's anything wrong with this guide please let me know and I'll edit it. I think it's quite correct considering it all worked for me but I'm no expert and I might have made a few over-generalizations for simplicities sake that I shouldn't have.

submitted by /u/Tman1677
[link] [comments]