summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Warkentin <andrey.warkentin@gmail.com>2020-03-03 13:08:10 +0000
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2020-03-03 15:06:35 +0100
commit1501fb8aa0efeaeec443dd046976ac2836aaa642 (patch)
treecea78f5d862820d9da685412c667390ff46db13b
parent639b1d5fd9b6a64dad49085d6644255b814a9434 (diff)
Platform/RPi: Use GetModelInstalledMB () to read RAM size
Use the call introduced in the previous commit to read the platform's installed memory. Signed-off-by: Pete Batard <pete@akeo.ie> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
-rw-r--r--Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index f25c439f..5585cb84 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
+++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
@@ -870,21 +870,19 @@ MemArrMapInfoUpdateSmbiosType19 (
)
{
EFI_STATUS Status;
- UINT32 BoardRevision = 0;
+ UINT32 InstalledMB = 0;
// Note: Type 19 addresses are expressed in KB, not bytes
// The memory layout used in all known Pi SoC's starts at 0
mMemArrMapInfoType19.StartingAddress = 0;
+
// The minimum RAM size used on any Raspberry Pi model is 256 MB
mMemArrMapInfoType19.EndingAddress = 256 * 1024;
- Status = mFwProtocol->GetModelRevision (&BoardRevision);
+ Status = mFwProtocol->GetModelInstalledMB (&InstalledMB);
if (Status != EFI_SUCCESS) {
DEBUG ((DEBUG_WARN, "Couldn't get the board memory size - defaulting to 256 MB: %r\n", Status));
} else {
- // www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
- // Bits [20-22] indicate the amount of memory starting with 256MB (000b)
- // and doubling in size for each value (001b = 512 MB, 010b = 1GB, etc.)
- mMemArrMapInfoType19.EndingAddress <<= (BoardRevision >> 20) & 0x07;
+ mMemArrMapInfoType19.EndingAddress = InstalledMB * 1024;
}
mMemArrMapInfoType19.EndingAddress -= 1;