]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c
IntelFrameworkModulePkg BdsDxe: Use PcdSet##S to replace PcdSet##
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / FrontPage.c
index f69b17c7bf3774bd09f48ad8d6dadf1de6215678..0a9238c2e7c8da87a81e6b9bff940f8bb51e72ed 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   FrontPage routines to handle the callbacks and browser calls\r
 \r
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2015, 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
@@ -395,13 +395,13 @@ InitializeFrontPage (
   //\r
   HiiHandle = gFrontPagePrivate.HiiHandle;\r
 \r
-  CurrentLang = GetEfiGlobalVariable (L"PlatformLang");\r
+  GetEfiGlobalVariable2 (L"PlatformLang", (VOID**)&CurrentLang, NULL);\r
 \r
   //\r
   // Get Support language list from variable.\r
   //\r
   if (mLanguageString == NULL){\r
-    mLanguageString = GetEfiGlobalVariable (L"PlatformLangCodes");\r
+    GetEfiGlobalVariable2 (L"PlatformLangCodes", (VOID**)&mLanguageString, NULL);\r
     if (mLanguageString == NULL) {\r
       mLanguageString = AllocateCopyPool (\r
                                  AsciiStrSize ((CHAR8 *) PcdGetPtr (PcdUefiVariableDefaultPlatformLangCodes)),\r
@@ -628,9 +628,9 @@ ConvertProcessorToString (
   StringBuffer = AllocateZeroPool (0x20);\r
   ASSERT (StringBuffer != NULL);\r
   Index = UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, FreqMhz / 1000, 3);\r
-  StrCat (StringBuffer, L".");\r
+  StrCatS (StringBuffer, 0x20 / sizeof (CHAR16), L".");\r
   UnicodeValueToString (StringBuffer + Index + 1, PREFIX_ZERO, (FreqMhz % 1000) / 10, 2);\r
-  StrCat (StringBuffer, L" GHz");\r
+  StrCatS (StringBuffer, 0x20 / sizeof (CHAR16), L" GHz");\r
   *String = (CHAR16 *) StringBuffer;\r
   return ;\r
 }\r
@@ -654,7 +654,7 @@ ConvertMemorySizeToString (
   StringBuffer = AllocateZeroPool (0x20);\r
   ASSERT (StringBuffer != NULL);\r
   UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, MemorySize, 6);\r
-  StrCat (StringBuffer, L" MB RAM");\r
+  StrCatS (StringBuffer, 0x20 / sizeof (CHAR16), L" MB RAM");\r
 \r
   *String = (CHAR16 *) StringBuffer;\r
 \r
@@ -891,64 +891,62 @@ ShowProgress (
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL Background;\r
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color;\r
 \r
-  if (TimeoutDefault == 0) {\r
-    return EFI_TIMEOUT;\r
-  }\r
-\r
-  DEBUG ((EFI_D_INFO, "\n\nStart showing progress bar... Press any key to stop it! ...Zzz....\n"));\r
-\r
-  SetMem (&Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);\r
-  SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);\r
-  SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);\r
-  \r
-  TmpStr = GetStringById (STRING_TOKEN (STR_START_BOOT_OPTION));\r
-\r
-  if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {\r
-    //\r
-    // Clear the progress status bar first\r
-    //\r
-    if (TmpStr != NULL) {\r
-      PlatformBdsShowProgress (Foreground, Background, TmpStr, Color, 0, 0);\r
-    }\r
-  }\r
-  \r
-\r
-  TimeoutRemain = TimeoutDefault;\r
-  while (TimeoutRemain != 0) {\r
-    DEBUG ((EFI_D_INFO, "Showing progress bar...Remaining %d second!\n", TimeoutRemain));\r
+  if (TimeoutDefault != 0) {\r
+    DEBUG ((EFI_D_INFO, "\n\nStart showing progress bar... Press any key to stop it! ...Zzz....\n"));\r
 \r
-    Status = WaitForSingleEvent (gST->ConIn->WaitForKey, ONE_SECOND);\r
-    if (Status != EFI_TIMEOUT) {\r
-      break;\r
-    }\r
-    TimeoutRemain--;\r
+    SetMem (&Foreground, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);\r
+    SetMem (&Background, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0x0);\r
+    SetMem (&Color, sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL), 0xff);\r
     \r
+    TmpStr = GetStringById (STRING_TOKEN (STR_START_BOOT_OPTION));\r
+\r
     if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {\r
       //\r
-      // Show progress\r
+      // Clear the progress status bar first\r
       //\r
       if (TmpStr != NULL) {\r
-        PlatformBdsShowProgress (\r
-          Foreground,\r
-          Background,\r
-          TmpStr,\r
-          Color,\r
-          ((TimeoutDefault - TimeoutRemain) * 100 / TimeoutDefault),\r
-          0\r
-          );\r
+        PlatformBdsShowProgress (Foreground, Background, TmpStr, Color, 0, 0);\r
       }\r
     }\r
-  }\r
-  \r
-  if (TmpStr != NULL) {\r
-    gBS->FreePool (TmpStr);\r
-  }\r
+    \r
 \r
-  //\r
-  // Timeout expired\r
-  //\r
-  if (TimeoutRemain == 0) {\r
-    return EFI_TIMEOUT;\r
+    TimeoutRemain = TimeoutDefault;\r
+    while (TimeoutRemain != 0) {\r
+      DEBUG ((EFI_D_INFO, "Showing progress bar...Remaining %d second!\n", TimeoutRemain));\r
+\r
+      Status = WaitForSingleEvent (gST->ConIn->WaitForKey, ONE_SECOND);\r
+      if (Status != EFI_TIMEOUT) {\r
+        break;\r
+      }\r
+      TimeoutRemain--;\r
+      \r
+      if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {\r
+        //\r
+        // Show progress\r
+        //\r
+        if (TmpStr != NULL) {\r
+          PlatformBdsShowProgress (\r
+            Foreground,\r
+            Background,\r
+            TmpStr,\r
+            Color,\r
+            ((TimeoutDefault - TimeoutRemain) * 100 / TimeoutDefault),\r
+            0\r
+            );\r
+        }\r
+      }\r
+    }\r
+    \r
+    if (TmpStr != NULL) {\r
+      gBS->FreePool (TmpStr);\r
+    }\r
+\r
+    //\r
+    // Timeout expired\r
+    //\r
+    if (TimeoutRemain == 0) {\r
+      return EFI_TIMEOUT;\r
+    }\r
   }\r
 \r
   //\r
@@ -1397,8 +1395,10 @@ BdsSetConsoleMode (
                   //\r
                   // Update text mode PCD.\r
                   //\r
-                  PcdSet32 (PcdConOutColumn, mSetupTextModeColumn);\r
-                  PcdSet32 (PcdConOutRow, mSetupTextModeRow);\r
+                  Status = PcdSet32S (PcdConOutColumn, mSetupTextModeColumn);\r
+                  ASSERT_EFI_ERROR (Status);\r
+                  Status = PcdSet32S (PcdConOutRow, mSetupTextModeRow);\r
+                  ASSERT_EFI_ERROR (Status);\r
                   FreePool (Info);\r
                   return EFI_SUCCESS;\r
                 }\r
@@ -1439,10 +1439,14 @@ BdsSetConsoleMode (
   // Set PCD to Inform GraphicsConsole to change video resolution.\r
   // Set PCD to Inform Consplitter to change text mode.\r
   //\r
-  PcdSet32 (PcdVideoHorizontalResolution, NewHorizontalResolution);\r
-  PcdSet32 (PcdVideoVerticalResolution, NewVerticalResolution);\r
-  PcdSet32 (PcdConOutColumn, NewColumns);\r
-  PcdSet32 (PcdConOutRow, NewRows);\r
+  Status = PcdSet32S (PcdVideoHorizontalResolution, NewHorizontalResolution);\r
+  ASSERT_EFI_ERROR (Status);\r
+  Status = PcdSet32S (PcdVideoVerticalResolution, NewVerticalResolution);\r
+  ASSERT_EFI_ERROR (Status);\r
+  Status = PcdSet32S (PcdConOutColumn, NewColumns);\r
+  ASSERT_EFI_ERROR (Status);\r
+  Status = PcdSet32S (PcdConOutRow, NewRows);\r
+  ASSERT_EFI_ERROR (Status);\r
   \r
   \r
   //\r