From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by mx.groups.io with SMTP id smtpd.web12.3385.1583240911694790036 for ; Tue, 03 Mar 2020 05:08:32 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@akeo-ie.20150623.gappssmtp.com header.s=20150623 header.b=Qd+cbtGl; spf=none, err=permanent DNS error (domain: akeo.ie, ip: 209.85.221.66, mailfrom: pete@akeo.ie) Received: by mail-wr1-f66.google.com with SMTP id j16so4283299wrt.3 for ; Tue, 03 Mar 2020 05:08:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=akeo-ie.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=gbsqssr79uyZyUvyJP/24SoBM1Opr2BnUS9rPy6uTO4=; b=Qd+cbtGlYffU3/+r/3fla+Udux8SPwubGdGbojihxAbV/EET+QzcxuMt7yAWSQNEEB nPrY/+TXSsD+I2U/L3e+L8+UfmV3dR97dIP447fI6xmK1A8Pft+BalLTazjI/gStfxZT GMQ93gpxrQn6iNnaizWgP95RHwftqIDvR/o4WBqjWjZws0afIBd/sB9IVC3XOk6qr74U pB8lsOJbBoGS7BtqsQvxaaa0aAZeqm+MbbtrCC0cUm12Vz9qrgd7wrfAHIo9Ryn+g3nb 6IiH1cAziUQvRq0UqiHTtHhXGHZR9/wtLXorl6zuyyiHG7ZqgbkivVAete3+s/utbSE4 wbQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=gbsqssr79uyZyUvyJP/24SoBM1Opr2BnUS9rPy6uTO4=; b=G1fSoPyq3DZxOxmbpa6FIOfKhq87YZlE8JN+nEpzBPQvAJyH+Hlyqol/31WeDWOMTX 9L9BQrjQN5ovS0hNAVk8PP7SyxNzNq+DZXM1ehiUz/7+OL9JfVPfT5PVjvQt8HPCTpYf f9bCzlxfbBI+9O3Gc5VAxZw+D8cKWErxwvzYgORfzQxZF2EDpi00zNmiTLy1trdsTx6v 8uORyILkWrHM8gP5tvU8nceRVvnXfhW7HCeZJ3dEcaK9s+Y11zLXxTIqFN+K7GXYigBW 6LV3xLPGKNhO+jMDKEEpm7I6fQRcLFpRHOm5DM2gMKkZ01LZkJgS0fy8TwgUAbpXP34H lxQQ== X-Gm-Message-State: ANhLgQ0GUHl3t6yK9CtA1Q/+2I8pRmgo6kpEqBybwWIA9EEFu0jabGd5 K4VOKhx5MCkKt8oZKk64mTlzsNYou88= X-Google-Smtp-Source: ADFU+vuc59VV6BfDCnKJZeCzk2COJ7MU/4KZt2YM+4rhIOxiQeavOWr/0IDgE6ZEpf3HdZ34XLfs7w== X-Received: by 2002:adf:f407:: with SMTP id g7mr5768672wro.178.1583240910025; Tue, 03 Mar 2020 05:08:30 -0800 (PST) Return-Path: Received: from localhost.localdomain ([84.203.56.244]) by smtp.gmail.com with ESMTPSA id j5sm3907620wmi.33.2020.03.03.05.08.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Mar 2020 05:08:29 -0800 (PST) From: "Pete Batard" 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 Message-Id: <20200303130814.3092-3-pete@akeo.ie> X-Mailer: git-send-email 2.21.0.windows.1 In-Reply-To: <20200303130814.3092-1-pete@akeo.ie> References: <20200303130814.3092-1-pete@akeo.ie> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Andrei Warkentin Use the call introduced in the previous commit to read the platform's installed memory. Signed-off-by: Pete Batard --- 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