AMD Rayon R7 5800H Install Monterey kernel Panic

zxc2689963

Active member
AMD OS X Member
Joined
Feb 27, 2022
Messages
135
Hello everyone, the Monterey kernel panic problem has been solved for AMD R7 5800H notebook installation. It is a great thing that the CPU can now run on 8 cores. Thank you guys very much.Thank them for discovering the problem and providing kernel patches @ExtremeX@Visual

Brand: Lenovo
Model: Legion 5 6th Gen
CPU: AMD Ryzen 7 5800h
GPU: AMD Radeon RX 6600m 8GB ( Separate GPU mode)
HDD: Samsung SSD 970 EVO Plus 1TB (1000 GB, PCI-E 3.0 x4)
WDS500G3X0C-00SJG0 (500 GB, PCI-E 3.0 x4)
Network: RealTek Semiconductor RTL8168/8111 PCI-E Gigabit Ethernet NIC
Intel(R) Wi-Fi 6E AX210 160MHz
Ram: x2 8GB 3200mhz ddr4
Display: 15.6 1080p 165HZ

Updated October 5, 2023
Problems solved:
1. You do not need to disable XHCI
2. The microphone problem is rectified
3. Monitor brightness can be adjusted, only in Ventura

Unresolved issues:
Failure to wake from sleep

 

Attachments

  • EFI-2023-10-5.zip
    40 MB · Views: 156
Last edited:
Solution
Panic from Monterey 12.6
View attachment 7258
Thanks. I looked at the sched_prim.c file in the XNU Kernel source code (nice of Apple to let us know exactly where to search) and found that it's related to the TSC (Time Stamp Counter) Syncronization of the CPU cores. The section of the code which gives the panic is: https://github.com/apple-oss-distributions/xnu/blob/xnu-8020.140.41/osfmk/kern/sched_prim.c#L2836
Unfortunately Apple didn't update the XNU Source Code for macOS 12.6 yet, but I still managed to find the place where it calls the panic.
Image 1 is the code of XNU that panics if the time between cores does not match (not syncronized properly).

As seen when comparing the Big Sur and Monterey code (Image 2), Big Sur...

Middleman

Active member
AMD OS X Member
Joined
Jan 29, 2021
Messages
723
Thanks again for your help,Use USBToolBox will be stuck in USBToolBox: XHC0: waitForMatchingService failed or timed out

Use USBPorts.kext to customize the correct port will be stuck in AppleNVME Assert failed

Using GenericUSBXHCI.kext can enter the system normally even if it is restarted, but cannot be used to start the installation program. It will cause USB failure and can only be installed in a non-USB way, which is why many people cannot install it
Not sure if you know but USBToolbox.kext also requires the use of UTBMap.kext loaded afterwards to work. On top of that for AMD setups you may need a PTXH or XHC rename SSDT for the USB to work. Check out CaseySJ’s guides on Ryzen setups for this.
 

zxc2689963

Active member
AMD OS X Member
Joined
Feb 27, 2022
Messages
135
Not sure if you know but USBToolbox.kext also requires the use of UTBMap.kext loaded afterwards to work. On top of that for AMD setups you may need a PTXH or XHC rename SSDT for the USB to work. Check out CaseySJ’s guides on Ryzen setups for this.
Yes, the order of using the kext in EFI is correct, and renaming XHC has been tried, but that's not the problem.
 

Middleman

Active member
AMD OS X Member
Joined
Jan 29, 2021
Messages
723
Yes, the order of using the kext in EFI is correct, and renaming XHC has been tried, but that's not the problem.
Have you tried checking the USB ports with Hackintool?
 

zty199

New member
AMD OS X Member
Joined
Apr 15, 2022
Messages
20
Excellent! I think the problem is the USB controller, because the original EFI by the OP used an outdated kext for generic USB 3.0 (XHCI) support. As a temporary solution, can you try adding that kext? If it boots, I'll make an injector kext that adds native support to Apple's kexts (like XHCI-Unsupported) for Intel. Get the GenericUSBXHCI kext from the OP's EFI.
I took a look at XHCI-unsupported.kext and IOUSBHostFamily.kext yesterday. So if I understand correctly, AppleUSBXHCIPCI is a plugin of IOUSBHostFamily; XHCI-unsupported.kext try to add unsupperted USB controller's device id to AppleUSBXHCIPCI to get native support from Apple's kext.

