mirror of
https://github.com/dortania/OpenCore-Legacy-Patcher.git
synced 2026-06-18 21:30:00 +10:00
Add NVMe Enhanced Power Management configuration
Closes https://github.com/dortania/OpenCore-Legacy-Patcher/issues/921
This commit is contained in:
+2
-5
@@ -227,7 +227,7 @@ class BuildOpenCore:
|
||||
if not self.computer.storage:
|
||||
print("- No PCIe Storage Controllers found to fix")
|
||||
|
||||
if not self.constants.custom_model:
|
||||
if not self.constants.custom_model and self.constants.allow_nvme_fixing is True:
|
||||
nvme_devices = [i for i in self.computer.storage if isinstance(i, device_probe.NVMeController)]
|
||||
for i, controller in enumerate(nvme_devices):
|
||||
print(f"- Found 3rd Party NVMe SSD ({i + 1}): {utilities.friendly_hex(controller.vendor_id)}:{utilities.friendly_hex(controller.device_id)}")
|
||||
@@ -245,11 +245,8 @@ class BuildOpenCore:
|
||||
print("- Falling back to -nvmefaspm")
|
||||
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " -nvmefaspm"
|
||||
|
||||
if (controller.vendor_id != 0x144D and controller.device_id != 0xA804 and self.model not in ["MacBookPro13,3", "MacBookPro14,3"]):
|
||||
if (controller.vendor_id != 0x144D and controller.device_id != 0xA804):
|
||||
# Avoid injecting NVMeFix when a native Apple NVMe drive is present
|
||||
# Note on 2016-2017 MacBook Pros, 15" devices used a stock Samsung SSD with IONVMeController
|
||||
# Technically this should be patched based on NVMeFix.kext logic,
|
||||
# however Apple deemed the SSD unsupported for enhanced performance
|
||||
# https://github.com/acidanthera/NVMeFix/blob/1.0.9/NVMeFix/NVMeFix.cpp#L220-L225
|
||||
if self.get_kext_by_bundle_path("NVMeFix.kext")["Enabled"] is False:
|
||||
self.enable_kext("NVMeFix.kext", self.constants.nvmefix_version, self.constants.nvmefix_path)
|
||||
|
||||
+31
-3
@@ -467,6 +467,33 @@ OpenCore will enable NVMe support in it's picker
|
||||
else:
|
||||
self.allow_nvme()
|
||||
|
||||
def allow_nvme_pwr_mgmt(self):
|
||||
utilities.cls()
|
||||
utilities.header(["Allow NVMe Power Management Adjustments"])
|
||||
print(
|
||||
"""
|
||||
For machines with upgraded NVMe drives, this
|
||||
option allows for better power management support
|
||||
within macOS.
|
||||
|
||||
Note that some NVMe drives don't support macOS's
|
||||
power management settings, and can result in boot
|
||||
issues. Disable this option if you experience
|
||||
IONVMeFamily kernel panics. Mainly applicable for
|
||||
Skylake and newer Macs.
|
||||
"""
|
||||
)
|
||||
|
||||
change_menu = input("Enable NVMe Power Management?(y/n/q): ")
|
||||
if change_menu in {"y", "Y", "yes", "Yes"}:
|
||||
self.constants.allow_nvme_fixing = True
|
||||
elif change_menu in {"n", "N", "no", "No"}:
|
||||
self.constants.allow_nvme_fixing = False
|
||||
elif change_menu in {"q", "Q", "Quit", "quit"}:
|
||||
print("Returning to previous menu")
|
||||
else:
|
||||
self.allow_nvme()
|
||||
|
||||
def allow_xhci(self):
|
||||
utilities.cls()
|
||||
utilities.header(["Allow NVMe UEFI Support"])
|
||||
@@ -1174,9 +1201,10 @@ system_profiler SPHardwareDataType | grep 'Model Identifier'
|
||||
title = ["Adjust Bootable Volume Settings"]
|
||||
menu = utilities.TUIMenu(title, "Please select an option: ", auto_number=True, top_level=True)
|
||||
options = [
|
||||
[f"Set FireWire Boot:\tCurrently {self.constants.firewire_boot}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).allow_firewire],
|
||||
[f"Set NVMe Boot:\tCurrently {self.constants.nvme_boot}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).allow_nvme],
|
||||
[f"Set XHCI Boot:\tCurrently {self.constants.xhci_boot}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).allow_xhci],
|
||||
[f"Set FireWire Boot:\t\tCurrently {self.constants.firewire_boot}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).allow_firewire],
|
||||
[f"Set XHCI Boot:\t\tCurrently {self.constants.xhci_boot}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).allow_xhci],
|
||||
[f"Set NVMe Boot:\t\tCurrently {self.constants.nvme_boot}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).allow_nvme],
|
||||
[f"Set NVMe Power Management:\tCurrently {self.constants.allow_nvme_fixing}", MenuOptions(self.constants.custom_model or self.constants.computer.real_model, self.constants).allow_nvme_pwr_mgmt],
|
||||
]
|
||||
|
||||
for option in options:
|
||||
|
||||
@@ -184,6 +184,7 @@ class Constants:
|
||||
self.disable_connectdrivers = False # Disable ConnectDrivers (hibernation)
|
||||
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.legacy_accel_support = [
|
||||
os_data.os_data.mojave,
|
||||
|
||||
@@ -116,6 +116,15 @@ class generate_defaults:
|
||||
settings.fu_arguments = " -disable_sidecar_mac"
|
||||
else:
|
||||
settings.fu_arguments = None
|
||||
if smbios_data.smbios_dictionary[model]["CPU Generation"] >= cpu_data.cpu_data.skylake.value:
|
||||
# On 2016-2017 MacBook Pros, 15" devices used a stock Samsung SSD with IONVMeController
|
||||
# Technically this should be patched based on NVMeFix.kext logic,
|
||||
# however Apple deemed the SSD unsupported for enhanced performance
|
||||
# In addition, some upgraded NVMe drives still have issues with enhanced power management
|
||||
# Safest to disable by default, allow user to configure afterwards
|
||||
settings.allow_nvme_fixing = False
|
||||
else:
|
||||
settings.allow_nvme_fixing = True
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user