diff --git a/CHANGELOG.md b/CHANGELOG.md index 580a29a94..b61de996e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ - Mainly applicable for iMac12,x and iGPU-only MacBooks - Add EFICheckDisabler - Based off stripped RestrictEvents.kext +- Add SimpleMSR to disable missing battery throttling on Nehalem+ MacBooks ## 0.2.5 diff --git a/README.md b/README.md index f74825ef1..94829b9e9 100644 --- a/README.md +++ b/README.md @@ -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 * [mario_bros_tech](https://github.com/mariobrostech) and the rest of the Unsupported Mac Discord * 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 * Endless testing, reporting issues * Apple diff --git a/payloads/Config/config.plist b/payloads/Config/config.plist index 51c90b3f6..4a69945d2 100644 --- a/payloads/Config/config.plist +++ b/payloads/Config/config.plist @@ -976,7 +976,7 @@ BundlePath CSLVFixup.kext Comment - Fix Music.app + Fix Music Enabled ExecutablePath @@ -988,6 +988,24 @@ PlistPath Contents/Info.plist + + Arch + x86_64 + BundlePath + SimpleMSR.kext + Comment + Disable firmware based battery throttling + Enabled + + ExecutablePath + Contents/MacOS/SimpleMSR + MaxKernel + + MinKernel + + PlistPath + Contents/Info.plist + Block diff --git a/payloads/Kexts/Misc/SimpleMSR-v1.0.0.zip b/payloads/Kexts/Misc/SimpleMSR-v1.0.0.zip new file mode 100644 index 000000000..9becfe14a Binary files /dev/null and b/payloads/Kexts/Misc/SimpleMSR-v1.0.0.zip differ diff --git a/resources/build.py b/resources/build.py index 69d293e76..5a94a7dd9 100644 --- a/resources/build.py +++ b/resources/build.py @@ -722,6 +722,11 @@ 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 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: # Ensure this is done at the end so all previous RestrictEvents patches are applied # RestrictEvents and EFICheckDisabler will confilict if both are injected diff --git a/resources/cli_menu.py b/resources/cli_menu.py index a61d1c6ea..1202e8e08 100644 --- a/resources/cli_menu.py +++ b/resources/cli_menu.py @@ -677,6 +677,35 @@ for Windows may prefer to only work with the dGPU and eGPU active. print("Returning to previous menu") else: 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): utilities.cls() @@ -919,6 +948,7 @@ system_profiler SPHardwareDataType | grep 'Model Identifier' 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, ], + [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: diff --git a/resources/constants.py b/resources/constants.py index 063f2e306..fbdfc8601 100644 --- a/resources/constants.py +++ b/resources/constants.py @@ -72,6 +72,10 @@ class Constants: ## https://github.com/cdf/Innie self.innie_version = "1.3.0" # Innie + ## arter97 + ## https://github.com/arter97/SimpleMSR/ + self.simplemsr_version = "1.0.0" # SimpleMSR + # Get resource path self.current_path = Path(__file__).parent.parent.resolve() self.payload_path = self.current_path / Path("payloads") @@ -140,13 +144,14 @@ class Constants: self.allow_ts2_accel = True # Set TeraScale 2 Acceleration support ## Miscellaneous - self.disallow_cpufriend = False # Disable CPUFriend - self.enable_wake_on_wlan = False # Allow Wake on WLAN for modern Broadcom - self.disable_tb = False # Disable Thunderbolt Controller - self.set_alc_usage = True # Set AppleALC usage - self.dGPU_switch = True # Set Display GPU Switching for Windows - self.force_surplus = False # Force SurPlus patch in newer OSes - self.force_latest_psp = False # Force latest PatcherSupportPkg + self.disallow_cpufriend = False # Disable CPUFriend + self.enable_wake_on_wlan = False # Allow Wake on WLAN for modern Broadcom + self.disable_tb = False # Disable Thunderbolt Controller + self.set_alc_usage = True # Set AppleALC usage + self.dGPU_switch = True # Set Display GPU Switching for Windows + self.force_surplus = False # Force SurPlus patch in newer OSes + self.force_latest_psp = False # Force latest PatcherSupportPkg + self.disable_msr_power_ctl = False # Disable MSR Power Control (missing battery throttling) # OS Versions ## Based off Major Kernel Version @@ -325,6 +330,10 @@ class Constants: @property def innie_path(self): 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 def latebloom_path(self):