]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c
Sync the branch changes to trunk.
[mirror_edk2.git] / Vlv2TbltDevicePkg / AcpiPlatform / AcpiPlatform.c
index 824f2377772bd61db1b2ccb9d7bed211c07a0830..c39c36daad797d3e298f3206b4a2e662d6867759 100644 (file)
@@ -697,7 +697,18 @@ OnReadyToBoot (
                   &VariableSize,\r
                   &SetupVarBuffer\r
                   );\r
-  ASSERT_EFI_ERROR (Status);\r
+  if (EFI_ERROR (Status) || VariableSize != sizeof(SYSTEM_CONFIGURATION)) {\r
+    //The setup variable is corrupted\r
+    VariableSize = sizeof(SYSTEM_CONFIGURATION);\r
+    Status = gRT->GetVariable(\r
+              L"SetupRecovery",\r
+              &mSystemConfigurationGuid,\r
+              NULL,\r
+              &VariableSize,\r
+              &SetupVarBuffer\r
+              );\r
+    ASSERT_EFI_ERROR (Status);\r
+  }    \r
 \r
   //\r
   // Find the AcpiSupport protocol.\r
@@ -817,7 +828,18 @@ AcpiPlatformEntryPoint (
                   &VarSize,\r
                   &mSystemConfiguration\r
                   );\r
-  ASSERT_EFI_ERROR (Status);\r
+  if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {\r
+    //The setup variable is corrupted\r
+    VarSize = sizeof(SYSTEM_CONFIGURATION);\r
+    Status = gRT->GetVariable(\r
+              L"SetupRecovery",\r
+              &mSystemConfigurationGuid,\r
+              NULL,\r
+              &VarSize,\r
+              &mSystemConfiguration\r
+              );\r
+    ASSERT_EFI_ERROR (Status);\r
+  }\r
 \r
   //\r
   // Find the AcpiSupport protocol.\r
@@ -842,6 +864,19 @@ AcpiPlatformEntryPoint (
                   &SysCfgSize,\r
                   &mSystemConfig\r
                   );\r
+  if (EFI_ERROR (Status) || SysCfgSize != sizeof(SYSTEM_CONFIGURATION)) {\r
+    //The setup variable is corrupted\r
+    SysCfgSize = sizeof(SYSTEM_CONFIGURATION);\r
+    Status = gRT->GetVariable(\r
+              L"SetupRecovery",\r
+              &gEfiNormalSetupGuid,\r
+              NULL,\r
+              &SysCfgSize,\r
+              &mSystemConfig\r
+              );\r
+    ASSERT_EFI_ERROR (Status);\r
+  }\r
+\r
 \r
   Status    = EFI_SUCCESS;\r
   Instance  = 0;\r