]> git.proxmox.com Git - mirror_edk2.git/blobdiff - IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c
Add BootlogoOnly feature in BDS for BGRT
[mirror_edk2.git] / IntelFrameworkModulePkg / Universal / BdsDxe / MemoryTest.c
index 5dbc6342f5689ae717ba37bd3804c9724a83f784..09d1bc1ea5f6e579f478ad9bf9f9901cbf0de1d1 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Perform the platform memory test\r
 \r
-Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 2012, 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
@@ -280,14 +280,17 @@ BdsMemoryTest (
     FreePool (Pos);\r
     return EFI_SUCCESS;\r
   }\r
+  \r
+  if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {\r
+    TmpStr = GetStringById (STRING_TOKEN (STR_ESC_TO_SKIP_MEM_TEST));\r
 \r
-  TmpStr = GetStringById (STRING_TOKEN (STR_ESC_TO_SKIP_MEM_TEST));\r
-\r
-  if (TmpStr != NULL) {\r
-    PrintXY (10, 10, NULL, NULL, TmpStr);\r
-    FreePool (TmpStr);\r
+    if (TmpStr != NULL) {\r
+      PrintXY (10, 10, NULL, NULL, TmpStr);\r
+      FreePool (TmpStr);\r
+    }\r
+  } else {\r
+    DEBUG ((EFI_D_INFO, "Enter memory test.\n"));\r
   }\r
-\r
   do {\r
     Status = GenMemoryTest->PerformMemoryTest (\r
                               GenMemoryTest,\r
@@ -305,43 +308,25 @@ BdsMemoryTest (
 \r
       ASSERT (0);\r
     }\r
+    \r
+    if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {\r
+      TempData = (UINT32) DivU64x32 (TotalMemorySize, 16);\r
+      TestPercent = (UINTN) DivU64x32 (\r
+                              DivU64x32 (MultU64x32 (TestedMemorySize, 100), 16),\r
+                              TempData\r
+                              );\r
+      if (TestPercent != PreviousValue) {\r
+        UnicodeValueToString (StrPercent, 0, TestPercent, 0);\r
+        TmpStr = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT));\r
+        if (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
-    TempData = (UINT32) DivU64x32 (TotalMemorySize, 16);\r
-    TestPercent = (UINTN) DivU64x32 (\r
-                            DivU64x32 (MultU64x32 (TestedMemorySize, 100), 16),\r
-                            TempData\r
-                            );\r
-    if (TestPercent != PreviousValue) {\r
-      UnicodeValueToString (StrPercent, 0, TestPercent, 0);\r
-      TmpStr = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT));\r
-      if (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
-      TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST));\r
-      if (TmpStr != NULL) {\r
-        PlatformBdsShowProgress (\r
-          Foreground,\r
-          Background,\r
-          TmpStr,\r
-          Color,\r
-          TestPercent,\r
-          (UINTN) PreviousValue\r
-          );\r
-        FreePool (TmpStr);\r
-      }\r
-    }\r
-\r
-    PreviousValue = TestPercent;\r
-\r
-    KeyStatus     = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);\r
-    if (!EFI_ERROR (KeyStatus) && (Key.ScanCode == SCAN_ESC)) {\r
-      if (!RequireSoftECCInit) {\r
         TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST));\r
         if (TmpStr != NULL) {\r
           PlatformBdsShowProgress (\r
@@ -349,13 +334,37 @@ BdsMemoryTest (
             Background,\r
             TmpStr,\r
             Color,\r
-            100,\r
+            TestPercent,\r
             (UINTN) PreviousValue\r
             );\r
           FreePool (TmpStr);\r
         }\r
+      }\r
+\r
+      PreviousValue = TestPercent;\r
+    } else {\r
+      DEBUG ((EFI_D_INFO, "Perform memory test (ESC to skip).\n"));\r
+    }\r
 \r
-        PrintXY (10, 10, NULL, NULL, L"100");\r
+    KeyStatus     = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);\r
+    if (!EFI_ERROR (KeyStatus) && (Key.ScanCode == SCAN_ESC)) {\r
+      if (!RequireSoftECCInit) {\r
+        if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {\r
+          TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST));\r
+          if (TmpStr != NULL) {\r
+            PlatformBdsShowProgress (\r
+              Foreground,\r
+              Background,\r
+              TmpStr,\r
+              Color,\r
+              100,\r
+              (UINTN) PreviousValue\r
+              );\r
+            FreePool (TmpStr);\r
+          }\r
+\r
+          PrintXY (10, 10, NULL, NULL, L"100");\r
+        }\r
         Status = GenMemoryTest->Finished (GenMemoryTest);\r
         goto Done;\r
       }\r
@@ -367,29 +376,35 @@ BdsMemoryTest (
   Status = GenMemoryTest->Finished (GenMemoryTest);\r
 \r
 Done:\r
-  UnicodeValueToString (StrTotalMemory, COMMA_TYPE, TotalMemorySize, 0);\r
-  if (StrTotalMemory[0] == L',') {\r
-    StrTotalMemory++;\r
-  }\r
-\r
-  TmpStr = GetStringById (STRING_TOKEN (STR_MEM_TEST_COMPLETED));\r
-  if (TmpStr != NULL) {\r
-    StrCat (StrTotalMemory, TmpStr);\r
-    FreePool (TmpStr);\r
-  }\r
+  if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {\r
+    UnicodeValueToString (StrTotalMemory, COMMA_TYPE, TotalMemorySize, 0);\r
+    if (StrTotalMemory[0] == L',') {\r
+      StrTotalMemory++;\r
+    }\r
 \r
-  PrintXY (10, 10, NULL, NULL, StrTotalMemory);\r
-  PlatformBdsShowProgress (\r
-    Foreground,\r
-    Background,\r
-    StrTotalMemory,\r
-    Color,\r
-    100,\r
-    (UINTN) PreviousValue\r
-    );\r
+    TmpStr = GetStringById (STRING_TOKEN (STR_MEM_TEST_COMPLETED));\r
+    if (TmpStr != NULL) {\r
+      StrCat (StrTotalMemory, TmpStr);\r
+      FreePool (TmpStr);\r
+    }\r
 \r
+    PrintXY (10, 10, NULL, NULL, StrTotalMemory);\r
+    PlatformBdsShowProgress (\r
+      Foreground,\r
+      Background,\r
+      StrTotalMemory,\r
+      Color,\r
+      100,\r
+      (UINTN) PreviousValue\r
+      );\r
+    \r
+  } else {\r
+    DEBUG ((EFI_D_INFO, "%d bytes of system memory tested OK\r\n", TotalMemorySize));\r
+  }\r
+  \r
   FreePool (Pos);\r
 \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