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: 148
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...

OG Nerd

Knows Enough To Get In Trouble
Donator
AMD OS X Member
Joined
Dec 7, 2021
Messages
284
Yes for now unfortunately. If you can boot up with 8 cores, that is as good as it gets.
@lev12354 Can you share the EFI that you booted Big Sur using the patches I uploaded without cpus=1 for @OG Nerd to test please. There must be a different settings somewhere between the configs that allowed yours to boot.
I have been stuck working on a TV show and had no time to do anything. Maybe next week i'll have some free time to play with the Legion
OK.... I want to create reinstall Big Sur and make a clean IOREG dump from there. If I understand it correctly, zxc2689963's EFI boots into Big Sur and all the USBs work, but not video (RX 6600m). So the attached EFI is a copy of his EFI that runs Big Sur. I removed some drivers not needed in an attempt to clean it up a bit. If you guys can go over this, keep in mind this will be for installing big sur so we can have an IOReg dump from there. If you would make changes that each of you think should work to boot/install big sur, I will install big sur and make a IOREG dump so we can go from there. I think jumping ahead to monterey might be a mistake, maybe getting everything running in Big Sur is the way to go like someone else suggested.

If you want to post a bare min EFI for me to boot off of and make an IOReg dump or what ever else in big sur, please do. Keep in mind that mine requires nvmefix.kext to boot. Here is the efi I have so far.
 

Attachments

  • EFI.zip
    25.9 MB · Views: 6

Shaneee

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

Attachments

  • EFI.zip
    25.8 MB · Views: 10

Middleman

Active member
AMD OS X Member
Joined
Jan 29, 2021
Messages
723
Here's mine. Using Shanee's updated EFI as base, I've added a new updated CPUR based on the Legion 5's BIOS dump, plus the device id for the RX6600M.
 

Attachments

  • EFI.zip
    25.8 MB · Views: 12

Edhawk

Guru
Guru
Joined
May 2, 2020
Messages
2,261
From what I can see the USBPorts.kext you are using is wrong, in that it is missing a number of ports.

The kext enables 8 x USB3 ports, which probably relate to the 4 x USB3.2 Gen1 ports on the exterior of the laptop. 3 x USB ports on the rear and 1 x USB port on the right hand side of the case.

Screenshot 2022-06-24 at 23.50.54.png USBPorts.kext/Contents/Info.plist, showing the 8 x USB3 ports that are enabled.

This kext leaves the USB-C 3.2 Gen 2 (DisplayPort 1.4 & power delivery) on the left side of the case, and the 2 x internal ports serving the Bluetooth and Webcam devices disabled.

If possible I would recommend installing Big Sur 11.1 or earlier, so the Kernel >Quirk > XhciPortLimit entry can be enabled in the config.plist to enable all of the USB ports, without having to use the truncated kext you are currently using.

I don't think Apple are offering downloads for early versions of macOS Big Sur. Corpnewt's GibmacOS doesn't go back as far as 11.3 or earlier, which you would need for the XhciPortLimit quirk to work.

I can share a copy of Big Sur, provide a link via PM to download the OS from my OneDrive shared folder. Copy of Big Sur as shown in the screenshot below.

Screenshot 2022-06-25 at 00.17.26.png 'Get Info' details for the early Big Sur release I have stored on my OneDrive share.

If this is attempted, then an SSDT-USBX.aml will need to be added to the ACPI folder and config.plist. As the USBPorts.kext currently contains the USB power settings and it will need to be removed if all the ports are to be discovered and enabled.

How are you getting your keyboard and trackpad to work? You don't have any laptop specific kexts in the OC setup?

I'll post an EFI for you to try tomorrow (later today Saturday).
 

OG Nerd

Knows Enough To Get In Trouble
Donator
AMD OS X Member
Joined
Dec 7, 2021
Messages
284
From what I can see the USBPorts.kext you are using is wrong, in that it is missing a number of ports.

