diff options
Diffstat (limited to 'Vlv2TbltDevicePkg/PlatformInitPei')
-rw-r--r-- | Vlv2TbltDevicePkg/PlatformInitPei/BootMode.c | 21 | ||||
-rw-r--r-- | Vlv2TbltDevicePkg/PlatformInitPei/PlatformEarlyInit.c | 14 |
2 files changed, 30 insertions, 5 deletions
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;
}
|