]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Vlv2TbltDevicePkg/PlatformInitPei/BootMode.c
MdePkg/BaseSafeIntLib: fix undefined behavior in SafeInt64Mult()
[mirror_edk2.git] / Vlv2TbltDevicePkg / PlatformInitPei / BootMode.c
index 174d8e974ee05dcbdca899e8e55ae4c4f922b726..3b94e3b54f08a80a0594b15fe081211abb91d80d 100644 (file)
@@ -202,6 +202,19 @@ UpdateBootMode (
                            &VarSize,\r
                            &SystemConfiguration\r
                            );\r
+      if (EFI_ERROR (Status) || VarSize != sizeof(SYSTEM_CONFIGURATION)) {\r
+        //The setup variable is corrupted\r
+        VarSize = sizeof(SYSTEM_CONFIGURATION);\r
+        Status = Variable->GetVariable(\r
+                  Variable,\r
+                  L"SetupRecovery",\r
+                  &gEfiSetupVariableGuid,\r
+                  NULL,\r
+                  &VarSize,\r
+                  &SystemConfiguration\r
+                  );\r
+        ASSERT_EFI_ERROR (Status);\r
+      }      \r
 \r
       if (SystemConfiguration.FastBoot == 1) {\r
             BootMode = BOOT_WITH_MINIMAL_CONFIGURATION;\r
@@ -386,16 +399,16 @@ SetPlatformBootMode (
     // Recovery mode\r
     //\r
     CopyMem (&PlatformSetupId.SetupName,\r
-             SAFE_SETUP_NAME,\r
-             StrSize (SAFE_SETUP_NAME));\r
+             &NORMAL_SETUP_NAME,\r
+             StrSize (NORMAL_SETUP_NAME));    \r
     PlatformSetupId.PlatformBootMode = PLATFORM_RECOVERY_MODE;\r
   } else if (CheckIfSafeMode(PeiServices, PlatformInfoHob)) {\r
     //\r
     // Safe mode also called config mode or maintenace mode.\r
     //\r
     CopyMem (&PlatformSetupId.SetupName,\r
-             SAFE_SETUP_NAME,\r
-             StrSize (SAFE_SETUP_NAME));\r
+             &NORMAL_SETUP_NAME,\r
+             StrSize (NORMAL_SETUP_NAME));\r
     PlatformSetupId.PlatformBootMode = PLATFORM_SAFE_MODE;\r
 \r
   } else if(0) { // else if (CheckIfManufacturingMode(PeiServices)) {\r