And I compare the XHCI-unsupported you provided and those can be found on other EFIs, seems that need to choose one key from IOKitPersonalities (each one represents part of the driver). I tested several times, and seems that I can add spoof to AppleAMDUSBXHCIPCI to get boot into 12.6 successfully (without GenericUSBXHCI). This is what I added to XHCI-unsupported.
截图_选择区域_20220923092559.png

Now I can get rid of GenericUSBXHCI.kext and use XHCI-unsupported only. However, though I can boot into 12.6, but now all my USB devices won't work (including USB mouse and keyboard), even PS/2 keyboard not working, that's confusing......

I managed to use remote control to take a look at IOReg, seems that AppleAMDUSBXHCIPCI is loaded and show under XHC0 nd XHC1 correctly. Even USBToolBox shows under USB controller too, but no ports show up......

I also tried again adding device-id and compatible properties (0x73a41002 0x73061002 supported by AppleAMDUSBXHCIPCI) under controller in config.plist and disable XHCI-unsupported, but it won't boot without GenericUSBXHCI. Seems that AppleAMDUSBXHCIPCI didn't recognize the controller?

So is using XHCI-unsupported the correct way to drive USB controller (simply just need to test which one to spoof)? Or need to find out how GenericUSBXHCI works and try to fix it?
 

Attachments

  • EFI-without_GenericUSBXHCI.zip
    5.1 MB · Views: 30
Last edited:

Middleman

Active member
AMD OS X Member
Joined
Jan 29, 2021
Messages
723
I took a look at XHCI-unsupported.kext and IOUSBHostFamily.kext yesterday. So if I understand correctly, AppleUSBXHCIPCI is a plugin of IOUSBHostFamily; XHCI-unsupported.kext try to add unsupperted USB controller's device id to AppleUSBXHCIPCI to get native support from Apple's kext.

And I compare the XHCI-unsupported you provided and those can be found on other EFIs, seems that need to choose one key from IOKitPersonalities (each one represents part of the driver). I tested several times, and seems that I can add spoof to AppleAMDUSBXHCIPCI to get boot into 12.6 successfully (without GenericUSBXHCI). This is what I added to XHCI-unsupported.
View attachment 7317

Now I can get rid of GenericUSBXHCI.kext and use XHCI-unsupported only. However, though I can boot into 12.6, but now all my USB devices won't work (including USB mouse and keyboard), even PS/2 keyboard not working, that's confusing......

I managed to use remote control to take a look at IOReg, seems that AppleAMDUSBXHCIPCI is loaded and show under XHC0 nd XHC1 correctly. Even USBToolBox shows under USB controller too, but no ports show up......

I also tried again adding device-id and compatible properties (0x73a41002 0x73061002 supported by AppleAMDUSBXHCIPCI) under controller in config.plist, but it won't boot without GenericUSBXHCI. Seems that AppleAMDUSBXHCIPCI didn't recognize the controller?

So is using XHCI-unsupported the correct way to drive USB controller (simply just need to test which one to spoof)? Or need to find out how GenericUSBXHCI works and try to fix it?
Do you have the SSDT-EC-USBX.aml or SSDT-UIAC also installed?
 

zty199

New member
AMD OS X Member
Joined
Apr 15, 2022
Messages
20
Do you have the SSDT-EC-USBX.aml or SSDT-UIAC also installed?
SSDT-USBX.aml is installed, but I don't have a SSDT-UIAC.aml......
(For now using EC0 to EC rename patch, disabled SSDT-EC and ECEnabler.kext, just for a test. So far looks normal?)
 

Middleman

Active member
AMD OS X Member
Joined
Jan 29, 2021
Messages
723
SSDT-USBX.aml is installed, but I don't have a SSDT-UIAC.aml......
(For now using EC0 to EC rename patch, disabled SSDT-EC and ECEnabler.kext, just for a test. So far looks normal?)
You shouldn't disable SSDT-EC or SSDT-EC-USBX. That's a vital component for Opencore to run.

I'd also suggest you get a copy of SSDT-UIAC.aml and include it as part of SSDT-USBX.aml.
With these two installed, just try enabling USBInjectAll only and see what ports comes up in the system.
Try that along with your XHCI-unsupported enabled/disabled and see how that affects the USB map.
Then you can run the Terminal scripts to see which ports needs renaming and which don't (as per Dortania USB mapping guide)
and then from there deduce the issues plaguing your current USB map setup.
 

