Add XCPM disabling

This commit is contained in:
Mykola Grymalyuk
2022-03-02 09:19:41 -07:00
parent ba82b41cbd
commit 1393db72dd
7 changed files with 66 additions and 14 deletions

View File

@@ -19,6 +19,10 @@
- Resolve i210/i225 NIC support on pre-Ivy Macs
- Resolve AirPlay to Mac support on Skylake+ Macs in 12.3 Beta 2+
- Resolve SDXC support in Monterey for Pre-Ivy Bridge Macs
- Rename Battery Throttling option to Firmware Throttling
- Expands support to desktops (ie. iMacs without Displays)
- Add XCPM disabling
- Forces `ACPI_SMC_PlatformPlugin` to outmatch `X86PlatformPlugin`
## 0.4.2
- Resolve app crashing on some 3rd party SAS/SATA controllers

View File

@@ -1761,21 +1761,30 @@ class wx_python_gui:
self.hibernation_checkbox.SetToolTip(wx.ToolTip("This will disable the ConnectDrivers in OpenCore\nRecommended to toggle if your machine is having issues with hibernation.\nMainly applicable for MacBookPro9,1 and MacBookPro10,1"))
# Disable Battery Throttling
self.disable_battery_throttling_checkbox = wx.CheckBox(self.frame, label="Disable Battery Throttling")
self.disable_battery_throttling_checkbox = wx.CheckBox(self.frame, label="Disable Firmware Throttling")
self.disable_battery_throttling_checkbox.SetValue(self.constants.disable_msr_power_ctl)
self.disable_battery_throttling_checkbox.Bind(wx.EVT_CHECKBOX, self.disable_battery_throttling_click)
self.disable_battery_throttling_checkbox.SetPosition(wx.Point(
self.hibernation_checkbox.GetPosition().x,
self.hibernation_checkbox.GetPosition().y + self.hibernation_checkbox.GetSize().height))
self.disable_battery_throttling_checkbox.SetToolTip(wx.ToolTip("This will forcefully disable MSR Power Control on Arrendale and newer Laptops\nMainly applicable for systems with severe battery throttling"))
self.disable_battery_throttling_checkbox.SetToolTip(wx.ToolTip("This will forcefully disable MSR Power Control on Arrendale and newer Macs\nMainly applicable for systems with severe throttling due to missing battery or display"))
# Disable XCPM
self.disable_xcpm_checkbox = wx.CheckBox(self.frame, label="Disable XCPM")
self.disable_xcpm_checkbox.SetValue(self.constants.disable_xcpm)
self.disable_xcpm_checkbox.Bind(wx.EVT_CHECKBOX, self.disable_xcpm_click)
self.disable_xcpm_checkbox.SetPosition(wx.Point(
self.disable_battery_throttling_checkbox.GetPosition().x,
self.disable_battery_throttling_checkbox.GetPosition().y + self.disable_battery_throttling_checkbox.GetSize().height))
self.disable_xcpm_checkbox.SetToolTip(wx.ToolTip("This will forcefully disable XCPM on Ivy Bridge EP and newer Macs\nMainly applicable for systems with severe throttling due to missing battery or display"))
# Software Demux
self.software_demux_checkbox = wx.CheckBox(self.frame, label="Software Demux")
self.software_demux_checkbox.SetValue(self.constants.software_demux)
self.software_demux_checkbox.Bind(wx.EVT_CHECKBOX, self.software_demux_click)
self.software_demux_checkbox.SetPosition(wx.Point(
self.disable_battery_throttling_checkbox.GetPosition().x,
self.disable_battery_throttling_checkbox.GetPosition().y + self.disable_battery_throttling_checkbox.GetSize().height))
self.disable_xcpm_checkbox.GetPosition().x,
self.disable_xcpm_checkbox.GetPosition().y + self.disable_xcpm_checkbox.GetSize().height))
self.software_demux_checkbox.SetToolTip(wx.ToolTip("This will force a software based demux on MacBookPro8,2/3 aiding for better battery life\nThis will require the dGPU to be disabled via NVRAM"))
if not self.constants.custom_model and self.computer.real_model not in ["MacBookPro8,2", "MacBookPro8,3"]:
self.software_demux_checkbox.Disable()
@@ -1942,6 +1951,14 @@ class wx_python_gui:
else:
print("Disable Battery Throttling Disabled")
self.constants.disable_msr_power_ctl = False
def disable_xcpm_click(self, event=None):
if self.disable_xcpm_checkbox.GetValue():
print("Disable XCPM Enabled")
self.constants.disable_xcpm = True
else:
print("Disable XCPM Disabled")
self.constants.disable_xcpm = False
def software_demux_click(self, event=None):
if self.software_demux_checkbox.GetValue():

Binary file not shown.

View File

