From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.86]) by mx.groups.io with SMTP id smtpd.web11.6257.1595282143605663232 for ; Mon, 20 Jul 2020 14:55:43 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@vmware.com header.s=selector2 header.b=XoqSXiKS; spf=pass (domain: vmware.com, ip: 40.107.93.86, mailfrom: awarkentin@vmware.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IxxxMqDTtJpu+YLP36TFwQ/Tl2AhinA7uk1huRZof8662OCWAPNr3Z8K3KxQL7TX6xEO5xKPij8RcVanfPcpxhebR79bJAq9bPOQHUggOi4AP3By1qjda78AQ+9N4wGkZttggSIRIVxHpW/VgI8JpjAda1MWWFpkS4X/yIvp7HcGpxw+xUzAIYarLHK5Nq4aRlnTUUpey69h0qbM8/A7JFl194OkH/V0SGoVjdkGdpCGHc+1sW/nl2IsOg2fiAENVtFzJbyu7OYU9zczZkMqGm4EY6z8qsaBDsUD/lJiW7Oze2JHxaE31LJi4Mx1RFzkBnzqfA60CQ5D4tFww19gtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OvFNk7JgoXnUto+DmjObaUM1pZQPAiE8azZpRVuayNQ=; b=a4ylx18vSOT/ojeMdcHBABNFYQ66uBGTGENpMLIuVawyGevwk5cvT3wG11CJh18UktYJ0STgrrij8UlRy+LJitdn5XrlQd7tcOi9wGielHcrmD1uhM/yoEwD0m7R2bFNdUUurd8FLzx378jIWWlBFMLe69kVo/eZJisq9ufmnST+QJSpWeTp5kinUD8xqVpEfiAiRCre4rh+bwf8Uk7IojcQ+pWuaNc+eXTXWgrRO9xE18Ee+Nm0rx6rChlGu5XUr7U5hEYvHntMRPHVp75mhpa0ZDHn/yL+N90Lbz14ZqdCF6mxyPmQut5jTQ7GCipGBojeCAbdiYl5l5XkqSuuFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vmware.com; dmarc=pass action=none header.from=vmware.com; dkim=pass header.d=vmware.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vmware.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=OvFNk7JgoXnUto+DmjObaUM1pZQPAiE8azZpRVuayNQ=; b=XoqSXiKSeSzARDRB69bdx2zWtZcQkg07WLuR/SZfpxf5Oyd+d0Gj1qFruxHAtSZc19HyBpzrZ5dk2j503uLmFLaK+d3LYvyRIx8VgCKkD+894s5ErZicE8JpHfOhtI2TOurXVf/henR4BoYgy8vqoEfIZL1M6BRguqPdHHOeSBQ= Received: from BN6PR05MB3411.namprd05.prod.outlook.com (2603:10b6:405:43::23) by BN6PR05MB3026.namprd05.prod.outlook.com (2603:10b6:404:2b::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3216.14; Mon, 20 Jul 2020 21:55:41 +0000 Received: from BN6PR05MB3411.namprd05.prod.outlook.com ([fe80::e1ef:31eb:c802:aef0]) by BN6PR05MB3411.namprd05.prod.outlook.com ([fe80::e1ef:31eb:c802:aef0%3]) with mapi id 15.20.3216.017; Mon, 20 Jul 2020 21:55:41 +0000 From: "Andrei Warkentin" To: Samer El-Haj-Mahmoud , "devel@edk2.groups.io" CC: Leif Lindholm , Pete Batard , Ard Biesheuvel Subject: Re: [edk2-platform][PATCH v1 6/7] Platforms/RaspberryPi: SMBIOS Memory Types fixes Thread-Topic: [edk2-platform][PATCH v1 6/7] Platforms/RaspberryPi: SMBIOS Memory Types fixes Thread-Index: AQHWXsH3kJvC7s1DakOfwJWfwVx8pakRA30K Date: Mon, 20 Jul 2020 21:55:41 +0000 Message-ID: References: <20200720181646.2891-1-Samer.El-Haj-Mahmoud@arm.com>,<20200720181646.2891-7-Samer.El-Haj-Mahmoud@arm.com> In-Reply-To: <20200720181646.2891-7-Samer.El-Haj-Mahmoud@arm.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=vmware.com; x-originating-ip: [98.214.99.181] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: e32e247d-782f-4386-2850-08d82cf7a563 x-ms-traffictypediagnostic: BN6PR05MB3026: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8882; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: t9asW0wsb92xcuE2hRgQSICSWksRsOP6T/1FqW40DXNKxWu09XnntoZctfxmnN8HLqJjSoWjb6toxJ11xm6U4mE3/XTaHC4mT77grzIvdt7ms2AiNlHt9U6T3oCnt7UG6fL1HQncKy1Op3tdl/K4NhYGChg8qDDBKAQ8QeZil9fGzV3Z2nZpCleDKvnh877GaxBVnPLdGC4acJ/DW3IiJf1rFFjvoEBlHFJZPoSWRheBPyixYlacGyuTIaoIA9vgck31TmsI26NrWb9fSjGOMds1krMQPJJx7jrK0A4WAgu+zVFhWhMp3X1er2wlpxhD x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN6PR05MB3411.namprd05.prod.outlook.com;PTR:;CAT:NONE;SFTY:;SFS:(4636009)(136003)(346002)(39860400002)(376002)(366004)(396003)(26005)(8676002)(5660300002)(19627405001)(8936002)(66946007)(54906003)(9686003)(316002)(52536014)(66556008)(64756008)(66446008)(55016002)(478600001)(110136005)(66476007)(186003)(4326008)(76116006)(7696005)(2906002)(86362001)(71200400001)(53546011)(83380400001)(19627235002)(6506007)(33656002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: tYL3hpmNfD4X4IrVpzwo9cs0De1pLmwO/de1jPN1H6ZWA1faCx7Dq1hIcXJ0zfObqAUL3C6fH7MxUJZee7vTpMuyef/ereBg4gnICwcVJK2Se2HOhYBuBZ7DJh1RDJUQpE5Kup6paWt1TuVUUoTufM4Ns2e3R8MUMcI0WippyhLoCXwft650P8bz1q6Z2X/p/e4GiEswL5Wf1AVjUYchWY3ozMRWC7OWzdFFcD1kKvNfhyGuvsO+HNrdVU7ZvNhpu0yMRUjhgavHVLtehfqxuGkWh8H+C5RDia5pkCBoLGbJzK8svb8TP9+wpb2b8S0+zElOBwo6oH3RxBsvHazGI48l0AXoVO7thFqZz0KsdmGHoiQ1MRahUrG07WuhdMd4iL9XurYJ8wc4jVr6EhQZRvsGiUaq+yw82LR8dX20Bf1igb7Ysno4MJedlf+Ft/rufGxQ/+n0qg/krsRfImqWbmMZDg7WQSgCXrspdAQgcPJpUrBr5FeirHQscDK1Dny3 x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: vmware.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN6PR05MB3411.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e32e247d-782f-4386-2850-08d82cf7a563 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Jul 2020 21:55:41.4749 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: b39138ca-3cee-4b4a-a4d6-cd83d9dd62f0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: TxH60klCLvCl33YFGCjgjFu59fF0COKpv+VRtrGtAzLpeU6mWrKbbvcAw1sWoVE6h5KUMDJWTzZmfSM05wsq8A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR05MB3026 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_BN6PR05MB34112A32E37DA11D36853CD6B97B0BN6PR05MB3411namp_" --_000_BN6PR05MB34112A32E37DA11D36853CD6B97B0BN6PR05MB3411namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Andrei Warkentin ________________________________ From: Samer El-Haj-Mahmoud Sent: Monday, July 20, 2020 1:16 PM To: devel@edk2.groups.io Cc: Leif Lindholm ; Pete Batard ; Andrei W= arkentin ; Ard Biesheuvel Subject: [edk2-platform][PATCH v1 6/7] Platforms/RaspberryPi: SMBIOS Memory= Types fixes Various fixes and enhancements for SMBIOS memory structures (Types 16, 17, and 19): - Type 16: - Update MaximumCapacity dynamically - Keep ExtendedMaximumCapacity at 0 (not used, per spec) - Type 17: - Update Size and VolatileSize dynamically - Change FormFactor from Unknown to Chip - Set DeviceSet to 0 (not part of set) instead of 0xFF (unknown) - Fix the DeviceLocator, BankLocator, and Manufacturer strings - Update MemoryType correctly for RPi4 and RPi3 - Add additional SMBIOS fields from 3.3 definition - Type 19: - Update MemoryArrayHandle to point to Type 16 handle Cc: Leif Lindholm Cc: Pete Batard Cc: Andrei Warkentin Cc: Ard Biesheuvel Signed-off-by: Samer El-Haj-Mahmoud --- Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | 115 += +++++++++++++------ 1 file changed, 83 insertions(+), 32 deletions(-) diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosD= xe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c index 4ee8ae6ebfc9..d382797602ce 100644 --- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c +++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c @@ -496,10 +496,10 @@ SMBIOS_TABLE_TYPE16 mPhyMemArrayInfoType16 =3D { MemoryArrayLocationSystemBoard, // Location; ///< = The enumeration value from MEMORY_ARRAY_LOCATION. MemoryArrayUseSystemMemory, // Use; ///< = The enumeration value from MEMORY_ARRAY_USE. MemoryErrorCorrectionUnknown, // MemoryErrorCorrection; ///< = The enumeration value from MEMORY_ERROR_CORRECTION. - 0x40000000, // MaximumCapacity; + 0x00000000, // MaximumCapacity; 0xFFFE, // MemoryErrorInformationHandle; 1, // NumberOfMemoryDevices; - 0x40000000ULL, // ExtendedMaximumCapacity; + 0x00000000ULL, // ExtendedMaximumCapacity; }; CHAR8 *mPhyMemArrayInfoType16Strings[] =3D { NULL @@ -510,18 +510,23 @@ CHAR8 *mPhyMemArrayInfoType16Strings[] =3D { ************************************************************************/ SMBIOS_TABLE_TYPE17 mMemDevInfoType17 =3D { { EFI_SMBIOS_TYPE_MEMORY_DEVICE, sizeof (SMBIOS_TABLE_TYPE17), 0 }, - 0, // MemoryArrayHandle; // Should match SMBIOS_TABLE_TYPE16.Ha= ndle, initialized at runtime, refer to PhyMemArrayInfoUpdateSmbiosType16() - 0xFFFE, // MemoryErrorInformationHandle; - 0xFFFF, // TotalWidth; - 0xFFFF, // DataWidth; - 0x0400, // Size; // When bit 15 is 0: Size in MB - // When bit 15 is 1: Size in KB, and continues in ExtendedSi= ze - MemoryFormFactorUnknown, // FormFactor; ///< The enu= meration value from MEMORY_FORM_FACTOR. - 0xff, // DeviceSet; - 1, // DeviceLocator String - 2, // BankLocator String - MemoryTypeDram, // MemoryType; ///< The enum= eration value from MEMORY_DEVICE_TYPE. - { // TypeDetail; + 0, // MemoryArrayHandle; // Should match SMBIOS_TABLE= _TYPE16.Handle, initialized at runtime, refer to PhyMemArrayInfoUpdateSmbio= sType16() + 0xFFFE, // MemoryErrorInformationHandle; (not provided) + 0xFFFF, // TotalWidth; (unknown) + 0xFFFF, // DataWidth; (unknown) + 0xFFFF, // Size; // When bit 15 is 0: Size in MB + // When bit 15 is 1: Size in KB, and continues in = ExtendedSize + // initialized at runtime, refer to PhyMemArrayInf= oUpdateSmbiosType16() + MemoryFormFactorChip, // FormFactor; ///< The enumer= ation value from MEMORY_FORM_FACTOR. + 0, // DeviceSet; + 1, // DeviceLocator String + 0, // BankLocator String +#if (RPI_MODEL =3D=3D 4) + MemoryTypeLpddr4, // MemoryType; ///< The enumer= ation value from MEMORY_DEVICE_TYPE. +#else + MemoryTypeLpddr2, // MemoryType; ///< The enumer= ation value from MEMORY_DEVICE_TYPE. +#endif + { // TypeDetail; 0, // Reserved :1; 0, // Other :1; 1, // Unknown :1; @@ -539,19 +544,42 @@ SMBIOS_TABLE_TYPE17 mMemDevInfoType17 =3D { 0, // Unbuffered :1; 0, // Reserved1 :1; }, - 0, // Speed; - 3, // Manufacturer String - 0, // SerialNumber String - 0, // AssetTag String - 0, // PartNumber String - 0, // Attributes; - 0, // ExtendedSize; - 0, // ConfiguredMemoryClockSpeed; + 0, // Speed; (unknown) + 2, // Manufacturer String + 0, // SerialNumber String + 0, // AssetTag String + 0, // PartNumber String + 0, // Attributes; (unknown rank) + 0, // ExtendedSize; (since Size < 32GB-1) + 0, // ConfiguredMemoryClockSpeed; (unknown) + 0, // MinimumVoltage; (unknown) + 0, // MaximumVoltage; (unknown) + 0, // ConfiguredVoltage; (unknown) + MemoryTechnologyDram, // MemoryTechnology ///< The enume= ration value from MEMORY_DEVICE_TECHNOLOGY + {{ // MemoryOperatingModeCapability + 0, // Reserved :1; + 0, // Other :1; + 0, // Unknown :1; + 1, // VolatileMemory :1; + 0, // ByteAccessiblePersistentMemory :1; + 0, // BlockAccessiblePersistentMemory :1; + 0 // Reserved :10; + }}, + 0, // FirwareVersion + 0, // ModuleManufacturerID (unknown) + 0, // ModuleProductID (unknown) + 0, // MemorySubsystemControllerManufacturerID (unknow= n) + 0, // MemorySubsystemControllerProductID (unknown) + 0, // NonVolatileSize + 0xFFFFFFFFFFFFFFFFULL,// VolatileSize // initialized at runtime, refer t= o PhyMemArrayInfoUpdateSmbiosType16() + 0, // CacheSize + 0, // LogicalSize (since MemoryType is not MemoryType= LogicalNonVolatileDevice) + 0, // ExtendedSpeed, + 0 // ExtendedConfiguredMemorySpeed }; CHAR8 *mMemDevInfoType17Strings[] =3D { - "OS Virtual Memory", - "malloc", - "OSV", + "SDRAM", + "Micron", NULL }; @@ -562,10 +590,10 @@ SMBIOS_TABLE_TYPE19 mMemArrMapInfoType19 =3D { { EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS, sizeof (SMBIOS_TABLE_TYPE= 19), 0 }, 0x00000000, // StartingAddress; 0x00000000, // EndingAddress; - 0, // MemoryArrayHandle; + 0, // MemoryArrayHandle; // Should match SMBIOS_TABLE_TYPE16.Ha= ndle, initialized at runtime, refer to PhyMemArrayInfoUpdateSmbiosType16() 1, // PartitionWidth; - 0, // ExtendedStartingAddress; - 0, // ExtendedEndingAddress; + 0, // ExtendedStartingAddress; // not used + 0, // ExtendedEndingAddress; // not used }; CHAR8 *mMemArrMapInfoType19Strings[] =3D { NULL @@ -1000,14 +1028,37 @@ PhyMemArrayInfoUpdateSmbiosType16 ( VOID ) { - EFI_SMBIOS_HANDLE MemArraySmbiosHande; + EFI_SMBIOS_HANDLE MemArraySmbiosHandle; + EFI_STATUS Status; + UINT32 InstalledMB =3D 0; - LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mPhyMemArrayInfoType16, mPhyMe= mArrayInfoType16Strings, &MemArraySmbiosHande); + // + // Update memory size fields: + // - Type 16 MaximumCapacity in KB + // - Type 17 size in MB (since bit 15 =3D 0) + // - Type 17 VolatileSize in Bytes + // + + // The minimum RAM size used on any Raspberry Pi model is 256 MB + mMemDevInfoType17.Size =3D 256; + + 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 { + mMemDevInfoType17.Size =3D InstalledMB; // Size in MB + } + + mPhyMemArrayInfoType16.MaximumCapacity =3D mMemDevInfoType17.Size * 1024= ; // Size in KB + mMemDevInfoType17.VolatileSize =3D MultU64x32 (mMemDevInfoType17.Size, 1= 024 * 1024); // Size in Bytes + + LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mPhyMemArrayInfoType16, mPhyMe= mArrayInfoType16Strings, &MemArraySmbiosHandle); // - // Update the memory device information + // Update the memory device information and memory array map with the ne= wly added type 16 handle // - mMemDevInfoType17.MemoryArrayHandle =3D MemArraySmbiosHande; + mMemDevInfoType17.MemoryArrayHandle =3D MemArraySmbiosHandle; + mMemArrMapInfoType19.MemoryArrayHandle =3D MemArraySmbiosHandle; } /*********************************************************************** -- 2.17.1 --_000_BN6PR05MB34112A32E37DA11D36853CD6B97B0BN6PR05MB3411namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
Reviewed-by: Andrei Warken= tin <awarkentin@vmware.com>

From: Samer El-Haj-Mahmoud = <Samer.El-Haj-Mahmoud@arm.com>
Sent: Monday, July 20, 2020 1:16 PM
To: devel@edk2.groups.io <devel@edk2.groups.io>
Cc: Leif Lindholm <leif@nuviainc.com>; Pete Batard <pete@ak= eo.ie>; Andrei Warkentin <awarkentin@vmware.com>; Ard Biesheuvel &= lt;ard.biesheuvel@arm.com>
Subject: [edk2-platform][PATCH v1 6/7] Platforms/RaspberryPi: SMBIOS= Memory Types fixes
 
Various fixes and enhancements for SMBIOS memory s= tructures
(Types 16, 17, and 19):

 - Type 16:
    - Update MaximumCapacity dynamically
    - Keep ExtendedMaximumCapacity at 0 (not used, per spec)=

 - Type 17:
   - Update Size and VolatileSize dynamically
   - Change FormFactor from Unknown to Chip
   - Set DeviceSet to 0 (not part of set) instead of 0xFF (unknow= n)
   - Fix the DeviceLocator, BankLocator, and Manufacturer strings=
   - Update MemoryType correctly for RPi4 and RPi3
   - Add additional SMBIOS fields from 3.3 definition

 - Type 19:
   - Update MemoryArrayHandle to point to Type 16 handle

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Pete Batard <pete@akeo.ie>
Cc: Andrei Warkentin <awarkentin@vmware.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com> ---
 Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c | = 115 ++++++++++++++------
 1 file changed, 83 insertions(+), 32 deletions(-)

diff --git a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosD= xe.c b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c index 4ee8ae6ebfc9..d382797602ce 100644
--- a/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c +++ b/Platform/RaspberryPi/Drivers/PlatformSmbiosDxe/PlatformSmbiosDxe.c @@ -496,10 +496,10 @@ SMBIOS_TABLE_TYPE16 mPhyMemArrayInfoType16 =3D {
   MemoryArrayLocationSystemBoard, // Location;   =             &nb= sp;       ///< The enumeration value from = MEMORY_ARRAY_LOCATION.
   MemoryArrayUseSystemMemory,     // Use;&nb= sp;            =             &nb= sp;  ///< The enumeration value from MEMORY_ARRAY_USE.
   MemoryErrorCorrectionUnknown,   // MemoryErrorCorrec= tion;          ///< The enu= meration value from MEMORY_ERROR_CORRECTION.
-  0x40000000,         &n= bsp;           // Maximum= Capacity;
+  0x00000000,         &n= bsp;           // Maximum= Capacity;
   0xFFFE,         &= nbsp;           &nbs= p;   // MemoryErrorInformationHandle;
   1,          =             &nb= sp;       // NumberOfMemoryDevices;
-  0x40000000ULL,         = ;         // ExtendedMaximumCapacit= y;
+  0x00000000ULL,         = ;         // ExtendedMaximumCapacit= y;
 };
 CHAR8 *mPhyMemArrayInfoType16Strings[] =3D {
   NULL
@@ -510,18 +510,23 @@ CHAR8 *mPhyMemArrayInfoType16Strings[] =3D {
 *********************************************************************= ***/
 SMBIOS_TABLE_TYPE17 mMemDevInfoType17 =3D {
   { EFI_SMBIOS_TYPE_MEMORY_DEVICE, sizeof (SMBIOS_TABLE_TYPE17),= 0 },
-  0,          // MemoryA= rrayHandle; // Should match SMBIOS_TABLE_TYPE16.Handle, initialized at runt= ime, refer to PhyMemArrayInfoUpdateSmbiosType16()
-  0xFFFE,     // MemoryErrorInformationHandle; -  0xFFFF,     // TotalWidth;
-  0xFFFF,     // DataWidth;
-  0x0400,     // Size; // When bit 15 is 0: Size = in MB
-            &n= bsp; // When bit 15 is 1: Size in KB, and continues in ExtendedSize
-  MemoryFormFactorUnknown, // FormFactor;    &nbs= p;            &= nbsp;   ///< The enumeration value from MEMORY_FORM_FACTOR. -  0xff,       // DeviceSet;
-  1,          // DeviceL= ocator String
-  2,          // BankLoc= ator String
-  MemoryTypeDram,         // = MemoryType;          &nbs= p;          ///< The enumer= ation value from MEMORY_DEVICE_TYPE.
-  {           // Ty= peDetail;
+  0,           = ;         // MemoryArrayHandle; // = Should match SMBIOS_TABLE_TYPE16.Handle, initialized at runtime, refer to P= hyMemArrayInfoUpdateSmbiosType16()
+  0xFFFE,          =      // MemoryErrorInformationHandle; (not provided) +  0xFFFF,          =      // TotalWidth; (unknown)
+  0xFFFF,          =      // DataWidth; (unknown)
+  0xFFFF,          =      // Size; // When bit 15 is 0: Size in MB
+            &n= bsp;           // When bi= t 15 is 1: Size in KB, and continues in ExtendedSize
+            &n= bsp;           // initial= ized at runtime, refer to PhyMemArrayInfoUpdateSmbiosType16()
+  MemoryFormFactorChip, // FormFactor;     &= nbsp;           &nbs= p;   ///< The enumeration value from MEMORY_FORM_FACTOR.
+  0,           = ;         // DeviceSet;
+  1,           = ;         // DeviceLocator String +  0,           = ;         // BankLocator String
+#if (RPI_MODEL =3D=3D 4)
+  MemoryTypeLpddr4,     // MemoryType;  = ;            &n= bsp;      ///< The enumeration value from MEMOR= Y_DEVICE_TYPE.
+#else
+  MemoryTypeLpddr2,     // MemoryType;  = ;            &n= bsp;      ///< The enumeration value from MEMOR= Y_DEVICE_TYPE.
+#endif
+  {           =           // TypeDetail;
     0,  // Reserved     =    :1;
     0,  // Other     &nb= sp;     :1;
     1,  // Unknown     &= nbsp;   :1;
@@ -539,19 +544,42 @@ SMBIOS_TABLE_TYPE17 mMemDevInfoType17 =3D {
     0,  // Unbuffered    &nbs= p; :1;
     0,  // Reserved1     = ;  :1;
   },
-  0,          // Speed;<= br> -  3,          // Manufac= turer String
-  0,          // SerialN= umber String
-  0,          // AssetTa= g String
-  0,          // PartNum= ber String
-  0,          // Attribu= tes;
-  0,          // Extende= dSize;
-  0,          // Configu= redMemoryClockSpeed;
+  0,           = ;         // Speed; (unknown)
+  2,           = ;         // Manufacturer String +  0,           = ;         // SerialNumber String +  0,           = ;         // AssetTag String
+  0,           = ;         // PartNumber String
+  0,           = ;         // Attributes; (unknown r= ank)
+  0,           = ;         // ExtendedSize; (since S= ize < 32GB-1)
+  0,           = ;         // ConfiguredMemoryClockS= peed; (unknown)
+  0,           = ;         // MinimumVoltage; (unkno= wn)
+  0,           = ;         // MaximumVoltage; (unkno= wn)
+  0,           = ;         // ConfiguredVoltage; (un= known)
+  MemoryTechnologyDram, // MemoryTechnology    &n= bsp;            ///&= lt; The enumeration value from MEMORY_DEVICE_TECHNOLOGY
+  {{           = ;         // MemoryOperatingModeCap= ability
+    0,  // Reserved      = ;            &n= bsp;     :1;
+    0,  // Other      &n= bsp;            = ;        :1;
+    0,  // Unknown      =             &nb= sp;      :1;
+    1,  // VolatileMemory     = ;             := 1;
+    0,  // ByteAccessiblePersistentMemory  :1; +    0,  // BlockAccessiblePersistentMemory :1;
+    0   // Reserved     =             &nb= sp;      :10;
+  }},
+  0,           = ;         // FirwareVersion
+  0,           = ;         // ModuleManufacturerID (= unknown)
+  0,           = ;         // ModuleProductID (unkno= wn)
+  0,           = ;         // MemorySubsystemControl= lerManufacturerID (unknown)
+  0,           = ;         // MemorySubsystemControl= lerProductID (unknown)
+  0,           = ;         // NonVolatileSize
+  0xFFFFFFFFFFFFFFFFULL,// VolatileSize // initialized at runtime, re= fer to PhyMemArrayInfoUpdateSmbiosType16()
+  0,           = ;         // CacheSize
+  0,           = ;         // LogicalSize (since Mem= oryType is not MemoryTypeLogicalNonVolatileDevice)
+  0,           = ;         // ExtendedSpeed,
+  0           =           // ExtendedConfigure= dMemorySpeed
 };
 CHAR8 *mMemDevInfoType17Strings[] =3D {
-  "OS Virtual Memory",
-  "malloc",
-  "OSV",
+  "SDRAM",
+  "Micron",
   NULL
 };
 
@@ -562,10 +590,10 @@ SMBIOS_TABLE_TYPE19 mMemArrMapInfoType19 =3D {
   { EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS, sizeof (SMBIOS_= TABLE_TYPE19), 0 },
   0x00000000, // StartingAddress;
   0x00000000, // EndingAddress;
-  0,          // MemoryA= rrayHandle;
+  0,          // MemoryA= rrayHandle; // Should match SMBIOS_TABLE_TYPE16.Handle, initialized at runt= ime, refer to PhyMemArrayInfoUpdateSmbiosType16()
   1,          // Pa= rtitionWidth;
-  0,          // Extende= dStartingAddress;
-  0,          // Extende= dEndingAddress;
+  0,          // Extende= dStartingAddress;  // not used
+  0,          // Extende= dEndingAddress;    // not used
 };
 CHAR8 *mMemArrMapInfoType19Strings[] =3D {
   NULL
@@ -1000,14 +1028,37 @@ PhyMemArrayInfoUpdateSmbiosType16 (
   VOID
   )
 {
-  EFI_SMBIOS_HANDLE MemArraySmbiosHande;
+  EFI_SMBIOS_HANDLE MemArraySmbiosHandle;
+  EFI_STATUS        Status;
+  UINT32          &= nbsp; InstalledMB =3D 0;
 
-  LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mPhyMemArrayInfoType1= 6, mPhyMemArrayInfoType16Strings, &MemArraySmbiosHande);
+ //
+ // Update memory size fields:
+ //  - Type 16 MaximumCapacity in KB
+ //  - Type 17 size in MB (since bit 15 =3D 0)
+ //  - Type 17 VolatileSize in Bytes
+ //
+
+ // The minimum RAM size used on any Raspberry Pi model is 256 MB
+  mMemDevInfoType17.Size =3D 256;
+
+  Status =3D mFwProtocol->GetModelInstalledMB (&InstalledMB);<= br> +  if (Status !=3D EFI_SUCCESS) {
+    DEBUG ((DEBUG_WARN, "Couldn't get the board memory= size - defaulting to 256 MB: %r\n", Status));
+  } else {
+    mMemDevInfoType17.Size =3D InstalledMB; // Size in MB +  }
+
+  mPhyMemArrayInfoType16.MaximumCapacity =3D mMemDevInfoType17.Size *= 1024; // Size in KB
+  mMemDevInfoType17.VolatileSize =3D MultU64x32 (mMemDevInfoType17.Si= ze, 1024 * 1024);  // Size in Bytes
+
+  LogSmbiosData ((EFI_SMBIOS_TABLE_HEADER*)&mPhyMemArrayInfoType1= 6, mPhyMemArrayInfoType16Strings, &MemArraySmbiosHandle);
 
   //
-  // Update the memory device information
+  // Update the memory device information and memory array map with t= he newly added type 16 handle
   //
-  mMemDevInfoType17.MemoryArrayHandle =3D MemArraySmbiosHande;
+  mMemDevInfoType17.MemoryArrayHandle =3D MemArraySmbiosHandle;
+  mMemArrMapInfoType19.MemoryArrayHandle =3D MemArraySmbiosHandle;  }
 
 /********************************************************************= ***
--
2.17.1

--_000_BN6PR05MB34112A32E37DA11D36853CD6B97B0BN6PR05MB3411namp_--