mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-07 05:44:23 +02:00
Vlv2TbltDevicePkg/PlatformBootManager: Add capsule/recovery handling.
Add capsule and recovery boot path handling in platform BDS. Cc: David Wei <david.wei@intel.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Chao Zhang <chao.b.zhang@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
This commit is contained in:
parent
19d29d358f
commit
04d8d8835e
@ -1,15 +1,15 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
|
||||||
|
|
||||||
This program and the accompanying materials are licensed and made available under
|
This program and the accompanying materials are licensed and made available under
|
||||||
the terms and conditions of the BSD License that accompanies this distribution.
|
the terms and conditions of the BSD License that accompanies this distribution.
|
||||||
The full text of the license may be found at
|
The full text of the license may be found at
|
||||||
http://opensource.org/licenses/bsd-license.php.
|
http://opensource.org/licenses/bsd-license.php.
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Module Name:
|
Module Name:
|
||||||
@ -45,6 +45,9 @@ Abstract:
|
|||||||
#include <Library/GenericBdsLib/String.h>
|
#include <Library/GenericBdsLib/String.h>
|
||||||
#include <Library/NetLib.h>
|
#include <Library/NetLib.h>
|
||||||
|
|
||||||
|
#include <Library/CapsuleLib.h>
|
||||||
|
#include <Protocol/EsrtManagement.h>
|
||||||
|
|
||||||
EFI_GUID *ConnectDriverTable[] = {
|
EFI_GUID *ConnectDriverTable[] = {
|
||||||
&gEfiMmioDeviceProtocolGuid,
|
&gEfiMmioDeviceProtocolGuid,
|
||||||
&gEfiI2cMasterProtocolGuid,
|
&gEfiI2cMasterProtocolGuid,
|
||||||
@ -1585,7 +1588,7 @@ EFIAPI
|
|||||||
PlatformBdsPolicyBehavior (
|
PlatformBdsPolicyBehavior (
|
||||||
IN OUT LIST_ENTRY *DriverOptionList,
|
IN OUT LIST_ENTRY *DriverOptionList,
|
||||||
IN OUT LIST_ENTRY *BootOptionList,
|
IN OUT LIST_ENTRY *BootOptionList,
|
||||||
IN PROCESS_CAPSULES ProcessCapsules,
|
IN PROCESS_CAPSULES BdsProcessCapsules,
|
||||||
IN BASEM_MEMORY_TEST BaseMemoryTest
|
IN BASEM_MEMORY_TEST BaseMemoryTest
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
@ -1594,11 +1597,8 @@ PlatformBdsPolicyBehavior (
|
|||||||
EFI_BOOT_MODE BootMode;
|
EFI_BOOT_MODE BootMode;
|
||||||
BOOLEAN DeferredImageExist;
|
BOOLEAN DeferredImageExist;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
CHAR16 CapsuleVarName[36];
|
|
||||||
CHAR16 *TempVarName;
|
|
||||||
SYSTEM_CONFIGURATION SystemConfiguration;
|
SYSTEM_CONFIGURATION SystemConfiguration;
|
||||||
UINTN VarSize;
|
UINTN VarSize;
|
||||||
BOOLEAN SetVariableFlag;
|
|
||||||
PLATFORM_PCI_DEVICE_PATH *EmmcBootDevPath;
|
PLATFORM_PCI_DEVICE_PATH *EmmcBootDevPath;
|
||||||
EFI_GLOBAL_NVS_AREA_PROTOCOL *GlobalNvsArea;
|
EFI_GLOBAL_NVS_AREA_PROTOCOL *GlobalNvsArea;
|
||||||
EFI_HANDLE FvProtocolHandle;
|
EFI_HANDLE FvProtocolHandle;
|
||||||
@ -1612,13 +1612,14 @@ PlatformBdsPolicyBehavior (
|
|||||||
BOOLEAN IsFirstBoot;
|
BOOLEAN IsFirstBoot;
|
||||||
UINT16 *BootOrder;
|
UINT16 *BootOrder;
|
||||||
UINTN BootOrderSize;
|
UINTN BootOrderSize;
|
||||||
|
ESRT_MANAGEMENT_PROTOCOL *EsrtManagement;
|
||||||
|
|
||||||
Timeout = PcdGet16 (PcdPlatformBootTimeOut);
|
Timeout = PcdGet16 (PcdPlatformBootTimeOut);
|
||||||
if (Timeout > 10 ) {
|
if (Timeout > 10 ) {
|
||||||
//we think the Timeout variable is corrupted
|
//we think the Timeout variable is corrupted
|
||||||
Timeout = 10;
|
Timeout = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
VarSize = sizeof(SYSTEM_CONFIGURATION);
|
||||||
Status = gRT->GetVariable(
|
Status = gRT->GetVariable(
|
||||||
NORMAL_SETUP_NAME,
|
NORMAL_SETUP_NAME,
|
||||||
@ -1639,7 +1640,7 @@ PlatformBdsPolicyBehavior (
|
|||||||
&SystemConfiguration
|
&SystemConfiguration
|
||||||
);
|
);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Load the driver option as the driver option list
|
// Load the driver option as the driver option list
|
||||||
@ -1651,37 +1652,6 @@ PlatformBdsPolicyBehavior (
|
|||||||
//
|
//
|
||||||
BootMode = GetBootModeHob();
|
BootMode = GetBootModeHob();
|
||||||
|
|
||||||
//
|
|
||||||
// Clear all the capsule variables CapsuleUpdateData, CapsuleUpdateData1, CapsuleUpdateData2...
|
|
||||||
// as early as possible which will avoid the next time boot after the capsule update
|
|
||||||
// will still into the capsule loop
|
|
||||||
//
|
|
||||||
StrCpy (CapsuleVarName, EFI_CAPSULE_VARIABLE_NAME);
|
|
||||||
TempVarName = CapsuleVarName + StrLen (CapsuleVarName);
|
|
||||||
Index = 0;
|
|
||||||
SetVariableFlag = TRUE;
|
|
||||||
while (SetVariableFlag) {
|
|
||||||
if (Index > 0) {
|
|
||||||
UnicodeValueToString (TempVarName, 0, Index, 0);
|
|
||||||
}
|
|
||||||
Status = gRT->SetVariable (
|
|
||||||
CapsuleVarName,
|
|
||||||
&gEfiCapsuleVendorGuid,
|
|
||||||
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS |
|
|
||||||
EFI_VARIABLE_BOOTSERVICE_ACCESS,
|
|
||||||
0,
|
|
||||||
(VOID *)NULL
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
//
|
|
||||||
// There is no capsule variables, quit
|
|
||||||
//
|
|
||||||
SetVariableFlag = FALSE;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
Index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// No deferred images exist by default
|
// No deferred images exist by default
|
||||||
//
|
//
|
||||||
@ -1733,6 +1703,11 @@ PlatformBdsPolicyBehavior (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Status = gBS->LocateProtocol(&gEsrtManagementProtocolGuid, NULL, (VOID **)&EsrtManagement);
|
||||||
|
if (EFI_ERROR(Status)) {
|
||||||
|
EsrtManagement = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
switch (BootMode) {
|
switch (BootMode) {
|
||||||
|
|
||||||
case BOOT_WITH_MINIMAL_CONFIGURATION:
|
case BOOT_WITH_MINIMAL_CONFIGURATION:
|
||||||
@ -1822,13 +1797,18 @@ PlatformBdsPolicyBehavior (
|
|||||||
#ifdef FTPM_ENABLE
|
#ifdef FTPM_ENABLE
|
||||||
TrEEPhysicalPresenceLibProcessRequest(NULL);
|
TrEEPhysicalPresenceLibProcessRequest(NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (EsrtManagement != NULL) {
|
||||||
|
EsrtManagement->LockEsrtRepository();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Close boot script and install ready to lock
|
// Close boot script and install ready to lock
|
||||||
//
|
//
|
||||||
InstallReadyToLock ();
|
InstallReadyToLock ();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Give one chance to enter the setup if we
|
// Give one chance to enter the setup if we
|
||||||
// select Gummiboot "Reboot Into Firmware Interface" and Fast Boot is enabled.
|
// select Gummiboot "Reboot Into Firmware Interface" and Fast Boot is enabled.
|
||||||
//
|
//
|
||||||
BootIntoFirmwareInterface();
|
BootIntoFirmwareInterface();
|
||||||
@ -1863,6 +1843,10 @@ PlatformBdsPolicyBehavior (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (EsrtManagement != NULL) {
|
||||||
|
EsrtManagement->LockEsrtRepository();
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Close boot script and install ready to lock
|
// Close boot script and install ready to lock
|
||||||
//
|
//
|
||||||
@ -1887,6 +1871,16 @@ PlatformBdsPolicyBehavior (
|
|||||||
//
|
//
|
||||||
PlatformBdsConnectConsole (gPlatformConsole);
|
PlatformBdsConnectConsole (gPlatformConsole);
|
||||||
PlatformBdsDiagnostics (EXTENSIVE, FALSE, BaseMemoryTest);
|
PlatformBdsDiagnostics (EXTENSIVE, FALSE, BaseMemoryTest);
|
||||||
|
|
||||||
|
DEBUG((EFI_D_INFO, "ProcessCapsules Before EndOfDxe......\n"));
|
||||||
|
ProcessCapsules ();
|
||||||
|
DEBUG((EFI_D_INFO, "ProcessCapsules Done\n"));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Close boot script and install ready to lock
|
||||||
|
//
|
||||||
|
InstallReadyToLock ();
|
||||||
|
|
||||||
BdsLibConnectAll ();
|
BdsLibConnectAll ();
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1903,12 +1897,13 @@ PlatformBdsPolicyBehavior (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
if (EsrtManagement != NULL) {
|
||||||
// Close boot script and install ready to lock
|
EsrtManagement->SyncEsrtFmp();
|
||||||
//
|
}
|
||||||
InstallReadyToLock ();
|
|
||||||
|
|
||||||
ProcessCapsules (BOOT_ON_FLASH_UPDATE);
|
DEBUG((EFI_D_INFO, "ProcessCapsules After ConnectAll......\n"));
|
||||||
|
ProcessCapsules();
|
||||||
|
DEBUG((EFI_D_INFO, "ProcessCapsules Done\n"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BOOT_IN_RECOVERY_MODE:
|
case BOOT_IN_RECOVERY_MODE:
|
||||||
@ -2012,6 +2007,10 @@ FULL_CONFIGURATION:
|
|||||||
#ifdef FTPM_ENABLE
|
#ifdef FTPM_ENABLE
|
||||||
TrEEPhysicalPresenceLibProcessRequest(NULL);
|
TrEEPhysicalPresenceLibProcessRequest(NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (EsrtManagement != NULL) {
|
||||||
|
EsrtManagement->SyncEsrtFmp();
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// Close boot script and install ready to lock
|
// Close boot script and install ready to lock
|
||||||
//
|
//
|
||||||
@ -2029,7 +2028,7 @@ FULL_CONFIGURATION:
|
|||||||
PlatformBdsEnterFrontPageWithHotKey (Timeout, FALSE);
|
PlatformBdsEnterFrontPageWithHotKey (Timeout, FALSE);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Give one chance to enter the setup if we
|
// Give one chance to enter the setup if we
|
||||||
// select Gummiboot "Reboot Into Firmware Interface"
|
// select Gummiboot "Reboot Into Firmware Interface"
|
||||||
//
|
//
|
||||||
BootIntoFirmwareInterface();
|
BootIntoFirmwareInterface();
|
||||||
@ -2047,7 +2046,7 @@ FULL_CONFIGURATION:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,6 +72,7 @@
|
|||||||
FileHandleLib
|
FileHandleLib
|
||||||
S3BootScriptLib
|
S3BootScriptLib
|
||||||
SerialPortLib
|
SerialPortLib
|
||||||
|
CapsuleLib
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiFirmwareVolume2ProtocolGuid
|
gEfiFirmwareVolume2ProtocolGuid
|
||||||
@ -90,6 +91,7 @@
|
|||||||
gEfiMmioDeviceProtocolGuid
|
gEfiMmioDeviceProtocolGuid
|
||||||
gEfiI2cMasterProtocolGuid
|
gEfiI2cMasterProtocolGuid
|
||||||
gEfiI2cHostProtocolGuid
|
gEfiI2cHostProtocolGuid
|
||||||
|
gEsrtManagementProtocolGuid
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gEfiMemoryTypeInformationGuid
|
gEfiMemoryTypeInformationGuid
|
||||||
|
Loading…
x
Reference in New Issue
Block a user