提交 a5a4754e 编写于 作者: V vit9696

OpenCoreUefi: Implement ExitBootServicesDelay quirk

上级 c0098e57
...@@ -1137,6 +1137,7 @@ blocking. ...@@ -1137,6 +1137,7 @@ blocking.
\subsection{Quirks Properties}\label{kernelpropsquirks} \subsection{Quirks Properties}\label{kernelpropsquirks}
\begin{enumerate} \begin{enumerate}
\item \item
\texttt{AppleCpuPmCfgLock}\\ \texttt{AppleCpuPmCfgLock}\\
\textbf{Type}: \texttt{plist\ boolean}\\ \textbf{Type}: \texttt{plist\ boolean}\\
...@@ -2523,6 +2524,19 @@ build -a X64 -b RELEASE -t XCODE5 -p IntelFrameworkModulePkg/IntelFrameworkModul ...@@ -2523,6 +2524,19 @@ build -a X64 -b RELEASE -t XCODE5 -p IntelFrameworkModulePkg/IntelFrameworkModul
\begin{enumerate} \begin{enumerate}
\item
\texttt{ExitBootServicesDelay}\\
\textbf{Type}: \texttt{plist\ integer}\\
\textbf{Default value}: \texttt{0}\\
\textbf{Description}: Adds delay in microseconds after \texttt{EXIT\_BOOT\_SERVICES}
event.
This is a very ugly quirk to circumvent "Still waiting for root device" message
on select APTIO IV firmwares, namely ASUS Z87-Pro, when using FileVault 2 in particular.
It seems that for some reason they execute code in parallel to \texttt{EXIT\_BOOT\_SERVICES},
which results in SATA controller being inaccessible from macOS. A better approach should be
found in some future. Expect 3-5 seconds to be enough in case the quirk is needed.
\item \item
\texttt{IgnoreInvalidFlexRatio}\\ \texttt{IgnoreInvalidFlexRatio}\\
\textbf{Type}: \texttt{plist\ boolean}\\ \textbf{Type}: \texttt{plist\ boolean}\\
......
...@@ -444,38 +444,7 @@ ...@@ -444,38 +444,7 @@
<key>PlatformInfo</key> <key>PlatformInfo</key>
<dict> <dict>
<key>Automatic</key> <key>Automatic</key>
<false/> <true/>
<key>DataHub</key>
<dict>
<key>ARTFrequency</key>
<integer>0</integer>
<key>BoardProduct</key>
<string>Mac-F221BEC8</string>
<key>BoardRevision</key>
<data>AQ==</data>
<key>DevicePathsSupported</key>
<data>AQ==</data>
<key>FSBFrequency</key>
<integer>0</integer>
<key>InitialTSC</key>
<integer>0</integer>
<key>PlatformName</key>
<string>platform</string>
<key>SmcBranch</key>
<data>AAAAAAAAAAA=</data>
<key>SmcPlatform</key>
<data>AAAAAAAAAAA=</data>
<key>SmcRevision</key>
<data>ATkPAAAF</data>
<key>StartupPowerEvents</key>
<integer>0</integer>
<key>SystemProductName</key>
<string>MacPro5,1</string>
<key>SystemSerialNumber</key>
<string>W0000000001</string>
<key>SystemUUID</key>
<string>00000000-0000-0000-0000-000000000000</string>
</dict>
<key>Generic</key> <key>Generic</key>
<dict> <dict>
<key>SystemUUID</key> <key>SystemUUID</key>
...@@ -489,76 +458,6 @@ ...@@ -489,76 +458,6 @@
<key>SystemSerialNumber</key> <key>SystemSerialNumber</key>
<string>W0000000001</string> <string>W0000000001</string>
</dict> </dict>
<key>PlatformNVRAM</key>
<dict>
<key>BID</key>
<string>Mac-F221BEC8</string>
<key>MLB</key>
<string>M000000000001</string>
<key>ROM</key>
<data>ESIzAAAA</data>
<key>FirmwareFeatures</key>
<data>N+EP6AAAAAA=</data>
<key>FirmwareFeaturesMask</key>
<data>P/8f/wAAAAA=</data>
</dict>
<key>SMBIOS</key>
<dict>
<key>BIOSVendor</key>
<string></string>
<key>BIOSVersion</key>
<string>142.0.0.0.0</string>
<key>BIOSReleaseDate</key>
<string>02/14/2019</string>
<key>SystemManufacturer</key>
<string></string>
<key>SystemProductName</key>
<string>MacPro5,1</string>
<key>SystemVersion</key>
<string>1.1</string>
<key>SystemSerialNumber</key>
<string>W0000000001</string>
<key>SystemUUID</key>
<string>00000000-0000-0000-0000-000000000000</string>
<key>SystemSKUNumber</key>
<string>Mac-F221BEC8</string>
<key>SystemFamily</key>
<string>MacPro</string>
<key>BoardManufacturer</key>
<string></string>
<key>BoardProduct</key>
<string>Mac-F221BEC8</string>
<key>BoardVersion</key>
<string>MacPro5,1</string>
<key>BoardSerialNumber</key>
<string>M000000000001</string>
<key>BoardAssetTag</key>
<string></string>
<key>BoardType</key>
<integer>11</integer>
<key>BoardLocationInChassis</key>
<string>Part Component</string>
<key>ChassisManufacturer</key>
<string></string>
<key>ChassisType</key>
<integer>7</integer>
<key>ChassisVersion</key>
<string>Mac-F221BEC8</string>
<key>ChassisSerialNumber</key>
<string>W0000000001</string>
<key>ChassisAssetTag</key>
<string></string>
<key>PlatformFeature</key>
<integer>0</integer>
<key>FirmwareFeatures</key>
<data>N+EP6AAAAAA=</data>
<key>FirmwareFeaturesMask</key>
<data>P/8f/wAAAAA=</data>
<key>ProcessorType</key>
<integer>0</integer>
<key>MemoryFormFactor</key>
<integer>9</integer>
</dict>
<key>UpdateDataHub</key> <key>UpdateDataHub</key>
<true/> <true/>
<key>UpdateNVRAM</key> <key>UpdateNVRAM</key>
...@@ -590,6 +489,8 @@ ...@@ -590,6 +489,8 @@
</dict> </dict>
<key>Quirks</key> <key>Quirks</key>
<dict> <dict>
<key>ExitBootServicesDelay</key>
<integer>0</integer>
<key>IgnoreInvalidFlexRatio</key> <key>IgnoreInvalidFlexRatio</key>
<false/> <false/>
<key>IgnoreTextInGraphics</key> <key>IgnoreTextInGraphics</key>
......
...@@ -444,7 +444,38 @@ ...@@ -444,7 +444,38 @@
<key>PlatformInfo</key> <key>PlatformInfo</key>
<dict> <dict>
<key>Automatic</key> <key>Automatic</key>
<true/> <false/>
<key>DataHub</key>
<dict>
<key>ARTFrequency</key>
<integer>0</integer>
<key>BoardProduct</key>
<string>Mac-F221BEC8</string>
<key>BoardRevision</key>
<data>AQ==</data>
<key>DevicePathsSupported</key>
<data>AQ==</data>
<key>FSBFrequency</key>
<integer>0</integer>
<key>InitialTSC</key>
<integer>0</integer>
<key>PlatformName</key>
<string>platform</string>
<key>SmcBranch</key>
<data>AAAAAAAAAAA=</data>
<key>SmcPlatform</key>
<data>AAAAAAAAAAA=</data>
<key>SmcRevision</key>
<data>ATkPAAAF</data>
<key>StartupPowerEvents</key>
<integer>0</integer>
<key>SystemProductName</key>
<string>MacPro5,1</string>
<key>SystemSerialNumber</key>
<string>W0000000001</string>
<key>SystemUUID</key>
<string>00000000-0000-0000-0000-000000000000</string>
</dict>
<key>Generic</key> <key>Generic</key>
<dict> <dict>
<key>SystemUUID</key> <key>SystemUUID</key>
...@@ -458,6 +489,76 @@ ...@@ -458,6 +489,76 @@
<key>SystemSerialNumber</key> <key>SystemSerialNumber</key>
<string>W0000000001</string> <string>W0000000001</string>
</dict> </dict>
<key>PlatformNVRAM</key>
<dict>
<key>BID</key>
<string>Mac-F221BEC8</string>
<key>MLB</key>
<string>M000000000001</string>
<key>ROM</key>
<data>ESIzAAAA</data>
<key>FirmwareFeatures</key>
<data>N+EP6AAAAAA=</data>
<key>FirmwareFeaturesMask</key>
<data>P/8f/wAAAAA=</data>
</dict>
<key>SMBIOS</key>
<dict>
<key>BIOSVendor</key>
<string></string>
<key>BIOSVersion</key>
<string>142.0.0.0.0</string>
<key>BIOSReleaseDate</key>
<string>02/14/2019</string>
<key>SystemManufacturer</key>
<string></string>
<key>SystemProductName</key>
<string>MacPro5,1</string>
<key>SystemVersion</key>
<string>1.1</string>
<key>SystemSerialNumber</key>
<string>W0000000001</string>
<key>SystemUUID</key>
<string>00000000-0000-0000-0000-000000000000</string>
<key>SystemSKUNumber</key>
<string>Mac-F221BEC8</string>
<key>SystemFamily</key>
<string>MacPro</string>
<key>BoardManufacturer</key>
<string></string>
<key>BoardProduct</key>
<string>Mac-F221BEC8</string>
<key>BoardVersion</key>
<string>MacPro5,1</string>
<key>BoardSerialNumber</key>
<string>M000000000001</string>
<key>BoardAssetTag</key>
<string></string>
<key>BoardType</key>
<integer>11</integer>
<key>BoardLocationInChassis</key>
<string>Part Component</string>
<key>ChassisManufacturer</key>
<string></string>
<key>ChassisType</key>
<integer>7</integer>
<key>ChassisVersion</key>
<string>Mac-F221BEC8</string>
<key>ChassisSerialNumber</key>
<string>W0000000001</string>
<key>ChassisAssetTag</key>
<string></string>
<key>PlatformFeature</key>
<integer>0</integer>
<key>FirmwareFeatures</key>
<data>N+EP6AAAAAA=</data>
<key>FirmwareFeaturesMask</key>
<data>P/8f/wAAAAA=</data>
<key>ProcessorType</key>
<integer>0</integer>
<key>MemoryFormFactor</key>
<integer>9</integer>
</dict>
<key>UpdateDataHub</key> <key>UpdateDataHub</key>
<true/> <true/>
<key>UpdateNVRAM</key> <key>UpdateNVRAM</key>
...@@ -489,6 +590,8 @@ ...@@ -489,6 +590,8 @@
</dict> </dict>
<key>Quirks</key> <key>Quirks</key>
<dict> <dict>
<key>ExitBootServicesDelay</key>
<integer>0</integer>
<key>IgnoreInvalidFlexRatio</key> <key>IgnoreInvalidFlexRatio</key>
<false/> <false/>
<key>IgnoreTextInGraphics</key> <key>IgnoreTextInGraphics</key>
......
...@@ -30,7 +30,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. ...@@ -30,7 +30,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <Protocol/DevicePath.h> #include <Protocol/DevicePath.h>
#include <Protocol/GraphicsOutput.h> #include <Protocol/GraphicsOutput.h>
STATIC EFI_EVENT mReleaseUsbOwnershipEvent; STATIC EFI_EVENT mOcExitBootServicesEvent;
STATIC STATIC
VOID VOID
...@@ -209,16 +209,33 @@ OcProvideConsoleGop ( ...@@ -209,16 +209,33 @@ OcProvideConsoleGop (
STATIC STATIC
VOID VOID
EFIAPI EFIAPI
OcReleaseUsbOwnership ( OcExitBootServicesHandler (
IN EFI_EVENT Event, IN EFI_EVENT Event,
IN VOID *Context IN VOID *Context
) )
{ {
EFI_STATUS Status; EFI_STATUS Status;
OC_GLOBAL_CONFIG *Config;
Status = ReleaseUsbOwnership (); Config = (OC_GLOBAL_CONFIG *) Context;
DEBUG ((DEBUG_INFO, "OC: ReleaseUsbOwnership status - %r\n", Status)); if (Config->Uefi.Quirks.ReleaseUsbOwnership) {
Status = ReleaseUsbOwnership ();
DEBUG ((DEBUG_INFO, "OC: ReleaseUsbOwnership status - %r\n", Status));
}
//
// FIXME: This is a very ugly hack for (at least) ASUS Z87-Pro.
// This board results in still waiting for root devices due to firmware
// performing some timer(?) actions in parallel to ExitBootServices.
// Some day we should figure out what exactly happens there.
// It is not the first time I face this, check AptioInputFix timer code:
// https://github.com/acidanthera/AptioFixPkg/blob/e54c185/Platform/AptioInputFix/Timer/AIT.c#L72-L73
// Roughly 5 seconds is good enough.
//
if (Config->Uefi.Quirks.ExitBootServicesDelay > 0) {
gBS->Stall (Config->Uefi.Quirks.ExitBootServicesDelay);
}
} }
STATIC STATIC
...@@ -269,13 +286,14 @@ OcLoadUefiSupport ( ...@@ -269,13 +286,14 @@ OcLoadUefiSupport (
&Config->Uefi.Quirks.RequestBootVarRouting &Config->Uefi.Quirks.RequestBootVarRouting
); );
if (Config->Uefi.Quirks.ReleaseUsbOwnership) { if (Config->Uefi.Quirks.ReleaseUsbOwnership
|| Config->Uefi.Quirks.ExitBootServicesDelay > 0) {
gBS->CreateEvent ( gBS->CreateEvent (
EVT_SIGNAL_EXIT_BOOT_SERVICES, EVT_SIGNAL_EXIT_BOOT_SERVICES,
TPL_NOTIFY, TPL_NOTIFY,
OcReleaseUsbOwnership, OcExitBootServicesHandler,
NULL, Config,
&mReleaseUsbOwnershipEvent &mOcExitBootServicesEvent
); );
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册