Fix NVMe properties applying with OC installed

Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/212
This commit is contained in:
Mykola Grymalyuk
2021-05-11 10:44:23 -06:00
parent 75200e9c8d
commit 0a0a59feea
3 changed files with 33 additions and 15 deletions

View File

@@ -15,6 +15,8 @@
- Fix iMac7,1 audio support - Fix iMac7,1 audio support
- Work-around Bluetooth Kernel Panic on Apple's Bluetooth 2.0 Controllers (USB 05AC:8206) - Work-around Bluetooth Kernel Panic on Apple's Bluetooth 2.0 Controllers (USB 05AC:8206)
- Affects iMac7,1 and MacPro3,1 - Affects iMac7,1 and MacPro3,1
- Fix iMac external display support
- Fix NVMe properties not applying when OpenCore is installed
## 0.1.2 ## 0.1.2
- Fix IDE support on 2008 era MacBooks, iMacs and Xserves - Fix IDE support on 2008 era MacBooks, iMacs and Xserves

View File

@@ -103,18 +103,34 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
[f"Enable Verbose Mode:\t\tCurrently {self.constants.verbose_debug}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_verbose], [f"Enable Verbose Mode:\t\tCurrently {self.constants.verbose_debug}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_verbose],
[f"Enable OpenCore DEBUG:\t\tCurrently {self.constants.opencore_debug}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_oc], [f"Enable OpenCore DEBUG:\t\tCurrently {self.constants.opencore_debug}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_oc],
[f"Enable Kext DEBUG:\t\t\tCurrently {self.constants.kext_debug}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_kext], [f"Enable Kext DEBUG:\t\t\tCurrently {self.constants.kext_debug}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_kext],
[f"Assume Metal GPU Always:\t\tCurrently {self.constants.imac_vendor}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_metal],
[f"Assume Upgraded Wifi Always:\tCurrently {self.constants.wifi_build}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_wifi],
[f"Set ShowPicker Mode:\t\tCurrently {self.constants.showpicker}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_showpicker], [f"Set ShowPicker Mode:\t\tCurrently {self.constants.showpicker}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_showpicker],
[f"Set Vault Mode:\t\t\tCurrently {self.constants.vault}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_vault], [f"Set Vault Mode:\t\t\tCurrently {self.constants.vault}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_vault],
[f"Set SIP and SecureBootModel:\tSIP: {self.constants.sip_status} SBM: {self.constants.secure_status}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_sip], [f"Set SIP and SecureBootModel:\tSIP: {self.constants.sip_status} SBM: {self.constants.secure_status}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_sip],
[f"Allow OpenCore on native Models:\tCurrently {self.constants.allow_oc_everywhere}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).allow_native_models],
[f"Advanced Patch Settings, for developers only", self.advanced_patcher_settings],
]
for option in options:
menu.add_menu_option(option[0], function=option[1])
response = menu.start()
def advanced_patcher_settings(self):
response = None
while not (response and response == -1):
title = [
"Adjust Advanced Patcher Settings, for developers ONLY"
]
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
options = [
[f"Assume Metal GPU Always:\t\tCurrently {self.constants.imac_vendor}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_metal],
[f"Assume Upgraded Wifi Always:\tCurrently {self.constants.wifi_build}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_wifi],
[f"Set SMBIOS Mode:\t\t\tCurrently {self.constants.serial_settings}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_serial], [f"Set SMBIOS Mode:\t\t\tCurrently {self.constants.serial_settings}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_serial],
[f"DRM Preferences:\t\t\tCurrently {self.constants.drm_support}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).drm_setting], [f"DRM Preferences:\t\t\tCurrently {self.constants.drm_support}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).drm_setting],
[f"Set Generic Bootstrap:\t\t{self.constants.boot_efi}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).bootstrap_setting], [f"Set Generic Bootstrap:\t\tCurrently {self.constants.boot_efi}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).bootstrap_setting],
[f"Assume Legacy GPU:\t\t\t{self.constants.assume_legacy}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).force_accel_setting], [f"Assume Legacy GPU:\t\t\tCurrently {self.constants.assume_legacy}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).force_accel_setting],
[f"Allow OpenCore on native Models:\t{self.constants.allow_oc_everywhere}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).allow_native_models], #[f"Download more RAM:\t\t\tCurrently {self.constants.download_ram}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).download_more_ram_dot_com],
[f"Download more RAM:\t\t\t{self.constants.download_ram}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).download_more_ram_dot_com], [f"Disable CPU Friend:\t\t\tCurrently {self.constants.disallow_cpufriend}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).disable_cpufriend],
[f"Disable CPU Friend:\t\t{self.constants.disallow_cpufriend}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).disable_cpufriend],
[f"Set Custom name {self.constants.custom_cpu_model_value}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).custom_cpu], [f"Set Custom name {self.constants.custom_cpu_model_value}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).custom_cpu],
] ]