The kext enables 8 x USB3 ports, which probably relate to the 4 x USB3.2 Gen1 ports on the exterior of the laptop. 3 x USB ports on the rear and 1 x USB port on the right hand side of the case.

View attachment 6323 USBPorts.kext/Contents/Info.plist, showing the 8 x USB3 ports that are enabled.

This kext leaves the USB-C 3.2 Gen 2 (DisplayPort 1.4 & power delivery) on the left side of the case, and the 2 x internal ports serving the Bluetooth and Webcam devices disabled.

If possible I would recommend installing Big Sur 11.1 or earlier, so the Kernel >Quirk > XhciPortLimit entry can be enabled in the config.plist to enable all of the USB ports, without having to use the truncated kext you are currently using.

I don't think Apple are offering downloads for early versions of macOS Big Sur. Corpnewt's GibmacOS doesn't go back as far as 11.3 or earlier, which you would need for the XhciPortLimit quirk to work.

I can share a copy of Big Sur, provide a link via PM to download the OS from my OneDrive shared folder. Copy of Big Sur as shown in the screenshot below.

View attachment 6327 'Get Info' details for the early Big Sur release I have stored on my OneDrive share.

If this is attempted, then an SSDT-USBX.aml will need to be added to the ACPI folder and config.plist. As the USBPorts.kext currently contains the USB power settings and it will need to be removed if all the ports are to be discovered and enabled.

How are you getting your keyboard and trackpad to work? You don't have any laptop specific kexts in the OC setup?

I'll post an EFI for you to try tomorrow (later today Saturday).
Here's mine. Using Shanee's updated EFI as base, I've added a new updated CPUR based on the Legion 5's BIOS dump, plus the device id for the RX6600M.
@OG Nerd Please give this a go.
Ahhh…. Ok,that is the original usbports kext that came with the efi from post 98. I made a port map with usbtoolbox, I will swap to that one and will install an early version of Big Sur to get a better dump…. I will try it with both efis from shaneee and middleman as well. Won’t be able to do until Monday but will post dumps when I do.
 

OG Nerd

Knows Enough To Get In Trouble
Donator
AMD OS X Member
Joined
Dec 7, 2021
Messages
284
From what I can see the USBPorts.kext you are using is wrong, in that it is missing a number of ports.

The kext enables 8 x USB3 ports, which probably relate to the 4 x USB3.2 Gen1 ports on the exterior of the laptop. 3 x USB ports on the rear and 1 x USB port on the right hand side of the case.

View attachment 6323 USBPorts.kext/Contents/Info.plist, showing the 8 x USB3 ports that are enabled.

This kext leaves the USB-C 3.2 Gen 2 (DisplayPort 1.4 & power delivery) on the left side of the case, and the 2 x internal ports serving the Bluetooth and Webcam devices disabled.

If possible I would recommend installing Big Sur 11.1 or earlier, so the Kernel >Quirk > XhciPortLimit entry can be enabled in the config.plist to enable all of the USB ports, without having to use the truncated kext you are currently using.

I don't think Apple are offering downloads for early versions of macOS Big Sur. Corpnewt's GibmacOS doesn't go back as far as 11.3 or earlier, which you would need for the XhciPortLimit quirk to work.

I can share a copy of Big Sur, provide a link via PM to download the OS from my OneDrive shared folder. Copy of Big Sur as shown in the screenshot below.

View attachment 6327 'Get Info' details for the early Big Sur release I have stored on my OneDrive share.

If this is attempted, then an SSDT-USBX.aml will need to be added to the ACPI folder and config.plist. As the USBPorts.kext currently contains the USB power settings and it will need to be removed if all the ports are to be discovered and enabled.

How are you getting your keyboard and trackpad to work? You don't have any laptop specific kexts in the OC setup?

