X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=sidebyside;f=IntelFrameworkModulePkg%2FUniversal%2FBdsDxe%2FMemoryTest.c;h=fedb151a0c63bb3195a70af2e81d6fb7c0ccb3f9;hb=83daa931dc58e708ac446271a2883d6b73bd77ae;hp=09d1bc1ea5f6e579f478ad9bf9f9901cbf0de1d1;hpb=2df686c67c7819e01a1487dd703faffef2b59dce;p=mirror_edk2.git diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c b/IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c index 09d1bc1ea5..fedb151a0c 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/MemoryTest.c @@ -1,7 +1,7 @@ /** @file Perform the platform memory test -Copyright (c) 2004 - 2012, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2015, 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 @@ -230,11 +230,13 @@ BdsMemoryTest ( EFI_GRAPHICS_OUTPUT_BLT_PIXEL Color; BOOLEAN IsFirstBoot; UINT32 TempData; + UINTN StrTotalMemorySize; ReturnStatus = EFI_SUCCESS; ZeroMem (&Key, sizeof (EFI_INPUT_KEY)); - Pos = AllocatePool (128); + StrTotalMemorySize = 128; + Pos = AllocateZeroPool (StrTotalMemorySize); if (Pos == NULL) { return ReturnStatus; @@ -322,7 +324,12 @@ BdsMemoryTest ( // // TmpStr size is 64, StrPercent is reserved to 16. // - StrCat (StrPercent, TmpStr); + StrnCatS ( + StrPercent, + sizeof (StrPercent) / sizeof (CHAR16), + TmpStr, + sizeof (StrPercent) / sizeof (CHAR16) - StrLen (StrPercent) - 1 + ); PrintXY (10, 10, NULL, NULL, StrPercent); FreePool (TmpStr); } @@ -346,30 +353,32 @@ BdsMemoryTest ( DEBUG ((EFI_D_INFO, "Perform memory test (ESC to skip).\n")); } - 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); + 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"); } - - PrintXY (10, 10, NULL, NULL, L"100"); + Status = GenMemoryTest->Finished (GenMemoryTest); + goto Done; } - Status = GenMemoryTest->Finished (GenMemoryTest); - goto Done; - } - TestAbort = TRUE; + TestAbort = TRUE; + } } } while (Status != EFI_NOT_FOUND); @@ -380,11 +389,17 @@ Done: UnicodeValueToString (StrTotalMemory, COMMA_TYPE, TotalMemorySize, 0); if (StrTotalMemory[0] == L',') { StrTotalMemory++; + StrTotalMemorySize -= sizeof (CHAR16); } TmpStr = GetStringById (STRING_TOKEN (STR_MEM_TEST_COMPLETED)); if (TmpStr != NULL) { - StrCat (StrTotalMemory, TmpStr); + StrnCatS ( + StrTotalMemory, + StrTotalMemorySize / sizeof (CHAR16), + TmpStr, + StrTotalMemorySize / sizeof (CHAR16) - StrLen (StrTotalMemory) - 1 + ); FreePool (TmpStr); }