]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Application/UiApp/FrontPage.c
Revert "EmulatorPkg: don't display the cpu current speed"
[mirror_edk2.git] / MdeModulePkg / Application / UiApp / FrontPage.c
index 1c0afa560a4628d4232c46389c577a9ea45a5f37..4b95cccb5cf534952fbc6f42cd44add51ec2c769 100644 (file)
@@ -1,14 +1,9 @@
 /** @file\r
   FrontPage routines to handle the callbacks and browser calls\r
 \r
-Copyright (c) 2004 - 2016, 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
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>\r
+(C) Copyright 2018 Hewlett Packard Enterprise Development LP<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -19,8 +14,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 EFI_GUID   mFrontPageGuid      = FRONT_PAGE_FORMSET_GUID;\r
 \r
-BOOLEAN   gConnectAllHappened = FALSE;\r
-BOOLEAN   mFeaturerSwitch = TRUE;\r
 BOOLEAN   mResetRequired  = FALSE;\r
 \r
 EFI_FORM_BROWSER2_PROTOCOL      *gFormBrowser2;\r
@@ -153,6 +146,8 @@ FakeRouteConfig (
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
+  *Progress = Configuration;\r
+\r
   return EFI_NOT_FOUND;\r
 }\r
 \r
@@ -400,7 +395,7 @@ ConvertProcessorToString (
 \r
   if (Base10Exponent >= 6) {\r
     FreqMhz = ProcessorFrequency;\r
-    for (Index = 0; Index < (UINTN) (Base10Exponent - 6); Index++) {\r
+    for (Index = 0; Index < (UINT32) Base10Exponent - 6; Index++) {\r
       FreqMhz *= 10;\r
     }\r
   } else {\r
@@ -409,9 +404,16 @@ ConvertProcessorToString (
   DestMax = 0x20 / sizeof (CHAR16);\r
   StringBuffer = AllocateZeroPool (0x20);\r
   ASSERT (StringBuffer != NULL);\r
-  Index = UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, FreqMhz / 1000, 3);\r
+  UnicodeValueToStringS (StringBuffer, sizeof (CHAR16) * DestMax, LEFT_JUSTIFY, FreqMhz / 1000, 3);\r
+  Index = StrnLenS (StringBuffer, DestMax);\r
   StrCatS (StringBuffer, DestMax, L".");\r
-  UnicodeValueToString (StringBuffer + Index + 1, PREFIX_ZERO, (FreqMhz % 1000) / 10, 2);\r
+  UnicodeValueToStringS (\r
+    StringBuffer + Index + 1,\r
+    sizeof (CHAR16) * (DestMax - (Index + 1)),\r
+    PREFIX_ZERO,\r
+    (FreqMhz % 1000) / 10,\r
+    2\r
+    );\r
   StrCatS (StringBuffer, DestMax, L" GHz");\r
   *String = (CHAR16 *) StringBuffer;\r
   return ;\r
@@ -435,7 +437,7 @@ ConvertMemorySizeToString (
 \r
   StringBuffer = AllocateZeroPool (0x24);\r
   ASSERT (StringBuffer != NULL);\r
-  UnicodeValueToString (StringBuffer, LEFT_JUSTIFY, MemorySize, 10);\r
+  UnicodeValueToStringS (StringBuffer, 0x24, LEFT_JUSTIFY, MemorySize, 10);\r
   StrCatS (StringBuffer, 0x24 / sizeof (CHAR16), L" MB RAM");\r
 \r
   *String = (CHAR16 *) StringBuffer;\r
@@ -484,7 +486,7 @@ GetOptionalStringByIndex (
     *String = GetStringById (STRING_TOKEN (STR_MISSING_STRING));\r
   } else {\r
     *String = AllocatePool (StrSize * sizeof (CHAR16));\r
-    AsciiStrToUnicodeStr (OptionalStrStart, *String);\r
+    AsciiStrToUnicodeStrS (OptionalStrStart, *String, StrSize);\r
   }\r
 \r
   return EFI_SUCCESS;\r
@@ -580,7 +582,7 @@ UpdateFrontPageBannerStrings (
   SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED;\r
   Status = Smbios->GetNext (Smbios, &SmbiosHandle, NULL, &Record, NULL);\r
   while (!EFI_ERROR(Status)) {\r
-    if (Record->Type == EFI_SMBIOS_TYPE_BIOS_INFORMATION) {\r
+    if (Record->Type == SMBIOS_TYPE_BIOS_INFORMATION) {\r
       Type0Record = (SMBIOS_TABLE_TYPE0 *) Record;\r
       StrIndex = Type0Record->BiosVersion;\r
       GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type0Record + Type0Record->Hdr.Length), StrIndex, &NewString);\r
@@ -598,7 +600,7 @@ UpdateFrontPageBannerStrings (
       }\r
     }\r
 \r
-    if (Record->Type == EFI_SMBIOS_TYPE_SYSTEM_INFORMATION) {\r
+    if (Record->Type == SMBIOS_TYPE_SYSTEM_INFORMATION) {\r
       Type1Record = (SMBIOS_TABLE_TYPE1 *) Record;\r
       StrIndex = Type1Record->ProductName;\r
       GetOptionalStringByIndex ((CHAR8*)((UINT8*)Type1Record + Type1Record->Hdr.Length), StrIndex, &NewString);\r
@@ -607,7 +609,7 @@ UpdateFrontPageBannerStrings (
       FreePool (NewString);\r
     }\r
 \r
-    if ((Record->Type == EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION) && !FoundCpu) {\r
+    if ((Record->Type == SMBIOS_TYPE_PROCESSOR_INFORMATION) && !FoundCpu) {\r
       Type4Record = (SMBIOS_TABLE_TYPE4 *) Record;\r
       //\r
       // The information in the record should be only valid when the CPU Socket is populated.\r
@@ -628,7 +630,7 @@ UpdateFrontPageBannerStrings (
       }\r
     }\r
 \r
-    if ( Record->Type == EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS ) {\r
+    if ( Record->Type == SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS ) {\r
       Type19Record = (SMBIOS_TABLE_TYPE19 *) Record;\r
       if (Type19Record->StartingAddress != 0xFFFFFFFF ) {\r
         InstalledMemory += RShiftU64(Type19Record->EndingAddress -\r
@@ -714,7 +716,7 @@ UiSetConsoleMode (
 \r
   if (IsSetupMode) {\r
     //\r
-    // The requried resolution and text mode is setup mode.\r
+    // The required resolution and text mode is setup mode.\r
     //\r
     NewHorizontalResolution = mSetupHorizontalResolution;\r
     NewVerticalResolution   = mSetupVerticalResolution;\r
@@ -770,7 +772,7 @@ UiSetConsoleMode (
             return EFI_SUCCESS;\r
           } else {\r
             //\r
-            // If current text mode is different from requried text mode.  Set new video mode\r
+            // If current text mode is different from required text mode.  Set new video mode\r
             //\r
             for (Index = 0; Index < MaxTextMode; Index++) {\r
               Status = SimpleTextOut->QueryMode (SimpleTextOut, Index, &CurrentColumn, &CurrentRow);\r
@@ -795,7 +797,7 @@ UiSetConsoleMode (
             }\r
             if (Index == MaxTextMode) {\r
               //\r
-              // If requried text mode is not supported, return error.\r
+              // If required text mode is not supported, return error.\r
               //\r
               FreePool (Info);\r
               return EFI_UNSUPPORTED;\r
@@ -990,9 +992,10 @@ UiEntry (
 \r
   //\r
   // Indicate if the connect all has been performed before.\r
+  // If has not been performed before, do here.\r
   //\r
-  if (ConnectAllHappened) {\r
-    gConnectAllHappened = TRUE;\r
+  if (!ConnectAllHappened) {\r
+    EfiBootManagerConnectAll ();\r
   }\r
 \r
   //\r
@@ -1032,34 +1035,7 @@ UiEntry (
 //\r
 \r
 \r
-/**\r
-  Enable the setup browser reset reminder feature.\r
-  This routine is used in platform tip. If the platform policy need the feature, use the routine to enable it.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-EnableResetReminderFeature (\r
-  VOID\r
-  )\r
-{\r
-  mFeaturerSwitch = TRUE;\r
-}\r
-\r
-\r
-/**\r
-  Disable the setup browser reset reminder feature.\r
-  This routine is used in platform tip. If the platform policy do not want the feature, use the routine to disable it.\r
 \r
-**/\r
-VOID\r
-EFIAPI\r
-DisableResetReminderFeature (\r
-  VOID\r
-  )\r
-{\r
-  mFeaturerSwitch = FALSE;\r
-}\r
 \r
 \r
 /**\r
@@ -1077,33 +1053,7 @@ EnableResetRequired (
 }\r
 \r
 \r
-/**\r
-  Record the info that  no reset is required.\r
-  A  module boolean variable is used to record whether a reset is required.\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-DisableResetRequired (\r
-  VOID\r
-  )\r
-{\r
-  mResetRequired = FALSE;\r
-}\r
-\r
-\r
-/**\r
-  Check whether platform policy enable the reset reminder feature. The default is enabled.\r
 \r
-**/\r
-BOOLEAN\r
-EFIAPI\r
-IsResetReminderFeatureEnable (\r
-  VOID\r
-  )\r
-{\r
-  return mFeaturerSwitch;\r
-}\r
 \r
 \r
 /**\r
@@ -1136,31 +1086,28 @@ SetupResetReminder (
   CHAR16                        *StringBuffer1;\r
   CHAR16                        *StringBuffer2;\r
 \r
-\r
   //\r
   //check any reset required change is applied? if yes, reset system\r
   //\r
-  if (IsResetReminderFeatureEnable ()) {\r
-    if (IsResetRequired ()) {\r
-\r
-      StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));\r
-      ASSERT (StringBuffer1 != NULL);\r
-      StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));\r
-      ASSERT (StringBuffer2 != NULL);\r
-      StrCpyS (StringBuffer1, MAX_STRING_LEN, L"Configuration changed. Reset to apply it Now.");\r
-      StrCpyS (StringBuffer2, MAX_STRING_LEN, L"Press ENTER to reset");\r
-      //\r
-      // Popup a menu to notice user\r
-      //\r
-      do {\r
-        CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL);\r
-      } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);\r
+  if (IsResetRequired ()) {\r
+\r
+    StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));\r
+    ASSERT (StringBuffer1 != NULL);\r
+    StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));\r
+    ASSERT (StringBuffer2 != NULL);\r
+    StrCpyS (StringBuffer1, MAX_STRING_LEN, L"Configuration changed. Reset to apply it Now.");\r
+    StrCpyS (StringBuffer2, MAX_STRING_LEN, L"Press ENTER to reset");\r
+    //\r
+    // Popup a menu to notice user\r
+    //\r
+    do {\r
+      CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, StringBuffer1, StringBuffer2, NULL);\r
+    } while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);\r
 \r
-      FreePool (StringBuffer1);\r
-      FreePool (StringBuffer2);\r
+    FreePool (StringBuffer1);\r
+    FreePool (StringBuffer2);\r
 \r
-      gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);\r
-    }\r
+    gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);\r
   }\r
 }\r
 \r