I'll post an EFI for you to try tomorrow (later today Saturday).
The earliest version I see on anymacos is 11.5, if that will not work then I would appreciate the link! As for keyboard, it is working with supplied EFI but the trackpad is not, I am using wireless keyboard and mouse. If you cam get that EFI by monday I will try getting a dump with that one as well. I figure once I install Big sur, we can just swap out the EFI's to get multiple dumps.

I do have a bootable working version of windows 11 on the second ssd, so if there is anything that can be or needs to be done on that, we have that as an option as well.
 

Middleman

Active member
AMD OS X Member
Joined
Jan 29, 2021
Messages
723

OG Nerd

Knows Enough To Get In Trouble
Donator
AMD OS X Member
Joined
Dec 7, 2021
Messages
284
Maybe, there are some different in my BIOS setting.......
I can't find AHCI Mode setting option
CSM Switch
Above 4G Decoding Switch
SVM Switch
Serial Port Switch......


On my legion I had to do the following;

Graphics Mux: Discrete
AMD V: Disabled
Always On USB: Disabled
AMD Platform Security: Disabled
Secure Boot: Disabled
 

Middleman

Active member
AMD OS X Member
Joined
Jan 29, 2021
Messages
723
@lyx have you made sure your gpu is set to Dynamic?
@lyx,

I also noticed you seemed to have radvesa activated? You need to delete that from the NVRAM boot-arg.
On my legion I had to do the following;

Graphics Mux: Discrete
AMD V: Disabled
Always On USB: Disabled
AMD Platform Security: Disabled
Secure Boot: Disabled
No he can't use Discrete mode because he has Nvidia RTX 30 card, not RX6600M.
 

Middleman

Active member
AMD OS X Member
Joined
Jan 29, 2021
Messages
723
I really do think for @lyx's we create a separate thread for support, as his Legion 5 has Nvidia dgpu installed (and Cezanne IGPU) not RX6600M.
 

Jo-Toku

Donator
Donator
AMD OS X Member
Joined
Dec 29, 2021
Messages
230
I really do think for @lyx's we create a separate thread for support, as his Legion 5 has Nvidia dgpu installed (and Cezanne IGPU) not RX6600M.
He could but there is not much he can do. Even with the IGPU development, he will not gain graphics acceleration. I am following the vega development on telegram, and there is no real progress
 

zxc2689963

Active member
AMD OS X Member
Joined
Feb 27, 2022
Messages
135
As for THE USB port mapping, I have customized the USB interface in system 10.15.7. What we need to solve is the kernel Panic caused by the installation of Monterey system in AMD notebook CPU. I know that there are several other AMD notebook CPUS that have such a situation.
 

Attachments

  • USBPorts-10.15.7.zip
    2.4 KB · Views: 4

Middleman

Active member
AMD OS X Member
Joined
Jan 29, 2021
Messages
723
As for THE USB port mapping, I have customized the USB interface in system 10.15.7. What we need to solve is the kernel Panic caused by the installation of Monterey system in AMD notebook CPU. I know that there are several other AMD notebook CPUS that have such a situation.
As for the Monterey Kp on AMD I have actually resolved that already. My latest build for the VCS with dual core Ryzen APU can boot Monterey 12.4. no problem.
However the settings used are very specific. AppleMCEReporterDisabler and NVMeFix must be used.
 

zxc2689963

Active member
AMD OS X Member
Joined
Feb 27, 2022
Messages
135
I have tried Middleman's SSDT-CPUR and Shaneee's CPU patch, but nothing worked. I did some tests, writing the CPU definition in DSDT, changing only one core, and got the following results



The number of CPU cores is 0x00,0x01,0x02, and 0x03. As soon as 0x01 is loaded, there will be a kernel panic. I define the CPU core in DSDT to skip 0x01 and get the following result: no kernel panic. You can see that AppleACPICPU: is recognized, but the system will not load

 

Middleman

Active member
AMD OS X Member
Joined
Jan 29, 2021
Messages
723
I have tried Middleman's SSDT-CPUR and Shaneee's CPU patch, but nothing worked. I did some tests, writing the CPU definition in DSDT, changing only one core, and got the following results



The number of CPU cores is 0x00,0x01,0x02, and 0x03. As soon as 0x01 is loaded, there will be a kernel panic. I define the CPU core in DSDT to skip 0x01 and get the following result: no kernel panic. You can see that AppleACPICPU: is recognized, but the system will not load

@zxc2689963 you should be using this latest one. The one you have points to the wrong registers >
 

Attachments

  • SSDT-CPUR-5800H-3.aml.zip
    987 bytes · Views: 8

taqieallah

New member
AMD OS X Member
Joined
Oct 19, 2020
Messages
3
i dont have ryzen laptop but my asus g15 had the same issue with monterey and the only way to fix it was editing voodootsc kext and adding 0 value to info.plist
..
 

Edhawk

Guru
Guru
Joined
May 2, 2020
Messages
2,261
@OG Nerd I have attached an OC 0.8.1 EFI folder for your Legion 5 laptop. I have gone a bit left field with this EFI as I am treating your laptop as a laptop, not an iMacPro or MacPro.

I have looked at the DSDT.aml tables provided by users from post #1, 14 and another later post.
I have inspected the DSDT.aml and other SSDT's provided and come up with what I hope are a few helpful solutions.

There are a few notable items that appear in the DSDT.aml table.
  1. Graphics card is named VGA, not GFX0, - so WhateverGreen.kext would never match with the VGA device.
  2. Processor is named C000 - C00F inclusive, not PR01 etc.
  3. USB controllers are named XHC0 and XHC1
  4. The Trackpad appears to be an ELAN I2C device found under _SB/PCI0/I2CB/TPDD
To remedy the above I have done the following:
  1. Used the DSDT.aml table provided in post #1 with Corpnewt's SSDTTime script to generate the following SSDT's and config.plist patches
    1. SSDT-EC.aml
    2. SSDT-HPET.aml + 3 x ACPI patches
    3. SSDT-USB-Reset.aml
  2. I have also added the following tables
    1. SSDT-CPUR-5800H-3.aml [provided by @Middleman) as this uses the correct naming convention for your CPU processor entries
    2. SSDT-USBX.aml for USB power settings
    3. SSDT-XOSI.aml + ACPI rename patch
  3. The Drivers and Tools folders I have set as standard for an OC 0.8.1 AMD setup.
  4. The kexts folder has been reconfigured to reflect this device is a LAPTOP.
    1. I have included the kexts shown in the screenshot below:
    2. Screenshot 2022-06-25 at 16.34.55.png /EFI/OC/Kexts folder contents
    3. Laptop specific kexts:
      1. BrightnessKeys.kext - Brightness fix
      2. ECEnabler.kext - Battery fix
      3. NoTouchID.kext - Touch ID fix
      4. SMCBatteryManager.kext - battery fix
      5. VoodooI2C.kext - HID fix
      6. VoodooI2CELAN.kext - fix for Elan Touchpad
      7. VoodooI2CHID.kext - HID fix
      8. VoodooPS2Controller.kext - Keyboard and Trackpad fix - with Mouse kext disabled in config.plist
  5. Regarding the config.plist I have used the following:
    1. I have used the SMBIOS from a MacBookPro16,4 not an iMP or MP, as this is a LAPTOP not a desktop system.
    2. I have added a number of ACPI Rename patches for USB, GPU, HPET and _OSI
    3. I have followed the setup for a Ryzen system, mostly. With a few changes to the basic setup that are more inline with a laptop setup.
This is how the EFI tree looks in expanded mode:

Screenshot 2022-06-25 at 16.45.58.png EFI OC 0.8.1 folder contents

The config.plist in the OC folder has the SMBIOS data redacted, so you need to generate and add the MacBookPro16,4 SMBIOS data yourself; Serial Number, MLB, ROM and SystemUUID.

You need to use the ResetNvramEntry.efi tool (press SpaceBar to display tools) before trying to boot with this EFI. So as to clear any existing Nvram settings, otherwise your system may not work with this EFI.