ExtremeXT

Donator
Donator
Joined
Aug 7, 2022
Messages
843
Not sure if you know but USBToolbox.kext also requires the use of UTBMap.kext loaded afterwards to work. On top of that for AMD setups you may need a PTXH or XHC rename SSDT for the USB to work. Check out CaseySJ’s guides on Ryzen setups for this.
USBToolBox already does all the necessary renames.

Have you tried checking the USB ports with Hackintool?
That's not the problem, the problem is that macOS' USB kexts don't load for the laptop's USB controllers as they aren't defined as one (missing the CC part, check image from my desktop)
I took a look at XHCI-unsupported.kext and IOUSBHostFamily.kext yesterday. So if I understand correctly, AppleUSBXHCIPCI is a plugin of IOUSBHostFamily; XHCI-unsupported.kext try to add unsupperted USB controller's device id to AppleUSBXHCIPCI to get native support from Apple's kext.

And I compare the XHCI-unsupported you provided and those can be found on other EFIs, seems that need to choose one key from IOKitPersonalities (each one represents part of the driver). I tested several times, and seems that I can add spoof to AppleAMDUSBXHCIPCI to get boot into 12.6 successfully (without GenericUSBXHCI). This is what I added to XHCI-unsupported.
View attachment 7317

Now I can get rid of GenericUSBXHCI.kext and use XHCI-unsupported only. However, though I can boot into 12.6, but now all my USB devices won't work (including USB mouse and keyboard), even PS/2 keyboard not working, that's confusing......

I managed to use remote control to take a look at IOReg, seems that AppleAMDUSBXHCIPCI is loaded and show under XHC0 nd XHC1 correctly. Even USBToolBox shows under USB controller too, but no ports show up......

I also tried again adding device-id and compatible properties (0x73a41002 0x73061002 supported by AppleAMDUSBXHCIPCI) under controller in config.plist and disable XHCI-unsupported, but it won't boot without GenericUSBXHCI. Seems that AppleAMDUSBXHCIPCI didn't recognize the controller?

So is using XHCI-unsupported the correct way to drive USB controller (simply just need to test which one to spoof)? Or need to find out how GenericUSBXHCI works and try to fix it?
GenericUSBXHCI is an ancient kext that hasn't been updated in years, I really don't think fixing it is worth it.

What is the Rename EC0 to EC (USB Power) used for? We are already creating a Fake EC with an SSDT, no need to rename ours. Remove that and stay back to our original EC setup.

In the EFI you provided, XhciPortLimit is enabled. That quirk is broken in Big Sur 11.3 and above and usually causes problems such as ours (no USB ports working), I'm pretty sure that that's the problem. You should also remove SSDT-USB-Reset.
You shouldn't disable SSDT-EC or SSDT-EC-USBX. That's a vital component for Opencore to run.

I'd also suggest you get a copy of SSDT-UIAC.aml and include it as part of SSDT-USBX.aml.
With these two installed, just try enabling USBInjectAll only and see what ports comes up in the system.
Try that along with your XHCI-unsupported enabled/disabled and see how that affects the USB map.
Then you can run the Terminal scripts to see which ports needs renaming and which don't (as per Dortania USB mapping guide)
and then from there deduce the issues plaguing your current USB map setup.
SSDT-UIAC and USBInjectAll don't work on AMD chipsets and are totally useless.
 

Attachments

  • Screenshot_11.png
    Screenshot_11.png
    13.8 KB · Views: 40

OG Nerd

Knows Enough To Get In Trouble
Donator
AMD OS X Member
Joined
Dec 7, 2021
Messages
284
I successfully installed it, but it is very difficult to start the installation. It is very likely to be stuck in AppleNVME Assert failed, and I need to restart repeatedly and it will always succeed once. I restart more than 20 times before successful installation,

I have tried to leave only one SN750 hard drive with the same error, GenericUSBXHCI.kext cannot be used to start the installer
Which EFI are you using for 12.6? Can you post it please? I am going to try on mine this coming Monday.
 

zxc2689963

Active member
AMD OS X Member
Joined
Feb 27, 2022
Messages
135
Which EFI are you using for 12.6? Can you post it please? I am going to try on mine this coming Monday.
Install 12.6 system, but the installation is difficult, USB problem has not been solved, you need to cancel GenericusBxHCI. kext when installing, select it after the installation
 

