]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/Library/PlatformBootManagerLib/MemoryTest.c
Nt32Pkg: Remove it
[mirror_edk2.git] / Nt32Pkg / Library / PlatformBootManagerLib / MemoryTest.c
diff --git a/Nt32Pkg/Library/PlatformBootManagerLib/MemoryTest.c b/Nt32Pkg/Library/PlatformBootManagerLib/MemoryTest.c
deleted file mode 100644 (file)
index df0d56a..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-/** @file\r
-  Perform the platform memory test\r
-\r
-Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.<BR>\r
-SPDX-License-Identifier: BSD-2-Clause-Patent\r
-\r
-**/\r
-\r
-#include "PlatformBootManager.h"\r
-\r
-EFI_HII_HANDLE gStringPackHandle                  = NULL;\r
-EFI_GUID       mPlatformBootManagerStringPackGuid = {\r
-  0x154dd51, 0x9079, 0x4a10, { 0x89, 0x5c, 0x9c, 0x7, 0x72, 0x81, 0x57, 0x88 }\r
-  };\r
-// extern UINT8  BdsDxeStrings[];\r
-\r
-//\r
-// BDS Platform Functions\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
-  @retval EFI_STATUS    Success test all the system memory and update\r
-                        the memory resource\r
-\r
-**/\r
-EFI_STATUS\r
-PlatformBootManagerMemoryTest (\r
-  IN EXTENDMEM_COVERAGE_LEVEL Level\r
-  )\r
-{\r
-  EFI_STATUS                        Status;\r
-  EFI_STATUS                        KeyStatus;\r
-  EFI_STATUS                        InitStatus;\r
-  EFI_STATUS                        ReturnStatus;\r
-  BOOLEAN                           RequireSoftECCInit;\r
-  EFI_GENERIC_MEMORY_TEST_PROTOCOL  *GenMemoryTest;\r
-  UINT64                            TestedMemorySize;\r
-  UINT64                            TotalMemorySize;\r
-  UINTN                             TestPercent;\r
-  UINT64                            PreviousValue;\r
-  BOOLEAN                           ErrorOut;\r
-  BOOLEAN                           TestAbort;\r
-  EFI_INPUT_KEY                     Key;\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
-  UINT32                            TempData;\r
-  UINTN                             StrTotalMemorySize;\r
-\r
-  ReturnStatus = EFI_SUCCESS;\r
-  ZeroMem (&Key, sizeof (EFI_INPUT_KEY));\r
-\r
-  StrTotalMemorySize = 128;\r
-  Pos = AllocateZeroPool (StrTotalMemorySize);\r
-  ASSERT (Pos != NULL);\r
-\r
-  if (gStringPackHandle == NULL) {  \r
-    gStringPackHandle = HiiAddPackages (\r
-                           &mPlatformBootManagerStringPackGuid,\r
-                           gImageHandle,\r
-                           PlatformBootManagerLibStrings,\r
-                           NULL\r
-                           );\r
-    ASSERT (gStringPackHandle != NULL);\r
-  }\r
-\r
-  StrTotalMemory    = Pos;\r
-\r
-  TestedMemorySize  = 0;\r
-  TotalMemorySize   = 0;\r
-  PreviousValue     = 0;\r
-  ErrorOut          = FALSE;\r
-  TestAbort         = FALSE;\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
-  RequireSoftECCInit = FALSE;\r
-\r
-  Status = gBS->LocateProtocol (\r
-                  &gEfiGenericMemTestProtocolGuid,\r
-                  NULL,\r
-                  (VOID **) &GenMemoryTest\r
-                  );\r
-  if (EFI_ERROR (Status)) {\r
-    FreePool (Pos);\r
-    return EFI_SUCCESS;\r
-  }\r
-\r
-  InitStatus = GenMemoryTest->MemoryTestInit (\r
-                                GenMemoryTest,\r
-                                Level,\r
-                                &RequireSoftECCInit\r
-                                );\r
-  if (InitStatus == EFI_NO_MEDIA) {\r
-    //\r
-    // The PEI codes also have the relevant memory test code to check the memory,\r
-    // it can select to test some range of the memory or all of them. If PEI code\r
-    // checks all the memory, this BDS memory test will has no not-test memory to\r
-    // do the test, and then the status of EFI_NO_MEDIA will be returned by\r
-    // "MemoryTestInit". So it does not need to test memory again, just return.\r
-    //\r
-    FreePool (Pos);\r
-    return EFI_SUCCESS;\r
-  }\r
-  \r
-  if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {\r
-    TmpStr = HiiGetString (gStringPackHandle, STRING_TOKEN (STR_ESC_TO_SKIP_MEM_TEST), NULL);\r
-\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
-  do {\r
-    Status = GenMemoryTest->PerformMemoryTest (\r
-                              GenMemoryTest,\r
-                              &TestedMemorySize,\r
-                              &TotalMemorySize,\r
-                              &ErrorOut,\r
-                              TestAbort\r
-                              );\r
-    if (ErrorOut && (Status == EFI_DEVICE_ERROR)) {\r
-      TmpStr = HiiGetString (gStringPackHandle, STRING_TOKEN (STR_SYSTEM_MEM_ERROR), NULL);\r
-      if (TmpStr != NULL) {\r
-        PrintXY (10, 10, NULL, NULL, TmpStr);\r
-        FreePool (TmpStr);\r
-      }\r
-\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
-        UnicodeValueToStringS (StrPercent, sizeof (StrPercent), 0, TestPercent, 0);\r
-        TmpStr = HiiGetString (gStringPackHandle, STRING_TOKEN (STR_MEMORY_TEST_PERCENT), NULL);\r
-        if (TmpStr != NULL) {\r
-          //\r
-          // TmpStr size is 64, StrPercent is reserved to 16.\r
-          //\r
-          StrnCatS (\r
-            StrPercent,\r
-            sizeof (StrPercent) / sizeof (CHAR16), \r
-            TmpStr,\r
-            sizeof (StrPercent) / sizeof (CHAR16) - StrLen (StrPercent) - 1\r
-            );\r
-          PrintXY (10, 10, NULL, NULL, StrPercent);\r
-          FreePool (TmpStr);\r
-        }\r
-\r
-        TmpStr = HiiGetString (gStringPackHandle, STRING_TOKEN (STR_PERFORM_MEM_TEST), NULL);\r
-        if (TmpStr != NULL) {\r
-          BootLogoUpdateProgress (\r
-            Foreground,\r
-            Background,\r
-            TmpStr,\r
-            Color,\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
-    if (!PcdGetBool (PcdConInConnectOnDemand)) {\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 = HiiGetString (gStringPackHandle, STRING_TOKEN (STR_PERFORM_MEM_TEST), NULL);\r
-            if (TmpStr != NULL) {\r
-              BootLogoUpdateProgress (\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
-\r
-        TestAbort = TRUE;\r
-      }\r
-    }\r
-  } while (Status != EFI_NOT_FOUND);\r
-\r
-  Status = GenMemoryTest->Finished (GenMemoryTest);\r
-\r
-Done:\r
-  if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) {\r
-    UnicodeValueToStringS (StrTotalMemory, StrTotalMemorySize, COMMA_TYPE, TotalMemorySize, 0);\r
-    if (StrTotalMemory[0] == L',') {\r
-      StrTotalMemory++;\r
-      StrTotalMemorySize -= sizeof (CHAR16);\r
-    }\r
-\r
-    TmpStr = HiiGetString (gStringPackHandle, STRING_TOKEN (STR_MEM_TEST_COMPLETED), NULL);\r
-    if (TmpStr != NULL) {\r
-      StrnCatS (\r
-        StrTotalMemory,\r
-        StrTotalMemorySize / sizeof (CHAR16),\r
-        TmpStr,\r
-        StrTotalMemorySize / sizeof (CHAR16) - StrLen (StrTotalMemory) - 1\r
-        );\r
-      FreePool (TmpStr);\r
-    }\r
-\r
-    PrintXY (10, 10, NULL, NULL, StrTotalMemory);\r
-    BootLogoUpdateProgress (\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
-  return ReturnStatus;\r
-}\r