/** @file\r
\r
Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>\r
- \r\r
- This program and the accompanying materials are licensed and made available under\r\r
- the terms and conditions of the BSD License that accompanies this distribution. \r\r
- The full text of the license may be found at \r\r
- http://opensource.org/licenses/bsd-license.php. \r\r
- \r\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r\r
- \r\r
+ \r
+ This program and the accompanying materials are licensed and made available under\r
+ the terms and conditions of the BSD License that accompanies this distribution. \r
+ The full text of the license may be found at \r
+ http://opensource.org/licenses/bsd-license.php. \r
+ \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+ \r
\r
\r
Module Name:\r
#include <Library/GenericBdsLib/String.h>\r
#include <Library/NetLib.h>\r
\r
+#include <Library/CapsuleLib.h>\r
+#include <Protocol/EsrtManagement.h>\r
+\r
EFI_GUID *ConnectDriverTable[] = {\r
&gEfiMmioDeviceProtocolGuid,\r
&gEfiI2cMasterProtocolGuid,\r
PlatformBdsPolicyBehavior (\r
IN OUT LIST_ENTRY *DriverOptionList,\r
IN OUT LIST_ENTRY *BootOptionList,\r
- IN PROCESS_CAPSULES ProcessCapsules,\r
+ IN PROCESS_CAPSULES BdsProcessCapsules,\r
IN BASEM_MEMORY_TEST BaseMemoryTest\r
)\r
{\r
EFI_BOOT_MODE BootMode;\r
BOOLEAN DeferredImageExist;\r
UINTN Index;\r
- CHAR16 CapsuleVarName[36];\r
- CHAR16 *TempVarName;\r
SYSTEM_CONFIGURATION SystemConfiguration;\r
UINTN VarSize;\r
- BOOLEAN SetVariableFlag;\r
PLATFORM_PCI_DEVICE_PATH *EmmcBootDevPath;\r
EFI_GLOBAL_NVS_AREA_PROTOCOL *GlobalNvsArea;\r
EFI_HANDLE FvProtocolHandle;\r
BOOLEAN IsFirstBoot;\r
UINT16 *BootOrder;\r
UINTN BootOrderSize;\r
+ ESRT_MANAGEMENT_PROTOCOL *EsrtManagement;\r
\r
Timeout = PcdGet16 (PcdPlatformBootTimeOut);\r
if (Timeout > 10 ) {\r
//we think the Timeout variable is corrupted\r
Timeout = 10;\r
}\r
- \r
+\r
VarSize = sizeof(SYSTEM_CONFIGURATION);\r
Status = gRT->GetVariable(\r
NORMAL_SETUP_NAME,\r
&SystemConfiguration\r
);\r
ASSERT_EFI_ERROR (Status);\r
- } \r
+ }\r
\r
//\r
// Load the driver option as the driver option list\r
//\r
BootMode = GetBootModeHob();\r
\r
- //\r
- // Clear all the capsule variables CapsuleUpdateData, CapsuleUpdateData1, CapsuleUpdateData2...\r
- // as early as possible which will avoid the next time boot after the capsule update\r
- // will still into the capsule loop\r
- //\r
- StrCpy (CapsuleVarName, EFI_CAPSULE_VARIABLE_NAME);\r
- TempVarName = CapsuleVarName + StrLen (CapsuleVarName);\r
- Index = 0;\r
- SetVariableFlag = TRUE;\r
- while (SetVariableFlag) {\r
- if (Index > 0) {\r
- UnicodeValueToString (TempVarName, 0, Index, 0);\r
- }\r
- Status = gRT->SetVariable (\r
- CapsuleVarName,\r
- &gEfiCapsuleVendorGuid,\r
- EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS |\r
- EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
- 0,\r
- (VOID *)NULL\r
- );\r
- if (EFI_ERROR (Status)) {\r
- //\r
- // There is no capsule variables, quit\r
- //\r
- SetVariableFlag = FALSE;\r
- continue;\r
- }\r
- Index++;\r
- }\r
-\r
//\r
// No deferred images exist by default\r
//\r
}\r
}\r
\r
+ Status = gBS->LocateProtocol(&gEsrtManagementProtocolGuid, NULL, (VOID **)&EsrtManagement);\r
+ if (EFI_ERROR(Status)) {\r
+ EsrtManagement = NULL;\r
+ }\r
+\r
switch (BootMode) {\r
\r
case BOOT_WITH_MINIMAL_CONFIGURATION:\r
#ifdef FTPM_ENABLE\r
TrEEPhysicalPresenceLibProcessRequest(NULL);\r
#endif\r
+\r
+ if (EsrtManagement != NULL) {\r
+ EsrtManagement->LockEsrtRepository();\r
+ }\r
+\r
//\r
// Close boot script and install ready to lock\r
//\r
InstallReadyToLock ();\r
\r
//\r
- // Give one chance to enter the setup if we \r
+ // Give one chance to enter the setup if we\r
// select Gummiboot "Reboot Into Firmware Interface" and Fast Boot is enabled.\r
//\r
BootIntoFirmwareInterface();\r
}\r
}\r
\r
+ if (EsrtManagement != NULL) {\r
+ EsrtManagement->LockEsrtRepository();\r
+ }\r
+\r
//\r
// Close boot script and install ready to lock\r
//\r
//\r
PlatformBdsConnectConsole (gPlatformConsole);\r
PlatformBdsDiagnostics (EXTENSIVE, FALSE, BaseMemoryTest);\r
+\r
+ DEBUG((EFI_D_INFO, "ProcessCapsules Before EndOfDxe......\n"));\r
+ ProcessCapsules ();\r
+ DEBUG((EFI_D_INFO, "ProcessCapsules Done\n"));\r
+\r
+ //\r
+ // Close boot script and install ready to lock\r
+ //\r
+ InstallReadyToLock ();\r
+\r
BdsLibConnectAll ();\r
\r
//\r
}\r
}\r
\r
- //\r
- // Close boot script and install ready to lock\r
- //\r
- InstallReadyToLock ();\r
+ if (EsrtManagement != NULL) {\r
+ EsrtManagement->SyncEsrtFmp();\r
+ }\r
\r
- ProcessCapsules (BOOT_ON_FLASH_UPDATE);\r
+ DEBUG((EFI_D_INFO, "ProcessCapsules After ConnectAll......\n"));\r
+ ProcessCapsules();\r
+ DEBUG((EFI_D_INFO, "ProcessCapsules Done\n"));\r
break;\r
\r
case BOOT_IN_RECOVERY_MODE:\r
#ifdef FTPM_ENABLE\r
TrEEPhysicalPresenceLibProcessRequest(NULL);\r
#endif\r
+\r
+ if (EsrtManagement != NULL) {\r
+ EsrtManagement->SyncEsrtFmp();\r
+ }\r
//\r
// Close boot script and install ready to lock\r
//\r
PlatformBdsEnterFrontPageWithHotKey (Timeout, FALSE);\r
\r
//\r
- // Give one chance to enter the setup if we \r
+ // Give one chance to enter the setup if we\r
// select Gummiboot "Reboot Into Firmware Interface"\r
//\r
BootIntoFirmwareInterface();\r
return;\r
}\r
\r
- \r
+\r
break;\r
}\r
\r