Post a photo of the Verbose text if it kernel panics.
 

Attachments

  • EFI.zip
    33.4 MB · Views: 16
Last edited:

zxc2689963

Active member
AMD OS X Member
Joined
Feb 27, 2022
Messages
135
@OG Nerd I have attached an OC 0.8.1 EFI folder for your Legion 5 laptop. I have gone a bit left field with this EFI as I am treating your laptop as a laptop, not an iMacPro or MacPro.

I have looked at the DSDT.aml tables provided by users from post #1, 14 and another later post.
I have inspected the DSDT.aml and other SSDT's provided and come up with what I hope are a few helpful solutions.

There are a few notable items that appear in the DSDT.aml table.
  1. Graphics card is named VGA, not GFX0, - so WhateverGreen.kext would never match with the VGA device.
  2. Processor is named C000 - C00F inclusive, not PR01 etc.
  3. USB controllers are named XHC0 and XHC1
  4. The Trackpad appears to be an ELAN I2C device found under _SB/PCI0/I2CB/TPDD
To remedy the above I have done the following:
  1. Used the DSDT.aml table provided in post #1 with Corpnewt's SSDTTime script to generate the following SSDT's and config.plist patches
    1. SSDT-EC.aml
    2. SSDT-HPET.aml + 3 x ACPI patches
    3. SSDT-USB-Reset.aml
  2. I have also added the following tables
    1. SSDT-CPUR-5800H-3.aml [provided by @Middleman) as this uses the correct naming convention for your CPU processor entries
    2. SSDT-USBX.aml for USB power settings
    3. SSDT-XOSI.aml + ACPI rename patch
  3. The Drivers and Tools folders I have set as standard for an OC 0.8.1 AMD setup.
  4. The kexts folder has been reconfigured to reflect this device is a LAPTOP.
    1. I have included the kexts shown in the screenshot below:
    2. View attachment 6344 /EFI/OC/Kexts folder contents
    3. Laptop specific kexts:
      1. BrightnessKeys.kext - Brightness fix
      2. ECEnabler.kext - Battery fix
      3. NoTouchID.kext - Touch ID fix
      4. SMCBatteryManager.kext - battery fix
      5. VoodooI2C.kext - HID fix
      6. VoodooI2CELAN.kext - fix for Elan Touchpad
      7. VoodooI2CHID.kext - HID fix
      8. VoodooPS2Controller.kext - Keyboard and Trackpad fix - with Mouse kext disabled in config.plist
  5. Regarding the config.plist I have used the following:
    1. I have used the SMBIOS from a MacBookPro16,4 not an iMP or MP, as this is a LAPTOP not a desktop system.
    2. I have added a number of ACPI Rename patches for USB, GPU, HPET and _OSI
    3. I have followed the setup for a Ryzen system, mostly. With a few changes to the basic setup that are more inline with a laptop setup.
This is how the EFI tree looks in expanded mode:

View attachment 6345 EFI OC 0.8.1 folder contents

The config.plist in the OC folder has the SMBIOS data redacted, so you need to generate and add the MacBookPro16,4 SMBIOS data yourself; Serial Number, MLB, ROM and SystemUUID.

You need to use the ResetNvramEntry.efi tool (press SpaceBar to display tools) before trying to boot with this EFI. So as to clear any existing Nvram settings, otherwise your system may not work with this EFI.

Post a photo of the Verbose text if it kernel panics.
Thank you, I tried, loading as shown in the picture, black screen restart
 

Attachments

  • 6.jpg
    6.jpg
    2.6 MB · Views: 12

zxc2689963

Active member
AMD OS X Member
Joined
Feb 27, 2022
Messages
135
I checked SSDT-CPUR and found that some parameters are wrong, 0x00000400+0x10, the correct one is 0x00000410


 

Attachments

  • SSDT-CPUR-5800H.zip
    338 bytes · Views: 5
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.