Add support for Aquantia AQtion Ethernet Controllers

This commit is contained in:
Hoang Hong Quan
2025-01-14 14:15:13 +07:00
parent e2001a8553
commit 86725b28fb
6 changed files with 52 additions and 33 deletions

View File

@@ -3041,15 +3041,7 @@ DefinitionBlock ("", "SSDT", 2, "ZPSS", "UsbReset", 0x00001000)
else:
selected_patches.append("PLUG")
ethernet_pci = None
for network_name, network_props in hardware_report.get("Network", {}).items():
device_id = network_props.get("Device ID")
if self.utils.contains_any(pci_data.NetworkIDs, device_id, start=108, end=219):
ethernet_pci = 108
break
if not ethernet_pci:
if not any(network_props.get("Device ID") in pci_data.NetworkIDs[108:270] for network_props in hardware_report.get("Network", {}).values()):
selected_patches.append("RMNE")
if hardware_report.get("Motherboard").get("Chipset") in ("C610/X99", "Wellsburg", "X299"):

View File

@@ -225,32 +225,42 @@ class CompatibilityChecker:
for device_name, device_props in self.hardware_report.get("Network", {}).items():
bus_type = device_props.get("Bus Type")
device_id = device_props.get("Device ID")
is_device_supported = device_id in pci_data.NetworkIDs
try:
device_index = pci_data.NetworkIDs.index(device_id)
max_version = os_data.get_latest_darwin_version()
min_version = os_data.get_lowest_darwin_version()
ocl_patched_max_version = max_version
ocl_patched_min_version = "23.0.0"
max_version = os_data.get_latest_darwin_version()
min_version = os_data.get_lowest_darwin_version()
ocl_patched_max_version = max_version
ocl_patched_min_version = "20.0.0"
if device_id in ("8086-15F2", "8086-15F3", "8086-15F8", "8086-125B", "8086-125C", "8086-125D", "8086-3102"):
min_version = "19.0.0"
if 109 < device_index < 115:
min_version = "19.0.0"
if 262 < device_index < 270:
min_version = "21.0.0"
if not is_device_supported:
if bus_type.startswith("PCI"):
device_props["Compatibility"] = (None, None)
else:
if pci_data.NetworkIDs.index(device_id) < 108:
if device_id == primary_wifi_device:
if device_id in ("14E4-43A0", "14E4-43A3", "14E4-43BA"):
if device_index == 13 or 17 < device_index < 21:
max_version = "22.99.99"
ocl_patched_min_version = "23.0.0"
elif device_index < 12:
max_version = "17.99.99"
if device_index < 21:
device_props["OCLP Compatibility"] = (ocl_patched_max_version, ocl_patched_min_version)
self.ocl_patched_macos_version = (ocl_patched_max_version, self.ocl_patched_macos_version[-1] if self.ocl_patched_macos_version and self.utils.parse_darwin_version(self.ocl_patched_macos_version[-1]) < self.utils.parse_darwin_version(device_props.get("OCLP Compatibility")[-1]) else device_props.get("OCLP Compatibility")[-1])
device_props["Compatibility"] = (max_version, min_version)
primary_wifi_device = None
else:
device_props["Compatibility"] = (None, None)
else:
device_props["Compatibility"] = (max_version, min_version)
except:
pass
if bus_type.startswith("PCI") and not device_props.get("Compatibility"):
device_props["Compatibility"] = (None, None)
print("{}- {}: {}".format(" "*3, device_name, self.show_macos_compatibility(device_props.get("Compatibility"))))
def check_storage_compatibility(self):

View File

