]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
Report the setting variable failure to platform through the status code when core...
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / FrontPage.c
index da0e17b38daab41e88c0fe3f8254ae2f9fb6217f..3bbe71a8fe7c0082d80648022f30f4615f3a6c18 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   FrontPage routines to handle the callbacks and browser calls\r
 \r
-Copyright (c) 2004 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -182,7 +182,6 @@ FrontPageCallback (
   CHAR8                         *LangCode;\r
   CHAR8                         *Lang;\r
   UINTN                         Index;\r
-  EFI_STATUS                    Status;\r
 \r
   if (Action != EFI_BROWSER_ACTION_CHANGING && Action != EFI_BROWSER_ACTION_CHANGED) {\r
     //\r
@@ -226,14 +225,13 @@ FrontPageCallback (
       }\r
 \r
       if (Index == Value->u8) {\r
-        Status = gRT->SetVariable (\r
+        BdsDxeSetVariableAndReportStatusCodeOnError (\r
                         L"PlatformLang",\r
                         &gEfiGlobalVariableGuid,\r
                         EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS,\r
                         AsciiStrSize (Lang),\r
                         Lang\r
                         );\r
-        ASSERT_EFI_ERROR(Status);\r
       } else {\r
         ASSERT (FALSE);\r
       }\r
@@ -399,10 +397,10 @@ InitializeFrontPage (
 \r
   CurrentLang = GetEfiGlobalVariable (L"PlatformLang");\r
 \r
-  if (gFrontPagePrivate.LanguageToken == NULL) {\r
-    //\r
-    // Get Support language list from variable.\r
-    //\r
+  //\r
+  // Get Support language list from variable.\r
+  //\r
+  if (mLanguageString == NULL){\r
     mLanguageString = GetEfiGlobalVariable (L"PlatformLangCodes");\r
     if (mLanguageString == NULL) {\r
       mLanguageString = AllocateCopyPool (\r
@@ -411,7 +409,9 @@ InitializeFrontPage (
                                  );\r
       ASSERT (mLanguageString != NULL);\r
     }\r
+  }\r
 \r
+  if (gFrontPagePrivate.LanguageToken == NULL) {\r
     //\r
     // Count the language list number.\r
     //  \r
@@ -1093,6 +1093,9 @@ PlatformBdsEnterFrontPage (
                     sizeof(UINT64),\r
                     &OsIndication\r
                     );\r
+    //\r
+    // Changing the content without increasing its size with current variable implementation shouldn't fail.\r
+    //\r
     ASSERT_EFI_ERROR (Status);\r
 \r
     //\r
@@ -1223,6 +1226,7 @@ PlatformBdsEnterFrontPage (
 \r
   if (mLanguageString != NULL) {\r
     FreePool (mLanguageString);\r
+    mLanguageString = NULL;\r
   }\r
   //\r
   //Will leave browser, check any reset required change is applied? if yes, reset system\r