mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-04-23 19:40:15 +10:00
Merge branch 'main' into vmm
This commit is contained in:
@@ -42,6 +42,9 @@
|
|||||||
- Add EFICheckDisabler
|
- Add EFICheckDisabler
|
||||||
- Based off stripped RestrictEvents.kext
|
- Based off stripped RestrictEvents.kext
|
||||||
- Add SimpleMSR to disable missing battery throttling on Nehalem+ MacBooks
|
- Add SimpleMSR to disable missing battery throttling on Nehalem+ MacBooks
|
||||||
|
- Implement software demux patch set for 2011 15/17" MacBook Pros
|
||||||
|
- Alternative to hardware demux
|
||||||
|
- Adds [AMDGPUWakeHandler](https://github.com/blackgate/AMDGPUWakeHandler)
|
||||||
|
|
||||||
## 0.2.5
|
## 0.2.5
|
||||||
|
|
||||||
|
|||||||
BIN
payloads/ACPI/SSDT-DGPU.aml
Normal file
BIN
payloads/ACPI/SSDT-DGPU.aml
Normal file
Binary file not shown.
103
payloads/ACPI/Source/SSDT-DGPU.dsl
Normal file
103
payloads/ACPI/Source/SSDT-DGPU.dsl
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
/* Requests power off of dGPU in MacBookPro8,2/3 (TS2 hardware failure)
|
||||||
|
* Main goal is to ensure power draw from the dGPU is reduced as
|
||||||
|
* much as possible to simulate a hardware demux without actual
|
||||||
|
* hardware modifications.
|
||||||
|
*
|
||||||
|
* Notes:
|
||||||
|
* - SSDT must be used in conjuction with '_INI' to 'XINI' patch
|
||||||
|
* to reroute PCI0 initialization.
|
||||||
|
*
|
||||||
|
* - AMD drivers in macOS may still attempt to attach and kernel
|
||||||
|
* panic. Disable the dGPU with class-code/device-id spoof or
|
||||||
|
* with '-wegnoegpu'.
|
||||||
|
*
|
||||||
|
* - dGPU will reactivate with sleep-wake, additional process
|
||||||
|
* is needed to disable the dGPU.
|
||||||
|
* - ie. AMDGPUWakeHandler.kext for macOS
|
||||||
|
*
|
||||||
|
* Ref:
|
||||||
|
* - https://www.tonymacx86.com/threads/help-macbook-pro-disable-radeon-gpu-via-dsdt.164458/
|
||||||
|
* - https://github.com/blackgate/AMDGPUWakeHandler
|
||||||
|
* - https://help.ubuntu.com/community/MacBookPro8-2/Raring
|
||||||
|
*/
|
||||||
|
DefinitionBlock ("", "SSDT", 2, "DRTNIA", "dGPU_OFF", 0x00001000)
|
||||||
|
{
|
||||||
|
External (_SB_.PCI0, DeviceObj)
|
||||||
|
External (OSYS)
|
||||||
|
|
||||||
|
Scope (_SB.PCI0)
|
||||||
|
{
|
||||||
|
OperationRegion (IOGP, SystemIO, 0x0700, 0x51)
|
||||||
|
Field (IOGP, ByteAcc, NoLock, Preserve)
|
||||||
|
{
|
||||||
|
Offset (0x10),
|
||||||
|
P710, 8,
|
||||||
|
Offset (0x28),
|
||||||
|
P728, 8,
|
||||||
|
Offset (0x40),
|
||||||
|
P740, 8,
|
||||||
|
Offset (0x50),
|
||||||
|
P750, 8
|
||||||
|
}
|
||||||
|
|
||||||
|
Method (_INI, 0, NotSerialized) // _INI: Initialize
|
||||||
|
{
|
||||||
|
Store (0x07D0, OSYS)
|
||||||
|
If (CondRefOf (\_OSI, Local0))
|
||||||
|
{
|
||||||
|
If (_OSI ("Darwin"))
|
||||||
|
{
|
||||||
|
Store (0x2710, OSYS)
|
||||||
|
}
|
||||||
|
|
||||||
|
If (\_OSI ("Linux"))
|
||||||
|
{
|
||||||
|
Store (0x03E8, OSYS)
|
||||||
|
}
|
||||||
|
|
||||||
|
If (\_OSI ("Windows 2001"))
|
||||||
|
{
|
||||||
|
Store (0x07D1, OSYS)
|
||||||
|
}
|
||||||
|
|
||||||
|
If (\_OSI ("Windows 2001 SP1"))
|
||||||
|
{
|
||||||
|
Store (0x07D1, OSYS)
|
||||||
|
}
|
||||||
|
|
||||||
|
If (\_OSI ("Windows 2001 SP2"))
|
||||||
|
{
|
||||||
|
Store (0x07D2, OSYS)
|
||||||
|
}
|
||||||
|
|
||||||
|
If (\_OSI ("Windows 2006"))
|
||||||
|
{
|
||||||
|
Store (0x07D6, OSYS)
|
||||||
|
}
|
||||||
|
|
||||||
|
If (\_OSI ("Windows 2007"))
|
||||||
|
{
|
||||||
|
Store (0x07D7, OSYS)
|
||||||
|
}
|
||||||
|
|
||||||
|
If (\_OSI ("Windows 2008"))
|
||||||
|
{
|
||||||
|
Store (0x07D8, OSYS)
|
||||||
|
}
|
||||||
|
|
||||||
|
If (\_OSI ("Windows 2009"))
|
||||||
|
{
|
||||||
|
Store (0x07D9, OSYS)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disables dGPU
|
||||||
|
Store ("Requesting dGPU power off", Debug)
|
||||||
|
P728 = One // Switch select
|
||||||
|
P710 = 0x02 // Switch display
|
||||||
|
P740 = 0x02 // Switch DDC
|
||||||
|
P750 = Zero // Power down discrete graphics
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -31,6 +31,14 @@
|
|||||||
<key>Path</key>
|
<key>Path</key>
|
||||||
<string>SSDT-PCI.aml</string>
|
<string>SSDT-PCI.aml</string>
|
||||||
</dict>
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>Enabled</key>
|
||||||
|
<false/>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Requests power off of dGPU for Sandy Bridge MacBook Pros</string>
|
||||||
|
<key>Path</key>
|
||||||
|
<string>SSDT-DGPU.aml</string>
|
||||||
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>Delete</key>
|
<key>Delete</key>
|
||||||
<array/>
|
<array/>
|
||||||
@@ -156,6 +164,36 @@
|
|||||||
<key>TableSignature</key>
|
<key>TableSignature</key>
|
||||||
<data>RFNEVA==</data>
|
<data>RFNEVA==</data>
|
||||||
</dict>
|
</dict>
|
||||||
|
<dict>
|
||||||
|
<key>Base</key>
|
||||||
|
<string>\_SB.PCI0</string>
|
||||||
|
<key>BaseSkip</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>_INI to XINI</string>
|
||||||
|
<key>Count</key>
|
||||||
|
<integer>1</integer>
|
||||||
|
<key>Enabled</key>
|
||||||
|
<false/>
|
||||||
|
<key>Find</key>
|
||||||
|
<data>X0lOSQ==</data>
|
||||||
|
<key>Limit</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>Mask</key>
|
||||||
|
<data></data>
|
||||||
|
<key>OemTableId</key>
|
||||||
|
<data></data>
|
||||||
|
<key>Replace</key>
|
||||||
|
<data>WElOSQ==</data>
|
||||||
|
<key>ReplaceMask</key>
|
||||||
|
<data></data>
|
||||||
|
<key>Skip</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>TableLength</key>
|
||||||
|
<integer>0</integer>
|
||||||
|
<key>TableSignature</key>
|
||||||
|
<data>RFNEVA==</data>
|
||||||
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>Quirks</key>
|
<key>Quirks</key>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -1055,6 +1093,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>AMDGPUWakeHandler.kext</string>
|
||||||
|
<key>Comment</key>
|
||||||
|
<string>Force disable dGPU on wake</string>
|
||||||
|
<key>Enabled</key>
|
||||||
|
<false/>
|
||||||
|
<key>ExecutablePath</key>
|
||||||
|
<string>Contents/MacOS/AMDGPUWakeHandler</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/>
|
||||||
|
|||||||
BIN
payloads/Kexts/Misc/AMDGPUWakeHandler-v1.0.0.zip
Normal file
BIN
payloads/Kexts/Misc/AMDGPUWakeHandler-v1.0.0.zip
Normal file
Binary file not shown.
@@ -634,6 +634,19 @@ class BuildOpenCore:
|
|||||||
|
|
||||||
self.config["DeviceProperties"]["Add"][tb_device_path] = {"class-code": binascii.unhexlify("FFFFFFFF"), "device-id": binascii.unhexlify("FFFF0000")}
|
self.config["DeviceProperties"]["Add"][tb_device_path] = {"class-code": binascii.unhexlify("FFFFFFFF"), "device-id": binascii.unhexlify("FFFF0000")}
|
||||||
|
|
||||||
|
if self.constants.software_demux is True and self.model in ["MacBookPro8,2", "MacBookPro8,3"]:
|
||||||
|
print("- Enabling software demux")
|
||||||
|
# Add ACPI patches
|
||||||
|
self.get_item_by_kv(self.config["ACPI"]["Add"], "Path", "SSDT-DGPU.aml")["Enabled"] = True
|
||||||
|
self.get_item_by_kv(self.config["ACPI"]["Patch"], "Comment", "_INI to XINI")["Enabled"] = True
|
||||||
|
shutil.copy(self.constants.demux_ssdt_path, self.constants.acpi_path)
|
||||||
|
# Disable dGPU
|
||||||
|
# IOACPIPlane:/_SB/PCI0@0/P0P2@10000/GFX0@0
|
||||||
|
self.config["DeviceProperties"]["Add"]["PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"] = {"class-code": binascii.unhexlify("FFFFFFFF"), "device-id": binascii.unhexlify("FFFF0000"), "IOName": "Dortania Disabled Card", "name": "Dortania Disabled Card"}
|
||||||
|
self.config["DeviceProperties"]["Delete"]["PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)"] = ["class-code", "device-id", "IOName", "name"]
|
||||||
|
# Add AMDGPUWakeHandler
|
||||||
|
self.enable_kext("AMDGPUWakeHandler.kext", self.constants.gpu_wake_version, self.constants.gpu_wake_path)
|
||||||
|
|
||||||
# Bluetooth Detection
|
# Bluetooth Detection
|
||||||
if not self.constants.custom_model and self.computer.bluetooth_chipset:
|
if not self.constants.custom_model and self.computer.bluetooth_chipset:
|
||||||
if self.computer.bluetooth_chipset in ["BRCM2070 Hub", "BRCM2046 Hub"]:
|
if self.computer.bluetooth_chipset in ["BRCM2070 Hub", "BRCM2046 Hub"]:
|
||||||
|
|||||||
@@ -681,6 +681,34 @@ for Windows may prefer to only work with the dGPU and eGPU active.
|
|||||||
else:
|
else:
|
||||||
self.dGPU_switch_support()
|
self.dGPU_switch_support()
|
||||||
|
|
||||||
|
def set_software_demux(self):
|
||||||
|
utilities.cls()
|
||||||
|
utilities.header(["Set Software Demux"])
|
||||||
|
print(
|
||||||
|
"""
|
||||||
|
For MacBookPro8,2/3 users, it's very common for the dGPU to fail and
|
||||||
|
thus require the user to disable them via the 'gpu-power-prefs'
|
||||||
|
nvram argument.
|
||||||
|
|
||||||
|
However this solution still allows the dGPU to pull power (6-7w). Enabling
|
||||||
|
this option will simulate a demuxed enviroment allowing the dGPU to pull nearly
|
||||||
|
no power and have the iGPU handle all tasks including brightness control.
|
||||||
|
|
||||||
|
Note: this option requires dGPU to be disabled via NVRAM:
|
||||||
|
https://dortania.github.io/OpenCore-Legacy-Patcher/ACCEL.html#unable-to-switch-gpus-on-2011-15-and-17-macbook-pros
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
change_menu = input("Set Software Demux?(y/n/q): ")
|
||||||
|
if change_menu in {"y", "Y", "yes", "Yes"}:
|
||||||
|
self.constants.software_demux = True
|
||||||
|
elif change_menu in {"n", "N", "no", "No"}:
|
||||||
|
self.constants.software_demux = False
|
||||||
|
elif change_menu in {"q", "Q", "Quit", "quit"}:
|
||||||
|
print("Returning to previous menu")
|
||||||
|
else:
|
||||||
|
self.set_software_demux()
|
||||||
|
|
||||||
def set_battery_throttle(self):
|
def set_battery_throttle(self):
|
||||||
utilities.cls()
|
utilities.cls()
|
||||||
utilities.header(["Disable Firmware Throttling"])
|
utilities.header(["Disable Firmware Throttling"])
|
||||||
@@ -951,6 +979,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"Set Software Demux:\t\tCurrently {self.constants.software_demux}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).set_software_demux],
|
||||||
[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 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],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,10 @@ class Constants:
|
|||||||
## https://github.com/arter97/SimpleMSR/
|
## https://github.com/arter97/SimpleMSR/
|
||||||
self.simplemsr_version = "1.0.0" # SimpleMSR
|
self.simplemsr_version = "1.0.0" # SimpleMSR
|
||||||
|
|
||||||
|
## blackgate
|
||||||
|
## https://github.com/blackgate/AMDGPUWakeHandler
|
||||||
|
self.gpu_wake_version = "1.0.0"
|
||||||
|
|
||||||
# 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")
|
||||||
@@ -152,6 +156,7 @@ class Constants:
|
|||||||
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)
|
self.disable_msr_power_ctl = False # Disable MSR Power Control (missing battery throttling)
|
||||||
|
self.software_demux = False # Enable Software Demux patch set
|
||||||
|
|
||||||
# OS Versions
|
# OS Versions
|
||||||
## Based off Major Kernel Version
|
## Based off Major Kernel Version
|
||||||
@@ -201,6 +206,10 @@ class Constants:
|
|||||||
def windows_ssdt_path(self):
|
def windows_ssdt_path(self):
|
||||||
return self.payload_path / Path("ACPI/SSDT-PCI.aml")
|
return self.payload_path / Path("ACPI/SSDT-PCI.aml")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def demux_ssdt_path(self):
|
||||||
|
return self.payload_path / Path("ACPI/SSDT-DGPU.aml")
|
||||||
|
|
||||||
# Drivers
|
# Drivers
|
||||||
@property
|
@property
|
||||||
def nvme_driver_path(self):
|
def nvme_driver_path(self):
|
||||||
@@ -335,6 +344,10 @@ class Constants:
|
|||||||
def simplemsr_path(self):
|
def simplemsr_path(self):
|
||||||
return self.payload_kexts_path / Path(f"Misc/SimpleMSR-v{self.simplemsr_version}.zip")
|
return self.payload_kexts_path / Path(f"Misc/SimpleMSR-v{self.simplemsr_version}.zip")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def gpu_wake_path(self):
|
||||||
|
return self.payload_kexts_path / Path(f"Misc/AMDGPUWakeHandler-v{self.gpu_wake_version}.zip")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def latebloom_path(self):
|
def latebloom_path(self):
|
||||||
return self.payload_kexts_path / Path(f"Misc/latebloom-v{self.latebloom_version}.zip")
|
return self.payload_kexts_path / Path(f"Misc/latebloom-v{self.latebloom_version}.zip")
|
||||||
|
|||||||
@@ -722,12 +722,21 @@ set million colour before rebooting"""
|
|||||||
self.iron_gpu = False
|
self.iron_gpu = False
|
||||||
self.sandy_gpu = False
|
self.sandy_gpu = False
|
||||||
|
|
||||||
|
def check_dgpu_status(self):
|
||||||
|
dgpu = self.constants.computer.dgpu
|
||||||
|
if dgpu:
|
||||||
|
if dgpu.class_code and dgpu.class_code == 0xFFFFFFFF:
|
||||||
|
# If dGPU is disabled via class-codes, assume demuxed
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def detect_demux(self):
|
def detect_demux(self):
|
||||||
# If GFX0 is missing, assume machine was demuxed
|
# If GFX0 is missing, assume machine was demuxed
|
||||||
# -wegnoegpu would also trigger this, so ensure arg is not present
|
# -wegnoegpu would also trigger this, so ensure arg is not present
|
||||||
if not "-wegnoegpu" in (utilities.get_nvram("boot-args") or ""):
|
if not "-wegnoegpu" in (utilities.get_nvram("boot-args") or ""):
|
||||||
igpu = self.constants.computer.igpu
|
igpu = self.constants.computer.igpu
|
||||||
dgpu = self.constants.computer.dgpu
|
dgpu = self.check_dgpu_status()
|
||||||
if igpu and not dgpu:
|
if igpu and not dgpu:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|||||||
@@ -67,5 +67,6 @@ def validate(settings):
|
|||||||
settings.enable_wake_on_wlan = True
|
settings.enable_wake_on_wlan = True
|
||||||
settings.disable_tb = True
|
settings.disable_tb = True
|
||||||
settings.force_surplus = True
|
settings.force_surplus = True
|
||||||
|
settings.software_demux = True
|
||||||
build_prebuilt()
|
build_prebuilt()
|
||||||
build_dumps()
|
build_dumps()
|
||||||
|
|||||||
Reference in New Issue
Block a user