From 1393db72ddf8f8acac27d1f65c5644ce89cc1d81 Mon Sep 17 00:00:00 2001 From: Mykola Grymalyuk Date: Wed, 2 Mar 2022 09:19:41 -0700 Subject: [PATCH] Add XCPM disabling --- CHANGELOG.md | 4 +++ gui/gui_main.py | 25 ++++++++++--- payloads/Kexts/Misc/ASPP-Override-v1.0.0.zip | Bin 2225 -> 0 bytes payloads/Kexts/Misc/ASPP-Override-v1.0.1.zip | Bin 0 -> 1921 bytes resources/build.py | 13 ++++--- resources/cli_menu.py | 35 ++++++++++++++++--- resources/constants.py | 3 +- 7 files changed, 66 insertions(+), 14 deletions(-) delete mode 100644 payloads/Kexts/Misc/ASPP-Override-v1.0.0.zip create mode 100644 payloads/Kexts/Misc/ASPP-Override-v1.0.1.zip diff --git a/CHANGELOG.md b/CHANGELOG.md index da86993cd..ee44e8ef7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/gui/gui_main.py b/gui/gui_main.py index e1bcf3941..55cb5e3ce 100644 --- a/gui/gui_main.py +++ b/gui/gui_main.py @@ -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(): diff --git a/payloads/Kexts/Misc/ASPP-Override-v1.0.0.zip b/payloads/Kexts/Misc/ASPP-Override-v1.0.0.zip deleted file mode 100644 index 0e0bb40f5d2af9b836ab938c22a4349143f171b0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2225 zcmWIWW@Zs#0D&J{>_Wf{C?U+Cz~C4h5TNT{mReMlnUboPomx?%9~#2Tz^+pEJyA~N z2N;)Da5FHnd}U-{02>qlHjsmX1I55QKtpAL2FAzxIy(CYN9gOtW15X(v?9=WG^3Lf zM3d7Kk`g}n`h2l-|bIKUgkFJE<}iMzxAFFa&tBbKH62 z6_NmSEXctSuK*bgt9|TI!bS#r*f{6sm89mC6hi{ZNdOW+pnyX22_ld_A(@=P!N8zK zz+}(7w0ymSoXp}9aA=(X+7T**H6rGQ-Y%MLAW-YKujx|y;w72Jne7&n8zvhS<{X>g z^Lxs~L|!TGgB%m5_`k~ka(dSft{Y2Me&lwmKKD*ecI}zf@toJ=9G>ZjPXD#Ca8b5G zlSzuwt}F6?Z{KUJyJ~M{et1dQx@qnd7az|XPzQ0W;;O}GQ zV!qV>k8kYObUBfDV%a1www<1<-tXAM6@4smRp=$x#_~yNhTKKcaS;q*T2p*}N>!#j z^GZ5gdnSF-)!%x78j@jY7Rl3tO}$eeeNsw#G)=8%`tKe0Qj%ZJ(Nu{Jzvfx|i*M3I z+saQ}I^IjICLG*4=bhWV1Luv?d_EVjmnP2HJ9GOX-6HvxCplK^ntX@UOgi|P(suk0 zIk?VYespy1q+Q8tZ!b-}SasmC4&y>Kfrb0ckHs>wD>?l>Ub@KYAKw(^w3XWpAg~x z!|+5)(H_aP9_QXoSsf+>pP=jEcrvOo~!p=@9X{U z@d}S+rAxPc$<4borF!Bs*1OufTUM5=yK+$H_mvqA^TdoA%BGseN(W~dXG$rjzpynp zI7#W_sTjvg4-a4VKNfkrP5FKG!~jD^sY{y2yN$F}yOXXS%M;sTzu&al)N)(O>mr{` zJ1+h{Ue5^1aHdAbA1!8LU;rh4?Ad}3C~JsZc3_qq`tY2m7mp){kW!u)8W`MTyyRdf zEYBPWE=~?Hy-c{mU^H)`W@2L(w}F9&>htHXRK-M|EP3@*MQr*MvE|E_s7za;#m?e9 z#VCq_lb?;Pu4UJqBTr;HVwfj%q$C))Px99FWO?Pk<iR{mYW5!evZ>+h=MyvbTifro{O~<}SIgVq zoSB}R?$`X8`~6JD`9&5yk`*R9mu%4pHCHv&HP+v( zVr=iPZ>+ByFRsH6E>-7m7G9FZ$iM)K$^dUhCJ|=bbq=V!1%dyLAQDSlqf`@E3s;B* zusR62NC(wHFz~-I5XhvcMnd)rwmJfCm7@&M_gMS_Pq$!C;jJ+co&wbw$k_%|XTZS! x#xepn;m98Z0up2=ax8)}Bn}5d;NPONTC3^;Vv$BD#Ub0k diff --git a/payloads/Kexts/Misc/ASPP-Override-v1.0.1.zip b/payloads/Kexts/Misc/ASPP-Override-v1.0.1.zip new file mode 100644 index 0000000000000000000000000000000000000000..26a41b85fcbdba4c94e6b945b12d0e477c288786 GIT binary patch literal 1921 zcmWIWW@Zs#0D&J{>_Wf{C?U+Cz~C4h5TNT{mReMlnUboPomx?%9~#2Tz^+pEJyA~N zM`G4g`J~bcZU#n{uZ#=~V1oj{268ZPpcr@uXs9gE!1#DyM`!=w2z|YHOtVppo``95 za)M}bdO}jd2VbAC5By;r0S!zOB$(9&q!~YIDX@KfZ=k@)$`*6LP(_8~6wAvQOh@E0 zyd(r4{WKHzzv+WsvfL!EAf0L4c}{Cr2RE&Jl9}D2 z?DO_Oz~KcSCx4Ruxk+Zvf<+;E9}XET-|cUnzM}eQdtqz~^)<__9Ip z+HU`r95d#P6g-uixR0k?gs}T zsm#_qm-pp83Hq;EQ5L@&2{Prx5puWm;2Y3fBg9UvYd9`%jmgMzNgENFN-~R z>eH-G@)CWbiCkLAOy_TQaa$~2!#k0?Ws*0C(#mtIE7mD8KHVeDQ}C>BwfB{G4EDyd zOLc$U4NmUVTNb*_#{ZSe{by>^3*V<)v)H>zdxq6>E7_2pQ;*4bMXuzy6+7=~6<_uj ze}2;xshX8W)6O>@&CxtC^=Q~fm8)+(bIf|;?Rno9{PX|g9yI&Szaqc)=AcApH{nsn*Wl_^t>ObU70kg(#GzQdb?2M+WH zOrJet4zuBXHjf#LW&}>0Gk?-5@d=Y7V}ybtCvXK#H4nApbeaD*Or2>_q=XCWPPyY5 zJC3Y-EbNibF_j}FQDdK7_SMswb%NZzVrR;GV(OhP6@2_vHuNyC}!w)VcLN4z-bqQE5fPyW+n~_O`8Fv{9DnCHrzaxmm60Ru4 z9@Y{SVgam7MJ}R1WhxB(Zwv%7DJo%+{eql4KvsatJQ(=zCN82H~ET8Rkr9Vj3{b|S|jDDlI<|HhBZNCAn@o1|og0B=?{ SkQJ;zs0qxCPQcvAzyJWoB7N@w literal 0 HcmV?d00001 diff --git a/resources/build.py b/resources/build.py index fe5a7a704..a0ea81244 100644 --- a/resources/build.py +++ b/resources/build.py @@ -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") diff --git a/resources/cli_menu.py b/resources/cli_menu.py index 8d32c1eb0..5bbf8aca9 100644 --- a/resources/cli_menu.py +++ b/resources/cli_menu.py @@ -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], diff --git a/resources/constants.py b/resources/constants.py index 03b29132b..4d1e481a2 100644 --- a/resources/constants.py +++ b/resources/constants.py @@ -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,