Skip to content

Commit 0a0a59f

Browse files
committed
Fix NVMe properties applying with OC installed
Closes #212
1 parent 75200e9 commit 0a0a59f

File tree

3 files changed

+33
-15
lines changed

3 files changed

+33
-15
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
- Fix iMac7,1 audio support
1616
- Work-around Bluetooth Kernel Panic on Apple's Bluetooth 2.0 Controllers (USB 05AC:8206)
1717
- Affects iMac7,1 and MacPro3,1
18+
- Fix iMac external display support
19+
- Fix NVMe properties not applying when OpenCore is installed
1820

1921
## 0.1.2
2022
- Fix IDE support on 2008 era MacBooks, iMacs and Xserves

OpenCore-Patcher.command

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,34 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
103103
[f"Enable Verbose Mode:\t\tCurrently {self.constants.verbose_debug}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_verbose],
104104
[f"Enable OpenCore DEBUG:\t\tCurrently {self.constants.opencore_debug}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_oc],
105105
[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],
106-
[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],
107-
[f"Assume Upgraded Wifi Always:\tCurrently {self.constants.wifi_build}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_wifi],
108106
[f"Set ShowPicker Mode:\t\tCurrently {self.constants.showpicker}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_showpicker],
109107
[f"Set Vault Mode:\t\t\tCurrently {self.constants.vault}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_vault],
110108
[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],
109+
[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],
110+
[f"Advanced Patch Settings, for developers only", self.advanced_patcher_settings],
111+
]
112+
113+
for option in options:
114+
menu.add_menu_option(option[0], function=option[1])
115+
116+
response = menu.start()
117+
118+
def advanced_patcher_settings(self):
119+
response = None
120+
while not (response and response == -1):
121+
title = [
122+
"Adjust Advanced Patcher Settings, for developers ONLY"
123+
]
124+
menu = Utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
125+
options = [
126+
[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],
127+
[f"Assume Upgraded Wifi Always:\tCurrently {self.constants.wifi_build}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).change_wifi],
111128
[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],
112129
[f"DRM Preferences:\t\t\tCurrently {self.constants.drm_support}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).drm_setting],
113-
[f"Set Generic Bootstrap:\t\t{self.constants.boot_efi}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).bootstrap_setting],
114-
[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],
115-
[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],
116-
[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],
117-
[f"Disable CPU Friend:\t\t{self.constants.disallow_cpufriend}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).disable_cpufriend],
130+
[f"Set Generic Bootstrap:\t\tCurrently {self.constants.boot_efi}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).bootstrap_setting],
131+
[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],
132+
#[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],
133+
[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],
118134
[f"Set Custom name {self.constants.custom_cpu_model_value}", CliMenu.MenuOptions(self.constants.custom_model or self.current_model, self.constants).custom_cpu],
119135
]
120136

Resources/Build.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ def build_efi(self):
131131
self.enable_kext("Innie.kext", self.constants.innie_version, self.constants.innie_path)
132132
x = x + 1
133133
except ValueError:
134-
print("- No PCIe Storage Controllers found to fix")
134+
print("- No PCIe Storage Controllers found to fix(V)")
135135
except IndexError:
136-
print("- No PCIe Storage Controllers found to fix")
136+
print("- No PCIe Storage Controllers found to fix(I)")
137137

138138
if not self.constants.custom_model:
139139
nvme_devices = plistlib.loads(subprocess.run("ioreg -c IOPCIDevice -r -d2 -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode())
@@ -153,10 +153,10 @@ def build_efi(self):
153153
nvme_acpi = ""
154154
# Disable Bit 0 (L0s), enable Bit 1 (L1)
155155
if not isinstance(nvme_aspm, int):
156-
binascii.unhexlify(nvme_aspm)
157-
nvme_aspm = self.hexswap(nvme_aspm)
158-
nvme_aspm = int(nvme_aspm, 16)
156+
nvme_aspm = int.from_bytes(nvme_aspm, byteorder='little')
159157
nvme_aspm = (nvme_aspm & (~3)) | 2
158+
#nvme_aspm &= ~1 # Turn off bit 1
159+
#nvme_aspm |= 2 # Turn on bit 2
160160
self.config["#Revision"][f"Hardware-NVMe-{x}"] = f'{nvme_vendor}:{nvme_device}'
161161
try:
162162
nvme_path = DeviceProbe.pci_probe().deviceproperty_probe(nvme_vendor, nvme_device, nvme_acpi)
@@ -174,9 +174,9 @@ def build_efi(self):
174174
self.enable_kext("NVMeFix.kext", self.constants.nvmefix_version, self.constants.nvmefix_path)
175175
x = x + 1
176176
except ValueError:
177-
print("- No 3rd Party NVMe drive found")
177+
print("- No 3rd Party NVMe drive found(V)")
178178
except IndexError:
179-
print("- No 3rd Party NVMe drive found")
179+
print("- No 3rd Party NVMe drive found(I)")
180180

181181
def wifi_fake_id(self):
182182
default_path = True
@@ -405,7 +405,7 @@ def amd_patch(self, backlight_path):
405405
nvidia_patch(self, self.gfx0_path)
406406
else:
407407
print("- Failed to find vendor")
408-
elif not self.constants.custom_model:
408+
elif not self.constants.custom_model and self.model in ModelArray.LegacyGPU:
409409
dgpu_vendor,dgpu_device,dgpu_acpi = DeviceProbe.pci_probe().gpu_probe("GFX0")
410410
if dgpu_vendor:
411411
print(f"- Detected dGPU: {dgpu_vendor}:{dgpu_device}")

0 commit comments

Comments
 (0)