Merge branch 'main' into vmm

This commit is contained in:
Mykola Grymalyuk
2021-10-11 16:50:35 -06:00
committed by GitHub
10 changed files with 228 additions and 1 deletions

View File

@@ -634,6 +634,19 @@ class BuildOpenCore:
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
if not self.constants.custom_model and self.computer.bluetooth_chipset:
if self.computer.bluetooth_chipset in ["BRCM2070 Hub", "BRCM2046 Hub"]:

View File

@@ -681,6 +681,34 @@ for Windows may prefer to only work with the dGPU and eGPU active.
else:
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):
utilities.cls()
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}",
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],
]

View File

@@ -76,6 +76,10 @@ class Constants:
## https://github.com/arter97/SimpleMSR/
self.simplemsr_version = "1.0.0" # SimpleMSR
## blackgate
## https://github.com/blackgate/AMDGPUWakeHandler
self.gpu_wake_version = "1.0.0"
# Get resource path
self.current_path = Path(__file__).parent.parent.resolve()
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_latest_psp = False # Force latest PatcherSupportPkg
self.disable_msr_power_ctl = False # Disable MSR Power Control (missing battery throttling)
self.software_demux = False # Enable Software Demux patch set
# OS Versions
## Based off Major Kernel Version
@@ -200,6 +205,10 @@ class Constants:
@property
def windows_ssdt_path(self):
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
@property
@@ -334,6 +343,10 @@ class Constants:
@property
def simplemsr_path(self):
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
def latebloom_path(self):

View File

@@ -721,13 +721,22 @@ set million colour before rebooting"""
self.amd_ts2 = False
self.iron_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):
# If GFX0 is missing, assume machine was demuxed
# -wegnoegpu would also trigger this, so ensure arg is not present
if not "-wegnoegpu" in (utilities.get_nvram("boot-args") or ""):
igpu = self.constants.computer.igpu
dgpu = self.constants.computer.dgpu
dgpu = self.check_dgpu_status()
if igpu and not dgpu:
return True
return False

View File

@@ -67,5 +67,6 @@ def validate(settings):
settings.enable_wake_on_wlan = True
settings.disable_tb = True
settings.force_surplus = True
settings.software_demux = True
build_prebuilt()
build_dumps()