diff --git a/CHANGELOG.md b/CHANGELOG.md index a8537ce2c..3cebdb4fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # OpenCore Legacy Patcher changelog ## 0.1.6 +- Add XHCI UEFI Driver for 3rd Party USB 3.0 Controllers + - Allows for Boot Support from OpenCore' Picker ## 0.1.5 - Fix crashing when Wireless module not present diff --git a/Resources/Build.py b/Resources/Build.py index de6843a11..76fb303f7 100644 --- a/Resources/Build.py +++ b/Resources/Build.py @@ -476,6 +476,21 @@ class BuildOpenCore: print("- Adding Mac Pro, Xserve DRM patches") self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " shikigva=128 unfairgva=1 -wegtree" + # Add XhciDxe if firmware doesn't have XHCI controller support and XCHI controller detected + if self.model not in ModelArray.XhciSupport and not self.constants.custom_model: + devices = plistlib.loads(subprocess.run("ioreg -c IOPCIDevice -r -d2 -a".split(), stdout=subprocess.PIPE).stdout.decode().strip().encode()) + try: + devices = [i for i in devices if i["class-code"] == binascii.unhexlify(self.constants.classcode_xhci)] + vendor_id = self.hexswap(binascii.hexlify(devices[0]["vendor-id"]).decode()[:4]) + device_id = self.hexswap(binascii.hexlify(devices[0]["device-id"]).decode()[:4]) + print("- Found XHCI Controller, adding Boot Support") + shutil.copy(self.constants.xhci_driver_path, self.constants.drivers_path) + self.config["UEFI"]["Drivers"] += ["XhciDxe.efi"] + except ValueError: + print("- No XHCI Controller Found (V)") + except IndexError: + print("- No XHCI Controller Found (I)") + # Add OpenCanopy print("- Adding OpenCanopy GUI") shutil.rmtree(self.constants.resources_path, onerror=rmtree_handler) diff --git a/Resources/Constants.py b/Resources/Constants.py index cb4db447b..8f7370e03 100644 --- a/Resources/Constants.py +++ b/Resources/Constants.py @@ -111,6 +111,7 @@ class Constants: self.classcode_wifi = "00800200" self.classcode_gpu = "00000300" self.classcode_gpu_variant = "00800300" + self.classcode_xhci = "30030C00" # Nvidia GPU Architecture self.arch_tesla = "NV50" @@ -138,6 +139,8 @@ class Constants: def nvme_driver_path(self): return self.payload_path / Path("Drivers/NvmExpressDxe.efi") @property def exfat_legacy_driver_path(self): return self.payload_path / Path("Drivers/ExFatDxeLegacy.efi") + @property + def xhci_driver_path(self): return self.payload_path / Path("Drivers/XhciDxe.efi") # Kexts @property diff --git a/Resources/DeviceProbe.py b/Resources/DeviceProbe.py index f401d81ee..fab8d4b7b 100644 --- a/Resources/DeviceProbe.py +++ b/Resources/DeviceProbe.py @@ -47,6 +47,7 @@ class pci_probe: # IOACPIPlane:/_SB/PCI0@0/P0P2@10000 -> /PCI0@0/P0P2@1 acpi_path = acpi_path_full.replace("IOACPIPlane:/_SB", "") acpi_path = acpi_path.replace("0000", "") + acpi_path = acpi_path.replace("0001", "") acpi_path = acpi_path.replace("ffff", "0") acpi_path = acpi_path.upper() return acpi_path diff --git a/Resources/ModelArray.py b/Resources/ModelArray.py index 37c5a6064..481c8f7da 100644 --- a/Resources/ModelArray.py +++ b/Resources/ModelArray.py @@ -442,6 +442,39 @@ NVMePatch = [ "Dortania1,1" ] +XhciSupport = [ + "MacBookAir5,1", + "MacBookAir5,2", + "MacBookAir6,1", + "MacBookAir6,2", + "MacBookAir7,1", + "MacBookAir7,2", + "MacBookPro9,1", + "MacBookPro9,2", + "MacBookPro10,1", + "MacBookPro10,2", + "MacBookPro11,1", + "MacBookPro11,2", + "MacBookPro11,3", + "MacBookPro11,4", + "MacBookPro11,5", + "MacBookPro12,1", + "Macmini6,1", + "Macmini6,2", + "Macmini7,1", + "iMac13,1", + "iMac13,2", + "iMac13,3", + "iMac14,1", + "iMac14,2", + "iMac14,3", + "iMac15,1", + "iMac16,1", + "iMac16,2", + "MacPro6,1", + "Dortania1,1" +] + SidecarPatch = [ "MacBook8,1", "MacBookAir5,1", diff --git a/payloads/Drivers/XhciDxe.efi b/payloads/Drivers/XhciDxe.efi new file mode 100644 index 000000000..802838f9b Binary files /dev/null and b/payloads/Drivers/XhciDxe.efi differ