Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iMac Navi and Lexa additions #1149

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions opencore_legacy_patcher/datasets/video_bios_data.py

Large diffs are not rendered by default.

25 changes: 24 additions & 1 deletion opencore_legacy_patcher/efi_builder/graphics_audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,12 +243,21 @@ def _amd_mxm_patch(self, backlight_path) -> None:
if not self.constants.custom_model:
if self.computer.dgpu.device_id == 0x7340:
logging.info(f"- Adding AMD RX5500XT vBIOS injection")
self.config["DeviceProperties"]["Add"][backlight_path] = {"shikigva": 128, "unfairgva": 1, "agdpmod": "pikera", "rebuild-device-tree": 1, "enable-gva-support": 1, "ATY,bin_image": binascii.unhexlify(video_bios_data.RX5500XT_64K) }
self.config["DeviceProperties"]["Add"][backlight_path] = {"CFG_LINK_FIXED_MAP": 2, "shikigva": 128, "unfairgva": 1, "agdpmod": "pikera", "rebuild-device-tree": 1, "enable-gva-support": 1, "ATY,bin_image": binascii.unhexlify(video_bios_data.RX5500XT_64K) }
logging.info(f"- Adding AMD RX5500XT boot-args")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " agdpmod=pikera applbkl=3"
elif self.computer.dgpu.device_id == 0x73FF:
logging.info(f"- Adding AMD RX6600M vBIOS injection")
self.config["DeviceProperties"]["Add"][backlight_path] = {"model": "AMD Radeon RX6600M", "CFG_LINK_FIXED_MAP": 2, "shikigva": 128, "unfairgva": 1, "agdpmod": "pikera", "rebuild-device-tree": 1, "enable-gva-support": 1, "ATY,bin_image": binascii.unhexlify(video_bios_data.RX6600M_64K) }
logging.info(f"- Adding AMD RX6600M boot-args")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " agdpmod=pikera applbkl=3"
elif self.computer.dgpu.device_id_unspoofed == 0x6981:
logging.info(f"- Adding AMD WX3200 device spoofing")
self.config["DeviceProperties"]["Add"][backlight_path] = {"shikigva": 128, "unfairgva": 1, "agdpmod": "pikera", "rebuild-device-tree": 1, "enable-gva-support": 1, "model": "AMD Radeon Pro WX 3200", "device-id": binascii.unhexlify("FF67")}
elif self.computer.dgpu.device_id_unspoofed == 0x67FF:
# we cannot detect a spoofed Lexa card and have to assume the 0x67FF is such a card and add the spoofing
logging.info(f"- Adding AMD WX3200 device spoofing")
self.config["DeviceProperties"]["Add"][backlight_path] = {"shikigva": 128, "unfairgva": 1, "agdpmod": "pikera", "rebuild-device-tree": 1, "enable-gva-support": 1, "model": "AMD Radeon Pro WX 3200", "device-id": binascii.unhexlify("FF67")}
else:
self.config["DeviceProperties"]["Add"][backlight_path] = {"shikigva": 128, "unfairgva": 1, "agdpmod": "pikera", "rebuild-device-tree": 1, "enable-gva-support": 1}
else:
Expand Down Expand Up @@ -306,13 +315,27 @@ def _amd_mxm_patch(self, backlight_path) -> None:
navi_backlight_path = backlight_path+"/Pci(0x0,0x0)/Pci(0x0,0x0)"
self.config["DeviceProperties"]["Add"][navi_backlight_path] = {
"ATY,bin_image": binascii.unhexlify(video_bios_data.RX5500XT_64K),
"CFG_LINK_FIXED_MAP": 2,
"shikigva": 128,
"unfairgva": 1,
"rebuild-device-tree": 1,
"enable-gva-support": 1
}
logging.info(f"- Adding AMD RX5500XT boot-args")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " agdpmod=pikera applbkl=3"
elif self.constants.imac_model == "Navi23":
logging.info("- Adding Navi Spoofing Patches")
navi_backlight_path = backlight_path+"/Pci(0x0,0x0)/Pci(0x0,0x0)"
self.config["DeviceProperties"]["Add"][navi_backlight_path] = {
"ATY,bin_image": binascii.unhexlify(video_bios_data.RX6600M_64K),
"CFG_LINK_FIXED_MAP": 2,
"shikigva": 128,
"unfairgva": 1,
"rebuild-device-tree": 1,
"enable-gva-support": 1
}
logging.info(f"- Adding AMD RX6600M boot-args")
self.config["NVRAM"]["Add"]["7C436110-AB2A-4BBB-A880-FE41995C9F82"]["boot-args"] += " agdpmod=pikera applbkl=3"


