From 620f289162b08d319fe1e73b3c7e2baff6b388e4 Mon Sep 17 00:00:00 2001 From: Tim He Date: Thu, 11 Jun 2015 02:50:20 +0000 Subject: Sync the branch changes to trunk. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update the FCE tool to remove “runtime access” . and recovery "Setup" variable in case of “Setup” variable size is incorrect somehow. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Tim He Reviewed-by: David Wei git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17620 6f19259b-4bc3-4df7-8a09-765794883524 --- Vlv2TbltDevicePkg/PlatformInitPei/BootMode.c | 21 +++++++++++++++++---- .../PlatformInitPei/PlatformEarlyInit.c | 14 +++++++++++++- 2 files changed, 30 insertions(+), 5 deletions(-) (limited to 'Vlv2TbltDevicePkg/PlatformInitPei') diff --git a/Vlv2TbltDevicePkg/PlatformInitPei/BootMode.c b/Vlv2TbltDevicePkg/PlatformInitPei/BootMode.c index 174d8e974e..3b94e3b54f 100644 --- a/Vlv2TbltDevicePkg/PlatformInitPei/BootMode.c +++ b/Vlv2TbltDevicePkg/PlatformInitPei/BootMode.c @@ -202,6 +202,19 @@ UpdateBootMode ( &VarSize, &SystemConfiguration ); + if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) { + //The setup variable is corrupted + VarSize = sizeof(SYSTEM_CONFIGURATION); + Status = Variable->GetVariable( + Variable, + L"SetupRecovery", + &gEfiSetupVariableGuid, + NULL, + &VarSize, + &SystemConfiguration + ); + ASSERT_EFI_ERROR (Status); + } if (SystemConfiguration.FastBoot == 1) { BootMode = BOOT_WITH_MINIMAL_CONFIGURATION; @@ -386,16 +399,16 @@ SetPlatformBootMode ( // Recovery mode // CopyMem (&PlatformSetupId.SetupName, - SAFE_SETUP_NAME, - StrSize (SAFE_SETUP_NAME)); + &NORMAL_SETUP_NAME, + StrSize (NORMAL_SETUP_NAME)); PlatformSetupId.PlatformBootMode = PLATFORM_RECOVERY_MODE; } else if (CheckIfSafeMode(PeiServices, PlatformInfoHob)) { // // Safe mode also called config mode or maintenace mode. // CopyMem (&PlatformSetupId.SetupName, - SAFE_SETUP_NAME, - StrSize (SAFE_SETUP_NAME)); + &NORMAL_SETUP_NAME, + StrSize (NORMAL_SETUP_NAME)); PlatformSetupId.PlatformBootMode = PLATFORM_SAFE_MODE; } else if(0) { // else if (CheckIfManufacturingMode(PeiServices)) { diff --git a/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c b/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c index 1a12c53e96..0b0acf5d2f 100644 --- a/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c +++ b/Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c @@ -196,7 +196,19 @@ GetSetupVariable ( &VariableSize, SystemConfiguration ); - ASSERT_EFI_ERROR(Status); + if (EFI_ERROR (Status) || VariableSize != sizeof(SYSTEM_CONFIGURATION)) { + //The setup variable is corrupted + VariableSize = sizeof(SYSTEM_CONFIGURATION); + Status = Variable->GetVariable( + Variable, + L"SetupRecovery", + &gEfiSetupVariableGuid, + NULL, + &VariableSize, + SystemConfiguration + ); + ASSERT_EFI_ERROR (Status); + } return Status; } -- cgit v1.2.3