@@ -174,14 +174,17 @@ class BuildOpenCore:
print(f"- Adding additional FeatureUnlock args: {self.constants.fu_arguments}")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += self.constants.fu_arguments
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 or self.constants.disable_xcpm is True:
# With macOS 12.3 Beta 1, Apple dropped the 'plugin-type' check within X86PlatformPlugin
# Because of this, X86PP will match onto the CPU instead of ACPI_SMC_PlatformPlugin
# This causes power management to break on pre-Ivy Bridge CPUs as they don't have correct
# power management tables provided.
# This patch will simply increase ASPP's 'IOProbeScore' to outmatch X86PP
print("- Fixing ACPI SMC Power Management support")
print("- Overriding ACPI SMC matching")
self.enable_kext("ASPP-Override.kext", self.constants.aspp_override_version, self.constants.aspp_override_path)
if self.constants.disable_xcpm is True:
# Only inject on older OSes if user requests
self.get_item_by_kv(self.config["Kernel"]["Add"], "BundlePath", "ASPP-Override.kext")["MinKernel"] = ""
if self.model in ["MacBookPro6,1", "MacBookPro6,2", "MacBookPro9,1", "MacBookPro10,1"]:
# Modded RestrictEvents with displaypolicyd blocked to fix dGPU switching
@@ -926,10 +929,10 @@ class BuildOpenCore:
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.filesystems.apfs")["Enabled"] = True
# Lets us check in sys_patch.py if config supports FileVault
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Settings"] += " -allow_fv"
if self.constants.disable_msr_power_ctl is True and self.model.startswith("MacBook"):
print("- Disabling Battery Throttling")
if self.constants.disable_msr_power_ctl is True:
print("- Disabling Firmware Throttling")
if smbios_data.smbios_dictionary[self.model]["CPU Generation"] >= cpu_data.cpu_data.nehalem.value:
# Nehalem and newer MacBooks force firmware throttling via MSR_POWER_CTL
# Nehalem and newer systems force firmware throttling via MSR_POWER_CTL
self.enable_kext("SimpleMSR.kext", self.constants.simplemsr_version, self.constants.simplemsr_path)
if self.constants.disable_connectdrivers is True:
print("- Disabling ConnectDrivers")

View File

@@ -807,16 +807,16 @@ https://dortania.github.io/OpenCore-Legacy-Patcher/ACCEL.html#unable-to-switch-g
print(
"""
By default on Nehalem and newer Macs, the firmware will throttle if
the battery is either dead or missing. The firmware will set
the battery or Display is either dead or missing. The firmware will set
'BD PROCHOT' to notify the OS the machine needs to run in an extreme
low power mode.
Enabling this option will patch 'MSR_POWER_CTL' to be unset allowing
proper CPU behaviour as if battery is present. Note that this can cause
proper CPU behaviour as if hardware is present. Note that this can cause
instability in situations where the CPU is being taxed and pulls more
power than the PSU can supply.
power than the laptop's PSU can supply.
Note: Only supported on Nehalem and newer MacBooks (2010+)
Note: Only supported on Nehalem and newer Macs (2010+)
"""
)
@@ -830,6 +830,32 @@ Note: Only supported on Nehalem and newer MacBooks (2010+)
else:
self.set_battery_throttle()
def set_xcpm(self):
utilities.cls()
utilities.header(["Disable XCPM"])
print(
"""
By default on Ivy Bridge EP and newer Macs, the system will throttle if
the battery or Display is either dead or missing. Apple's XCPM will set
'BD PROCHOT' to avoid damage to the system.
Enabling this option will disable Apple's XNU CPU Power Management (XCPM)
and fall back onto the older ACPI_SMC_PlatformPlugin.kext.
Note: Only supported on Ivy Bridge EP and newer Macs (2013+)
"""
)
change_menu = input("Disable XCPM?(y/n/q): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.disable_xcpm = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.disable_xcpm = False
elif change_menu in {"q", "Q", "Quit", "quit"}:
print("Returning to previous menu")
else:
self.set_xcpm()
def set_surplus(self):
utilities.cls()
utilities.header(["Override SurPlus MaxKernel"])
@@ -1236,6 +1262,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
],
[f"Set Hibernation Workaround:\tCurrently {self.constants.disable_connectdrivers}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_hibernation_workaround],
[f"Disable Battery Throttling:\tCurrently {self.constants.disable_msr_power_ctl}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_battery_throttle],
[f"Disable XCPM:\t\tCurrently {self.constants.disable_xcpm}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_xcpm],
[f"Set Software Demux:\tCurrently {self.constants.software_demux}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_software_demux],
[f"Set 3rd Party SSD Support:\tCurrently {self.constants.allow_3rd_party_drives}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_3rd_party_drices],
[f"Set FeatureUnlock: \tCurrently {self.constants.fu_status}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_fu_settings],

View File

@@ -70,7 +70,7 @@ class Constants:
self.smcspoof_version = "1.0.0" # SMC-Spoof
self.mce_version = "1.0.0" # AppleMCEReporterDisabler
self.btspoof_version = "1.0.0" # Bluetooth-Spoof
self.aspp_override_version = "1.0.0" # ACPI_SMC_PlatformPlugin Override
self.aspp_override_version = "1.0.1" # ACPI_SMC_PlatformPlugin Override
## Syncretic
## https://forums.macrumors.com/members/syncretic.1173816/
@@ -187,6 +187,7 @@ class Constants:
self.allow_3rd_party_drives = True # Allow ThridPartyDrives quirk
self.set_content_caching = False # Set Content Caching
self.allow_nvme_fixing = True # Allow NVMe Kernel Space Patches
self.disable_xcpm = False # Disable XCPM (X86PlatformPlugin.kext)
self.legacy_accel_support = [
os_data.os_data.mojave,