]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c
1. PI SMBIOS Checkin. Major change include:
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / MemoryTest.c
index fabdf243108b760f676b9e5502fe7b3957e6a6b3..19a505e2b7d8e21fe8d5f955a91b803ac9e16029 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Perform the platform memory test\r
 \r
-Copyright (c) 2004 - 2008, Intel Corporation. <BR>\r
+Copyright (c) 2004 - 2009, Intel Corporation. <BR>\r
 All rights reserved. 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
@@ -193,15 +193,13 @@ PlatformBdsShowProgress (
 }\r
 \r
 /**\r
-\r
   Perform the memory test base on the memory test intensive level,\r
   and update the memory resource.\r
 \r
+  @param  Level         The memory test intensive level.\r
 \r
-  @param Level           The memory test intensive level.\r
-\r
-  @retval  EFI_STATUS       Success test all the system memory and update\r
-                            the memory resource\r
+  @retval EFI_STATUS    Success test all the system memory and update\r
+                        the memory resource\r
 \r
 **/\r
 EFI_STATUS\r
@@ -222,16 +220,14 @@ BdsMemoryTest (
   BOOLEAN                           ErrorOut;\r
   BOOLEAN                           TestAbort;\r
   EFI_INPUT_KEY                     Key;\r
-  CHAR16                            StrPercent[16];\r
+  CHAR16                            StrPercent[80];\r
   CHAR16                            *StrTotalMemory;\r
   CHAR16                            *Pos;\r
   CHAR16                            *TmpStr;\r
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL     Foreground;\r
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL     Background;\r
   EFI_GRAPHICS_OUTPUT_BLT_PIXEL     Color;\r
-  UINT8                             Value;\r
-  UINTN                             DataSize;\r
-  UINT32                            Attributes;\r
+  BOOLEAN                           IsFirstBoot;\r
   UINT32                            TempData;\r
 \r
   ReturnStatus = EFI_SUCCESS;\r
@@ -257,10 +253,6 @@ BdsMemoryTest (
 \r
   RequireSoftECCInit = FALSE;\r
 \r
-  gST->ConOut->ClearScreen (gST->ConOut);\r
-  gST->ConOut->SetAttribute (gST->ConOut, EFI_YELLOW | EFI_BRIGHT);\r
-  gST->ConOut->EnableCursor (gST->ConOut, FALSE);\r
-\r
   Status = gBS->LocateProtocol (\r
                   &gEfiGenericMemTestProtocolGuid,\r
                   NULL,\r
@@ -288,11 +280,10 @@ BdsMemoryTest (
     return EFI_SUCCESS;\r
   }\r
 \r
-  gST->ConOut->SetCursorPosition (gST->ConOut, 0, 2);\r
   TmpStr = GetStringById (STRING_TOKEN (STR_ESC_TO_SKIP_MEM_TEST));\r
 \r
   if (TmpStr != NULL) {\r
-    gST->ConOut->OutputString (gST->ConOut, TmpStr);\r
+    PrintXY (10, 10, NULL, NULL, TmpStr);\r
     FreePool (TmpStr);\r
   }\r
 \r
@@ -308,8 +299,6 @@ BdsMemoryTest (
       TmpStr = GetStringById (STRING_TOKEN (STR_SYSTEM_MEM_ERROR));\r
       if (TmpStr != NULL) {\r
         PrintXY (10, 10, NULL, NULL, TmpStr);\r
-        gST->ConOut->SetCursorPosition (gST->ConOut, 0, 4);\r
-        gST->ConOut->OutputString (gST->ConOut, TmpStr);\r
         FreePool (TmpStr);\r
       }\r
 \r
@@ -323,10 +312,13 @@ BdsMemoryTest (
                             );\r
     if (TestPercent != PreviousValue) {\r
       UnicodeValueToString (StrPercent, 0, TestPercent, 0);\r
-      gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0);\r
       TmpStr = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT));\r
       if (TmpStr != NULL) {\r
-        BdsLibOutputStrings (gST->ConOut, StrPercent, TmpStr, NULL);\r
+        //\r
+        // TmpStr size is 64, StrPercent is reserved to 16.\r
+        //\r
+        StrCat (StrPercent, TmpStr);\r
+        PrintXY (10, 10, NULL, NULL, StrPercent);\r
         FreePool (TmpStr);\r
       }\r
 \r
@@ -362,8 +354,7 @@ BdsMemoryTest (
           FreePool (TmpStr);\r
         }\r
 \r
-        gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0);\r
-        gST->ConOut->OutputString (gST->ConOut, L"100");\r
+        PrintXY (10, 10, NULL, NULL, L"100");\r
         Status = GenMemoryTest->Finished (GenMemoryTest);\r
         goto Done;\r
       }\r
@@ -386,10 +377,7 @@ Done:
     FreePool (TmpStr);\r
   }\r
 \r
-  gST->ConOut->ClearScreen (gST->ConOut);\r
-  gST->ConOut->SetAttribute (gST->ConOut, EFI_YELLOW | EFI_BRIGHT);\r
-  gST->ConOut->EnableCursor (gST->ConOut, FALSE);\r
-  gST->ConOut->OutputString (gST->ConOut, StrTotalMemory);\r
+  PrintXY (10, 10, NULL, NULL, StrTotalMemory);\r
   PlatformBdsShowProgress (\r
     Foreground,\r
     Background,\r
@@ -401,24 +389,13 @@ Done:
 \r
   FreePool (Pos);\r
 \r
-  DataSize = sizeof (Value);\r
-  Status = gRT->GetVariable (\r
-                  L"BootState",\r
-                  &gEfiBootStateGuid,\r
-                  &Attributes,\r
-                  &DataSize,\r
-                  &Value\r
-                  );\r
-\r
-  if (EFI_ERROR (Status)) {\r
-    Value = 1;\r
-    gRT->SetVariable (\r
-          L"BootState",\r
-          &gEfiBootStateGuid,\r
-          EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
-          sizeof (Value),\r
-          &Value\r
-          );\r
+  //\r
+  // Use a DynamicHii type pcd to save the boot status, which is used to\r
+  // control configuration mode, such as FULL/MINIMAL/NO_CHANGES configuration.\r
+  //\r
+  IsFirstBoot = PcdGetBool(PcdBootState);\r
+  if (IsFirstBoot) {\r
+    PcdSetBool(PcdBootState, FALSE);\r
   }\r
 \r
   return ReturnStatus;\r