From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.77.1610735240629096315 for ; Fri, 15 Jan 2021 10:27:20 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: pranav.madhu@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5A9FA11B3; Fri, 15 Jan 2021 10:27:20 -0800 (PST) Received: from usa.arm.com (a074742.blr.arm.com [10.162.16.32]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2C0D93F719; Fri, 15 Jan 2021 10:27:18 -0800 (PST) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm Subject: [edk2-platforms][PATCH V1 10/11] Platform/ARM/SgiPkg: Add SMBIOS Type19 Table Date: Fri, 15 Jan 2021 23:56:47 +0530 Message-Id: <20210115182648.20938-11-pranav.madhu@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210115182648.20938-1-pranav.madhu@arm.com> References: <20210115182648.20938-1-pranav.madhu@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Add the SMBIOS type 19 table (Memory Array Mapped Addr) that includes information about the address mapping for a Physical Memory Array. Signed-off-by: Pranav Madhu --- Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h = | 6 ++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type19MemoryArrayMappedAdd= ress.c | 73 ++++++++++++++++++++ 4 files changed, 81 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatform= Dxe.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe= .inf index 7f16aef64c8e..15db3d05b6b6 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -32,6 +32,7 @@ Type7CacheInformation.c Type16PhysicalMemoryArray.c Type17MemoryDevice.c + Type19MemoryArrayMappedAddress.c =20 [Packages] ArmPkg/ArmPkg.dec diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatform= Dxe.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h index c56429541504..1cd66b759446 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -51,6 +51,12 @@ InstallMemoryDevice ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +EFI_STATUS +EFIAPI +InstallMemoryArrayMappedAddress ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + enum SMBIOS_REFRENCE_HANDLES { SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, SMBIOS_HANDLE_CLUSTER1, diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatform= Dxe.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index 464fb62d06fa..847260b24750 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -28,6 +28,7 @@ ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D= { &InstallCacheInformation, &InstallPhysicalMemoryArray, &InstallMemoryDevice, + &InstallMemoryArrayMappedAddress, }; =20 /** diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type19MemoryAr= rayMappedAddress.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type19= MemoryArrayMappedAddress.c new file mode 100644 index 000000000000..b34fdf754900 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type19MemoryArrayMapp= edAddress.c @@ -0,0 +1,73 @@ +/** @file + SMBIOS Type 19 (Memory Array Mapped Address) table for ARM RD platform= s. + + Copyright (c) 2020-2021, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +#include "SmbiosPlatformDxe.h" + +#define TYPE19_STRINGS \ + "\0" /* Null string */ + +/* SMBIOS Type19 structure */ +#pragma pack(1) +struct ArmRdSmbiosType19 { + SMBIOS_TABLE_TYPE19 Base; + UINT8 Strings[sizeof (TYPE19_STRINGS)]; +}; +#pragma pack() + +/* Memory Array Mapped Address (SMBIOS 3.4 spec, section 7.20 */ +static struct ArmRdSmbiosType19 mArmRdSmbiosType19 =3D { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS, // Type 19 + sizeof (SMBIOS_TABLE_TYPE19), // Length + SMBIOS_HANDLE_PI_RESERVED, // Assign an unused handle numbe= r + }, + 0, // Starting address + 0, // Ending address + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Memory array handle + 1 // Partition width + }, + // Text strings (unformatted area) + TYPE19_STRINGS +}; + +/** + Install SMBIOS Bios information Table + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed in is already in= use. +**/ +EFI_STATUS +InstallMemoryArrayMappedAddress ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType19)->Han= dle; + + mArmRdSmbiosType19.Base.StartingAddress =3D PcdGet64 (PcdSystemMemoryB= ase) / SIZE_1KB; + mArmRdSmbiosType19.Base.EndingAddress =3D ((PcdGet64 (PcdSystemMemoryB= ase) + + (PcdGet64 (PcdSystemMemorySize) + SIZE_16MB)) / // 16MB Trusted= DRAM + SIZE_1KB) - 1; + + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType19 + ); + return Status; +} --=20 2.17.1