diff --git a/Changelog.md b/Changelog.md index 9314e1ef3d0..42def676ac1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ OpenCore Changelog #### v0.8.0 - Added support for early log preservation - Switched to Python 3 in scripts (use `python /path/to/script` to force Python 2) +- Added `ForceAquantiaEthernet` for Aquantia AQtion AQC-107s based 10GbE network cards support, thx @Mieze #### v0.7.9 - Added auto-detect `macOS Installer` volume name for use when `.disk_label` file cannot be displayed diff --git a/Docs/Configuration.md5 b/Docs/Configuration.md5 index 9056485c93f..cef98ae99b7 100644 --- a/Docs/Configuration.md5 +++ b/Docs/Configuration.md5 @@ -1 +1 @@ -889e4083fc23ff23b71c1ebfc6ef7c88 +bd9caa75d299d8a25ef88fd4d6833b83 diff --git a/Docs/Configuration.pdf b/Docs/Configuration.pdf index 82d837067b6..e69527c61d9 100644 Binary files a/Docs/Configuration.pdf and b/Docs/Configuration.pdf differ diff --git a/Docs/Configuration.tex b/Docs/Configuration.tex index 1bc7417eb9c..4ffdc145fd4 100755 --- a/Docs/Configuration.tex +++ b/Docs/Configuration.tex @@ -2647,6 +2647,16 @@ \subsection{Quirks Properties}\label{kernelpropsquirks} \emph{Note}: This option should be avoided whenever possible. Modern firmware typically have compatible AHCI controllers. +\item + \texttt{ForceAquantiaEthernet}\\ + \textbf{Type}: \texttt{plist\ boolean}\\ + \textbf{Failsafe}: \texttt{false}\\ + \textbf{Requirement}: 10.15.4\\ + \textbf{Description}: Enable Aquantia AQtion AQC-107s based 10GbE network cards support. + + This option enables Aquantia AQtion AQC-107s based 10GbE network cards support, + which used to work natively before macOS 10.15.4. + \item \texttt{ForceSecureBootScheme}\\ \textbf{Type}: \texttt{plist\ boolean}\\ diff --git a/Docs/Differences/Differences.pdf b/Docs/Differences/Differences.pdf index 7c6a16f8fcd..7d437451f18 100644 Binary files a/Docs/Differences/Differences.pdf and b/Docs/Differences/Differences.pdf differ diff --git a/Docs/Differences/Differences.tex b/Docs/Differences/Differences.tex index b5234acdd9f..a75dcb2ff0e 100644 --- a/Docs/Differences/Differences.tex +++ b/Docs/Differences/Differences.tex @@ -1,7 +1,7 @@ \documentclass[]{article} %DIF LATEXDIFF DIFFERENCE FILE -%DIF DEL PreviousConfiguration.tex Wed Mar 9 13:03:27 2022 -%DIF ADD ../Configuration.tex Sun Mar 20 14:02:15 2022 +%DIF DEL PreviousConfiguration.tex Thu Mar 10 21:36:27 2022 +%DIF ADD ../Configuration.tex Sun Mar 20 12:27:38 2022 \usepackage{lmodern} \usepackage{amssymb,amsmath} @@ -122,7 +122,7 @@ %DIF HYPERREF PREAMBLE %DIF PREAMBLE \providecommand{\DIFadd}[1]{\texorpdfstring{\DIFaddtex{#1}}{#1}} %DIF PREAMBLE \providecommand{\DIFdel}[1]{\texorpdfstring{\DIFdeltex{#1}}{}} %DIF PREAMBLE -%DIF LISTINGS PREAMBLE %DIF PREAMBLE +%DIF COLORLISTINGS PREAMBLE %DIF PREAMBLE \RequirePackage{listings} %DIF PREAMBLE \RequirePackage{color} %DIF PREAMBLE \lstdefinelanguage{DIFcode}{ %DIF PREAMBLE @@ -2712,7 +2712,19 @@ \subsection{Quirks Properties}\label{kernelpropsquirks} typically have compatible AHCI controllers. \item - \texttt{ForceSecureBootScheme}\\ + \DIFaddbegin \texttt{\DIFadd{ForceAquantiaEthernet}}\\ + \textbf{\DIFadd{Type}}\DIFadd{: }\texttt{\DIFadd{plist\ boolean}}\\ + \textbf{\DIFadd{Failsafe}}\DIFadd{: }\texttt{\DIFadd{false}}\\ + \textbf{\DIFadd{Requirement}}\DIFadd{: 10.15.4}\\ + \textbf{\DIFadd{Description}}\DIFadd{: Enable Aquantia AQtion AQC-107s based 10GbE network cards support. +} + + \DIFadd{This option enables Aquantia AQtion AQC-107s based 10GbE network cards support, + which used to work natively before macOS 10.15.4. +} + +\item + \DIFaddend \texttt{ForceSecureBootScheme}\\ \textbf{Type}: \texttt{plist\ boolean}\\ \textbf{Failsafe}: \texttt{false}\\ \textbf{Requirement}: 11\\ diff --git a/Docs/Errata/Errata.pdf b/Docs/Errata/Errata.pdf index 4b24b1a5a14..c5b4ae7af13 100644 Binary files a/Docs/Errata/Errata.pdf and b/Docs/Errata/Errata.pdf differ diff --git a/Docs/Sample.plist b/Docs/Sample.plist index b7b4ea4417c..23df8d51025 100644 --- a/Docs/Sample.plist +++ b/Docs/Sample.plist @@ -1013,6 +1013,8 @@ ExternalDiskIcons + ForceAquantiaEthernet + ForceSecureBootScheme IncreasePciBarSize diff --git a/Docs/SampleCustom.plist b/Docs/SampleCustom.plist index cebf34c868d..e5f34325801 100644 --- a/Docs/SampleCustom.plist +++ b/Docs/SampleCustom.plist @@ -1013,6 +1013,8 @@ ExternalDiskIcons + ForceAquantiaEthernet + ForceSecureBootScheme IncreasePciBarSize diff --git a/Include/Acidanthera/Library/OcAppleKernelLib.h b/Include/Acidanthera/Library/OcAppleKernelLib.h index b95adb17a22..f09e4f4ad7c 100644 --- a/Include/Acidanthera/Library/OcAppleKernelLib.h +++ b/Include/Acidanthera/Library/OcAppleKernelLib.h @@ -583,6 +583,10 @@ typedef enum { // Set custom APFS trim timeout. // KernelQuirkSetApfsTrimTimeout, + // + // Enable Aquantia AQtion AQC-107s support. + // + KernelQuirkForceAquantiaEthernet, KernelQuirkMax } KERNEL_QUIRK_NAME; diff --git a/Include/Acidanthera/Library/OcConfigurationLib.h b/Include/Acidanthera/Library/OcConfigurationLib.h index b7a1340c6d1..32bb8bd2501 100644 --- a/Include/Acidanthera/Library/OcConfigurationLib.h +++ b/Include/Acidanthera/Library/OcConfigurationLib.h @@ -290,6 +290,7 @@ _(BOOLEAN , DisableRtcChecksum , , FALSE , ()) \ _(BOOLEAN , ExtendBTFeatureFlags , , FALSE , ()) \ _(BOOLEAN , ExternalDiskIcons , , FALSE , ()) \ + _(BOOLEAN , ForceAquantiaEthernet , , FALSE , ()) \ _(BOOLEAN , ForceSecureBootScheme , , FALSE , ()) \ _(BOOLEAN , IncreasePciBarSize , , FALSE , ()) \ _(BOOLEAN , LapicKernelPanic , , FALSE , ()) \ diff --git a/Library/OcAppleKernelLib/CommonPatches.c b/Library/OcAppleKernelLib/CommonPatches.c index eda057043c5..46227f76712 100644 --- a/Library/OcAppleKernelLib/CommonPatches.c +++ b/Library/OcAppleKernelLib/CommonPatches.c @@ -627,7 +627,7 @@ PatchUsbXhciPortLimit1 ( // On 10.14.4 and newer IOUSBHostFamily also needs limit removal. // Thanks to ydeng discovering this. // - if (!OcMatchDarwinVersion (KernelVersion, KERNEL_VERSION(18, 5, 0), 0)) { + if (!OcMatchDarwinVersion (KernelVersion, KERNEL_VERSION (18, 5, 0), 0)) { DEBUG ((DEBUG_INFO, "OCAK: Skipping port patch IOUSBHostFamily on %u\n", KernelVersion)); return EFI_SUCCESS; } @@ -1889,6 +1889,72 @@ PatchLegacyCommpage ( return EFI_NOT_FOUND; } +STATIC +CONST UINT8 +mAquantiaEthernetPatchFind[] = { + 0x41, 0xC7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ///< mov dword ptr [whatever], 0 + 0xE9 ///< jmp +}; + +STATIC +CONST UINT8 +mAquantiaEthernetPatchReplace[] = { + 0x41, 0xC7, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, ///< mov dword ptr [whatever], 1 + 0xE9 ///< jmp +}; + +STATIC +CONST UINT8 +mAquantiaEthernetPatchMask[] = { + 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, + 0xFF +}; + +STATIC +PATCHER_GENERIC_PATCH +mAquantiaEthernetPatch = { + .Comment = DEBUG_POINTER ("ForceAquantiaEthernet"), + .Base = "__ZN30AppleEthernetAquantiaAqtion10718checkConfigSupportERiS0_", + .Find = mAquantiaEthernetPatchFind, + .Mask = mAquantiaEthernetPatchMask, + .Replace = mAquantiaEthernetPatchReplace, + .ReplaceMask = mAquantiaEthernetPatchMask, + .Size = sizeof (mAquantiaEthernetPatchFind), + .Count = 1, + .Skip = 0 +}; + +STATIC +EFI_STATUS +PatchAquantiaEthernet ( + IN OUT PATCHER_CONTEXT *Patcher, + IN UINT32 KernelVersion + ) +{ + EFI_STATUS Status; + + // + // This patch is not required before macOS 10.15.4. + // + if (!OcMatchDarwinVersion (KernelVersion, 0, KERNEL_VERSION (19, 4, 0))) { + DEBUG ((DEBUG_INFO, "OCAK: Skipping patching AquantiaEthernet before %u\n", KernelVersion)); + return EFI_SUCCESS; + } + + if (Patcher == NULL) { + return EFI_NOT_FOUND; + } + + Status = PatcherApplyGenericPatch (Patcher, &mAquantiaEthernetPatch); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "OCAK: Failed to apply Aquantia Ethernet patch - %r\n", Status)); + } else { + DEBUG ((DEBUG_INFO, "OCAK: Patch success Aquantia Ethernet\n")); + } + + return Status; +} + STATIC EFI_STATUS PatchForceSecureBootScheme ( @@ -2085,6 +2151,7 @@ KERNEL_QUIRK gKernelQuirks[] = { [KernelQuirkLegacyCommpage] = { NULL, PatchLegacyCommpage }, [KernelQuirkForceSecureBootScheme] = { "com.apple.security.AppleImage4", PatchForceSecureBootScheme }, [KernelQuirkSetApfsTrimTimeout] = { "com.apple.filesystems.apfs", PatchSetApfsTrimTimeout }, + [KernelQuirkForceAquantiaEthernet] = { "com.apple.driver.AppleEthernetAquantiaAqtion", PatchAquantiaEthernet }, }; EFI_STATUS diff --git a/Library/OcConfigurationLib/OcConfigurationLib.c b/Library/OcConfigurationLib/OcConfigurationLib.c index fdfdae9c04f..03eee338fd2 100644 --- a/Library/OcConfigurationLib/OcConfigurationLib.c +++ b/Library/OcConfigurationLib/OcConfigurationLib.c @@ -359,6 +359,7 @@ mKernelQuirksSchema[] = { OC_SCHEMA_BOOLEAN_IN ("DisableRtcChecksum", OC_GLOBAL_CONFIG, Kernel.Quirks.DisableRtcChecksum), OC_SCHEMA_BOOLEAN_IN ("ExtendBTFeatureFlags", OC_GLOBAL_CONFIG, Kernel.Quirks.ExtendBTFeatureFlags), OC_SCHEMA_BOOLEAN_IN ("ExternalDiskIcons", OC_GLOBAL_CONFIG, Kernel.Quirks.ExternalDiskIcons), + OC_SCHEMA_BOOLEAN_IN ("ForceAquantiaEthernet", OC_GLOBAL_CONFIG, Kernel.Quirks.ForceAquantiaEthernet), OC_SCHEMA_BOOLEAN_IN ("ForceSecureBootScheme", OC_GLOBAL_CONFIG, Kernel.Quirks.ForceSecureBootScheme), OC_SCHEMA_BOOLEAN_IN ("IncreasePciBarSize", OC_GLOBAL_CONFIG, Kernel.Quirks.IncreasePciBarSize), OC_SCHEMA_BOOLEAN_IN ("LapicKernelPanic", OC_GLOBAL_CONFIG, Kernel.Quirks.LapicKernelPanic), diff --git a/Library/OcMainLib/OpenCoreKernelPatch.c b/Library/OcMainLib/OpenCoreKernelPatch.c index b59f55d94d8..55c7fb7c408 100644 --- a/Library/OcMainLib/OpenCoreKernelPatch.c +++ b/Library/OcMainLib/OpenCoreKernelPatch.c @@ -256,6 +256,10 @@ OcKernelApplyPatches ( OcKernelApplyQuirk (KernelQuirkExtendBTFeatureFlags, CacheType, DarwinVersion, Context, NULL); } + if (Config->Kernel.Quirks.ForceAquantiaEthernet) { + OcKernelApplyQuirk (KernelQuirkForceAquantiaEthernet, CacheType, DarwinVersion, Context, NULL); + } + if (Config->Kernel.Quirks.ForceSecureBootScheme) { OcKernelApplyQuirk (KernelQuirkForceSecureBootScheme, CacheType, DarwinVersion, Context, NULL); }