From nobody Tue Feb 10 20:49:04 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+55304+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+55304+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1583231636; cv=none; d=zohomail.com; s=zohoarc; b=Z+0ar6LQin/PePhf9LqAV/omIB2xoXiD7rGvtB1iY9dhZBYRdE7+/PgqUIaONAMsSwYjPfLI7F/Vi90b5YrjuQWHeBuximQEM3msU4G0XeR8vBKtG7FX4St0R3+YkjG8tXJe/llnOvlzo/InELNwV0t5NbtTcFMpzuBOWoL5rLI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583231636; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=gECo1qk4TbqgDbNl2qwch0T20BfZSFRXa8Q+f6d9s4U=; b=itpMLrjDt0eJavhimSvCoDzhzQe4V6vebkbWz7GWbdACG8Ps/h/F5rqGCHsq1JKOBHAzSrCNJKfIaxm4jiPbjz1pQiq/Yco446WzG15OGbyofztKrRntW44pGD4Atr4nkC2199F+g3CGEfL7Fe9OzVU/tcSfxs9d1ZtchfiRktA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+55304+1787277+3901457@groups.io Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 158323163651180.35768000988651; Tue, 3 Mar 2020 02:33:56 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id SKN0YY1788612xhKHDUokuoC; Tue, 03 Mar 2020 02:33:55 -0800 X-Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by mx.groups.io with SMTP id smtpd.web11.1945.1583231634837799756 for ; Tue, 03 Mar 2020 02:33:55 -0800 X-Received: by mail-wm1-f66.google.com with SMTP id a141so2282890wme.2 for ; Tue, 03 Mar 2020 02:33:54 -0800 (PST) X-Gm-Message-State: Ddi7mIfuCFeIA0V4st1l6BEbx1787277AA= X-Google-Smtp-Source: ADFU+vtRTBQ8Vwjysyg5UXr6hL4YSMrzkZCMPPrjMzmfoHsg3YDVIsPCmOrR3E7jgNe15qXjOXG8kg== X-Received: by 2002:a1c:1d84:: with SMTP id d126mr3538676wmd.187.1583231632940; Tue, 03 Mar 2020 02:33:52 -0800 (PST) X-Received: from localhost.localdomain ([84.203.56.244]) by smtp.gmail.com with ESMTPSA id c4sm3255193wml.7.2020.03.03.02.33.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Mar 2020 02:33:52 -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 1/5] Platform/RPi: Add firmware call to read installed memory size Date: Tue, 3 Mar 2020 10:33:35 +0000 Message-Id: <20200303103339.7468-2-pete@akeo.ie> In-Reply-To: <20200303103339.7468-1-pete@akeo.ie> References: <20200303103339.7468-1-pete@akeo.ie> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pete@akeo.ie Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1583231635; bh=P3yQS2Wmp4EN0eRHywHT2wDolT85zi9ecXz0cAUz9lY=; h=Cc:Date:From:Reply-To:Subject:To; b=BN5BbpMq8S9X7VxtAnt0ENXtibcy1qtI3K6BqfNhuNMRZOVYmI14OPMsUmZsVOGV/aB JoqX0BNE5jmgKVTE3aUIGJMaad1Ab2jEMy0xgYODO/kOsYWB4pppY3Z0KxEM1fIEeGC3J iXNVQVykiz7XzqJMrXP+pR1yRWueabKpW0E= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Andrei Warkentin Add a new RPiFirmwareGetModelInstalledMB () call in RpiFirmwareDxe to return the amount of detected installed RAM on the system (in MB). Use the new call in PlatformSmbiosDxe. Signed-off-by: Pete Batard --- Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 10 ++= --- Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c | 29 ++= +++++++++- Platform/RaspberryPi/Include/Protocol/RpiFirmware.h | 47 ++= +++++++++--------- 3 files changed, 59 insertions(+), 27 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosD= xe.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 =3D 0; + UINT32 InstalledMB =3D 0; =20 // 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 =3D 0; + // The minimum RAM size used on any Raspberry Pi model is 256 MB mMemArrMapInfoType19.EndingAddress =3D 256 * 1024; - Status =3D mFwProtocol->GetModelRevision (&BoardRevision); + Status =3D mFwProtocol->GetModelInstalledMB (&InstalledMB); if (Status !=3D EFI_SUCCESS) { DEBUG ((DEBUG_WARN, "Couldn't get the board memory size - defaulting t= o 256 MB: %r\n", Status)); } else { - // www.raspberrypi.org/documentation/hardware/raspberrypi/revision-cod= es/README.md - // Bits [20-22] indicate the amount of memory starting with 256MB (000= b) - // and doubling in size for each value (001b =3D 512 MB, 010b =3D 1GB,= etc.) - mMemArrMapInfoType19.EndingAddress <<=3D (BoardRevision >> 20) & 0x07; + mMemArrMapInfoType19.EndingAddress =3D InstalledMB * 1024; } mMemArrMapInfoType19.EndingAddress -=3D 1; =20 diff --git a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c b= /Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c index 75826fdc0e53..40c78b5d57cf 100644 --- a/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c +++ b/Platform/RaspberryPi/Drivers/RpiFirmwareDxe/RpiFirmwareDxe.c @@ -606,6 +606,32 @@ RpiFirmwareGetModelName ( } } =20 +STATIC +EFI_STATUS +EFIAPI +RPiFirmwareGetModelInstalledMB ( + OUT UINT32 *InstalledMB + ) +{ + EFI_STATUS Status; + UINT32 Revision; + + Status =3D RpiFirmwareGetModelRevision(&Revision); + if (EFI_ERROR(Status)) { + DEBUG ((DEBUG_ERROR, "%a: Could not get the board revision: Status =3D= =3D %r\n", + __FUNCTION__, Status)); + return EFI_DEVICE_ERROR; + } + + // + // 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 =3D 512 MB, 010b =3D 1GB, e= tc.) + // + *InstalledMB =3D 256 << ((Revision >> 20) & 0x07); + return EFI_SUCCESS; +} + STATIC EFI_STATUS EFIAPI @@ -1236,7 +1262,8 @@ STATIC RASPBERRY_PI_FIRMWARE_PROTOCOL mRpiFirmwarePro= tocol =3D { RpiFirmwareGetFirmwareRevision, RpiFirmwareGetManufacturerName, RpiFirmwareGetCpuName, - RpiFirmwareGetArmMemory + RpiFirmwareGetArmMemory, + RPiFirmwareGetModelInstalledMB, }; =20 /** diff --git a/Platform/RaspberryPi/Include/Protocol/RpiFirmware.h b/Platform= /RaspberryPi/Include/Protocol/RpiFirmware.h index e3287e3c040f..108becbd3b6d 100644 --- a/Platform/RaspberryPi/Include/Protocol/RpiFirmware.h +++ b/Platform/RaspberryPi/Include/Protocol/RpiFirmware.h @@ -115,6 +115,12 @@ EFI_STATUS UINT32 *Revision ); =20 +typedef +EFI_STATUS +(EFIAPI *GET_MODEL_INSTALLED_MB) ( + UINT32 *InstalledMB + ); + typedef CHAR8* (EFIAPI *GET_MANUFACTURER_NAME) ( @@ -135,26 +141,27 @@ EFI_STATUS ); =20 typedef struct { - SET_POWER_STATE SetPowerState; - GET_MAC_ADDRESS GetMacAddress; - GET_COMMAND_LINE GetCommandLine; - GET_CLOCK_RATE GetClockRate; - GET_CLOCK_RATE GetMaxClockRate; - GET_CLOCK_RATE GetMinClockRate; - SET_CLOCK_RATE SetClockRate; - GET_FB GetFB; - FREE_FB FreeFB; - GET_FB_SIZE GetFBSize; - SET_LED SetLed; - GET_SERIAL GetSerial; - GET_MODEL GetModel; - GET_MODEL_REVISION GetModelRevision; - GET_MODEL_NAME GetModelName; - GET_MODEL_FAMILY GetModelFamily; - GET_FIRMWARE_REVISION GetFirmwareRevision; - GET_MANUFACTURER_NAME GetManufacturerName; - GET_CPU_NAME GetCpuName; - GET_ARM_MEM GetArmMem; + SET_POWER_STATE SetPowerState; + GET_MAC_ADDRESS GetMacAddress; + GET_COMMAND_LINE GetCommandLine; + GET_CLOCK_RATE GetClockRate; + GET_CLOCK_RATE GetMaxClockRate; + GET_CLOCK_RATE GetMinClockRate; + SET_CLOCK_RATE SetClockRate; + GET_FB GetFB; + FREE_FB FreeFB; + GET_FB_SIZE GetFBSize; + SET_LED SetLed; + GET_SERIAL GetSerial; + GET_MODEL GetModel; + GET_MODEL_REVISION GetModelRevision; + GET_MODEL_NAME GetModelName; + GET_MODEL_FAMILY GetModelFamily; + GET_FIRMWARE_REVISION GetFirmwareRevision; + GET_MANUFACTURER_NAME GetManufacturerName; + GET_CPU_NAME GetCpuName; + GET_ARM_MEM GetArmMem; + GET_MODEL_INSTALLED_MB GetModelInstalledMB; } RASPBERRY_PI_FIRMWARE_PROTOCOL; =20 extern EFI_GUID gRaspberryPiFirmwareProtocolGuid; --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#55304): https://edk2.groups.io/g/devel/message/55304 Mute This Topic: https://groups.io/mt/71697495/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-