X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=IntelFrameworkModulePkg%2FUniversal%2FBdsDxe%2FMemoryTest.c;h=410d4f1db66d75f3b3c54a42abc8c5362f6c3c40;hb=59ec2b00f98ffdd2f92306d23ec22ab05e1b199b;hp=854f8952c44bf340a2088e94c3561913e38b425f;hpb=08c4ca5bca647d1848cb803f03153ff6de4f8209;p=mirror_edk2.git diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c b/IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c index 854f8952c4..410d4f1db6 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c @@ -1,8 +1,8 @@ /** @file Perform the platform memory test -Copyright (c) 2004 - 2008, Intel Corporation.
-All rights reserved. This program and the accompanying materials +Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
+This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php @@ -193,18 +193,17 @@ PlatformBdsShowProgress ( } /** - Perform the memory test base on the memory test intensive level, and update the memory resource. + @param Level The memory test intensive level. - @param Level The memory test intensive level. - - @retval EFI_STATUS Success test all the system memory and update - the memory resource + @retval EFI_STATUS Success test all the system memory and update + the memory resource **/ EFI_STATUS +EFIAPI BdsMemoryTest ( IN EXTENDMEM_COVERAGE_LEVEL Level ) @@ -222,7 +221,7 @@ BdsMemoryTest ( BOOLEAN ErrorOut; BOOLEAN TestAbort; EFI_INPUT_KEY Key; - CHAR16 StrPercent[16]; + CHAR16 StrPercent[80]; CHAR16 *StrTotalMemory; CHAR16 *Pos; CHAR16 *TmpStr; @@ -255,10 +254,6 @@ BdsMemoryTest ( RequireSoftECCInit = FALSE; - gST->ConOut->ClearScreen (gST->ConOut); - gST->ConOut->SetAttribute (gST->ConOut, EFI_YELLOW | EFI_BRIGHT); - gST->ConOut->EnableCursor (gST->ConOut, FALSE); - Status = gBS->LocateProtocol ( &gEfiGenericMemTestProtocolGuid, NULL, @@ -285,15 +280,17 @@ BdsMemoryTest ( FreePool (Pos); return EFI_SUCCESS; } + + if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) { + TmpStr = GetStringById (STRING_TOKEN (STR_ESC_TO_SKIP_MEM_TEST)); - gST->ConOut->SetCursorPosition (gST->ConOut, 0, 2); - TmpStr = GetStringById (STRING_TOKEN (STR_ESC_TO_SKIP_MEM_TEST)); - - if (TmpStr != NULL) { - gST->ConOut->OutputString (gST->ConOut, TmpStr); - FreePool (TmpStr); + if (TmpStr != NULL) { + PrintXY (10, 10, NULL, NULL, TmpStr); + FreePool (TmpStr); + } + } else { + DEBUG ((EFI_D_INFO, "Enter memory test.\n")); } - do { Status = GenMemoryTest->PerformMemoryTest ( GenMemoryTest, @@ -306,47 +303,30 @@ BdsMemoryTest ( TmpStr = GetStringById (STRING_TOKEN (STR_SYSTEM_MEM_ERROR)); if (TmpStr != NULL) { PrintXY (10, 10, NULL, NULL, TmpStr); - gST->ConOut->SetCursorPosition (gST->ConOut, 0, 4); - gST->ConOut->OutputString (gST->ConOut, TmpStr); FreePool (TmpStr); } ASSERT (0); } + + if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) { + TempData = (UINT32) DivU64x32 (TotalMemorySize, 16); + TestPercent = (UINTN) DivU64x32 ( + DivU64x32 (MultU64x32 (TestedMemorySize, 100), 16), + TempData + ); + if (TestPercent != PreviousValue) { + UnicodeValueToString (StrPercent, 0, TestPercent, 0); + TmpStr = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT)); + if (TmpStr != NULL) { + // + // TmpStr size is 64, StrPercent is reserved to 16. + // + StrCat (StrPercent, TmpStr); + PrintXY (10, 10, NULL, NULL, StrPercent); + FreePool (TmpStr); + } - TempData = (UINT32) DivU64x32 (TotalMemorySize, 16); - TestPercent = (UINTN) DivU64x32 ( - DivU64x32 (MultU64x32 (TestedMemorySize, 100), 16), - TempData - ); - if (TestPercent != PreviousValue) { - UnicodeValueToString (StrPercent, 0, TestPercent, 0); - gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0); - TmpStr = GetStringById (STRING_TOKEN (STR_MEMORY_TEST_PERCENT)); - if (TmpStr != NULL) { - BdsLibOutputStrings (gST->ConOut, StrPercent, TmpStr, NULL); - FreePool (TmpStr); - } - - TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST)); - if (TmpStr != NULL) { - PlatformBdsShowProgress ( - Foreground, - Background, - TmpStr, - Color, - TestPercent, - (UINTN) PreviousValue - ); - FreePool (TmpStr); - } - } - - PreviousValue = TestPercent; - - KeyStatus = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); - if (!EFI_ERROR (KeyStatus) && (Key.ScanCode == SCAN_ESC)) { - if (!RequireSoftECCInit) { TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST)); if (TmpStr != NULL) { PlatformBdsShowProgress ( @@ -354,51 +334,79 @@ BdsMemoryTest ( Background, TmpStr, Color, - 100, + TestPercent, (UINTN) PreviousValue ); FreePool (TmpStr); } - - gST->ConOut->SetCursorPosition (gST->ConOut, 0, 0); - gST->ConOut->OutputString (gST->ConOut, L"100"); - Status = GenMemoryTest->Finished (GenMemoryTest); - goto Done; } - TestAbort = TRUE; + PreviousValue = TestPercent; + } else { + DEBUG ((EFI_D_INFO, "Perform memory test (ESC to skip).\n")); + } + + if (!PcdGetBool (PcdConInConnectOnDemand)) { + KeyStatus = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key); + if (!EFI_ERROR (KeyStatus) && (Key.ScanCode == SCAN_ESC)) { + if (!RequireSoftECCInit) { + if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) { + TmpStr = GetStringById (STRING_TOKEN (STR_PERFORM_MEM_TEST)); + if (TmpStr != NULL) { + PlatformBdsShowProgress ( + Foreground, + Background, + TmpStr, + Color, + 100, + (UINTN) PreviousValue + ); + FreePool (TmpStr); + } + + PrintXY (10, 10, NULL, NULL, L"100"); + } + Status = GenMemoryTest->Finished (GenMemoryTest); + goto Done; + } + + TestAbort = TRUE; + } } } while (Status != EFI_NOT_FOUND); Status = GenMemoryTest->Finished (GenMemoryTest); Done: - UnicodeValueToString (StrTotalMemory, COMMA_TYPE, TotalMemorySize, 0); - if (StrTotalMemory[0] == L',') { - StrTotalMemory++; - } - - TmpStr = GetStringById (STRING_TOKEN (STR_MEM_TEST_COMPLETED)); - if (TmpStr != NULL) { - StrCat (StrTotalMemory, TmpStr); - FreePool (TmpStr); - } + if (!FeaturePcdGet(PcdBootlogoOnlyEnable)) { + UnicodeValueToString (StrTotalMemory, COMMA_TYPE, TotalMemorySize, 0); + if (StrTotalMemory[0] == L',') { + StrTotalMemory++; + } - gST->ConOut->ClearScreen (gST->ConOut); - gST->ConOut->SetAttribute (gST->ConOut, EFI_YELLOW | EFI_BRIGHT); - gST->ConOut->EnableCursor (gST->ConOut, FALSE); - gST->ConOut->OutputString (gST->ConOut, StrTotalMemory); - PlatformBdsShowProgress ( - Foreground, - Background, - StrTotalMemory, - Color, - 100, - (UINTN) PreviousValue - ); + TmpStr = GetStringById (STRING_TOKEN (STR_MEM_TEST_COMPLETED)); + if (TmpStr != NULL) { + StrCat (StrTotalMemory, TmpStr); + FreePool (TmpStr); + } + PrintXY (10, 10, NULL, NULL, StrTotalMemory); + PlatformBdsShowProgress ( + Foreground, + Background, + StrTotalMemory, + Color, + 100, + (UINTN) PreviousValue + ); + + } else { + DEBUG ((EFI_D_INFO, "%d bytes of system memory tested OK\r\n", TotalMemorySize)); + } + FreePool (Pos); + // // Use a DynamicHii type pcd to save the boot status, which is used to // control configuration mode, such as FULL/MINIMAL/NO_CHANGES configuration.