etorix Posted May 27 Share Posted May 27 (edited) Recent motherboards now have "Device ()" declarations in their ACPI tables which are conditional on certain variables. For instance: If ((PCHA != Zero)): If ((PCHS != 0x04)): MacOS does not read these variables and may not create devices as required. If the device is used elsewhere in ACPI code but has not been created, macOS will outright fail to boot; @vit9696 has explained the issue and created an ACPI patch for the (PCHA != Zero) condition which allows to hack Intel Core Ultra. Looking into DSDT files posted for troubleshooting or installation help, I see that there are many more conditional declarations, including for useful devices such as network, audio, SATA controllers, and that some have wake related method attached. This may be related to the commonly reported sleep/wake issue on these platforms. As the conditional blocks may be quite long, I have written a little Python script to collect the conditional declarations. 'condevscan' takes the decompiled DSDT as argument (or nothing if the target file is 'dsdt.dsl' in the same directory) and outputs the conditional declarations, with the attached conditions and line numbers. No safeguards and not much refinements: It largely assumes the clean formatting out a decompiler (no double spaces within code), catches "If", "Else" and "ElseIf" conditions but would currently miss "Case" conditions, which I have not yet seen in the wild in this context. $ ./condevscan.py DSDT-decomped.dsl 12453: If ((PCHS != 0x04)) 12455: Device (SBUS) 12779: If ((PCHS != 0x04)) 12783: Device (XDCI) 12779: If ((PCHS != 0x04)) 13030: If ((GBES != Zero)) 13032: Device (GLAN) // ... It does NOT generate ACPI patches: Interpreting the results, deciding whether to patch and how, is left to the reader. Hopefully, this will help knowledgeable people look deeper in the ACPI of 800-series and AMD5 boards and decide whether we should be patching more conditions. condevscan.py.zip Edited May 27 by etorix 3 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/ Share on other sites More sharing options...
spakk Posted May 27 Share Posted May 27 On 5/27/2025 at 12:26 PM, etorix said: Recent motherboards now have "Device ()" declarations in their ACPI tables which are conditional on certain variables. For instance: If ((PCHA != Zero)): If ((PCHS != 0x04)): MacOS does not read these variables and may not create devices as required. If the device is used elsewhere in ACPI code but has not been created, macOS will outright fail to boot; @vit9696 has explained the issue and created an ACPI patch for the (PCHA != Zero) condition which allows to hack Intel Core Ultra. Looking into DSDT files posted for troubleshooting or installation help, I see that there are many more conditional declarations, including for useful devices such as network, audio, SATA controllers, and that some have wake related method attached. This may be related to the commonly reported sleep/wake issue on these platforms. As the conditional blocks may be quite long, I have written a little Python script to collect the conditional declarations. 'condevscan' takes the decompiled DSDT as argument (or nothing if the target file is 'dsdt.dsl' in the same directory) and outputs the conditional declarations, with the attached conditions and line numbers. No safeguards and not much refinements: It largely assumes the clean formatting out a decompiler (no double spaces within code), catches "If", "Else" and "ElseIf" conditions but would currently miss "Case" conditions, which I have not yet seen in the wild in this context. $ ./condevscan.py DSDT-decomped.dsl 12453: If ((PCHS != 0x04)) 12455: Device (SBUS) 12779: If ((PCHS != 0x04)) 12783: Device (XDCI) 12779: If ((PCHS != 0x04)) 13030: If ((GBES != Zero)) 13032: Device (GLAN) // ... It does NOT generate ACPI patches: Interpreting the results, deciding whether to patch and how, is left to the reader. Hopefully, this will help knowledgeable people look deeper in the ACPI of 800-series and AMD5 boards and decide whether we should be patching more conditions. condevscan.py.zip 1.08 kB · 5 downloads Do you mean something like this? C:\Users\User\Desktop\Phython-skript-condevscan>python condevscan3.py 🔍 Reading file: C:\Users\User\Desktop\Phython-skript-condevscan\dsdt.dsl 📄 File contains 8067 lines. 👀 First 10 lines of the file: '/*\n' ' * Intel ACPI Component Architecture\n' ' * AML/ASL+ Disassembler version 20210930 (32-bit version)\n' ' * Copyright (c) 2000 - 2021 Intel Corporation\n' ' * \n' ' * Disassembling to symbolic ASL+ operators\n' ' *\n' ' * Disassembly of C:/Users/User/Desktop/OpCore-Simplify-main/Results/ACPITables/dsdt.aml, Tue Jan 7 23:01:06 2025\n' ' *\n' ' * Original Table Header:\n' ▶ Device found: Device (PCI0) ▶ Device found: Device (AMDN) ▶ Device found: Device (IOMA) ... ▶ Device found: Device (PRT8) ✅ A total of 132 device blocks extracted. 📁 Folder already exists: C:\Users\User\Desktop\Phython-skript-condevscan\Output 💾 Devices saved to: C:\Users\User\Desktop\Phython-skript-condevscan\Output\extracted_devices.dsl C:\Users\User\Desktop\Phython-skript-condevscan> Edit: It's possible that I didn't understand this correctly. Are you trying to extract devices from a system DSDT (e.g., dsdt.dsl) to generate something like extracted_devices.dsl, and then use that to automatically create ACPI patches in a file like generated_patches.txt? Here are my extracted files from DSDT.dsl and the automatically generated patches in generated_patches.txt. Archive.zip Edit_(28.5.2025): If what I uploaded here matches what you ultimately want to generate and export, please let me know whether I should upload the script here or not. 1 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832627 Share on other sites More sharing options...
etorix Posted May 28 Author Share Posted May 28 The context is for this script is to hack Intel Core Ultra or AM5 Ryzen. Your DSDT (Gigabyte B350 in your signature I suppose) has no conditional device. Z880 or X670 boards have, and cannot boot without patches. The purpose of this little script is to find where problems could be and point to the right lines—some conditional blocks span over 10k lines of DSL code. The easier it is to look into these ACPI files, and the more experienced eyes we can get to look at it, the better. Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832640 Share on other sites More sharing options...
spakk Posted May 30 Share Posted May 30 On 5/28/2025 at 9:53 PM, etorix said: The context is for this script is to hack Intel Core Ultra or AM5 Ryzen. Your DSDT (Gigabyte B350 in your signature I suppose) has no conditional device. Z880 or X670 boards have, and cannot boot without patches. The purpose of this little script is to find where problems could be and point to the right lines—some conditional blocks span over 10k lines of DSL code. The easier it is to look into these ACPI files, and the more experienced eyes we can get to look at it, the better. Yes, that's correct – my test DSDT comes from my Hackintosh. Now that I fully understand what's going on, I couldn’t resist digging deeper. I believe we now have a very handy tool that can automatically generate DSDTs and the corresponding OpenCore patches for direct integration into OC. The last two DSDTs came from Z880 and X670 motherboards respectively – and in both cases, everything works flawlessly. Let me know if there's still interest. 5 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832658 Share on other sites More sharing options...
leesureone Posted May 30 Share Posted May 30 I'm interested in testing this, I have a couple of Z890 setups I could try it on. 1 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832663 Share on other sites More sharing options...
spakk Posted May 30 Share Posted May 30 7 hours ago, leesureone said: I'm interested in testing this, I have a couple of Z890 setups I could try it on. Please generate a raw DSDT from your system using the latest iasl or MaciASL tool and upload it here as a compressed file. Once I get home later, I will generate the final files, upload them here, and make them available to you. Please contribute constructively if something doesn't work, as I don't have access to a comparable system. The more information, the better! Feel free to upload DSDTs from other boards as well for testing purposes. I need a raw Z890 DSDT for patching.!!!! 1 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832665 Share on other sites More sharing options...
leesureone Posted May 30 Share Posted May 30 DSDT.aml.zip The attached is from an Asus Z890 Proart board using SSDTTime in windows. 1 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832667 Share on other sites More sharing options...
spakk Posted May 30 Share Posted May 30 5 minutes ago, leesureone said: DSDT.aml.zip The attached is from an Asus Z890 Proart board using SSDTTime in windows. DSDT-Analysis-Tool_dsdt_leesureone_Asus Z890 Proart board.zip 2 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832668 Share on other sites More sharing options...
spakk Posted May 30 Share Posted May 30 A small mistake was pointed out to me by Anto65: the files in the SSDT-Force-Individual folder are currently in .dsl format and need to be converted to .aml. I need to update my tool accordingly. And yes, that is correct: all required files must be compiled into .aml. The files in the SSDT-Force-Individual folder are currently in DSL format and need to be compiled into AML files using a tool like iasl or MaciASL. The compiled .aml files then have to be placed in the OpenCore folder EFI/OC/ACPI/ and added to the config.plist under ACPI -> Add so OpenCore loads them at boot. 2 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832675 Share on other sites More sharing options...
etorix Posted May 30 Author Share Posted May 30 Wow! I'm very curious how this will play out. I'm not sure it is useful to patch everything and enable any possible device. Seeing how some devices depend on nested conditions, or are created in different forms in different conditional branches, I doubt that patching could be fully automated without human oversight. (At the very least, some sanity checks would be warranted to avoid unwanted side effects.) But as to bringing attention and sparking new developments, this is already a success beyond my expectations! (And I'm flabbergasted that @spakk spent the time to draw detailed comparative tables about my crude and simple script 😵💫 ) 3 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832676 Share on other sites More sharing options...
Anto65 Posted May 30 Share Posted May 30 (edited) Don't worry, it's not a problem to convert them to Aml but if you add the option to your tool it's definitely even better 😛 In my case it reports a compilation error ... read the pm thanks Edited May 30 by Anto65 2 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832677 Share on other sites More sharing options...
Max.1974 Posted May 30 Share Posted May 30 (edited) 14 hours ago, spakk said: Yes, that's correct – my test DSDT comes from my Hackintosh. Now that I fully understand what's going on, I couldn’t resist digging deeper. I believe we now have a very handy tool that can automatically generate DSDTs and the corresponding OpenCore patches for direct integration into OC. The last two DSDTs came from Z880 and X670 motherboards respectively – and in both cases, everything works flawlessly. Let me know if there's still interest. It's awesome tool, congrats @spakk !! I admire people like you with brilliant capacity and blessed with knowledge for made ACPI tables works on Hack! I have many difficult to learn, compile and modify this lines. Open IA have been help me a little bit, I could compile all original kexts from RehabMan GitHub, and its still working. If is available to share, please tell us where. Thanks! Spoiler Edited May 30 by Max.1974 1 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832678 Share on other sites More sharing options...
MaLd0n Posted May 30 Share Posted May 30 3 hours ago, leesureone said: DSDT.aml.zip The attached is from an Asus Z890 Proart board using SSDTTime in windows. Only Z890 with "problems" is MSI and by the way are the best mobos. All other brands vit patch solves the problem. 3 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832680 Share on other sites More sharing options...
leesureone Posted May 30 Share Posted May 30 9 hours ago, spakk said: Please generate a raw DSDT from your system using the latest iasl or MaciASL tool and upload it here as a compressed file. Once I get home later, I will generate the final files, upload them here, and make them available to you. Please contribute constructively if something doesn't work, as I don't have access to a comparable system. The more information, the better! Feel free to upload DSDTs from other boards as well for testing purposes. I need a raw Z890 DSDT for patching.!!!! Spakk, thanks for uploading those Asus Z890 files, I kind of changed my mind and decided that if I'm going to spend a lot more time on this I really should work on the MSI Tomahawk Wifi board instead. I've uploaded the renamed DSDT file for when you have a chance to work your magic. Thanks in advance MSI DSDT.aml.zip Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832681 Share on other sites More sharing options...
etorix Posted May 31 Author Share Posted May 31 (edited) 18 hours ago, leesureone said: The attached is from an Asus Z890 Proart board using SSDTTime in windows. Looking at it, I would propose the following set of patches for the Asus Z890 ProArt (and possibly other 800 boards): #1 is from @vit9696, and known to be critical (PCHA != Zero) #2 is a generalisation of the PCHS != 0x04 patch first identified in a MSI board by grizleeadam on The-Other-Forum; there are two such large conditional blocks here #2a goes with #2 and further enables the GLAN device, which has a second condition #3 is a third, smaller, PCHS != 0x04 patch, which enables only the SBUS device under _SB.PC00; this is likely optional, as we know how to provide a system bus device for macOS with SSDT-SBUS-MCHC.aml. Confusingly, there is another SBUS device under _SB.PC02 in the conditional block of pach #1. #4 patches the VMDE == One block, which appears related to virtualisation (VT-d issues?) I leave untouched the sections which depend on I2SB, PCHA == Zero and CVFS because there are multiple conditional branches, so we'd need to decide on "the righ one" for macOS; and the PCHA == Zero block seems contradictory with patch #1 for PCHA != Zero. I also leave the MFFD (Modem Firmware Flash Device) at the end, which does not look to be essential. I also noticed a PowerResource PPIN which is conditionally defined (PCHA != Zero again) at lines 98404-98447. This could be relevant for sleep/wake issues, but it is not used elsewhere in the DSDT. Expert advice is welcome. For safety, test #2, #2 + #2a, #3 and #4 separately at first. #1 should always be enabled. scan_AsusZ890ProArt.zip Edited May 31 by etorix dicussion of dual SBUS 1 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832687 Share on other sites More sharing options...
etorix Posted May 31 Author Share Posted May 31 (edited) 13 hours ago, leesureone said: I really should work on the MSI Tomahawk Wifi board instead. I've uploaded the renamed DSDT file A quick look shows that the MSI Tomahawk board has a slightly smaller DSDT than the Asus Z890 Pro Art but all the same conditional structures and declarations. So the same set of patches should work on both. So I'll dare repost it as, potentially, a general set of patches for Intel 800 boards. Same recommendations: Always enable patch #1. Test #2, and check GLAN devices in IOreg. Test #2 with #2a, and check GLAN in IOreg. Test #3… and try to find out which system bus macOS uses. Test #4, and see whether it affects VT-d behaviour. Depending on the above, enable all patches. scan_msi.txt.zip Intel_800_Patches.plist.zip Edited May 31 by etorix corrected patches 2 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832688 Share on other sites More sharing options...
leesureone Posted May 31 Share Posted May 31 I used an EFI which will boot the Asus Z890 into Sequoia, I added the ACPI patches and kept Vit9696's patch and also enabled patch #2. Cleared the NVRAM and it didn't;t seem to make a difference as without patch #2. It starts to load macOS but then halts on a variety of ACPI errors. Please see attached, I wanted but could not upload the EFI file because apparently it is too large, even after removing the Resource folder. Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832689 Share on other sites More sharing options...
etorix Posted May 31 Author Share Posted May 31 I uploaded an amended version of the patches. But there are symbols in the error message which I cannot find in the DSDT so we have a problem, and I don't know where to start about it. Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832690 Share on other sites More sharing options...
spakk Posted May 31 Share Posted May 31 Hey@ll here is the tool – it took a bit of time. I had to fix some errors in the tool, and I hope now everyone can use this simple Python tool. I included everything you need in the zipped file DSDT-Analysis-Tool.zip, including a help file and some images in the "Picture" folder. It’s not a professional tool, but it should automatically generate everything you need. If you find any bugs in the code, feel free to fix and improve it — and share it freely with everyone. With that said, enjoy! 🛠️ What does the DSDT-Analysis-Tool.py do? The DSDT-Analysis-Tool.py is a small but useful Python script that helps you analyze a DSDT.aml file and automatically generate matching SSDTs and OpenCore patches — perfect for Hackintosh users. ✅ What the tool can do automatically: Select DSDT.aml With one click, you can load your DSDT.aml file. It gets copied to the working folder. Decompile the DSDT (make it readable) The tool uses iasl.exe to convert the DSDT.aml into a DSDT.dsl file, which is readable and editable. Find devices with "If" conditions It automatically searches for If conditions and the devices inside them, showing which devices are only active under certain conditions. Create SSDT-Force The tool generates an SSDT file with dummy devices so that OpenCore or Clover can recognize them properly. Create an OpenCore patch template A ready-to-use patch template is created automatically for use in OpenCore. Check for important devices It checks if key devices like HDEF, GFX0, or XHC are present. If any are missing, you get a warning. Create individual SSDTs for each device (optional) If you want, the tool can generate a separate SSDT for each found device. 💾 Where are the files saved? All generated files are saved automatically in this folder: C:\Users\Mein\Desktop\DSDT-Analysis-Tool\DSDT_xxx\ 🌍 Language Support The tool detects your system language (German, English, etc.). If your language isn’t supported, it defaults to English. 📦 What’s included in the ZIP file? The DSDT-Analysis-Tool.zip contains: The tool itself The required iasl.exe A help file Example images in the “Bilder” (Images) folder 📌 Note This is not a professional tool, but it automates many tasks to save time. If you find a bug or want to improve something: Feel free to change and share it freely with others! Have fun using it! 😊 DSDT-Analysis-Tool.zip 4 2 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832696 Share on other sites More sharing options...
spakk Posted May 31 Share Posted May 31 23 hours ago, leesureone said: Spakk, thanks for uploading those Asus Z890 files, I kind of changed my mind and decided that if I'm going to spend a lot more time on this I really should work on the MSI Tomahawk Wifi board instead. I've uploaded the renamed DSDT file for when you have a chance to work your magic. Thanks in advance MSI DSDT.aml.zip 82.97 kB · 3 downloads MSI DSDT_leesureone.zip 1 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832697 Share on other sites More sharing options...
Max.1974 Posted June 1 Share Posted June 1 2 hours ago, spakk said: Hey@ll here is the tool – it took a bit of time. I had to fix some errors in the tool, and I hope now everyone can use this simple Python tool. I included everything you need in the zipped file DSDT-Analysis-Tool.zip, including a help file and some images in the "Picture" folder. It’s not a professional tool, but it should automatically generate everything you need. If you find any bugs in the code, feel free to fix and improve it — and share it freely with everyone. With that said, enjoy! 🛠️ What does the DSDT-Analysis-Tool.py do? The DSDT-Analysis-Tool.py is a small but useful Python script that helps you analyze a DSDT.aml file and automatically generate matching SSDTs and OpenCore patches — perfect for Hackintosh users. ✅ What the tool can do automatically: Select DSDT.aml With one click, you can load your DSDT.aml file. It gets copied to the working folder. Decompile the DSDT (make it readable) The tool uses iasl.exe to convert the DSDT.aml into a DSDT.dsl file, which is readable and editable. Find devices with "If" conditions It automatically searches for If conditions and the devices inside them, showing which devices are only active under certain conditions. Create SSDT-Force The tool generates an SSDT file with dummy devices so that OpenCore or Clover can recognize them properly. Create an OpenCore patch template A ready-to-use patch template is created automatically for use in OpenCore. Check for important devices It checks if key devices like HDEF, GFX0, or XHC are present. If any are missing, you get a warning. Create individual SSDTs for each device (optional) If you want, the tool can generate a separate SSDT for each found device. 💾 Where are the files saved? All generated files are saved automatically in this folder: C:\Users\Mein\Desktop\DSDT-Analysis-Tool\DSDT_xxx\ 🌍 Language Support The tool detects your system language (German, English, etc.). If your language isn’t supported, it defaults to English. 📦 What’s included in the ZIP file? The DSDT-Analysis-Tool.zip contains: The tool itself The required iasl.exe A help file Example images in the “Bilder” (Images) folder 📌 Note This is not a professional tool, but it automates many tasks to save time. If you find a bug or want to improve something: Feel free to change and share it freely with others! Have fun using it! 😊 DSDT-Analysis-Tool.zip 2.28 MB · 3 downloads Thans @spakk i will install windows to test!! God bless you!! 1 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832699 Share on other sites More sharing options...
spakk Posted June 1 Share Posted June 1 5 hours ago, Max.1974 said: Thans @spakk i will install windows to test!! God bless you!! I’m modifying the code to make it work on macOS and Linux as well. I’ll upload the updated version here later today. 1 1 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832702 Share on other sites More sharing options...
spakk Posted June 1 Share Posted June 1 3 hours ago, spakk said: I’m modifying the code to make it work on macOS and Linux as well. I’ll upload the updated version here later today. Please test the tool "DSDT-Analysis-Tool_dsdt" to help simplify OpenCore (OC) patching for Hackintosh on Windows, macOS, and Linux. After testing, please share your feedback in a clear and objective manner by explaining what didn’t work or what issues you encountered. This will allow other users to join the discussion and help find solutions collaboratively. Our goal is to perfect the tool for real-world use. If you make improvements to the code that help us move forward, feel free to upload your corrected version here. Have fun using it! 😉 DSDT-Analysis-Tool_macOS-Linux.zip 5 1 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832705 Share on other sites More sharing options...
Cyberdevs Posted June 1 Share Posted June 1 @spakk Thanks for this tool. So excited to give it a try when I get back home 3 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832706 Share on other sites More sharing options...
Cyberdevs Posted June 1 Share Posted June 1 @spakk Just a quick question does this work with all mainboard models or is it designed to Z890 series? 1 Link to comment https://www.insanelymac.com/forum/topic/361117-scanning-for-conditional-device-declarations/#findComment-2832711 Share on other sites More sharing options...
Recommended Posts