Attachments

  • EFI.zip
    17.9 MB · Views: 23

zxc2689963

Active member
AMD OS X Member
Joined
Feb 27, 2022
Messages
135
In these days of use found that the system is not stable, a few minutes after successful boot easy to collapse restart
 

Attachments

  • 3.png
    3.png
    244.4 KB · Views: 40

ExtremeXT

Donator
Donator
Joined
Aug 7, 2022
Messages
843
In these days of use found that the system is not stable, a few minutes after successful boot easy to collapse restart
I will ask @Visual to make a patch for that, meanwhile I made a GitHub repo, I can add you to contribuitors if you want.

EDIT: patch in the repo, get the EFI from there
Also, I am trying to fix the backlight in the fix-backlight branch, you can test that if you want.
 
Last edited:

zxc2689963

Active member
AMD OS X Member
Joined
Feb 27, 2022
Messages
135
I will ask @Visual to make a patch for that, meanwhile I made a GitHub repo, I can add you to contribuitors if you want.

EDIT: patch in the repo, get the EFI from there
Also, I am trying to fix the backlight in the fix-backlight branch, you can test that if you want.
It's nice to have someone willing to help with maintenance
 

ExtremeXT

Donator
Donator
Joined
Aug 7, 2022
Messages
843

zxc2689963

Active member
AMD OS X Member
Joined
Feb 27, 2022
Messages
135

Attachments

  • 1.jpg
    1.jpg
    3.1 MB · Views: 25

zty199

New member
AMD OS X Member
Joined
Apr 15, 2022
Messages
20
Still stuck, can't do without GenericusBxHCI. kext
Seems that still need something like XHCI-unsupported.kext (or DummyAppleUSBXHCIPCI.kext, add device-id to one of the CFBundleIdentifier) to tell the kext to recognize the USB controller directly, or it will stall after PCI Configuration End...... (Only once or twice it won't stall after PCI, but still stall at USBToolBox timeout. Haven't tried to add boot-arg "utbwait=xxx" to add custom delay in this situation)
 

ExtremeXT

Donator
Donator
Joined
Aug 7, 2022
Messages
843
@Shaneee

Hello, after looking on the web I saw that AMD systems used to be problematic in terms of USB in the past, mainly needing kexts like GenericUSBXHCI. (https://www.insanelymac.com/forum/t...zen-without-genericusbxhci-or-injector-kexts/)

The same problem is present on the AMD laptop Lenovo Legion 5 Gen 6, which needs GenericUSBXHCI to boot properly, but even then, only USB periphials work, not USB storage devices. You can see the current progress on the fix-usb branch of my repo: https://github.com/extremegrief1/Lenovo_Legion_5_Hackintosh/tree/fix-usb

We have tried a lot of stuff, like spoofing the USB controller's device ID to B450/B550 (149C), Disabling USB LPM and ASPM, Disabling the RHUBs of each USB controller, modifying XHCI-Unsupported to load our controller into AppleAMDUSBXHCIPCI, etc.

With most of these attempts, it gets stuck around after PCI Configuration End. Do you have any idea on how to fix it?

- ExtremeXT
 

Shaneee

The AMD Guy
Staff member
Administrator
Joined
Mar 13, 2020
Messages
2,145

ExtremeXT

Donator
Donator
Joined
Aug 7, 2022
Messages
843
Are you sure it's a USB issue? It's a long shot but you could try these, https://forum.amd-osx.com/resources/generic-x570-usb-ssdts.2/
Should allow basic functionality
I'm 100% sure it's an USB issue, because when GenericUSBXHCI is added it boots.

The laptop motherboard is chipset FP6, which I don't think is even a bit close to X570, but since we don't have any more ideas, we'll try that.

As my own laptop has the same exact USB controller, I suspect that some of the ports are causing the issue, but I'm not exactly sure how to disable them, _STA doesn't seem to work... The only notable difference I saw between my laptop's USB controller and the Legion 5's is that mine supports PCIe ASPM, but disabling both ASPM and LPM for the USB controller still didn't work.

- ExtremeXT
 
Back
Top Bottom
  AdBlock Detected
Sure, ad-blocking software does a great job at blocking ads, but it also blocks some useful and important features of our website. For the best possible site experience please take a moment to disable your AdBlocker.