View File

@@ -131,9 +131,9 @@ class BuildOpenCore:
self.enable_kext("Innie.kext", self.constants.innie_version, self.constants.innie_path) self.enable_kext("Innie.kext", self.constants.innie_version, self.constants.innie_path)
x = x + 1 x = x + 1
except ValueError: except ValueError:
print("- No PCIe Storage Controllers found to fix") print("- No PCIe Storage Controllers found to fix(V)")
except IndexError: except IndexError:
print("- No PCIe Storage Controllers found to fix") print("- No PCIe Storage Controllers found to fix(I)")
if not self.constants.custom_model: if not self.constants.custom_model:
nvme_devices = plistlib.loads(subprocess.run("ioreg -c IOPCIDevice -r -d2 -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()) nvme_devices = plistlib.loads(subprocess.run("ioreg -c IOPCIDevice -r -d2 -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
@@ -153,10 +153,10 @@ class BuildOpenCore:
nvme_acpi = "" nvme_acpi = ""
# Disable Bit 0 (L0s), enable Bit 1 (L1) # Disable Bit 0 (L0s), enable Bit 1 (L1)
if not isinstance(nvme_aspm, int): if not isinstance(nvme_aspm, int):
binascii.unhexlify(nvme_aspm) nvme_aspm = int.from_bytes(nvme_aspm, byteorder='little')
nvme_aspm = self.hexswap(nvme_aspm)
nvme_aspm = int(nvme_aspm, 16)
nvme_aspm = (nvme_aspm & (~3)) | 2 nvme_aspm = (nvme_aspm & (~3)) | 2
#nvme_aspm &= ~1 # Turn off bit 1
#nvme_aspm |= 2 # Turn on bit 2
self.config["#Revision"][f"Hardware-NVMe-{x}"] = f'{nvme_vendor}:{nvme_device}' self.config["#Revision"][f"Hardware-NVMe-{x}"] = f'{nvme_vendor}:{nvme_device}'
try: try:
nvme_path = DeviceProbe.pci_probe().deviceproperty_probe(nvme_vendor, nvme_device, nvme_acpi) nvme_path = DeviceProbe.pci_probe().deviceproperty_probe(nvme_vendor, nvme_device, nvme_acpi)
@@ -174,9 +174,9 @@ class BuildOpenCore:
self.enable_kext("NVMeFix.kext", self.constants.nvmefix_version, self.constants.nvmefix_path) self.enable_kext("NVMeFix.kext", self.constants.nvmefix_version, self.constants.nvmefix_path)
x = x + 1 x = x + 1
except ValueError: except ValueError:
print("- No 3rd Party NVMe drive found") print("- No 3rd Party NVMe drive found(V)")
except IndexError: except IndexError:
print("- No 3rd Party NVMe drive found") print("- No 3rd Party NVMe drive found(I)")
def wifi_fake_id(self): def wifi_fake_id(self):
default_path = True default_path = True
@@ -405,7 +405,7 @@ class BuildOpenCore:
nvidia_patch(self, self.gfx0_path) nvidia_patch(self, self.gfx0_path)
else: else:
print("- Failed to find vendor") print("- Failed to find vendor")
elif not self.constants.custom_model: elif not self.constants.custom_model and self.model in ModelArray.LegacyGPU:
dgpu_vendor,dgpu_device,dgpu_acpi = DeviceProbe.pci_probe().gpu_probe("GFX0") dgpu_vendor,dgpu_device,dgpu_acpi = DeviceProbe.pci_probe().gpu_probe("GFX0")
if dgpu_vendor: if dgpu_vendor:
print(f"- Detected dGPU: {dgpu_vendor}:{dgpu_device}") print(f"- Detected dGPU: {dgpu_vendor}:{dgpu_device}")