Fixing Bluetooth and Sleep (almost) on MSI B450i Gaming AC

Obelix

New member
May 3, 2020
17
6
3
Hi All,

The BCM94352Z NGFF card built-in bluetooth module was not detected and the hack would hang then crash to sleep:
Code:
panic(cpu 0 caller 0xffffff8012e9167c): Sleep transition timed out after 180 seconds while calling power state change callbacks. Suspected bundle: com.apple.iokit.IOUSBHostFamily. Thread 0x3669.
Failure code:: 0x00000040 00000014
The solution was to recreate PTXH usb controller in a SSDT. following the SSDT Recreation section in the Dortania guide.

EDIT: The XHC0 controller is preventing the hack to sleep.
I added a SSDT to remap it.
I added a SSDT to disable XHC0 altogether.
The hack now sleeps as long as no device is connected to the internal USB headers and the two ports near the ethernet connector...


I have a more stable solution for sleep and power: Use both the EC and USBX SSDTs and map only PTXH and XHC0 in AMD-USB-MAP-MP7.kext.
The XHC0 controller seems to have a life of its own. Virtualization users reported passthrough issues for sound and USB with the ryzen chipsets and X470, X570, and B450 motherboards. Maybe this is an Agesa bug.

It sleeps with a USB 3 key connected to the XHC0 ports !

IMPORTANT: SMCAMDProcessor and the Ryzen powermanagement kexts causes a panic on my hack. It's been reported by many users. I disabled them until these work (See the files attached).

Power settings:
Code:
System-wide power settings:
Currently in use:
hibernatemode 0
womp 1
networkoversleep 0
sleep 10 (sleep prevented by sharingd)
Sleep On Power Button 1
ttyskeepawake 1
hibernatefile /var/vm/sleepimage
disksleep 10
gpuswitch 2
displaysleep 3
Also in the Bios I activated wake by USB mouse and keyboard. It works to nudge the hack back on without the power button.

Note that I'm not using the single USBMergeNUB method found in the Dortania or Hackintool's USB-MAP kexts.
I use the "AppleBusPowerController" to add power management for the MacPro7,1 because these are not defined in macOS for MacPro7,1 and iMacPro1,1.
I think (I'm not sure) that the T2 chip has something to do with USB power management on these models.

Then I used the "AppleUSBHostMergeProperties" to add a port map to the existing configurations listed in /System/Library/Extensions/IOUSBHostFamily.kext/Contents/PlugIns/AppleUSBHostPlatformProperties.kext/Contents/Info.plist

What I found is that the power properties defined by AppleBusPowerController override the values set in the USBX SSDT.

If you use the iMacPro1,1 SMBIOS on a B450 board you need to edit the Kext's info.plist.
This should work as well as the default iMacPro controller is named XHC1 and there is no XHC1 on the MSI B450i Gaming Plus AC.
-> Let me know if this works. I haven't tried iMacPro1,1 on this board.

Now that it sleeps, I get a wake issue XD
On wake, USB devices disconnect after the display is back on.
The mouse cursor will move for 1 second then it takes 6 seconds before it moves again. The internal bluetooth module is not impacted by this disconnection.

I tried many things like disabling XHC0 with a SSDT, mapping the PTXH ports in a SSDT.
I'm trying the hibernation fixup kext but I'm not sure how it works really. Let me know if this helped and if you found a fix.

Does a USBX device appear in your IORegistry Explorer? I wonder if the SSDT is inserting the USBX in the right place.
 

Attachments

Last edited:
  • Like
Reactions: tung_opeth

Obelix

New member
May 3, 2020
17
6
3
does it sleep?
Nope it hangs or panics .. :cry: need to look at the kp reports.
Do ryzentoshes sleep?


It does sleep. There are 3 long seconds before the display turn back on. If I use darkwake=0 the display wakes up immediately but the USB devices are not reconnected yet. So I do not use the darkwake NVRAM boot arg as it seems that macOS is doing the right thing.
 
Last edited:

Obelix

New member
May 3, 2020
17
6
3
What device are you using for BT?



You mean load a current Windows HDD using VBox? If that's the case I use this tool to link a physical drive to a VBox VM, https://whatroute.net/vboxrawdisk.html
Thanks ! This looks way easier and elegant than the workaround I found.

Yesterday I managed to overcome the permissions issue to make Vbox use a physical disk in Catalina scavenging bits and pieces from this page and this page:
  1. In BIOS, enable the AMD-V option.
  2. Open Virtual Box (6.1) and create a new virtual machine without any hard drive then quit Virtual Box
  3. Locate the disk identifier of the Windows disk in Disk Utility.app (CMD+I) or in terminal diskutil list ( i.e: /dev/diskX)
  4. Unmount the Windows partition using Disk Utility.app or in terminal
    Bash:
    diskutil unmountDisk dev/diskX
  5. Make yourself the owner of the windows disk using CLI:
    Bash:
    sudo chown <YourUserName> /dev/diskX
  6. Create a virtual disk with this command:
    Bash:
    VBoxManage internalcommands createrawvmdk -filename /Path/To/File.vmdk -rawdisk /dev/diskX
  7. Launch virtual box with root privileges. This needs to be done every time...
    Bash:
    sudo /Applications/VirtualBox.app/Contents/MacOS/VirtualBox
  8. Edit the virtual machine settings to add a SATA drive, select the existing .vmdk file created earlier
  9. Pray and launch your VM
 
  • Like
Reactions: Shaneee

asle

New member
Jun 6, 2020
4
0
1
Norway
Hi All,

The Fenvi card built-in bluetooth module was not detected.
The solution was to recreate PTXH usb controller in a SSDT. following the SSDT Recreation section in the Dortania guide.

EDIT: The XHC0 controller is preventing the hack to sleep.
I added a SSDT to remap it.
I added a SSDT to disable XHC0 altogether.
The hack now sleeps as long as no device is connected to the internal USB headers and the two ports near the ethernet connector...

If you have a MSI B450i Gaming AC I attached the SSDTs below.
Any other method that would keep all ports functional is welcome.
Regarding sleep I alsofound the only option was to disable XHC0 with a kext. Luckily the WIFI/BT is on the PTXH controller, but I loose 2 USB ports back. This is not really a good solution but it lets your machine sleep at least. I am testing this solution from another forum member. Can't believe how it is possible to have sleep, both controllers available and no USB patch!
 

Obelix

New member
May 3, 2020
17
6
3
Can't believe how it is possible to have sleep, both controllers available and no USB patch!
I updated the original post with some interesting updates and questions
 
Last edited:

Obelix

New member
May 3, 2020
17
6
3
I am testing this solution from another forum member.
The SSDT in @MöllyMcAlpine 's EFI is like a Swiss Army knife that might work on multiple boards both Intel and AMD.
On the MSI B450i board there is no native EC device in the DSDT so we do not need most of it.
Only the EC and USBX creation part in the end is relevant.