public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Pete Batard" <pete@akeo.ie>
To: devel@edk2.groups.io
Cc: ard.biesheuvel@linaro.org, leif@nuviainc.com, philmd@redhat.com,
	awarkentin@vmware.com
Subject: [edk2-devel][PATCH v2 2/6] Platform/RPi: Use GetModelInstalledMB () to read RAM size
Date: Tue,  3 Mar 2020 13:08:10 +0000	[thread overview]
Message-ID: <20200303130814.3092-3-pete@akeo.ie> (raw)
In-Reply-To: <20200303130814.3092-1-pete@akeo.ie>

From: Andrei Warkentin <andrey.warkentin@gmail.com>

Use the call introduced in the previous commit to read the
platform's installed memory.

Signed-off-by: Pete Batard <pete@akeo.ie>
---
 Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c
index f25c439f89c8..5585cb846f41 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;
 
-- 
2.21.0.windows.1


  parent reply	other threads:[~2020-03-03 13:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-03 13:08 [edk2-devel][PATCH v2 0/6] Platform/RPi: User config improvements Pete Batard
2020-03-03 13:08 ` [edk2-devel][PATCH v2 1/6] Platform/RPi: Add firmware call to read installed memory size Pete Batard
2020-03-03 13:08 ` Pete Batard [this message]
2020-03-03 13:08 ` [edk2-devel][PATCH v2 3/6] Platform/RPi: Separate RAM descriptors between 0-3 GB and 3+ GB Pete Batard
2020-03-03 13:08 ` [edk2-devel][PATCH v2 4/6] Platform/RPi: Make 3GB/4GB a runtime (BIOS setup) choice Pete Batard
2020-03-03 13:08 ` [edk2-devel][PATCH v2 5/6] Platform/RPi: Make Device Tree provision " Pete Batard
2020-03-03 13:08 ` [edk2-devel][PATCH v2 6/6] Platform/RPi/ConfigDxe: Improve RPi configuration form Pete Batard
2020-03-03 16:17   ` Andrei Warkentin
     [not found]   ` <15F8D78E42129034.31276@groups.io>
2020-03-03 16:20     ` Andrei Warkentin
2020-03-03 14:07 ` [edk2-devel][PATCH v2 0/6] Platform/RPi: User config improvements Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200303130814.3092-3-pete@akeo.ie \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox