summaryrefslogtreecommitdiff
path: root/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
diff options
context:
space:
mode:
Diffstat (limited to 'Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c')
-rw-r--r--Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c60
1 files changed, 54 insertions, 6 deletions
diff --git a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
index ad16267ec..195d73418 100644
--- a/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
+++ b/Vlv2TbltDevicePkg/Library/PlatformBdsLib/BdsPlatform.c
@@ -322,7 +322,18 @@ GetGopDevicePath (
&VarSize,
&mSystemConfiguration
);
- ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
+ //The setup variable is corrupted
+ VarSize = sizeof(SYSTEM_CONFIGURATION);
+ Status = gRT->GetVariable(
+ L"SetupRecovery",
+ &gEfiNormalSetupGuid,
+ NULL,
+ &VarSize,
+ &mSystemConfiguration
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
if(mSystemConfiguration.BootDisplayDevice != 0x0)
{
@@ -624,7 +635,18 @@ PlatformBdsForceActiveVga (
&VarSize,
&mSystemConfiguration
);
- ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
+ //The setup variable is corrupted
+ VarSize = sizeof(SYSTEM_CONFIGURATION);
+ Status = gRT->GetVariable(
+ L"SetupRecovery",
+ &gEfiNormalSetupGuid,
+ NULL,
+ &VarSize,
+ &mSystemConfiguration
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
if ((PlugInPciVgaDevicePath == NULL && OnboardPciVgaDevicePath != NULL) ) {
@@ -680,7 +702,18 @@ UpdateConsoleResolution(
&VarSize,
&SystemConfiguration
);
- ASSERT_EFI_ERROR (Status);
+ if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
+ //The setup variable is corrupted
+ VarSize = sizeof(SYSTEM_CONFIGURATION);
+ Status = gRT->GetVariable(
+ L"SetupRecovery",
+ &gEfiNormalSetupGuid,
+ NULL,
+ &VarSize,
+ &SystemConfiguration
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
switch (SystemConfiguration.IgdFlatPanel) {
@@ -1576,6 +1609,11 @@ PlatformBdsPolicyBehavior (
UINTN BootOrderSize;
Timeout = PcdGet16 (PcdPlatformBootTimeOut);
+ if (Timeout > 10 ) {
+ //we think the Timeout variable is corrupted
+ Timeout = 10;
+ }
+
VarSize = sizeof(SYSTEM_CONFIGURATION);
Status = gRT->GetVariable(
NORMAL_SETUP_NAME,
@@ -1584,9 +1622,19 @@ PlatformBdsPolicyBehavior (
&VarSize,
&SystemConfiguration
);
- if (EFI_ERROR (Status)) {
- return;
- }
+
+ if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {
+ //The setup variable is corrupted
+ VarSize = sizeof(SYSTEM_CONFIGURATION);
+ Status = gRT->GetVariable(
+ L"SetupRecovery",
+ &gEfiNormalSetupGuid,
+ NULL,
+ &VarSize,
+ &SystemConfiguration
+ );
+ ASSERT_EFI_ERROR (Status);
+ }
//
// Load the driver option as the driver option list