Add firmware throttle patch

Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/555
This commit is contained in:
Mykola Grymalyuk
2021-10-10 20:42:05 -06:00
parent 12e0ffff71
commit 47a2f71612
7 changed files with 73 additions and 8 deletions

View File

@@ -41,6 +41,7 @@
- Mainly applicable for iMac12,x and iGPU-only MacBooks - Mainly applicable for iMac12,x and iGPU-only MacBooks
- Add EFICheckDisabler - Add EFICheckDisabler
- Based off stripped RestrictEvents.kext - Based off stripped RestrictEvents.kext
- Add SimpleMSR to disable missing battery throttling on Nehalem+ MacBooks
## 0.2.5 ## 0.2.5

View File

@@ -65,6 +65,8 @@ Nightly builds can be found here courteous of nightly.link:
* Development of previous patchers, laying out much of what needs to be patched * Development of previous patchers, laying out much of what needs to be patched
* [mario_bros_tech](https://github.com/mariobrostech) and the rest of the Unsupported Mac Discord * [mario_bros_tech](https://github.com/mariobrostech) and the rest of the Unsupported Mac Discord
* Catalyst that started OpenCore Legacy Patcher * Catalyst that started OpenCore Legacy Patcher
* [arter97](https://github.com/arter97/)
* [SimpleMSR](https://github.com/arter97/SimpleMSR/) to disable firmware throttling in Nehalem+ MacBooks without batteries
* MacRumors and Unsupported Mac Communities * MacRumors and Unsupported Mac Communities
* Endless testing, reporting issues * Endless testing, reporting issues
* Apple * Apple

View File

@@ -976,7 +976,7 @@
<key>BundlePath</key> <key>BundlePath</key>
<string>CSLVFixup.kext</string> <string>CSLVFixup.kext</string>
<key>Comment</key> <key>Comment</key>
<string>Fix Music.app</string> <string>Fix Music</string>
<key>Enabled</key> <key>Enabled</key>
<false/> <false/>
<key>ExecutablePath</key> <key>ExecutablePath</key>
@@ -988,6 +988,24 @@
<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>SimpleMSR.kext</string>
<key>Comment</key>
<string>Disable firmware based battery throttling</string>
<key>Enabled</key>
<false/>
<key>ExecutablePath</key>
<string>Contents/MacOS/SimpleMSR</string>
<key>MaxKernel</key>
<string></string>
<key>MinKernel</key>
<string></string>
<key>PlistPath</key>
<string>Contents/Info.plist</string>
</dict>
</array> </array>
<key>Block</key> <key>Block</key>
<array/> <array/>

Binary file not shown.

View File

@@ -722,6 +722,11 @@ class BuildOpenCore:
self.get_item_by_kv(self.config["Kernel"]["Patch"], "Identifier", "com.apple.filesystems.apfs")["Enabled"] = True 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 # Lets us check in sys_patch.py if config supports FileVault
self.config["NVRAM"]["Add"]["4D1FDA02-38C7-4A6A-9CC6-4BCCA8B30102"]["OCLP-Settings"] += " -allow_fv" 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 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
self.enable_kext("SimpleMSR.kext", self.constants.simplemsr_version, self.constants.simplemsr_path)
if self.get_kext_by_bundle_path("RestrictEvents.kext")["Enabled"] is False: if self.get_kext_by_bundle_path("RestrictEvents.kext")["Enabled"] is False:
# Ensure this is done at the end so all previous RestrictEvents patches are applied # Ensure this is done at the end so all previous RestrictEvents patches are applied
# RestrictEvents and EFICheckDisabler will confilict if both are injected # RestrictEvents and EFICheckDisabler will confilict if both are injected

View File

@@ -677,6 +677,35 @@ for Windows may prefer to only work with the dGPU and eGPU active.
print("Returning to previous menu") print("Returning to previous menu")
else: else:
self.dGPU_switch_support() self.dGPU_switch_support()
def set_battery_throttle(self):
utilities.cls()
utilities.header(["Disable Firmware Throttling"])
print(
"""
By default on Nehalem and newer Macs, the firmware will throttle if
the battery 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
instability in situations where the CPU is being taxed and pulls more
power than the PSU can supply.
Note: Only supported on Nehalem and newer MacBooks (2010+)
"""
)
change_menu = input("Disable Firmware Throttling?(y/n/q): ")
if change_menu in {"y", "Y", "yes", "Yes"}:
self.constants.disable_msr_power_ctl = True
elif change_menu in {"n", "N", "no", "No"}:
self.constants.disable_msr_power_ctl = False
elif change_menu in {"q", "Q", "Quit", "quit"}:
print("Returning to previous menu")
else:
self.set_battery_throttle()
def set_surplus(self): def set_surplus(self):
utilities.cls() utilities.cls()
@@ -919,6 +948,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
f"Set Windows GMUX support:\tCurrently {self.constants.dGPU_switch}", f"Set Windows GMUX support:\tCurrently {self.constants.dGPU_switch}",
MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).dGPU_switch_support, MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).dGPU_switch_support,
], ],
[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],
] ]
for option in options: for option in options:

View File

@@ -72,6 +72,10 @@ class Constants:
## https://github.com/cdf/Innie ## https://github.com/cdf/Innie
self.innie_version = "1.3.0" # Innie self.innie_version = "1.3.0" # Innie
## arter97
## https://github.com/arter97/SimpleMSR/
self.simplemsr_version = "1.0.0" # SimpleMSR
# Get resource path # Get resource path
self.current_path = Path(__file__).parent.parent.resolve() self.current_path = Path(__file__).parent.parent.resolve()
self.payload_path = self.current_path / Path("payloads") self.payload_path = self.current_path / Path("payloads")
@@ -140,13 +144,14 @@ class Constants:
self.allow_ts2_accel = True # Set TeraScale 2 Acceleration support self.allow_ts2_accel = True # Set TeraScale 2 Acceleration support
## Miscellaneous ## Miscellaneous
self.disallow_cpufriend = False # Disable CPUFriend self.disallow_cpufriend = False # Disable CPUFriend
self.enable_wake_on_wlan = False # Allow Wake on WLAN for modern Broadcom self.enable_wake_on_wlan = False # Allow Wake on WLAN for modern Broadcom
self.disable_tb = False # Disable Thunderbolt Controller self.disable_tb = False # Disable Thunderbolt Controller
self.set_alc_usage = True # Set AppleALC usage self.set_alc_usage = True # Set AppleALC usage
self.dGPU_switch = True # Set Display GPU Switching for Windows self.dGPU_switch = True # Set Display GPU Switching for Windows
self.force_surplus = False # Force SurPlus patch in newer OSes self.force_surplus = False # Force SurPlus patch in newer OSes
self.force_latest_psp = False # Force latest PatcherSupportPkg self.force_latest_psp = False # Force latest PatcherSupportPkg
self.disable_msr_power_ctl = False # Disable MSR Power Control (missing battery throttling)
# OS Versions # OS Versions
## Based off Major Kernel Version ## Based off Major Kernel Version
@@ -325,6 +330,10 @@ class Constants:
@property @property
def innie_path(self): def innie_path(self):
return self.payload_kexts_path / Path(f"Misc/Innie-v{self.innie_version}.zip") return self.payload_kexts_path / Path(f"Misc/Innie-v{self.innie_version}.zip")
@property
def simplemsr_path(self):
return self.payload_kexts_path / Path(f"Misc/SimpleMSR-v{self.simplemsr_version}.zip")
@property @property
def latebloom_path(self): def latebloom_path(self):