@@ -381,11 +381,14 @@ class ConfigProdigy:
return None
def load_kernel_patch(self, motherboard_chipset, cpu_manufacturer, cpu_codename, cpu_cores, gpu_manufacturer, kexts):
def load_kernel_patch(self, motherboard_chipset, cpu_manufacturer, cpu_codename, cpu_cores, gpu_manufacturer, networks, kexts):
kernel_patch = []
if "AMD" in cpu_manufacturer:
kernel_patch.extend(self.g.get_amd_kernel_patches())
kernel_patch.extend(self.g.get_kernel_patches("AMD Vanilla Patches", self.g.amd_vanilla_patches_url))
if any(network_props.get("Device ID") in pci_data.NetworkIDs[263:270] for network_props in networks.values()):
kernel_patch.extend(self.g.get_kernel_patches("Aquantia macOS Patches", self.g.aquantia_macos_patches_url))
for kext in kexts:
if kext.checked:
@@ -408,7 +411,7 @@ class ConfigProdigy:
})
elif kext.name == "ForgedInvariant":
if not "AMD" in cpu_manufacturer:
kernel_patch.extend(self.g.get_amd_kernel_patches()[-6:-4])
kernel_patch.extend(self.g.get_kernel_patches("AMD Vanilla Patches", self.g.amd_vanilla_patches_url)[-6:-4])
elif kext.name == "CatalinaBCM5701Ethernet":
kernel_patch.append({
"Arch": "Any",
@@ -428,13 +431,15 @@ class ConfigProdigy:
})
for patch in kernel_patch:
if "cpuid_cores_per_package" in patch["Comment"]:
if "AppleEthernetAquantiaAqtion" in patch["Identifier"]:
patch["Enabled"] = patch["Base"] != ""
elif "cpuid_cores_per_package" in patch["Comment"]:
patch["Replace"] = patch["Replace"].hex()
patch["Replace"] = self.utils.hex_to_bytes(patch["Replace"][:2] + self.utils.int_to_hex(int(cpu_cores)) + patch["Replace"][4:])
elif "IOPCIIsHotplugPort" in patch["Comment"]:
if motherboard_chipset in chipset_data.AMDChipsets[17:] or cpu_codename in ("Raphael", "Storm Peak", "Phoenix", "Granite Ridge"):
patch["Enabled"] = True
if "_mtrr_update_action" in patch["Comment"]:
elif "_mtrr_update_action" in patch["Comment"]:
if "TRX" in motherboard_chipset.upper():
patch["Enabled"] = False
elif "AMD" in gpu_manufacturer:
@@ -593,6 +598,7 @@ class ConfigProdigy:
hardware_report.get("CPU").get("Codename"),
hardware_report.get("CPU").get("Core Count"),
list(hardware_report.get("GPU").items())[0][-1].get("Manufacturer"),
hardware_report.get("Network", {}),
kexts
)
config["Kernel"]["Quirks"]["AppleCpuPmCfgLock"] = bool(self.utils.contains_any(cpu_data.IntelCPUGenerations, hardware_report.get("CPU").get("Codename"), start=38))
@@ -601,6 +607,7 @@ class ConfigProdigy:
config["Kernel"]["Quirks"]["CustomSMBIOSGuid"] = True
config["Kernel"]["Quirks"]["DisableIoMapper"] = not "AMD" in hardware_report.get("CPU").get("Manufacturer")
config["Kernel"]["Quirks"]["DisableRtcChecksum"] = "ASUS" in hardware_report.get("Motherboard").get("Name") or "HP " in hardware_report.get("Motherboard").get("Name")
config["Kernel"]["Quirks"]["ForceAquantiaEthernet"] = any(network_props.get("Device ID") in pci_data.NetworkIDs[263:270] for network_props in hardware_report.get("Network", {}).values())
config["Kernel"]["Quirks"]["LapicKernelPanic"] = "HP " in hardware_report.get("Motherboard").get("Name")
config["Kernel"]["Quirks"]["PanicNoKextDump"] = config["Kernel"]["Quirks"]["PowerTimeoutKernelPanic"] = True
config["Kernel"]["Quirks"]["ProvideCurrentCpuInfo"] = "AMD" in hardware_report.get("CPU").get("Manufacturer") or hardware_report.get("CPU").get("Codename") in cpu_data.IntelCPUGenerations[:2]

View File

@@ -498,6 +498,15 @@ NetworkIDs = [
"14E4-1686",
"14E4-16B0",
"14E4-16B4",
# Aquantia AQC107
"1D6A-0001",
"1D6A-07B1",
"1D6A-D107",
"1D6A-87B1",
# Aquantia AQC113
"1D6A-14C0",
"1D6A-04C0",
"1D6A-94C0",
# RtWlanU.kext, RtWlanU1827.kext and RT2870USBWirelessDriver.kext
"0409-0408",
"0411-0242",

View File

@@ -16,6 +16,7 @@ class gatheringFiles:
self.dortania_builds_url = "https://raw.githubusercontent.com/dortania/build-repo/builds/latest.json"
self.ocbinarydata_url = "https://github.com/acidanthera/OcBinaryData/archive/refs/heads/master.zip"
self.amd_vanilla_patches_url = "https://raw.githubusercontent.com/AMD-OSX/AMD_Vanilla/beta/patches.plist"
self.aquantia_macos_patches_url = "https://raw.githubusercontent.com/CaseySJ/Aquantia-macOS-Patches/refs/heads/main/CaseySJ-Aquantia-Patch-Sets-1-and-2.plist"
self.temporary_dir = tempfile.mkdtemp()
self.ock_files_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "OCK_Files")
self.bootloader_kexts_data_path = os.path.join(os.path.dirname(os.path.dirname(os.path.realpath(__file__))), "bootloader_kexts_data.json")
@@ -210,15 +211,15 @@ class gatheringFiles:
shutil.rmtree(self.temporary_dir, ignore_errors=True)
def get_amd_kernel_patches(self):
def get_kernel_patches(self, patches_name, patches_url):
try:
response = self.fetcher.fetch_and_parse_content(self.amd_vanilla_patches_url, "plist")
response = self.fetcher.fetch_and_parse_content(patches_url, "plist")
return response["Kernel"]["Patch"]
except:
print("\n")
print("Unable to download AMD Vanilla Patches at this time")
print("from " + self.amd_vanilla_patches_url)
print("Unable to download {} at this time".format(patches_name))
print("from " + patches_url)
print("")
print("Please try again later or apply them manually. ", end="")
self.utils.request_input()

View File

@@ -159,7 +159,7 @@ class KextMaestro:
except:
continue
ethernet_device = 107 < device_index < 263
ethernet_device = 107 < device_index < 270
if device_index < 21 and self.utils.parse_darwin_version(macos_version) >= self.utils.parse_darwin_version("23.0.0"):
selected_kexts.append("IOSkywalkFamily")