X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=IntelFrameworkModulePkg%2FUniversal%2FBdsDxe%2FFrontPage.c;h=9f4d32835771b0b4c85fc043499429d561b6906e;hb=9b82facd9cf6cb8b0d6ecacd2fc084f70650db62;hp=14a7ae29f4dd347bc6d04ebc7837aae1c5864420;hpb=44873d305668a9ca0e99ff6c73dff14e6cbde9af;p=mirror_edk2.git diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c index 14a7ae29f4..9f4d328357 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c @@ -1,7 +1,7 @@ /** @file FrontPage routines to handle the callbacks and browser calls -Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2016, 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 @@ -300,6 +300,7 @@ InitializeFrontPage ( EFI_STATUS Status; CHAR8 *LangCode; CHAR8 *Lang; + UINTN LangSize; CHAR8 *CurrentLang; UINTN OptionCount; CHAR16 *StringBuffer; @@ -448,9 +449,10 @@ InitializeFrontPage ( } if (EFI_ERROR (Status)) { - StringBuffer = AllocatePool (AsciiStrSize (Lang) * sizeof (CHAR16)); + LangSize = AsciiStrSize (Lang); + StringBuffer = AllocatePool (LangSize * sizeof (CHAR16)); ASSERT (StringBuffer != NULL); - AsciiStrToUnicodeStr (Lang, StringBuffer); + AsciiStrToUnicodeStrS (Lang, StringBuffer, LangSize); } ASSERT (StringBuffer != NULL); @@ -702,7 +704,7 @@ GetOptionalStringByIndex ( *String = GetStringById (STRING_TOKEN (STR_MISSING_STRING)); } else { *String = AllocatePool (StrSize * sizeof (CHAR16)); - AsciiStrToUnicodeStr (OptionalStrStart, *String); + AsciiStrToUnicodeStrS (OptionalStrStart, *String, StrSize); } return EFI_SUCCESS; @@ -720,7 +722,6 @@ UpdateFrontPageStrings ( { UINT8 StrIndex; CHAR16 *NewString; - BOOLEAN Find[5]; EFI_STATUS Status; EFI_STRING_ID TokenToUpdate; EFI_SMBIOS_HANDLE SmbiosHandle; @@ -730,8 +731,9 @@ UpdateFrontPageStrings ( SMBIOS_TABLE_TYPE4 *Type4Record; SMBIOS_TABLE_TYPE19 *Type19Record; EFI_SMBIOS_TABLE_HEADER *Record; - - ZeroMem (Find, sizeof (Find)); + UINT64 InstalledMemory; + + InstalledMemory = 0; // // Update Front Page strings @@ -743,12 +745,8 @@ UpdateFrontPageStrings ( ); if (!EFI_ERROR (Status)) { SmbiosHandle = SMBIOS_HANDLE_PI_RESERVED; - do { - Status = Smbios->GetNext (Smbios, &SmbiosHandle, NULL, &Record, NULL); - if (EFI_ERROR(Status)) { - break; - } - + Status = Smbios->GetNext (Smbios, &SmbiosHandle, NULL, &Record, NULL); + while (!EFI_ERROR(Status)) { if (Record->Type == EFI_SMBIOS_TYPE_BIOS_INFORMATION) { Type0Record = (SMBIOS_TABLE_TYPE0 *) Record; StrIndex = Type0Record->BiosVersion; @@ -756,7 +754,6 @@ UpdateFrontPageStrings ( TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_BIOS_VERSION); HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL); FreePool (NewString); - Find[0] = TRUE; } if (Record->Type == EFI_SMBIOS_TYPE_SYSTEM_INFORMATION) { @@ -766,7 +763,6 @@ UpdateFrontPageStrings ( TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_COMPUTER_MODEL); HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL); FreePool (NewString); - Find[1] = TRUE; } if (Record->Type == EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION) { @@ -776,7 +772,6 @@ UpdateFrontPageStrings ( TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_CPU_MODEL); HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL); FreePool (NewString); - Find[2] = TRUE; } if (Record->Type == EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION) { @@ -785,22 +780,29 @@ UpdateFrontPageStrings ( TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_CPU_SPEED); HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL); FreePool (NewString); - Find[3] = TRUE; } if ( Record->Type == EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS ) { Type19Record = (SMBIOS_TABLE_TYPE19 *) Record; - ConvertMemorySizeToString ( - (UINT32)(RShiftU64((Type19Record->EndingAddress - Type19Record->StartingAddress + 1), 10)), - &NewString - ); - TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE); - HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL); - FreePool (NewString); - Find[4] = TRUE; + if (Type19Record->StartingAddress != 0xFFFFFFFF ) { + InstalledMemory += RShiftU64(Type19Record->EndingAddress - + Type19Record->StartingAddress + 1, 10); + } else { + InstalledMemory += RShiftU64(Type19Record->ExtendedEndingAddress - + Type19Record->ExtendedStartingAddress + 1, 20); + } } - } while ( !(Find[0] && Find[1] && Find[2] && Find[3] && Find[4])); + + Status = Smbios->GetNext (Smbios, &SmbiosHandle, NULL, &Record, NULL); + } + + // now update the total installed RAM size + ConvertMemorySizeToString ((UINT32)InstalledMemory, &NewString ); + TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE); + HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL); + FreePool (NewString); } + return ; } @@ -1395,8 +1397,10 @@ BdsSetConsoleMode ( // // Update text mode PCD. // - PcdSet32 (PcdConOutColumn, mSetupTextModeColumn); - PcdSet32 (PcdConOutRow, mSetupTextModeRow); + Status = PcdSet32S (PcdConOutColumn, mSetupTextModeColumn); + ASSERT_EFI_ERROR (Status); + Status = PcdSet32S (PcdConOutRow, mSetupTextModeRow); + ASSERT_EFI_ERROR (Status); FreePool (Info); return EFI_SUCCESS; } @@ -1437,10 +1441,14 @@ BdsSetConsoleMode ( // Set PCD to Inform GraphicsConsole to change video resolution. // Set PCD to Inform Consplitter to change text mode. // - PcdSet32 (PcdVideoHorizontalResolution, NewHorizontalResolution); - PcdSet32 (PcdVideoVerticalResolution, NewVerticalResolution); - PcdSet32 (PcdConOutColumn, NewColumns); - PcdSet32 (PcdConOutRow, NewRows); + Status = PcdSet32S (PcdVideoHorizontalResolution, NewHorizontalResolution); + ASSERT_EFI_ERROR (Status); + Status = PcdSet32S (PcdVideoVerticalResolution, NewVerticalResolution); + ASSERT_EFI_ERROR (Status); + Status = PcdSet32S (PcdConOutColumn, NewColumns); + ASSERT_EFI_ERROR (Status); + Status = PcdSet32S (PcdConOutRow, NewRows); + ASSERT_EFI_ERROR (Status); //