def _audio_handling(self) -> None:
Expand Down
2 changes: 2 additions & 0 deletions opencore_legacy_patcher/sys_patch/patchsets/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
amd_legacy_gcn,
amd_polaris,
amd_vega,
amd_navi,
)
from .hardware.networking import (
legacy_wireless,
Expand Down Expand Up @@ -122,6 +123,7 @@ def __init__(self, constants: constants.Constants,
amd_legacy_gcn.AMDLegacyGCN,
amd_polaris.AMDPolaris,
amd_vega.AMDVega,
amd_navi.AMDNavi,

legacy_wireless.LegacyWireless,
modern_wireless.ModernWireless,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ def _resolve_monterey_framebuffers(self) -> str:
- AppleIntelSKLGraphicsFramebuffer.kext
- AMDRadeonX4000.kext
- AMDRadeonX5000.kext
- AMDRadeonX6000.kext
"""
if self._xnu_major < os_data.sonoma.value:
return "12.5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from ...base import PatchType

from ...shared_patches.monterey_gva import MontereyGVA
from ...shared_patches.monterey_opencl import MontereyOpenCL
from ...shared_patches.amd_opencl import AMDOpenCL

Expand Down Expand Up @@ -73,16 +74,19 @@ def _model_specific_patches(self) -> dict:
"""
return {
"AMD Navi": {
PatchType.OVERWRITE_SYSTEM_VOLUME: {
"AMDRadeonX6000.kext": self._resolve_monterey_framebuffers(),
"AMDRadeonX6000Framebuffer.kext": "12.5",
PatchType.OVERWRITE_SYSTEM_VOLUME: {
"/System/Library/Extensions": {
"AMDRadeonX6000.kext": self._resolve_monterey_framebuffers(),
"AMDRadeonX6000Framebuffer.kext": "12.5",

"AMDRadeonVADriver2.bundle": "12.5",
"AMDRadeonX6000GLDriver.bundle": "12.5",
"AMDRadeonX6000MTLDriver.bundle": "12.5" if self._xnu_major < os_data.sequoia else "12.5-24",
"AMDRadeonX6000Shared.bundle": "12.5",
"AMDRadeonVADriver2.bundle": "12.5",
"AMDRadeonX6000GLDriver.bundle": "12.5",
"AMDRadeonX6000MTLDriver.bundle": "12.5" if self._xnu_major < os_data.sequoia else "12.5-24",
"AMDRadeonX6000Shared.bundle": "12.5",
"AMDRadeonX6000HWServices.kext": "12.5",

"AMDShared.bundle": "12.5",
"AMDShared.bundle": "12.5",
},
}
}
}
Expand Down Expand Up @@ -120,6 +124,9 @@ def patches(self) -> dict:
return {}

return {
# AMD GCN and newer GPUs can still use the native GVA stack
**MontereyGVA(self._xnu_major, self._xnu_minor, self._constants.detected_os_version).revert_patches(),

**MontereyOpenCL(self._xnu_major, self._xnu_minor, self._constants.detected_os_version).patches(),
**AMDOpenCL(self._xnu_major, self._xnu_minor, self._constants.detected_os_version).patches(),
**self._model_specific_patches(),
Expand Down
5 changes: 4 additions & 1 deletion opencore_legacy_patcher/wx_gui/gui_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ def _settings(self) -> dict:
"AMD Polaris",
"AMD Lexa",
"AMD Navi",
"AMD Navi23",
],
"value": "None",
"variable": "",
Expand Down Expand Up @@ -1296,6 +1297,8 @@ def gpu_selection_click(self, event: wx.Event) -> None:
self.constants.imac_model = "Lexa"
elif "Navi" in gpu_choice:
self.constants.imac_model = "Navi"
elif "Navi23" in gpu_choice:
self.constants.imac_model = "Navi23"
else:
raise Exception("Unknown GPU Model")
global_settings.GlobalEnviromentSettings().write_property("GUI:imac_vendor", "AMD")
Expand Down Expand Up @@ -1394,4 +1397,4 @@ def on_bless_root_vol(self, event: wx.Event) -> None:
if sys_patch.PatchSysVolume("",self.constants)._rebuild_root_volume() == True:
wx.MessageDialog(self.parent, "Root Volume saved, please reboot to apply changes", "Success", wx.OK | wx.ICON_INFORMATION).ShowModal()
else:
wx.MessageDialog(self.parent, "Root Volume update Failed, check terminal output", "Error", wx.OK | wx.ICON_ERROR).ShowModal()
wx.MessageDialog(self.parent, "Root Volume update Failed, check terminal output", "Error", wx.OK | wx.ICON_ERROR).ShowModal()
Loading