diff --git a/CHANGELOG.md b/CHANGELOG.md index 0eb6a07b54..8a362f9d39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ - Removes Gatekeeper "verifying" prompt on first launch after PKG installation - Note `gktool` is only available on macOS Sonoma and newer - Resolve unpatching crash edge case when host doesn't require patches. +- Add [TeraScaleFixup](https://github.com/Jazzzny/TeraScaleFixup) (Jazzzny) + - Provides support for non-natively supported AMD TeraScale 1 GPUs ## 1.5.0 - Restructure project directories diff --git a/README.md b/README.md index f53dfe3e43..0162f11d27 100644 --- a/README.md +++ b/README.md @@ -101,6 +101,7 @@ To run the project from source, see here: [Build and run from source](./SOURCE.m * Non-Metal Photo Booth Patch for Monterey+ * GUI and Backend Development * Vaulting implementation + * [TeraScaleFixup](https://github.com/Jazzzny/TeraScaleFixup) * Amazing users who've graciously donate hardware: * [JohnD](https://forums.macrumors.com/members/johnd.53633/) - 2013 Mac Pro * [SpiGAndromeda](https://github.com/SpiGAndromeda) - AMD Vega 64 diff --git a/opencore_legacy_patcher/constants.py b/opencore_legacy_patcher/constants.py index c4a499a43b..856b913420 100644 --- a/opencore_legacy_patcher/constants.py +++ b/opencore_legacy_patcher/constants.py @@ -123,7 +123,8 @@ def __init__(self) -> None: self.kdkless_version: str = "1.0.0" ## Jazzzny - self.legacy_keyboard: str = "1.0.0" # LegacyKeyboardInjector - Jazzzny + self.legacy_keyboard_version: str = "1.0.0" # LegacyKeyboardInjector + self.terascalefixup_version: str = "1.0.0" # TeraScaleFixup # Get resource path self.current_path: Path = Path(__file__).parent.parent.resolve() @@ -593,7 +594,11 @@ def apple_isight_path(self): @property def legacy_keyboard_path(self): - return self.payload_kexts_path / Path(f"Misc/LegacyKeyboardInjector-v{self.legacy_keyboard}.zip") + return self.payload_kexts_path / Path(f"Jazzzny/LegacyKeyboardInjector-v{self.legacy_keyboard_version}.zip") + + @property + def terascalefixup_path(self): + return self.payload_kexts_path / Path(f"Jazzzny/TeraScaleFixup-v{self.terascalefixup_version}-{self.kext_variant}.zip") @property def apple_raid_path(self): diff --git a/opencore_legacy_patcher/datasets/example_data.py b/opencore_legacy_patcher/datasets/example_data.py index d0a6dea874..bcfcc0fa28 100644 --- a/opencore_legacy_patcher/datasets/example_data.py +++ b/opencore_legacy_patcher/datasets/example_data.py @@ -679,6 +679,30 @@ class MacPro: opencore_version="REL-071-2021-07-02" ) + MacPro41_51__TeraScaleFixup_AMD = device_probe.Computer( + # 4,1 flashed to 5,1, HD 4890, BCM94360CD, WD SN750 NVMe + real_model="MacPro5,1", + real_board_id="Mac-F221BEC8", + reported_model="MacPro5,1", + reported_board_id="Mac-F221BEC8", + gpus=[device_probe.AMD(vendor_id=4098, device_id=37984, class_code=196608, name="GFX0", model="ATI Radeon HD 4890", pci_path="PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)")], + igpu=None, + dgpu=device_probe.AMD(vendor_id=4098, device_id=37984, class_code=196608, name="GFX0", model="ATI Radeon HD 4890", pci_path="PciRoot(0x0)/Pci(0x3,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)/Pci(0x0,0x0)"), + storage=[ + device_probe.SATAController(vendor_id=32902, device_id=14882, class_code=67073, name="SATA", model=None, pci_path="PciRoot(0x0)/Pci(0x1f,0x2)"), + device_probe.NVMeController(vendor_id=5559, device_id=20482, class_code=67586, name="PXS3", model=None, pci_path="PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)/Pci(0x2,0x0)/Pci(0x0,0x0)", aspm=2) + ], + + wifi=device_probe.Broadcom(vendor_id=5348, device_id=17312, class_code=163840, name="PXS4", model=None, pci_path="PciRoot(0x0)/Pci(0x1,0x0)/Pci(0x0,0x0)/Pci(0x4,0x0)/Pci(0x0,0x0)"), + cpu=device_probe.CPU( + name="Intel(R) Xeon(R) CPU X5670 @ 2.93GHz", + flags=["FPU", "VME", "DE", "PSE", "TSC", "MSR", "PAE", "MCE", "CX8", "APIC", "SEP", "MTRR", "PGE", "MCA", "CMOV", "PAT", "PSE36", "CLFSH", "DS", "ACPI", "MMX", "FXSR", "SSE", "SSE2", "SS", "HTT", "TM", "PBE", "SSE3", "PCLMULQDQ", "DTES64", "MON", "DSCPL", "VMX", "SMX", "EST", "TM2", "SSSE3", "CX16", "TPR", "PDCM", "SSE4.1", "SSE4.2", "POPCNT", "AES", "PCID"], + leafs=[], + ), + oclp_version="0.2.5", + opencore_version="REL-071-2021-07-02" + ) + MacPro41_51_Flashed_NVIDIA_WEB_DRIVERS = device_probe.Computer( real_model='MacPro5,1', real_board_id='Mac-F221BEC8', diff --git a/opencore_legacy_patcher/datasets/pci_data.py b/opencore_legacy_patcher/datasets/pci_data.py index 35f5585adb..4087ea9e92 100644 --- a/opencore_legacy_patcher/datasets/pci_data.py +++ b/opencore_legacy_patcher/datasets/pci_data.py @@ -964,21 +964,36 @@ class amd_ids: 0x9591, # HD 3650 (mobile) 0x9593, # HD 3670 (mobile) 0x9440, # HD 4870 - 0x9442, # HD 4850 + # 0x9442, # HD 4850 - This ID is present in AMDLegacySupport but not anywhere else 0x944A, # HD 4850 (mobile) 0x945A, # HD 4870 (mobile) 0x9490, # HD 4670 0x949E, # FirePro V5700 0x9480, # HD 4650/5165 (mobile) - 0x9540, # HD 4550 + # 0x9540, # HD 4550 - This ID is present in AMDLegacySupport but not anywhere else 0x9541, # Unknown 0x954E, # Unknown - 0x954F, # HD 4350/4550 + # 0x954F, # HD 4350/4550 - This ID is present in AMDLegacySupport but not anywhere else 0x9552, # HD 4330/4350/4550 (mobile) - 0x9553, # HD 4530/4570/545v (mobile) + # 0x9553, # HD 4530/4570/545v (mobile) - This ID is present in AMDLegacySupport but not anywhere else 0x94A0, # HD 4830 ] + # Not natively supported by ATIRadeonX2000, uses https://github.com/Jazzzny/TeraScaleFixup + terascale1_terascalefixup_ids = [ + 0x9498, # HD 4650 + 0x9540, # HD 4550 + 0x954F, # HD 4350/4550 + 0x9553, # HD 4530/4570/545v (mobile) + 0x9442, # HD 4850 + 0x9441, # HD 4870 X2 + 0x9443, # HD 4850 X2 + 0x944C, # HD 4830 + 0x9460, # HD 4890 + 0x9462, # HD 4860 + 0x94B3, # HD 4770 + ] + terascale_2_ids = [ 0x6738, # HD 6870 0x6739, # HD 6850 diff --git a/opencore_legacy_patcher/datasets/sys_patch_dict.py b/opencore_legacy_patcher/datasets/sys_patch_dict.py index 25bad6182b..280bee5dce 100644 --- a/opencore_legacy_patcher/datasets/sys_patch_dict.py +++ b/opencore_legacy_patcher/datasets/sys_patch_dict.py @@ -791,7 +791,7 @@ def _generate_sys_patch_dict(self): "AMD3800Controller.kext": "10.13.6", "AMD4600Controller.kext": "10.13.6", "AMD4800Controller.kext": "10.13.6", - "ATIRadeonX2000.kext": "10.13.6" if self.os_major < os_data.os_data.ventura else "10.13.6 TS1", + "ATIRadeonX2000.kext": "10.13.6", # if self.os_major < os_data.os_data.ventura else "10.13.6 TS1", "ATIRadeonX2000GA.plugin": "10.13.6", "ATIRadeonX2000GLDriver.bundle": "10.13.6", "ATIRadeonX2000VADriver.bundle": "10.13.6", diff --git a/opencore_legacy_patcher/detections/device_probe.py b/opencore_legacy_patcher/detections/device_probe.py index b17f1b36a4..5884867756 100644 --- a/opencore_legacy_patcher/detections/device_probe.py +++ b/opencore_legacy_patcher/detections/device_probe.py @@ -415,6 +415,8 @@ def detect_arch(self): self.arch = AMD.Archs.Legacy_GCN_9000 elif self.device_id in pci_data.amd_ids.terascale_1_ids: self.arch = AMD.Archs.TeraScale_1 + elif self.device_id in pci_data.amd_ids.terascale1_terascalefixup_ids: + self.arch = AMD.Archs.TeraScale_1 elif self.device_id in pci_data.amd_ids.terascale_2_ids: self.arch = AMD.Archs.TeraScale_2 elif self.device_id in pci_data.amd_ids.polaris_ids: diff --git a/opencore_legacy_patcher/efi_builder/graphics_audio.py b/opencore_legacy_patcher/efi_builder/graphics_audio.py index dce88af682..0320eed2f8 100644 --- a/opencore_legacy_patcher/efi_builder/graphics_audio.py +++ b/opencore_legacy_patcher/efi_builder/graphics_audio.py @@ -20,7 +20,8 @@ model_array, os_data, cpu_data, - video_bios_data + video_bios_data, + pci_data ) @@ -111,7 +112,7 @@ def _graphics_handling(self) -> None: if not support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("WhateverGreen.kext")["Enabled"] is True: support.BuildSupport(self.model, self.constants, self.config).enable_kext("WhateverGreen.kext", self.constants.whatevergreen_version, self.constants.whatevergreen_path) - # Web Driver specific + # Web Driver and TeraScaleFixup if not self.constants.custom_model: for i, device in enumerate(self.computer.gpus): if isinstance(device, device_probe.NVIDIA): @@ -137,6 +138,12 @@ def _graphics_handling(self) -> None: if "nvda_drv" not in self.config["NVRAM"]["Delete"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]: self.config["NVRAM"]["Delete"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"] += ["nvda_drv"] + if isinstance(device, device_probe.AMD): + if device.device_id in pci_data.amd_ids.terascale1_terascalefixup_ids: + logging.info(f"- Enabling TeraScaleFixup for GPU ({i + 1}): {utilities.friendly_hex(device.vendor_id)}:{utilities.friendly_hex(device.device_id)}") + support.BuildSupport(self.model, self.constants, self.config).enable_kext("TeraScaleFixup.kext", self.constants.terascalefixup_version, self.constants.terascalefixup_path) + + def _backlight_path_detection(self) -> None: """ iMac MXM dGPU Backlight DevicePath Detection diff --git a/opencore_legacy_patcher/efi_builder/misc.py b/opencore_legacy_patcher/efi_builder/misc.py index 2334fff497..1d2220cadb 100644 --- a/opencore_legacy_patcher/efi_builder/misc.py +++ b/opencore_legacy_patcher/efi_builder/misc.py @@ -210,7 +210,7 @@ def _topcase_handling(self) -> None: support.BuildSupport(self.model, self.constants, self.config).get_kext_by_bundle_path("AppleUSBTopCase.kext/Contents/PlugIns/AppleUSBTCKeyEventDriver.kext")["Enabled"] = True if self.computer.internal_keyboard_type == "Legacy": - support.BuildSupport(self.model, self.constants, self.config).enable_kext("LegacyKeyboardInjector.kext", self.constants.legacy_keyboard, self.constants.legacy_keyboard_path) + support.BuildSupport(self.model, self.constants, self.config).enable_kext("LegacyKeyboardInjector.kext", self.constants.legacy_keyboard_version, self.constants.legacy_keyboard_path) if self.computer.trackpad_type == "Legacy": support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleUSBTrackpad.kext", self.constants.apple_trackpad, self.constants.apple_trackpad_path) elif self.computer.trackpad_type == "Modern": @@ -232,7 +232,7 @@ def _topcase_handling(self) -> None: # Two-finger Top Case support for macOS High Sierra+ if self.model == "MacBook5,2": support.BuildSupport(self.model, self.constants, self.config).enable_kext("AppleUSBTrackpad.kext", self.constants.apple_trackpad, self.constants.apple_trackpad_path) # Also requires AppleUSBTopCase.kext - support.BuildSupport(self.model, self.constants, self.config).enable_kext("LegacyKeyboardInjector.kext", self.constants.legacy_keyboard, self.constants.legacy_keyboard_path) # Inject legacy personalities into AppleUSBTCKeyboard and AppleUSBTCKeyEventDriver + support.BuildSupport(self.model, self.constants, self.config).enable_kext("LegacyKeyboardInjector.kext", self.constants.legacy_keyboard_version, self.constants.legacy_keyboard_path) # Inject legacy personalities into AppleUSBTCKeyboard and AppleUSBTCKeyEventDriver def _thunderbolt_handling(self) -> None: diff --git a/opencore_legacy_patcher/support/validation.py b/opencore_legacy_patcher/support/validation.py index ead7b08079..1fa8284f04 100644 --- a/opencore_legacy_patcher/support/validation.py +++ b/opencore_legacy_patcher/support/validation.py @@ -60,6 +60,7 @@ def __init__(self, global_constants: constants.Constants, verify_unused_files: b example_data.MacPro.MacPro41_Modern_AMD, example_data.MacPro.MacPro41_51__Flashed_Modern_AMD, example_data.MacPro.MacPro41_51_Flashed_NVIDIA_WEB_DRIVERS, + example_data.MacPro.MacPro41_51__TeraScaleFixup_AMD, ] self.valid_dumps_native = [ diff --git a/opencore_legacy_patcher/sys_patch/sys_patch_detect.py b/opencore_legacy_patcher/sys_patch/sys_patch_detect.py index abdbe43258..34d5dc7434 100644 --- a/opencore_legacy_patcher/sys_patch/sys_patch_detect.py +++ b/opencore_legacy_patcher/sys_patch/sys_patch_detect.py @@ -25,7 +25,8 @@ model_array, os_data, sip_data, - smbios_data + smbios_data, + pci_data ) @@ -87,11 +88,12 @@ def __init__(self, model: str, global_constants: constants.Constants, self.legacy_t1_chip = False # Patch Requirements - self.amfi_must_disable = False - self.amfi_shim_bins = False - self.supports_metal = False - self.needs_nv_web_checks = False - self.requires_root_kc = False + self.amfi_must_disable = False + self.amfi_shim_bins = False + self.supports_metal = False + self.needs_nv_web_checks = False + self.requires_root_kc = False + self.needs_terascalefixup = False # Validation Checks self.sip_enabled = False @@ -167,6 +169,8 @@ def _detect_gpus(self): if os_data.os_data.ventura in self.constants.legacy_accel_support: self.amfi_shim_bins = True self.requires_root_kc = True + if gpu.device_id in pci_data.amd_ids.terascale1_terascalefixup_ids: + self.needs_terascalefixup = True elif gpu.arch == device_probe.AMD.Archs.TeraScale_2: if self.os_major > non_metal_os: self.amd_ts2 = True @@ -475,6 +479,16 @@ def _check_os_compat(self) -> bool: return False return True + def _check_terascalefixup(self): + """ + Query whether TeraScaleFixup.kext is loaded + + Returns: + bool: True if loaded, False otherwise + """ + + return utilities.check_kext_loaded("com.jazzzny.terascalefixup") + def _check_kdk(self): """ @@ -669,6 +683,7 @@ def detect_patch_set(self): f"Validation: {'AMFI' if self.constants.host_is_hackintosh is True or self._get_amfi_level_needed() > 2 else 'Library Validation'} is enabled": self.amfi_enabled if self.amfi_must_disable is True else False, "Validation: FileVault is enabled": self.fv_enabled, "Validation: System is dosdude1 patched": self.dosdude_patched, + #"Validation: TeraScaleFixup.kext missing": self.missing_terascalefixup if self.needs_terascalefixup is True else False, "Validation: WhateverGreen.kext missing": self.missing_whatever_green if self.nvidia_web is True else False, "Validation: Force OpenGL property missing": self.missing_nv_web_opengl if self.nvidia_web is True else False, "Validation: Force compat property missing": self.missing_nv_compat if self.nvidia_web is True else False, @@ -734,6 +749,9 @@ def verify_patch_allowed(self, print_errors: bool = False): self.missing_nv_compat = not self._check_nv_compat() self.missing_whatever_green = not self._check_whatevergreen() + if self.needs_terascalefixup is True: + self.missing_terascalefixup = not self._check_terascalefixup() + if print_errors is True: if self.sip_enabled is True: logging.info("\nCannot patch! Please disable System Integrity Protection (SIP).") @@ -777,6 +795,11 @@ def verify_patch_allowed(self, print_errors: bool = False): logging.info("\nCannot patch! WhateverGreen.kext missing") logging.info("Please ensure WhateverGreen.kext is installed") + #if self.needs_terascalefixup is True: + # if self.missing_terascalefixup is True: + # logging.info("\nCannot patch! TeraScaleFixup.kext missing") + # logging.info("Please ensure TeraScaleFixup.kext is installed") + if (not self.has_network) if (self.requires_root_kc and self.missing_kdk and self.os_major >= os_data.os_data.ventura.value) else False: logging.info("\nCannot patch! Network Connection Required") logging.info("Please ensure you have an active internet connection") diff --git a/payloads/Config/config.plist b/payloads/Config/config.plist index 0058125311..55e3032b54 100644 --- a/payloads/Config/config.plist +++ b/payloads/Config/config.plist @@ -473,6 +473,24 @@ PlistPath Contents/Info.plist + + Arch + x86_64 + Comment + Non-native TeraScale GPU Patching + Enabled + + MaxKernel + + MinKernel + 10.0.0 + BundlePath + TeraScaleFixup.kext + ExecutablePath + Contents/MacOS/TeraScaleFixup + PlistPath + Contents/Info.plist + Arch x86_64 diff --git a/payloads/Kexts/Misc/LegacyKeyboardInjector-v1.0.0.zip b/payloads/Kexts/Jazzzny/LegacyKeyboardInjector-v1.0.0.zip similarity index 100% rename from payloads/Kexts/Misc/LegacyKeyboardInjector-v1.0.0.zip rename to payloads/Kexts/Jazzzny/LegacyKeyboardInjector-v1.0.0.zip diff --git a/payloads/Kexts/Jazzzny/TeraScaleFixup-v1.0.0-DEBUG.zip b/payloads/Kexts/Jazzzny/TeraScaleFixup-v1.0.0-DEBUG.zip new file mode 100644 index 0000000000..ad571c3bb9 Binary files /dev/null and b/payloads/Kexts/Jazzzny/TeraScaleFixup-v1.0.0-DEBUG.zip differ diff --git a/payloads/Kexts/Jazzzny/TeraScaleFixup-v1.0.0-RELEASE.zip b/payloads/Kexts/Jazzzny/TeraScaleFixup-v1.0.0-RELEASE.zip new file mode 100644 index 0000000000..6550d1ba65 Binary files /dev/null and b/payloads/Kexts/Jazzzny/TeraScaleFixup-v1.0.0-RELEASE.zip differ diff --git a/payloads/Kexts/Update-Kexts.command b/payloads/Kexts/Update-Kexts.command index 48d2d8642f..f9508da289 100755 --- a/payloads/Kexts/Update-Kexts.command +++ b/payloads/Kexts/Update-Kexts.command @@ -64,6 +64,13 @@ KEXT_DICTIONARY = { }, }, + "Jazzzny": { + "TeraScaleFixup": { + "Repository": "https://github.com/Jazzzny/TeraScaleFixup", + "Constants Variable": "self.terascalefixup_version", + }, + }, + "Misc": { "Innie": { "Repository": "https://github.com/cdf/Innie",