Update the BDS frontpage to pull the RAM ranges from the smbios extended size fields when applicable. The RAM calculation also needs to take into account all the RAM ranges being provided as many machines have multiple physical address ranges.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeremy Linton <jeremy.lin...@arm.com> --- .../Universal/BdsDxe/FrontPage.c | 45 +++++++++++----------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c index 0a9238c..451eeac 100644 --- a/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c +++ b/IntelFrameworkModulePkg/Universal/BdsDxe/FrontPage.c @@ -720,7 +720,6 @@ UpdateFrontPageStrings ( { UINT8 StrIndex; CHAR16 *NewString; - BOOLEAN Find[5]; EFI_STATUS Status; EFI_STRING_ID TokenToUpdate; EFI_SMBIOS_HANDLE SmbiosHandle; @@ -730,8 +729,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 +743,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 +752,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 +761,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 +770,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 +778,30 @@ 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 += Type19Record->EndingAddress - + Type19Record->StartingAddress; + } else { + InstalledMemory += Type19Record->ExtendedEndingAddress - + Type19Record->ExtendedStartingAddress; + } } - } 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 + InstalledMemory >>= 20; + ConvertMemorySizeToString ((UINT32)InstalledMemory, &NewString ); + TokenToUpdate = STRING_TOKEN (STR_FRONT_PAGE_MEMORY_SIZE); + HiiSetString (gFrontPagePrivate.HiiHandle, TokenToUpdate, NewString, NULL); + FreePool (NewString); } + return ; } -- 2.4.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel