提交 48f95b65 编写于 作者: V vit9696

OcApfsLib: Add `GlobalConnect` mode for device handle connection

closes acidanthera/bugtracker#960
上级 e1b7844d
...@@ -16,6 +16,7 @@ OpenCore Changelog ...@@ -16,6 +16,7 @@ OpenCore Changelog
- Fixed slide choice on platforms when 0 slide is unavailable, thx @zhen-zen - Fixed slide choice on platforms when 0 slide is unavailable, thx @zhen-zen
- Fixed assertions caused by unaligned file path access in DEBUG builds - Fixed assertions caused by unaligned file path access in DEBUG builds
- Renamed `ConfigValidity` utility to `ocvalidate` for consistency - Renamed `ConfigValidity` utility to `ocvalidate` for consistency
- Added `GlobalConnect` for APFS loading to workaround older firmware issues
#### v0.5.9 #### v0.5.9
- Added full HiDPI support in OpenCanopy - Added full HiDPI support in OpenCanopy
......
...@@ -4635,6 +4635,18 @@ functioning. Feature highlights: ...@@ -4635,6 +4635,18 @@ functioning. Feature highlights:
\texttt{ScanPolicy}. See more details in ``EFI Jumpstart'' section of \texttt{ScanPolicy}. See more details in ``EFI Jumpstart'' section of
\href{https://developer.apple.com/support/apple-file-system/Apple-File-System-Reference.pdf}{Apple File System Reference}. \href{https://developer.apple.com/support/apple-file-system/Apple-File-System-Reference.pdf}{Apple File System Reference}.
\item
\texttt{GlobalConnect}\\
\textbf{Type}: \texttt{plist\ boolean}\\
\textbf{Failsafe}: \texttt{false}\\
\textbf{Description}: Perform full device connection during APFS loading.
Instead of partition handle connection normally used for APFS driver loading
every handle is connected recursively. This may take more time than usual
but can be the only way to access APFS partitions on some firmwares like
those found on older HP laptops.
\item \item
\texttt{HideVerbose}\\ \texttt{HideVerbose}\\
\textbf{Type}: \texttt{plist\ boolean}\\ \textbf{Type}: \texttt{plist\ boolean}\\
......
\documentclass[]{article} \documentclass[]{article}
%DIF LATEXDIFF DIFFERENCE FILE %DIF LATEXDIFF DIFFERENCE FILE
%DIF DEL PreviousConfiguration.tex Tue Jun 2 03:55:18 2020 %DIF DEL PreviousConfiguration.tex Tue Jun 2 03:55:18 2020
%DIF ADD ../Configuration.tex Sun Jun 21 16:58:05 2020 %DIF ADD ../Configuration.tex Mon Jun 22 00:02:42 2020
\usepackage{lmodern} \usepackage{lmodern}
\usepackage{amssymb,amsmath} \usepackage{amssymb,amsmath}
...@@ -4732,8 +4732,22 @@ functioning. Feature highlights: ...@@ -4732,8 +4732,22 @@ functioning. Feature highlights:
\texttt{ScanPolicy}. See more details in ``EFI Jumpstart'' section of \texttt{ScanPolicy}. See more details in ``EFI Jumpstart'' section of
\href{https://developer.apple.com/support/apple-file-system/Apple-File-System-Reference.pdf}{Apple File System Reference}. \href{https://developer.apple.com/support/apple-file-system/Apple-File-System-Reference.pdf}{Apple File System Reference}.
\item
\DIFaddbegin \texttt{\DIFadd{GlobalConnect}}\\
\textbf{\DIFadd{Type}}\DIFadd{: }\texttt{\DIFadd{plist\ boolean}}\\
\textbf{\DIFadd{Failsafe}}\DIFadd{: }\texttt{\DIFadd{false}}\\
\textbf{\DIFadd{Description}}\DIFadd{: Perform full device connection during APFS loading.
}
\DIFadd{Instead of partition handle connection normally used for APFS driver loading
every handle is connected recursively. This may take more time than usual
but can be the only way to access APFS partitions on some firmwares like
those found on older HP laptops.
}
\item \item
\texttt{HideVerbose}\\ \DIFaddend \texttt{HideVerbose}\\
\textbf{Type}: \texttt{plist\ boolean}\\ \textbf{Type}: \texttt{plist\ boolean}\\
\textbf{Failsafe}: \texttt{false}\\ \textbf{Failsafe}: \texttt{false}\\
\textbf{Description}: Hide verbose output from APFS driver. \textbf{Description}: Hide verbose output from APFS driver.
......
...@@ -848,6 +848,8 @@ ...@@ -848,6 +848,8 @@
<dict> <dict>
<key>EnableJumpstart</key> <key>EnableJumpstart</key>
<true/> <true/>
<key>GlobalConnect</key>
<false/>
<key>HideVerbose</key> <key>HideVerbose</key>
<true/> <true/>
<key>JumpstartHotPlug</key> <key>JumpstartHotPlug</key>
......
...@@ -951,6 +951,8 @@ ...@@ -951,6 +951,8 @@
<dict> <dict>
<key>EnableJumpstart</key> <key>EnableJumpstart</key>
<true/> <true/>
<key>GlobalConnect</key>
<false/>
<key>HideVerbose</key> <key>HideVerbose</key>
<true/> <true/>
<key>JumpstartHotPlug</key> <key>JumpstartHotPlug</key>
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
@param[in] MinVersion Minimal allowed APFS driver version to load. @param[in] MinVersion Minimal allowed APFS driver version to load.
@param[in] MinDate Minimal allowed APFS driver date to load. @param[in] MinDate Minimal allowed APFS driver date to load.
@param[in] ScanPolicy OpenCore scan policy. @param[in] ScanPolicy OpenCore scan policy.
@param[in] GlobalConnect Perform global device connection for APFS.
@param[in] IgnoreVerbose Avoid APFS driver verbose output. @param[in] IgnoreVerbose Avoid APFS driver verbose output.
**/ **/
VOID VOID
...@@ -64,6 +65,7 @@ OcApfsConfigure ( ...@@ -64,6 +65,7 @@ OcApfsConfigure (
IN UINT64 MinVersion, IN UINT64 MinVersion,
IN UINT32 MinDate, IN UINT32 MinDate,
IN UINT32 ScanPolicy, IN UINT32 ScanPolicy,
IN BOOLEAN GlobalConnect,
IN BOOLEAN IgnoreVerbose IN BOOLEAN IgnoreVerbose
); );
......
...@@ -479,6 +479,7 @@ typedef enum { ...@@ -479,6 +479,7 @@ typedef enum {
_(UINT64 , MinVersion , , 0 , ()) \ _(UINT64 , MinVersion , , 0 , ()) \
_(UINT32 , MinDate , , 0 , ()) \ _(UINT32 , MinDate , , 0 , ()) \
_(BOOLEAN , EnableJumpstart , , FALSE , ()) \ _(BOOLEAN , EnableJumpstart , , FALSE , ()) \
_(BOOLEAN , GlobalConnect , , FALSE , ()) \
_(BOOLEAN , HideVerbose , , FALSE , ()) \ _(BOOLEAN , HideVerbose , , FALSE , ()) \
_(BOOLEAN , JumpstartHotPlug , , FALSE , ()) _(BOOLEAN , JumpstartHotPlug , , FALSE , ())
OC_DECLARE (OC_UEFI_APFS) OC_DECLARE (OC_UEFI_APFS)
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <Library/OcAppleImageVerificationLib.h> #include <Library/OcAppleImageVerificationLib.h>
#include <Library/OcBootManagementLib.h> #include <Library/OcBootManagementLib.h>
#include <Library/OcConsoleLib.h> #include <Library/OcConsoleLib.h>
#include <Library/OcDriverConnectionLib.h>
#include <Library/OcGuardLib.h> #include <Library/OcGuardLib.h>
#include <Library/UefiBootServicesTableLib.h> #include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h> #include <Library/UefiRuntimeServicesTableLib.h>
...@@ -34,6 +35,7 @@ STATIC UINT64 mApfsMinimalVersion = OC_APFS_VERSION_DEFAULT; ...@@ -34,6 +35,7 @@ STATIC UINT64 mApfsMinimalVersion = OC_APFS_VERSION_DEFAULT;
STATIC UINT32 mApfsMinimalDate = OC_APFS_DATE_DEFAULT; STATIC UINT32 mApfsMinimalDate = OC_APFS_DATE_DEFAULT;
STATIC UINT32 mOcScanPolicy; STATIC UINT32 mOcScanPolicy;
STATIC BOOLEAN mIgnoreVerbose; STATIC BOOLEAN mIgnoreVerbose;
STATIC BOOLEAN mGlobalConnect;
STATIC EFI_SYSTEM_TABLE *mNullSystemTable; STATIC EFI_SYSTEM_TABLE *mNullSystemTable;
// //
...@@ -327,12 +329,23 @@ ApfsStartDriver ( ...@@ -327,12 +329,23 @@ ApfsStartDriver (
return Status; return Status;
} }
// if (mGlobalConnect) {
// Recursively connect controller to get apfs.efi loaded. //
// We cannot use apfs.efi handle as it apparently creates new handles. // Connect all devices when implicitly requested. This is a workaround
// This follows ApfsJumpStart driver implementation. // for some older HP laptops, which for some reason fail to connect by both
// // drive and partition handles.
gBS->ConnectController (PrivateData->LocationInfo.ControllerHandle, NULL, NULL, TRUE); // REF: https://github.com/acidanthera/bugtracker/issues/960
//
OcConnectDrivers ();
} else {
//
// Recursively connect controller to get apfs.efi loaded.
// We cannot use apfs.efi handle as it apparently creates new handles.
// This follows ApfsJumpStart driver implementation.
//
gBS->ConnectController (PrivateData->LocationInfo.ControllerHandle, NULL, NULL, TRUE);
}
return EFI_SUCCESS; return EFI_SUCCESS;
} }
...@@ -391,6 +404,7 @@ OcApfsConfigure ( ...@@ -391,6 +404,7 @@ OcApfsConfigure (
IN UINT64 MinVersion, IN UINT64 MinVersion,
IN UINT32 MinDate, IN UINT32 MinDate,
IN UINT32 ScanPolicy, IN UINT32 ScanPolicy,
IN BOOLEAN GlobalConnect,
IN BOOLEAN IgnoreVerbose IN BOOLEAN IgnoreVerbose
) )
{ {
...@@ -413,8 +427,9 @@ OcApfsConfigure ( ...@@ -413,8 +427,9 @@ OcApfsConfigure (
mApfsMinimalDate = MinDate; mApfsMinimalDate = MinDate;
} }
mOcScanPolicy = ScanPolicy; mOcScanPolicy = ScanPolicy;
mIgnoreVerbose = IgnoreVerbose; mIgnoreVerbose = IgnoreVerbose;
mGlobalConnect = GlobalConnect;
} }
EFI_STATUS EFI_STATUS
......
...@@ -57,6 +57,7 @@ ...@@ -57,6 +57,7 @@
DebugLib DebugLib
OcAppleImageVerificationLib OcAppleImageVerificationLib
OcConsoleLib OcConsoleLib
OcDriverConnectionLib
OcGuardLib OcGuardLib
OcMiscLib OcMiscLib
MemoryAllocationLib MemoryAllocationLib
......
...@@ -566,6 +566,7 @@ STATIC ...@@ -566,6 +566,7 @@ STATIC
OC_SCHEMA OC_SCHEMA
mUefiApfsSchema[] = { mUefiApfsSchema[] = {
OC_SCHEMA_BOOLEAN_IN ("EnableJumpstart", OC_GLOBAL_CONFIG, Uefi.Apfs.EnableJumpstart), OC_SCHEMA_BOOLEAN_IN ("EnableJumpstart", OC_GLOBAL_CONFIG, Uefi.Apfs.EnableJumpstart),
OC_SCHEMA_BOOLEAN_IN ("GlobalConnect", OC_GLOBAL_CONFIG, Uefi.Apfs.GlobalConnect),
OC_SCHEMA_BOOLEAN_IN ("HideVerbose", OC_GLOBAL_CONFIG, Uefi.Apfs.HideVerbose), OC_SCHEMA_BOOLEAN_IN ("HideVerbose", OC_GLOBAL_CONFIG, Uefi.Apfs.HideVerbose),
OC_SCHEMA_BOOLEAN_IN ("JumpstartHotPlug", OC_GLOBAL_CONFIG, Uefi.Apfs.JumpstartHotPlug), OC_SCHEMA_BOOLEAN_IN ("JumpstartHotPlug", OC_GLOBAL_CONFIG, Uefi.Apfs.JumpstartHotPlug),
OC_SCHEMA_INTEGER_IN ("MinDate", OC_GLOBAL_CONFIG, Uefi.Apfs.MinDate), OC_SCHEMA_INTEGER_IN ("MinDate", OC_GLOBAL_CONFIG, Uefi.Apfs.MinDate),
......
...@@ -538,6 +538,7 @@ OcLoadUefiSupport ( ...@@ -538,6 +538,7 @@ OcLoadUefiSupport (
Config->Uefi.Apfs.MinVersion, Config->Uefi.Apfs.MinVersion,
Config->Uefi.Apfs.MinDate, Config->Uefi.Apfs.MinDate,
Config->Misc.Security.ScanPolicy, Config->Misc.Security.ScanPolicy,
Config->Uefi.Apfs.GlobalConnect,
Config->Uefi.Apfs.HideVerbose Config->Uefi.Apfs.HideVerbose
); );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册