mirror of https://github.com/acidanthera/audk.git
OVMF BDS: Make use of NvVarsFileLib to make NV variable less volatile.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9275 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
e955462be2
commit
14b21de964
|
@ -666,8 +666,6 @@ Returns:
|
||||||
//
|
//
|
||||||
// Connect RootBridge
|
// Connect RootBridge
|
||||||
//
|
//
|
||||||
ConnectRootBridge ();
|
|
||||||
|
|
||||||
VarConout = BdsLibGetVariableAndSize (
|
VarConout = BdsLibGetVariableAndSize (
|
||||||
VarConsoleOut,
|
VarConsoleOut,
|
||||||
&gEfiGlobalVariableGuid,
|
&gEfiGlobalVariableGuid,
|
||||||
|
@ -772,6 +770,90 @@ PciInitialization (
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
ConnectRecursivelyIfPciMassStorage (
|
||||||
|
IN EFI_HANDLE Handle,
|
||||||
|
IN EFI_PCI_IO_PROTOCOL *Instance,
|
||||||
|
IN PCI_TYPE00 *PciHeader
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||||
|
CHAR16 *DevPathStr;
|
||||||
|
|
||||||
|
if (IS_CLASS1 (PciHeader, PCI_CLASS_MASS_STORAGE)) {
|
||||||
|
DevicePath = NULL;
|
||||||
|
Status = gBS->HandleProtocol (
|
||||||
|
Handle,
|
||||||
|
&gEfiDevicePathProtocolGuid,
|
||||||
|
(VOID*)&DevicePath
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Print Device Path
|
||||||
|
//
|
||||||
|
DevPathStr = DevicePathToStr (DevicePath);
|
||||||
|
DEBUG((
|
||||||
|
EFI_D_INFO,
|
||||||
|
"Found Mass Storage device: %s\n",
|
||||||
|
DevPathStr
|
||||||
|
));
|
||||||
|
FreePool(DevPathStr);
|
||||||
|
|
||||||
|
Status = gBS->ConnectController (Handle, NULL, NULL, TRUE);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
VisitingFileSystemInstance (
|
||||||
|
IN EFI_HANDLE Handle,
|
||||||
|
IN VOID *Instance,
|
||||||
|
IN VOID *Context
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
STATIC BOOLEAN ConnectedToFileSystem = FALSE;
|
||||||
|
|
||||||
|
if (ConnectedToFileSystem) {
|
||||||
|
return EFI_ALREADY_STARTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
Status = ConnectNvVarsToFileSystem (Handle);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
ConnectedToFileSystem = TRUE;
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
PlatformBdsRestoreNvVarsFromHardDisk (
|
||||||
|
)
|
||||||
|
{
|
||||||
|
VisitAllPciInstances (ConnectRecursivelyIfPciMassStorage);
|
||||||
|
VisitAllInstancesOfProtocol (
|
||||||
|
&gEfiSimpleFileSystemProtocolGuid,
|
||||||
|
VisitingFileSystemInstance,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
PlatformBdsConnectSequence (
|
PlatformBdsConnectSequence (
|
||||||
VOID
|
VOID
|
||||||
|
@ -950,6 +1032,14 @@ Returns:
|
||||||
|
|
||||||
DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior\n"));
|
DEBUG ((EFI_D_INFO, "PlatformBdsPolicyBehavior\n"));
|
||||||
|
|
||||||
|
ConnectRootBridge ();
|
||||||
|
|
||||||
|
//
|
||||||
|
// Try to restore variables from the hard disk early so
|
||||||
|
// they can be used for the other BDS connect operations.
|
||||||
|
//
|
||||||
|
PlatformBdsRestoreNvVarsFromHardDisk ();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Init the time out value
|
// Init the time out value
|
||||||
//
|
//
|
||||||
|
|
|
@ -46,10 +46,12 @@ Abstract:
|
||||||
#include <Library/DxeServicesTableLib.h>
|
#include <Library/DxeServicesTableLib.h>
|
||||||
#include <Library/DevicePathLib.h>
|
#include <Library/DevicePathLib.h>
|
||||||
#include <Library/IoLib.h>
|
#include <Library/IoLib.h>
|
||||||
|
#include <Library/NvVarsFileLib.h>
|
||||||
|
|
||||||
#include <Protocol/Decompress.h>
|
#include <Protocol/Decompress.h>
|
||||||
#include <Protocol/PciIo.h>
|
#include <Protocol/PciIo.h>
|
||||||
#include <Protocol/FirmwareVolume2.h>
|
#include <Protocol/FirmwareVolume2.h>
|
||||||
|
#include <Protocol/SimpleFileSystem.h>
|
||||||
|
|
||||||
#include <Guid/Acpi.h>
|
#include <Guid/Acpi.h>
|
||||||
#include <Guid/SmBios.h>
|
#include <Guid/SmBios.h>
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
MdeModulePkg/MdeModulePkg.dec
|
MdeModulePkg/MdeModulePkg.dec
|
||||||
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
|
IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec
|
||||||
|
OvmfPkg/OvmfPkg.dec
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
BaseLib
|
BaseLib
|
||||||
|
@ -47,6 +48,7 @@
|
||||||
PcdLib
|
PcdLib
|
||||||
GenericBdsLib
|
GenericBdsLib
|
||||||
PciLib
|
PciLib
|
||||||
|
NvVarsFileLib
|
||||||
|
|
||||||
[Pcd.common]
|
[Pcd.common]
|
||||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPlatformBootTimeOut
|
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPlatformBootTimeOut
|
||||||
|
|
|
@ -73,6 +73,8 @@
|
||||||
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
|
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
|
||||||
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
|
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
|
||||||
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
||||||
|
NvVarsFileLib|OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.inf
|
||||||
|
FileHandleLib|ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.inf
|
||||||
|
|
||||||
[LibraryClasses.common.SEC]
|
[LibraryClasses.common.SEC]
|
||||||
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
|
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
|
||||||
|
|
|
@ -73,6 +73,8 @@
|
||||||
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
|
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
|
||||||
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
|
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
|
||||||
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
||||||
|
NvVarsFileLib|OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.inf
|
||||||
|
FileHandleLib|ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.inf
|
||||||
|
|
||||||
[LibraryClasses.common.SEC]
|
[LibraryClasses.common.SEC]
|
||||||
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
|
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
|
||||||
|
|
|
@ -73,6 +73,8 @@
|
||||||
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
|
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
|
||||||
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
|
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
|
||||||
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
||||||
|
NvVarsFileLib|OvmfPkg/Library/NvVarsFileLib/NvVarsFileLib.inf
|
||||||
|
FileHandleLib|ShellPkg/Library/BaseFileHandleLib/BaseFileHandleLib.inf
|
||||||
|
|
||||||
[LibraryClasses.common.SEC]
|
[LibraryClasses.common.SEC]
|
||||||
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
|
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
|
||||||
|
|
Loading…
Reference in New Issue