Contribute
Register

AppleBusPowerController: USB Power using USBPorts.kext and device SSDTs

Status
Not open for further replies.
Joined
Mar 6, 2012
Messages
20
Motherboard
GIGABYTE Z370 AORUS Ultra Gaming
CPU
Core i7-8700k
Graphics
Radeon RX 5700XT
Mac
  1. MacBook Pro
  2. Mac mini
I recently transitioned away from using USBInjectAll.kext with a SSDT-UIAC in favor of the USBPorts.kext generated by Hackintool. I then customized the Info.plist of USBPorts to include USB power definitions. In addition that, I also have a SSDT-EC-USBX and a PCIe card specific SSDT. All ports work, have the right connector, and maintain consistent power (no device disconnects during sleep). Most people would probably stop at this point, however I'm looking to understand a number of things that are more complicated relating to power.

Currently I have these power states defined in some form in all three locations:
  • SSDT-EC-USBX: Adds EC and USBX devices. Uses a _DSM (Device-Specific Method) to set:
    • kUSBSleepPortCurrentLimit, 2100
    • kUSBSleepPowerSupply,5100
    • kUSBWakePortCurrentLimit,2100
    • kUSBWakePowerSupply,5100
  • USBPorts.kext/Contents/Info.plist: Uses IOProviderMergeProperties with AppleUSBMergeNub:
    • kUSBSleepPortCurrentLimit, 2100
    • kUSBSleepPowerSupply,5100
    • kUSBWakePortCurrentLimit,2100
    • kUSBWakePowerSupply,5100
  • SSDT-XHC2-PCI: Uses a _DSM (Device-Specific Method) on the XHC2 to set 3A ports (I think):
    • "AAPL,current-available", 2100
    • "AAPL,current-extra", 1000
    • "AAPL,current-in-sleep", 2100
    • "AAPL,max-port-current-in-sleep", 2100

This is stable, there are no kernel panics, errors about power in the boot log, and power values gets populated per ACPIExplorer in each location:
  • IOACPIPlane:/_SB/USBX@0
  • IOService:/IOResources/AppleBusPowerController
  • IODeviceTree:/PCI0@0/RP19@1B,2/XHC2@0

Here are the related references I could find:

What I'm doing must be redundant given what I'm trying to accomplish. I also have no idea if those high powered PCIe USB ports ACTUALLY provide any extra power as implemented (using AAPL,current-extra to add 1A to the default). I don't have an iOS device to check this with.

So I guess the questions are - How do you set differing USB power values per controller? IE setting ports on a PCIe card to 3A and motherboard ports to 2A. Is this what AAPL,current-extra is for?

Which ACPI devices do I actually need to create/customize/populate between USBX, EC, AppleBusPowerController, XHC, XHC2 in Catalina?
 
No need to use USBX device if you include the properties in your USBKext. Also, on Catalina you don't need SSDT-EC anymore because AppleBusPowerController now matches to IORTC and thus is loaded even without an EC present. The only case you still need SSDT-EC is if you cannot boot without it due to Apple's ACPIEC Driver attaching to your onboard EC. In this case, SSDT-EC will fix the booting issue but will not provide any further functionality.

If you want to use different power properties on different controllers you can do that via your USBKext. As an example, this is power property injection for my Intel USB controller and my ASMedia USB 3.1 controller:
Bildschirmfoto 2020-03-18 um 11.19.22.jpg
Bear in mind that if you have multiple USB cards located under a PXSX location you have to additionally match them against their pcidebug value in order to differentiate between them.

USB devices being ejected after sleep by the way is not related to USB power properties. This simply is a bug related to RAM frequency operating above specifications and can be fixed by disabling XMP and running the memory with a lower speed according to DDR specification - for example 2666MHz for DDR4. Anyhow, for most boards this bug has been fixed in Catalina. On my board the issue is gone even when running RAM on 4000MHz.
 
No need to use USBX device if you include the properties in your USBKext. Also, on Catalina you don't need SSDT-EC anymore because AppleBusPowerController now matches to IORTC and thus is loaded even without an EC present. The only case you still need SSDT-EC is if you cannot boot without it due to Apple's ACPIEC Driver attaching to your onboard EC. In this case, SSDT-EC will fix the booting issue but will not provide any further functionality.

If you want to use different power properties on different controllers you can do that via your USBKext. As an example, this is power property injection for my Intel USB controller and my ASMedia USB 3.1 controller:
View attachment 455262
Bear in mind that if you have multiple USB cards located under a PXSX location you have to additionally match them against their pcidebug value in order to differentiate between them.

USB devices being ejected after sleep by the way is not related to USB power properties. This simply is a bug related to RAM frequency operating above specifications and can be fixed by disabling XMP and running the memory with a lower speed according to DDR specification - for example 2666MHz for DDR4. Anyhow, for most boards this bug has been fixed in Catalina. On my board the issue is gone even when running RAM on 4000MHz.
Excellent, thank you. That cleared up a lot in one message.

Part of what had me confused was that without USBX the values within AppleBusPowerController were no longer getting populated, which I assumed was a problem. I was also finding that if I declared them in both USBX and USBPorts.kext (with differing currents per XHC device in Info.plist), I would get intermittent kernel panics on wake. I'm guessing that's what this comment in SSDT-EC-USBX referred to: "Depending on the configuration these values must match injected IOKitPersonalities for com.apple.driver.AppleUSBMergeNub".

I'm testing out your combination now, but is there any chance you know what the deal is with the AAPL _DSM power values? Ideally everything relating to a PCIe card would be self contained in a single SSDT
 
I haven't managed to get USB power properties working via SSDTs or Clover Device Properties in Catalina. Only USBKext injection works for me. USBX device seems to be deprecated. On newer Macs it doesn't exist anymore.
 
Yes! This was excellent. Why isn’t this covered more clearly in OpenCore Guide? I've always had a working USBPorts kext but now I deleted the USBX file and only have a simple SSDT-EC, which it would seem I will not need when and if I update to Big Sur.
 
I haven't managed to get USB power properties working via SSDTs or Clover Device Properties in Catalina. Only USBKext injection works for me. USBX device seems to be deprecated. On newer Macs it doesn't exist anymore.
This is good stuff. I stumbled upon the USBPorts USB power properties by accident and run my HackMini8,1 without USBX - it is running perfectly. I took the USB power properties from a real MacMini8,1 ACPI (USBX) and inserted them into USBPorts.kext/Contents/Info.plist.

While injecting USB power properites with USBPorts.kext seems to work perfectly and I have no USB problems with it, are you sure that newer Macs no longer use USBX? Here are the ACPI dumps from real Macs:

ACPI Dump - Real MacMini8,1
Screen Shot 2020-12-31 at 8.11.08 AM.png


ACPI Dump - Real iMacPro1,1
Screen Shot 2020-12-31 at 8.13.30 AM.png
 
Last edited:
Status
Not open for further replies.
Back
Top