build.py: Fix PM on Ivy Bridge and older

This commit is contained in:
Mykola Grymalyuk
2022-10-06 21:49:20 -06:00
parent 5a2afa4fa7
commit 964697a2c1
6 changed files with 56 additions and 0 deletions

View File

@@ -35,6 +35,7 @@
- ex. AMD GCN - ex. AMD GCN
- Relies on N-1 system for when matching KDK is not present - Relies on N-1 system for when matching KDK is not present
- Delete unused KDKs in `/Library/Developer/KDKs` during root patching - Delete unused KDKs in `/Library/Developer/KDKs` during root patching
- Resolve Power Management support for Ivy Bridge and older
- Increment Binaries: - Increment Binaries:
- OpenCorePkg 0.8.5 release - OpenCorePkg 0.8.5 release
- Lilu 1.6.2 - release - Lilu 1.6.2 - release

View File

@@ -1473,6 +1473,42 @@
<key>PlistPath</key> <key>PlistPath</key>
<string>Contents/Info.plist</string> <string>Contents/Info.plist</string>
</dict> </dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>BundlePath</key>
<string>AppleIntelCPUPowerManagement.kext</string>
<key>Comment</key>
<string>Legacy Power Management (pre-XCPM)</string>
<key>Enabled</key>
<false/>
<key>ExecutablePath</key>
<string>Contents/MacOS/AppleIntelCPUPowerManagement</string>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>22.0.0</string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
<dict>
<key>Arch</key>
<string>x86_64</string>
<key>BundlePath</key>
<string>AppleIntelCPUPowerManagementClient.kext</string>
<key>Comment</key>
<string>Legacy Power Management (pre-XCPM) Helper</string>
<key>Enabled</key>
<false/>
<key>ExecutablePath</key>
<string>Contents/MacOS/AppleIntelCPUPowerManagementClient</string>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string>22.0.0</string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
</array> </array>
<key>Block</key> <key>Block</key>
<array/> <array/>

View File

@@ -445,6 +445,16 @@ class BuildOpenCore:
self.get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "BUF0 to BUF1")["Enabled"] = True self.get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "BUF0 to BUF1")["Enabled"] = True
shutil.copy(self.constants.windows_ssdt_path, self.constants.acpi_path) shutil.copy(self.constants.windows_ssdt_path, self.constants.acpi_path)
# In macOS Ventura, Apple dropped AppleIntelCPUPowerManagement* kexts as they're unused on Haswell+
# However re-injecting the AICPUPM kexts is not enough, as Apple had 'intel_cpupm_matching' stripped from the kernel:
# https://github.com/apple-oss-distributions/xnu/blob/e7776783b89a353188416a9a346c6cdb4928faad/osfmk/i386/pal_routines.h#L153-L163
#
# To resolve, AICPUPM.kext was modified to no longer check for the presence of 'intel_cpupm_matching'
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.ivy_bridge.value:
print("- Enabling legacy power management support")
self.enable_kext("AppleIntelCPUPowerManagement.kext", self.constants.aicpupm_version, self.constants.aicpupm_path)
self.enable_kext("AppleIntelCPUPowerManagementClient.kext", self.constants.aicpupm_version, self.constants.aicpupm_client_path)
# With macOS Monterey, Apple's SDXC driver requires the system to support VT-D # With macOS Monterey, Apple's SDXC driver requires the system to support VT-D
# However pre-Ivy Bridge don't support this feature # However pre-Ivy Bridge don't support this feature
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.sandy_bridge.value: if smbios_data.smbios_dictionary[self.model]["CPU Generation"] <= cpu_data.cpu_data.sandy_bridge.value:

View File

@@ -63,6 +63,7 @@ class Constants:
self.intel_82574l_version = "1.0.0" # Intel82574L self.intel_82574l_version = "1.0.0" # Intel82574L
self.intel_8254x_version = "1.0.0" # AppleIntel8254XEthernet self.intel_8254x_version = "1.0.0" # AppleIntel8254XEthernet
self.apple_usb_11_injector = "1.0.0" # AppleUSBUHCI/OHCI self.apple_usb_11_injector = "1.0.0" # AppleUSBUHCI/OHCI
self.aicpupm_version = "1.0.0" # AppleIntelCPUPowerManagement/Client
## Apple - Dortania Modified ## Apple - Dortania Modified
self.bcm570_version = "1.0.2" # CatalinaBCM5701Ethernet self.bcm570_version = "1.0.2" # CatalinaBCM5701Ethernet
@@ -321,6 +322,14 @@ class Constants:
def apple_usb_11_injector_path(self): def apple_usb_11_injector_path(self):
return self.payload_kexts_path / Path(f"USB/USB1.1-Injector-v{self.apple_usb_11_injector}.zip") return self.payload_kexts_path / Path(f"USB/USB1.1-Injector-v{self.apple_usb_11_injector}.zip")
@property
def aicpupm_path(self):
return self.payload_kexts_path / Path(f"Misc/AppleIntelCPUPowerManagement-v{self.aicpupm_version}.zip")
@property
def aicpupm_client_path(self):
return self.payload_kexts_path / Path(f"Misc/AppleIntelCPUPowerManagementClient-v{self.aicpupm_version}.zip")
@property @property
def mce_path(self): def mce_path(self):
return self.payload_kexts_path / Path(f"Misc/AppleMCEReporterDisabler-v{self.mce_version}.zip") return self.payload_kexts_path / Path(f"Misc/AppleMCEReporterDisabler-v{self.mce_version}.zip")