From nobody Sun May 19 08:30:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+75523+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75523+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621866510; cv=none; d=zohomail.com; s=zohoarc; b=VxurKBbMBht3xTja8QipHhu5NPz+/VLCa3c7SKYoKcJe2yQyZffca/yVNFX/OJnNsPX9+iwfe6PxZYGS1+sIU+kyM5um7IXfxKGi38VkwpxWrmGR83AHox19YbEVw48NqFu2cZ+OpseUPbLnefTAkZttdM/HgzGSL0mp5wtJ58M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621866510; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Ugb9g7m2ieH+zNvmBlNBVsB7/wHRYaepiLPwY7Gm3fk=; b=hjRSE2ILTp9Ed5KxX2r1CmTgoXA20ZD8I+9wOotG7Y7R/wLp72JT+rwBkdP1HDNE7RKF1WIzFQeLrl0vSTs/Qug0FPCdcuWE+j31xjHVtaFeSFybhN2DeniXFOiAvgelaCYJu/rREHZnqCDu9VQAFvy7/vIuiDJeFlfLYaqvI2c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75523+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 162186651063880.55680380050251; Mon, 24 May 2021 07:28:30 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id swg6YY1788612xxzqfu1jjKm; Mon, 24 May 2021 07:28:30 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.23861.1621866509725269199 for ; Mon, 24 May 2021 07:28:29 -0700 X-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 4020C139F; Mon, 24 May 2021 07:28:29 -0700 (PDT) X-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 0DA3F3F719; Mon, 24 May 2021 07:28:27 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V4 01/11] Platform/Sgi: Define RD-N2 platform id values Date: Mon, 24 May 2021 19:58:06 +0530 Message-Id: <20210524142816.9967-2-pranav.madhu@arm.com> In-Reply-To: <20210524142816.9967-1-pranav.madhu@arm.com> References: <20210524142816.9967-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,pranav.madhu@arm.com X-Gm-Message-State: rh8oF1DqSHCTrm2BXz1G3BVax1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621866510; bh=P02XJiDcZmCE8zzobkt7kQ/FBpn5W6eIEoQS4cW7cOA=; h=Cc:Date:From:Reply-To:Subject:To; b=gc2E8nOiKP6Bv863o49irPGAEYYwaAqZytbkt89dAaGEeOM7MPYShMIKrHyX+ZkIJ1M RDisu0xQm1+5hpKtVKzQVfJ/o8rB1B93ggEMRBHyh+RmgwaYUDPo3XNqzkmxwmEiFrXMt ds4CCI5Vy9+xMHMfefB2/PUmsLSz5VT1PDY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add RD-N2 platform identification values including the part number and configuration number. This information will be used in populating the SMBIOS tables. Signed-off-by: Pranav Madhu Reviewed-by: Sami Mujawar --- Platform/ARM/SgiPkg/Include/SgiPlatform.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h b/Platform/ARM/SgiPk= g/Include/SgiPlatform.h index 818879b5f81e..1c5366878712 100644 --- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h +++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2018-2020, ARM Limited. All rights reserved. +* Copyright (c) 2018-2021, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -39,6 +39,10 @@ #define RD_V1_CONF_ID 0x1 #define RD_V1_MC_CONF_ID 0x2 =20 +// RD-N2 Platform Identification values +#define RD_N2_PART_NUM 0x7B7 +#define RD_N2_CONF_ID 0x1 + #define SGI_CONFIG_MASK 0x0F #define SGI_CONFIG_SHIFT 0x1C #define SGI_PART_NUM_MASK 0xFFF --=20 2.17.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 (#75523): https://edk2.groups.io/g/devel/message/75523 Mute This Topic: https://groups.io/mt/83052319/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- From nobody Sun May 19 08:30:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+75524+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75524+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621866512; cv=none; d=zohomail.com; s=zohoarc; b=EtAM9346+KLJJpIRvczFWi7D+QkEe61TJ6BivJFHhbiZFzrLbuEoecl7lVngRDggf4Gb9FheF648K0IO2DXObMIgrggP31viAWwHkqHoFIIuFApVngK1ZKBhU+FKxlPF2CFsesNIQCaLHp1w4fWQ7MLBAICTboSCWxqCkzlc4Ho= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621866512; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=PohYwxP9KhWjvIo8lOTmKEkw4nPsuiOikoXfRVfhfSE=; b=Rj9ktwhGSYMViylTYyGBgoLUyYZ5DyTqs2j94z6wXL9Z/EjrvOcmKMa7/tJ1LXLJnuH71P2WvwKmS4dudzYXLSee0P5Bk3JnT/ub591kC7Je+0w9MIkdCxmz4pO1PeA0+Qt6qkdSv+nTZLG+D7QbIfoW7VyUF1KCrfrTmke8ZAU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75524+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1621866512280547.026254864217; Mon, 24 May 2021 07:28:32 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id hrv0YY1788612xLRZdC6qsNw; Mon, 24 May 2021 07:28:31 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.24088.1621866511227654628 for ; Mon, 24 May 2021 07:28:31 -0700 X-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 D5771ED1; Mon, 24 May 2021 07:28:30 -0700 (PDT) X-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 AC2B73F719; Mon, 24 May 2021 07:28:29 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V4 02/11] Platform/Sgi: Add GetProductId API for SGI/RD Platforms Date: Mon, 24 May 2021 19:58:07 +0530 Message-Id: <20210524142816.9967-3-pranav.madhu@arm.com> In-Reply-To: <20210524142816.9967-1-pranav.madhu@arm.com> References: <20210524142816.9967-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,pranav.madhu@arm.com X-Gm-Message-State: VusBm6GEsbiOplT5QqhaOeoyx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621866511; bh=lEFmlxnLe4Oqp769ZYNsw9UsEweIGZGLS7QN+Q0tHzQ=; h=Cc:Date:From:Reply-To:Subject:To; b=JlBF0ln3qSfZRmYmEoZeYcewNdsCWEjrrLpuldHvIcc4j2IlbRZufC7pU8pkmOQErIB xG2gCm58Kdmc6mw25ehiefKOpQnbcYtz2Bx3kz7DxfQ8W8wFEOePNWulecwe8YHOgvvXx CrNMc4tAqJw48+Ta5W9oPVH0a7+GCYCfTd8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add GetProductId API for SGI/RD Platform. The API returns a product id in integer format based on the platform description data. The product id is required for other drivers such as SMBIOS. Signed-off-by: Pranav Madhu Reviewed-by: Sami Mujawar --- Platform/ARM/SgiPkg/Include/SgiPlatform.h | 30 +++++++ Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c | 86 +++++++++++++++= ++++- 2 files changed, 115 insertions(+), 1 deletion(-) diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h b/Platform/ARM/SgiPk= g/Include/SgiPlatform.h index 1c5366878712..4999c9870b49 100644 --- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h +++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h @@ -68,4 +68,34 @@ typedef struct { UINTN MultiChipMode; } SGI_PLATFORM_DESCRIPTOR; =20 +// Arm SGI/RD Product IDs +typedef enum { + UnknownId =3D 0, + Sgi575, + RdN1Edge, + RdN1EdgeX2, + RdE1Edge, + RdV1, + RdV1Mc, + RdN2 +} ARM_RD_PRODUCT_ID; + +// Arm ProductId look-up table +typedef struct { + UINTN ProductId; + UINTN PlatformId; + UINTN ConfigId; + UINTN MultiChipMode; +} SGI_PRODUCT_ID_LOOKUP; + +/** + Derermine the product ID. + + Determine the product ID by using the data in the Platform ID Descriptor= HOB + to lookup for a matching product ID. + + @retval Zero Failed identify platform. + @retval Others ARM_RD_PRODUCT_ID of the identified platform. +**/ +UINT8 SgiGetProductId (VOID); #endif // __SGI_PLATFORM_H__ diff --git a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c b/Platfo= rm/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c index 9731d7cccede..f27c949dbc24 100644 --- a/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c +++ b/Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c @@ -1,6 +1,6 @@ /** @file * -* Copyright (c) 2018, ARM Limited. All rights reserved. +* Copyright (c) 2018-2021, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * @@ -8,9 +8,12 @@ =20 #include #include +#include #include #include =20 +#include "SgiPlatform.h" + UINT64 NtFwConfigDtBlob; STATIC SGI_NT_FW_CONFIG_INFO_PPI mNtFwConfigDtInfoPpi; =20 @@ -21,6 +24,51 @@ STATIC ARM_CORE_INFO mCoreInfoTable[] =3D { }, }; =20 +STATIC CONST SGI_PRODUCT_ID_LOOKUP SgiProductIdLookup[] =3D { + { + Sgi575, + SGI575_PART_NUM, + SGI575_CONF_NUM, + 0 + }, + { + RdN1Edge, + RD_N1E1_EDGE_PART_NUM, + RD_N1_EDGE_CONF_ID, + 0 + }, + { + RdN1EdgeX2, + RD_N1E1_EDGE_PART_NUM, + RD_N1_EDGE_CONF_ID, + 1 + }, + { + RdE1Edge, + RD_N1E1_EDGE_PART_NUM, + RD_E1_EDGE_CONF_ID, + 0 + }, + { + RdV1, + RD_V1_PART_NUM, + RD_V1_CONF_ID, + 0 + }, + { + RdV1Mc, + RD_V1_PART_NUM, + RD_V1_MC_CONF_ID, + 1 + }, + { + RdN2, + RD_N2_PART_NUM, + RD_N2_CONF_ID, + 0 + } +}; + EFI_BOOT_MODE ArmPlatformGetBootMode ( VOID @@ -75,3 +123,39 @@ ArmPlatformGetPlatformPpiList ( *PpiListSize =3D sizeof (gPlatformPpiTable); *PpiList =3D gPlatformPpiTable; } + +/** + Derermine the product ID. + + Determine the product ID by using the data in the Platform ID Descriptor= HOB + to lookup for a matching product ID. + + @retval Zero Failed identify platform. + @retval Others ARM_RD_PRODUCT_ID of the identified platform. +**/ +UINT8 +SgiGetProductId ( + VOID + ) +{ + VOID *SystemIdHob; + UINT8 Idx; + SGI_PLATFORM_DESCRIPTOR *HobData; + + SystemIdHob =3D GetFirstGuidHob (&gArmSgiPlatformIdDescriptorGuid); + if (SystemIdHob =3D=3D NULL) { + return UnknownId; + } + + HobData =3D (SGI_PLATFORM_DESCRIPTOR *)GET_GUID_HOB_DATA (SystemIdHob); + + for (Idx =3D 0; Idx < ARRAY_SIZE (SgiProductIdLookup); Idx++) { + if ((HobData->PlatformId =3D=3D SgiProductIdLookup[Idx].PlatformId) && + (HobData->ConfigId =3D=3D SgiProductIdLookup[Idx].ConfigId) && + (HobData->MultiChipMode =3D=3D SgiProductIdLookup[Idx].MultiChipMo= de)) { + return SgiProductIdLookup[Idx].ProductId; + } + } + + return UnknownId; +} --=20 2.17.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 (#75524): https://edk2.groups.io/g/devel/message/75524 Mute This Topic: https://groups.io/mt/83052321/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- From nobody Sun May 19 08:30:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+75525+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75525+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621866513; cv=none; d=zohomail.com; s=zohoarc; b=LGA4V9U2TA6dlG1CzkNttXuHbfH7tbl+RhYJ/RpmJQIt/jZMYSNXWANRO33gGWsxwapnOxrAhNj0ci9K4J3QX09FB15O8Nl/1ZcnJn1aB0GBnZvHzKQH20VDyajoLXRxGC9g26Fk+03D0U0rEDy/+qfji/i28iQ/i278iPq6BBI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621866513; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=6kuv14XwXH0V052bcD+8FTHI5TmY3twsW9m1PYvCOYo=; b=ZflokW0iaXeImHa8qY/BPYPbI1GJfAbDDW4YDx2ueY5fHHBj1BPnlgY9CzZtnrf8LI2gN2xNKKnt/4uRgUFPMPrkbdK1RIHRL41fPPB0ZmXf80WLk5zRmB3rkKoCvHOT51xeIF9cV8yII0zBoeWMTqWGvtT1CHT7Xp6rxS4m/O8= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75525+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 162186651397653.70663641933095; Mon, 24 May 2021 07:28:33 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id UFMqYY1788612xTE7iU3pvH0; Mon, 24 May 2021 07:28:33 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.23863.1621866512954387801 for ; Mon, 24 May 2021 07:28:33 -0700 X-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 77D6EED1; Mon, 24 May 2021 07:28:32 -0700 (PDT) X-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 4DA8D3F719; Mon, 24 May 2021 07:28:31 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V4 03/11] Platform/Sgi: Add Initial SMBIOS support Date: Mon, 24 May 2021 19:58:08 +0530 Message-Id: <20210524142816.9967-4-pranav.madhu@arm.com> In-Reply-To: <20210524142816.9967-1-pranav.madhu@arm.com> References: <20210524142816.9967-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,pranav.madhu@arm.com X-Gm-Message-State: xwczycBZgepBc2zSrEpe3O78x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621866513; bh=UyWP52O/oGgxlZTXJuparoL7e1grWnxna2liFpPhc1Y=; h=Cc:Date:From:Reply-To:Subject:To; b=PafhSyFUoZglaipWt4xIRvCCSeK8fkRc4i8fbOfF76qRlo/ME69MBsPhCz3ndGEPCMt uCxHBYE2WMeikUPWrx6GVXoOg/kHkAyUNz4fT+ZKsjPeO1LNCi3FV5WlhDrSe3ZwpHT33 GkYu+L/mdYDMhQ3mRX/zK2ph//FZkgUSX/M= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" SMBIOS provides basic hardware and firmware configuration information through table-driven data structure. This patch adds SMBIOS driver support that allows for installation of multiple SMBIOS types. Also add SMBIOS Type0 (BIOS Information) table, that include information about BIOS vendor name, version, SMBIOS version and other information related to BIOS. Signed-off-by: Pranav Madhu Reviewed-by: Sami Mujawar --- Platform/ARM/SgiPkg/SgiPlatform.dsc.inc | 10= ++ Platform/ARM/SgiPkg/SgiPlatform.fdf | 8= +- Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 46= +++++++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 32= +++++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 98= ++++++++++++++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type0BiosInformation.c | 135= ++++++++++++++++++++ 6 files changed, 328 insertions(+), 1 deletion(-) diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc b/Platform/ARM/SgiPkg/= SgiPlatform.dsc.inc index 42e3600d15f4..a0f217f5107c 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc @@ -109,6 +109,10 @@ # ACPI Table Version gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x20 =20 + # SMBIOS entry point version + gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosVersion|0x0304 + gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosDocRev|0x0 + # # PCIe # @@ -247,6 +251,12 @@ MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf =20 + # + # SMBIOS/DMI + # + MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf + # # platform driver # diff --git a/Platform/ARM/SgiPkg/SgiPlatform.fdf b/Platform/ARM/SgiPkg/SgiP= latform.fdf index da23804828e5..e11d943d6efc 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.fdf +++ b/Platform/ARM/SgiPkg/SgiPlatform.fdf @@ -1,5 +1,5 @@ # -# Copyright (c) 2018, ARM Limited. All rights reserved. +# Copyright (c) 2018-2021, ARM Limited. All rights reserved. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -102,6 +102,12 @@ READ_LOCK_STATUS =3D TRUE INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf !include $(BOARD_DXE_FV_COMPONENTS) =20 + # + # SMBIOS/DMI + # + INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf + INF Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf + # Required by PCI INF ArmPkg/Drivers/ArmPciCpuIo2Dxe/ArmPciCpuIo2Dxe.inf =20 diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf new file mode 100644 index 000000000000..3568380f8404 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -0,0 +1,46 @@ +## @file +# This driver installs SMBIOS information for RD Platforms +# +# Copyright (c) 2021, ARM Limited. All rights reserved. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## + +[Defines] + INF_VERSION =3D 0x0001001A + BASE_NAME =3D SmbiosPlatformDxe + FILE_GUID =3D 86e0aa8b-4f8d-44a5-a140-1f693d529c76 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D SmbiosTableEntryPoint + +[Sources] + SmbiosPlatformDxe.c + Type0BiosInformation.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Platform/ARM/SgiPkg/SgiPlatform.dec + +[LibraryClasses] + ArmPlatformLib + DebugLib + HobLib + UefiDriverEntryPoint + +[Guids] + gEfiGlobalVariableGuid + gArmSgiPlatformIdDescriptorGuid + +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareRevision + +[Protocols] + gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED + +[Guids] + +[Depex] + gEfiSmbiosProtocolGuid diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h new file mode 100644 index 000000000000..a09f89ebe5bc --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -0,0 +1,32 @@ +/** @file + Declarations required for SMBIOS DXE driver. + + Functions declarations and data type declarations required for SMBIOS DXE + driver of the Arm Reference Design platforms. + + Copyright (c) 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef SMBIOS_PLATFORM_DXE_H_ +#define SMBIOS_PLATFORM_DXE_H_ + +/** + Install SMBIOS BIOS information Table. + + Install the SMBIOS BIOS information (type 0) table for Arm's reference d= esign + platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +EFIAPI +InstallType0BiosInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + +#endif // SMBIOS_PLATFORM_DXE_H_ diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c new file mode 100644 index 000000000000..20d4dedccb82 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -0,0 +1,98 @@ +/** @file + Install SMBIOS tables for Arm's SGI/RD platforms. + + This file is the driver entry point for installing SMBIOS tables on Arm's + Reference Design platforms. For each SMBIOS table installation handler + registered, the driver invokes the handler to register the respective ta= ble. + + Copyright (c) 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Specification Reference: + - SMBIOS Reference Specification 3.4.0 +**/ + +#include +#include +#include +#include +#include +#include + +#include "SgiPlatform.h" +#include "SmbiosPlatformDxe.h" + +typedef EFI_STATUS (*ARM_RD_SMBIOS_TABLE_INSTALL_FPTR)(EFI_SMBIOS_PROTOCOL= *); + +STATIC CONST +ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D { + &InstallType0BiosInformation, +}; + +/** + Driver entry point. Installs SMBIOS information. + + For all the available SMBIOS table installation handlers, invoke each of + those handlers and let the handlers install the SMBIOS tables. The count + of handlers that fail to install the SMBIOS tables is maintained for + additional logging. + + @param ImageHandle Module's image handle. + @param SystemTable Pointer of EFI_SYSTEM_TABLE. + + @retval EFI_SUCCESS All SMBIOS table install handlers invoked. + @retval EFI_NOT_FOUND Unsupported platform. + @retval Others Failed to invoke SMBIOS table install handlders. +**/ +EFI_STATUS +EFIAPI +SmbiosTableEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_PROTOCOL *Smbios =3D NULL; + UINT8 CountFail =3D 0; + UINT8 Idx; + + /* Install SMBIOS table only for supported product */ + if (SgiGetProductId () =3D=3D UnknownId) { + DEBUG (( + DEBUG_ERROR, + "Failed to install SMBIOS: Unknown product\n" + )); + return EFI_NOT_FOUND; + } + + /* Find the SMBIOS protocol */ + Status =3D gBS->LocateProtocol ( + &gEfiSmbiosProtocolGuid, + NULL, + (VOID **)&Smbios + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "Failed to install SMBIOS: Unable to locate protocol\n" + )); + return Status; + } + + /* Install the tables listed in mSmbiosTableList */ + for (Idx =3D 0; Idx < ARRAY_SIZE (mSmbiosTableList); Idx++) { + Status =3D (*mSmbiosTableList[Idx]) (Smbios); + if (EFI_ERROR (Status)) { + CountFail++; + } + } + + DEBUG (( + DEBUG_INFO, + "Installed %d of %d available SMBIOS tables\n", + ARRAY_SIZE (mSmbiosTableList) - CountFail, + ARRAY_SIZE (mSmbiosTableList) + )); + + return EFI_SUCCESS; +} diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type0BiosInforma= tion.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type0BiosInformation= .c new file mode 100644 index 000000000000..f5c1b2366d04 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type0BiosInformation.c @@ -0,0 +1,135 @@ +/** @file + SMBIOS Type 0 (BIOS information) table for ARM RD platforms. + + Install SMBIOS Type 0 (BIOS information) table for Arm's Reference Design + platforms. + + Copyright (c) 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Specification Reference: + - SMBIOS Reference Specification 3.4.0, Chapter 7.1 +**/ + +#include +#include + +#define TYPE0_STRINGS \ + "ARM LTD\0" /* Vendor */ \ + "EDK II\0" /* BiosVersion */ \ + __DATE__"\0" /* BiosReleaseDate */ \ + "\0" + +typedef enum { + VendorName =3D 1, + BiosVersion, + BiosReleaseDate +} TYPE0_STRING_ELEMENTS; + +/* SMBIOS Type0 structure */ +#pragma pack(1) +typedef struct { + SMBIOS_TABLE_TYPE0 Base; + CHAR8 Strings[sizeof (TYPE0_STRINGS)]; +} ARM_RD_SMBIOS_TYPE0; +#pragma pack() + +/* BIOS information */ +STATIC ARM_RD_SMBIOS_TYPE0 mArmRdSmbiosType0 =3D { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_BIOS_INFORMATION, // Type 0 + sizeof (SMBIOS_TABLE_TYPE0), // Length + SMBIOS_HANDLE_PI_RESERVED, // Assign an unused handle number + }, + VendorName, // String number of vendor name in TYPE0_STRINGS + BiosVersion, // String number of BiosVersion + 0, // Bios starting address segment + BiosReleaseDate, // String number of BiosReleaseDate + 0xFF, // Bios ROM size + { // MISC_BIOS_CHARACTERISTICS + 0, // Reserved + 0, // Unknown + 0, // BIOS Characteristics are not supported + 0, // ISA not supported + 0, // MCA not supported + 0, // EISA not supported + 1, // PCI supported + 0, // PC card (PCMCIA) not supported + 1, // Plug and Play is supported + 0, // APM not supported + 1, // BIOS upgradable + 0, // BIOS shadowing is not allowed + 0, // VL-VESA not supported + 0, // ESCD support is not available + 0, // Boot from CD not supported + 1, // selectable boot + }, + { // BIOSCharacteristicsExtensionBytes + ( + (1 << 0) | // ACPI Supported + (1 << 1) // Legacy USB supported + ), + ( + (1 << 3) | // Content distribution enabled + (1 << 4) // UEFI spec supported + ) + }, + 0, // SMBIOS Major Release, updated dynamically + 0, // SMBIOS Minor Release, updated dynamically + 0xFF, // Embedded Controller Firmware Major Release + 0xFF, // Embedded Controller Firmware Minor Release + { // EXTENDED_BIOS_ROM_SIZE + 64, // Size + 0 // Unit MB + } + }, + // Text strings (unformatted area) + TYPE0_STRINGS +}; + +/** + Install SMBIOS BIOS information Table. + + Install the SMBIOS BIOS information (type 0) table for Arm's reference d= esign + platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +InstallType0BiosInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType0)->Handle; + + /* Update firmware revision */ + mArmRdSmbiosType0.Base.SystemBiosMajorRelease =3D + (PcdGet32 (PcdFirmwareRevision) >> 16) & 0xFF; + mArmRdSmbiosType0.Base.SystemBiosMinorRelease =3D + PcdGet32 (PcdFirmwareRevision) & 0xFF; + + /* Install type 0 table */ + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType0 + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to install Type0 SMBIOS table.\n" + )); + } + + return Status; +} --=20 2.17.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 (#75525): https://edk2.groups.io/g/devel/message/75525 Mute This Topic: https://groups.io/mt/83052323/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- From nobody Sun May 19 08:30:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+75526+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75526+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621866515; cv=none; d=zohomail.com; s=zohoarc; b=WJfCyyJpv1ug3VTf06ctF2aWI4d9Ik2t8hSaSnNpqmE4zqdMpFSGnIUUatgfVIMtDWI2vJV0ooPnUtU0SHhdk/eG/K2ipyFoI8LM6Df2jGX2kU9g3a8skv0DFeFdH7/P+p6AS6GDdzjXdZIWvahsl/OvjH636yMW4q5zHP1uqGA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621866515; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=BjbI3fJNX+VrOnt+abtH9X84T2dz04lihuZZeOqA8Q8=; b=ks7P08Ct+Dp+U46L7tCxkr6zw6Ar2Y+P4fz8XYC9gU27MMgVM2SwivDxSuBgtkmzpb8NipYYuMSnILh75RD1btB7Yrt00EjMYGTTBG87RocSN9Eic1k4L3m03A8OgS0qORxkaImK5Hhi2g8s86JoguCP2OlCkMlbfqCnXvgoCPw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75526+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1621866515652548.9683536185134; Mon, 24 May 2021 07:28:35 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id mxD7YY1788612xDz7wOfGjrc; Mon, 24 May 2021 07:28:35 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.24046.1621866514437152748 for ; Mon, 24 May 2021 07:28:34 -0700 X-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 19C8CED1; Mon, 24 May 2021 07:28:34 -0700 (PDT) X-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 E47D33F719; Mon, 24 May 2021 07:28:32 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V4 04/11] Platform/Sgi: Add SMBIOS Type1 Table Date: Mon, 24 May 2021 19:58:09 +0530 Message-Id: <20210524142816.9967-5-pranav.madhu@arm.com> In-Reply-To: <20210524142816.9967-1-pranav.madhu@arm.com> References: <20210524142816.9967-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,pranav.madhu@arm.com X-Gm-Message-State: YQZ7WGi8BjeV5eTuVqlxyoaax1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621866515; bh=d8rWZ9e/mmllYZ1dSsL8hr7W95nFUqs8jHbi1tXOzLs=; h=Cc:Date:From:Reply-To:Subject:To; b=aIT9dvPUnIhNLSkS0yEVTX4r0zzGQktzJ6iT6gIRUw6WM8bB7YOUKhNLgHxIcQhWsad WEocOWuH+/gfwMu4RIXEcowhqaGPixU3MNb9XRxRasZYnec2U/4zJw39RtYRV4g959y/k CqXXU90gqzSzwk87aARz+M3QXOiyzyh2+Q0= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add the SMBIOS type 1 table (System Information) that includes information about manufacturer, product name, version, serial number and other information related to the system identification. Signed-off-by: Pranav Madhu Reviewed-by: Sami Mujawar --- Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | = 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h | = 19 +++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | = 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type1SystemInformation.c | 1= 42 ++++++++++++++++++++ 4 files changed, 163 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index 3568380f8404..f7beb1c66c80 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -16,6 +16,7 @@ [Sources] SmbiosPlatformDxe.c Type0BiosInformation.c + Type1SystemInformation.c =20 [Packages] ArmPkg/ArmPkg.dec diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h index a09f89ebe5bc..e2437b109899 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -29,4 +29,23 @@ InstallType0BiosInformation ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +/** + Install SMBIOS System information Table. + + Install the SMBIOS system information (type 1) table for Arm's reference + design platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_NOT_FOUND Unknown product id. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +EFIAPI +InstallType1SystemInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + #endif // SMBIOS_PLATFORM_DXE_H_ diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index 20d4dedccb82..b9ce50c82b4c 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -27,6 +27,7 @@ typedef EFI_STATUS (*ARM_RD_SMBIOS_TABLE_INSTALL_FPTR)(EF= I_SMBIOS_PROTOCOL *); STATIC CONST ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D { &InstallType0BiosInformation, + &InstallType1SystemInformation, }; =20 /** diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type1SystemInfor= mation.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type1SystemInforma= tion.c new file mode 100644 index 000000000000..367587c07673 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type1SystemInformation.c @@ -0,0 +1,142 @@ +/** @file + SMBIOS Type 1 (System information) table for ARM RD platforms. + + This file installs SMBIOS Type 1 (System information) table for Arm's + Reference Design platforms. Type 1 table defines attributes of the + overall system such as manufacturer, product name, UUID etc. + + Copyright (c) 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Specification Reference: + - SMBIOS Reference Specification 3.4.0, Chapter 7.2 +**/ + +#include +#include +#include +#include + +#include "SgiPlatform.h" + +#define TYPE1_STRINGS \ + "ARM LTD\0" /* Manufacturer */ \ + "Version not set\0" /* Version */ \ + "Serial not set\0" /* Serial number */ \ + "Not Applicable\0" /* SKU */ \ + "Not Applicable\0" /* Family */ \ + "SGI575\0" /* Product Names */ \ + "RdN1Edge\0" \ + "RdN1EdgeX2\0" \ + "RdE1Edge\0" \ + "RdV1\0" \ + "RdV1Mc\0" \ + "RdN2\0" + +typedef enum { + ManufacturerName =3D 1, + Version, + SerialNumber, + SKU, + Family, + ProductNameBase +} TYPE1_STRING_ELEMENTS; + +/* SMBIOS Type1 structure */ +#pragma pack(1) +typedef struct { + SMBIOS_TABLE_TYPE1 Base; + CHAR8 Strings[sizeof (TYPE1_STRINGS)]; +} ARM_RD_SMBIOS_TYPE1; +#pragma pack() + +STATIC GUID mSmbiosUid[] =3D { + /* Sgi575 */ + {0xdd7cad0a, 0x227c, 0x4ed4, {0x9f, 0x42, 0xa9, 0x8b, 0xd6, 0xa2, 0x42, = 0x6c}}, + /* Rd-N1-Edge */ + {0x80984efe, 0x404a, 0x43e0, {0xad, 0xa4, 0x63, 0xa0, 0xe0, 0xc4, 0x5e, = 0x60}}, + /* Rd-N1-Edge-X2 */ + {0x2cc4f916, 0x267a, 0x4251, {0x95, 0x6e, 0xf0, 0x49, 0x82, 0xbe, 0x94, = 0x58}}, + /* Rd-E1-Edge */ + {0x567f35c4, 0x104f, 0x447b, {0xa0, 0x94, 0x89, 0x2f, 0xbd, 0xb6, 0x5a, = 0x55}}, + /* Rd-V1 */ + {0xc481f0b1, 0x237c, 0x42d7, {0x98, 0xb2, 0xb4, 0xb4, 0x8d, 0xb5, 0x4f, = 0x50}}, + /* Rd-V1Mc */ + {0x1f3a0806, 0x18b5, 0x4eca, {0xad, 0xcd, 0xba, 0x9b, 0x07, 0xb1, 0x0a, = 0xcf}}, + /* Rd-N2 */ + {0xf2cded73, 0x37f9, 0x4ec9, {0xd9, 0xf9, 0x89, 0x9b, 0x74, 0x91, 0x20, = 0x49}} +}; + +/* System information */ +STATIC ARM_RD_SMBIOS_TYPE1 mArmRdSmbiosType1 =3D { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_SYSTEM_INFORMATION, // Type 1 + sizeof (SMBIOS_TABLE_TYPE1), // Length + SMBIOS_HANDLE_PI_RESERVED, // Assign an unused handle number + }, + ManufacturerName, // Manufacturer + ProductNameBase, // Product Name, update dynamically + Version, // Version + SerialNumber, // Serial + {0}, // UUID, Update dymanically + 1, // Wakeup type other + SKU, // SKU + Family, // Family + }, + // Text strings (unformatted) + TYPE1_STRINGS +}; + +/** + Install SMBIOS System information Table. + + Install the SMBIOS system information (type 1) table for Arm's reference + design platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_NOT_FOUND Unknown product id. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +InstallType1SystemInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + UINT8 ProductId; + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType1)->Handle; + ProductId =3D SgiGetProductId (); + + /* Choose the product name from TYPE1_STRINGS based on the product ID */ + if (ProductId !=3D UnknownId) { + mArmRdSmbiosType1.Base.ProductName =3D + ProductNameBase + (ProductId - 1); + CopyGuid (&mArmRdSmbiosType1.Base.Uuid, + &mSmbiosUid[ProductId - 1]); + } else { + return EFI_NOT_FOUND; + } + + /* Install type 1 table */ + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType1 + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to install Type1 SMBIOS table.\n" + )); + } + + return Status; +} --=20 2.17.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 (#75526): https://edk2.groups.io/g/devel/message/75526 Mute This Topic: https://groups.io/mt/83052324/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- From nobody Sun May 19 08:30:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+75527+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75527+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621866524; cv=none; d=zohomail.com; s=zohoarc; b=VpH8xfJtABHdea8cccxvMH/yx3rBZS5mYQ2XP+CJf6HgYevbYO5AakpFVrm4APsIK/Ka5Kg9duD5VH50vRLeLMtTujJGDR3Or7u/gNHgqW12OaArIu/HmYj+Dfz07rMTjRrq3LmHsMmswLoKhHNTGkNiuJXhmQKrOCV1QCjMs8s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621866524; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=V4tRbwpRWagCNWrjy34A7e3kt0fisfKYJq5C1K9ihpQ=; b=hFrg67sYB0qAoVS0/7AjfYdWBmmVf62YYElpm5iI7yfgvOa189c0yCU19f9Vd4hIZhIink0E2YijcQJ+0ncQVqJlykDBZCWq/kdLKlw7VWa9hdQcQxvuV3wo++icmOHT+tKH2Yg7j5NM3Z7H7hj6mroEpHyKLYGuixcOgbMGM+Q= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75527+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1621866524306584.9477458958172; Mon, 24 May 2021 07:28:44 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id LeFbYY1788612xIbQ1QRr5uS; Mon, 24 May 2021 07:28:43 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.23864.1621866516091160630 for ; Mon, 24 May 2021 07:28:36 -0700 X-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 AF9ACED1; Mon, 24 May 2021 07:28:35 -0700 (PDT) X-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 85EBA3F719; Mon, 24 May 2021 07:28:34 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V4 05/11] Platform/Sgi: Add SMBIOS Type3 Table Date: Mon, 24 May 2021 19:58:10 +0530 Message-Id: <20210524142816.9967-6-pranav.madhu@arm.com> In-Reply-To: <20210524142816.9967-1-pranav.madhu@arm.com> References: <20210524142816.9967-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,pranav.madhu@arm.com X-Gm-Message-State: 0PBD1jRRC3mtrD6gvcFMfIy0x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621866523; bh=3frqZVdiqRl3mio+v4Pk+CbdXAFfRNlgL4/vocXO7xw=; h=Cc:Date:From:Reply-To:Subject:To; b=SXtNayEcxYpykYwp0GN3ICEI6WUqiyVn5SmiZNXxx3A7XpXyRbX+ew9FbLciclAKvHQ byuYYa4NyF/9eLR7DLrQ5S6WSIGWiqJQr3UHjJqCWuAvibbmfi/7iiKJfG+PmOqDnrGkv neTnesA+4nakbYRlNIL9/NGW4WdW+dQk4sQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add the SMBIOS type 3 table (System Enclosure) that includes information about manufacturer, type, serial number and other information related to system enclosure. Signed-off-by: Pranav Madhu Reviewed-by: Sami Mujawar --- Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 1= + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 22= +++++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 1= + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type3SystemEnclosure.c | 103= ++++++++++++++++++++ 4 files changed, 127 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index f7beb1c66c80..b3c1619ddc66 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -17,6 +17,7 @@ SmbiosPlatformDxe.c Type0BiosInformation.c Type1SystemInformation.c + Type3SystemEnclosure.c =20 [Packages] ArmPkg/ArmPkg.dec diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h index e2437b109899..fc18cfc9f369 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -48,4 +48,26 @@ InstallType1SystemInformation ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +/** + Install SMBIOS System Enclosure Table + + Install the SMBIOS System Enclosure (type 3) table for Arm's Reference D= esign + platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +EFIAPI +InstallType3SystemEnclosure ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + +typedef enum { + SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, +} SMBIOS_REFRENCE_HANDLES; + #endif // SMBIOS_PLATFORM_DXE_H_ diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index b9ce50c82b4c..ac4c6120841f 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -28,6 +28,7 @@ STATIC CONST ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D { &InstallType0BiosInformation, &InstallType1SystemInformation, + &InstallType3SystemEnclosure, }; =20 /** diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type3SystemEnclo= sure.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type3SystemEnclosure= .c new file mode 100644 index 000000000000..146852eb4ae6 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type3SystemEnclosure.c @@ -0,0 +1,103 @@ +/** @file + SMBIOS Type 3 (System enclosure) table for ARM RD platforms. + + This file installs SMBIOS Type 3 (System enclosure) table for Arm Refere= nce + Design platforms. SMBIOS Type 3 table (System Enclosure) includes inform= ation + about manufacturer, type, serial number and other information related to + system enclosure. + + Copyright (c) 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Specification Reference: + - SMBIOS Reference Specification 3.4.0, Chapter 7.4 +**/ + +#include +#include + +#include "SmbiosPlatformDxe.h" + +#define TYPE3_STRINGS \ + "ARM LTD\0" /* Manufacturer */ \ + "Version not set\0" /* Version */ \ + "Serial not set\0" /* Serial */ \ + "Asset Tag not set\0" /* Asset Tag */ + +typedef enum { + ManufacturerName =3D 1, + Version, + SerialNumber, + AssetTag +} TYPE3_STRING_ELEMENTS; + +/* SMBIOS Type3 structure */ +#pragma pack(1) +typedef struct { + SMBIOS_TABLE_TYPE3 Base; + CHAR8 Strings[sizeof (TYPE3_STRINGS)]; +} ARM_RD_SMBIOS_TYPE3; +#pragma pack() + +/* System information */ +STATIC ARM_RD_SMBIOS_TYPE3 mArmRdSmbiosType3 =3D { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE, // Type 3 + sizeof (SMBIOS_TABLE_TYPE1), // Length + SMBIOS_HANDLE_ENCLOSURE, // Assign an unused handle number + }, + ManufacturerName, // Manufacturer + 2, // Enclosure type unknown + Version, // Version + SerialNumber, // Serial + AssetTag, // Asset Tag + ChassisStateSafe, // Boot chassis state + ChassisStateSafe, // Power supply state + ChassisStateSafe, // Thermal state + ChassisSecurityStatusUnknown, // Security Status + {0}, // BIOS vendor specific Information + }, + // Text strings (unformatted) + TYPE3_STRINGS +}; + +/** + Install SMBIOS System Enclosure Table + + Install the SMBIOS System Enclosure (type 3) table for Arm's Reference D= esign + platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +InstallType3SystemEnclosure ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType3)->Handle; + + /* Install type 3 table */ + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType3 + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to install Type3 SMBIOS table.\n" + )); + } + + return Status; +} --=20 2.17.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 (#75527): https://edk2.groups.io/g/devel/message/75527 Mute This Topic: https://groups.io/mt/83052325/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- From nobody Sun May 19 08:30:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+75528+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75528+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621866518; cv=none; d=zohomail.com; s=zohoarc; b=nAcsQ/4irZnP7e7eS5Wx9bbNDcW74wIDB/p8cJ7ATsT5OAtFPYdbMohZ7qw3PyxMkdabRQhUJsdV8cqp28I7CwVHY93sTlKA4MeQxI3eYHlY2BgEbPbbRtQy9nR0oGyPBu1fPsnTclLG57md5rj3KfysOAnX7AmvaccwIkt7Lbk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621866518; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=eBEaE5Sy0AoT6flItVO7yNa2QJ+e0zislwWVLrmQ6uk=; b=VgNeBIt6pfv1wUmTSCeftm/2d3xHvSNA+Xya6spN6DjXsPk2UrmGG+jaNdt2q1XBXg9RG+jAZxJ/5qOqGoymLBRv1rJTJr/FQCfJhXUi8nLWZUNclTiN5Gb/uH4IFAYoKHksxZNuMbmgwKbf3PQBrFkuBHW0LkV8lpgLKxY6U9A= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75528+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1621866518756610.5944925697853; Mon, 24 May 2021 07:28:38 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id uXPdYY1788612xVC3DhmuaOd; Mon, 24 May 2021 07:28:38 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.23865.1621866517632183257 for ; Mon, 24 May 2021 07:28:37 -0700 X-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 50E46139F; Mon, 24 May 2021 07:28:37 -0700 (PDT) X-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 2770C3F719; Mon, 24 May 2021 07:28:35 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V4 06/11] Platform/Sgi: Add SMBIOS Type4 Table Date: Mon, 24 May 2021 19:58:11 +0530 Message-Id: <20210524142816.9967-7-pranav.madhu@arm.com> In-Reply-To: <20210524142816.9967-1-pranav.madhu@arm.com> References: <20210524142816.9967-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,pranav.madhu@arm.com X-Gm-Message-State: C7dKgra0Z2qIUND3kN0ot8csx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621866518; bh=+ZVmEubzfx7/90HE+YjVPJJygVIGyZJe6p+NJg/IO5M=; h=Cc:Date:From:Reply-To:Subject:To; b=InBAnHRkj10hK+I2vJwuhBucB8PIgeeZNiJQ32O18Fav/3tjkkvkCMZ/igCpPuhbaKj diiYkWmay6b7bVpHB8NA5hMrEMbhghpq3Zu/71LaCgqUPgUWCnz4voAlXPiozmTGxaCWW QaDp932VWaT1xHeRAH4vFLL3O2rM+bCvO6Y= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add the SMBIOS type 4 table (Processor Information) that includes information about manufacture, family, processor id, maximum operating frequency, and other information related to the processor. Signed-off-by: Pranav Madhu Reviewed-by: Sami Mujawar --- Platform/ARM/SgiPkg/SgiPlatform.dsc.inc = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf = | 6 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h = | 25 +++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type4ProcessorInformation.c = | 219 ++++++++++++++++++++ 5 files changed, 252 insertions(+) diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc b/Platform/ARM/SgiPkg/= SgiPlatform.dsc.inc index a0f217f5107c..091de0c99c74 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc @@ -56,6 +56,7 @@ HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeC= oreMemoryAllocationLib.inf PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf =20 [LibraryClasses.common.DXE_DRIVER] FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index b3c1619ddc66..4652a9c62b88 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -18,6 +18,7 @@ Type0BiosInformation.c Type1SystemInformation.c Type3SystemEnclosure.c + Type4ProcessorInformation.c =20 [Packages] ArmPkg/ArmPkg.dec @@ -27,9 +28,11 @@ Platform/ARM/SgiPkg/SgiPlatform.dec =20 [LibraryClasses] + ArmLib ArmPlatformLib DebugLib HobLib + PrintLib UefiDriverEntryPoint =20 [Guids] @@ -37,6 +40,9 @@ gArmSgiPlatformIdDescriptorGuid =20 [FixedPcd] + gArmPlatformTokenSpaceGuid.PcdClusterCount + gArmPlatformTokenSpaceGuid.PcdCoreCount + gArmSgiTokenSpaceGuid.PcdChipCount gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareRevision =20 [Protocols] diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h index fc18cfc9f369..7c2164ae04bf 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -66,8 +66,33 @@ InstallType3SystemEnclosure ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +/** + Install SMBIOS Processor information Table + + Install the SMBIOS Processor information (type 4) table for Arm's Refere= nce + Design platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_NOT_FOUND Unknown product id. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +EFIAPI +InstallType4ProcessorInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + typedef enum { SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, + SMBIOS_HANDLE_CLUSTER1, + SMBIOS_HANDLE_L1I_CACHE, + SMBIOS_HANDLE_L1D_CACHE, + SMBIOS_HANDLE_L2_CACHE, + SMBIOS_HANDLE_L3_CACHE, + SMBIOS_HANDLE_L4_CACHE, } SMBIOS_REFRENCE_HANDLES; =20 #endif // SMBIOS_PLATFORM_DXE_H_ diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index ac4c6120841f..7ef6f88a783d 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -29,6 +29,7 @@ ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D { &InstallType0BiosInformation, &InstallType1SystemInformation, &InstallType3SystemEnclosure, + &InstallType4ProcessorInformation, }; =20 /** diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type4ProcessorIn= formation.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type4ProcessorI= nformation.c new file mode 100644 index 000000000000..9ecaea3603de --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type4ProcessorInformati= on.c @@ -0,0 +1,219 @@ +/** @file + SMBIOS Type 4 (Processor information) table for ARM RD platforms. + + This file installs SMBIOS Type 4 (Processor information) Table for Arm's + Reference Design platforms. It includes information about manufacture, + family, processor id, maximum operating frequency, and other information + related to the processor. + + Copyright (c) 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Specification Reference: + - SMBIOS Reference Specification 3.4.0, Chapter 7.5 +**/ + +#include +#include +#include +#include +#include + +#include "SgiPlatform.h" +#include "SmbiosPlatformDxe.h" + +#define NEOVERSE_E1_THREADS_PER_CORE 2 + +#define SOCKET_TYPE_BASE 3 +#define SOCKET_TYPE_NUM 1 +#define PROCESSOR_VERSION_BASE (SOCKET_TYPE_BASE + SOCKET_TYPE_NUM) +#define PROCESSOR_VERSION_NUM 8 +#define SERIAL_NUMBER_BASE (PROCESSOR_VERSION_BASE + PROCESSOR_VERSIO= N_NUM) +#define TYPE4_STRINGS \ + "0x000\0" /* Part Number */ \ + "ARM LTD\0" /* manufactuer */ \ + "Other\0" /* socket type */ \ + "Unknown\0" /* Processor Version */ \ + "Cortex-A75\0" \ + "Neoverse-N1\0" \ + "Neoverse-N1\0" \ + "Neoverse-E1\0" \ + "Neoverse-V1\0" \ + "Neoverse-V1\0" \ + "Neoverse-N2\0" \ + "000-0\0" /* Serial number */ \ + "783-3\0" \ + "786-1\0" \ + "786-1\0" \ + "786-2\0" \ + "78A-1\0" \ + "78A-2\0" \ + "7B7-1\0" + +typedef enum { + PartNumber =3D 1, + ManufacturerName, + SocketTypeBase =3D SOCKET_TYPE_BASE, + ProcessorVersionBase =3D PROCESSOR_VERSION_BASE, + SerialNumberBase =3D SERIAL_NUMBER_BASE +} TYPE4_STRING_ELEMENTS; + +/* SMBIOS Type4 structure */ +#pragma pack(1) +typedef struct { + SMBIOS_TABLE_TYPE4 Base; + CHAR8 Strings[sizeof (TYPE4_STRINGS)]; +} ARM_RD_SMBIOS_TYPE4; +#pragma pack() + +/* Processor information */ +STATIC ARM_RD_SMBIOS_TYPE4 mArmRdSmbiosType4 =3D { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION, // Type 4 + sizeof (SMBIOS_TABLE_TYPE4), // Length + SMBIOS_HANDLE_CLUSTER1, // handle number + }, + SocketTypeBase, // Socket type + CentralProcessor, // Processor type + ProcessorFamilyIndicatorFamily2, + // Use Processor Family 2 field + ManufacturerName, // Manufacturer string number + {{0}, {0}}, // Processor id, update dynamically + ProcessorVersionBase, // Processor version, update dynamically + {0, 0, 0, 0, 0, 1}, // Non legacy mode for processor voltage + 0, // External clock frequency unknown + 2600, // Max speed in MHz + 2600, // Current speed in MHz + ( // Status + (1 << 6) | // CPU Socket Populated + (1 << 0) // CPU Enabled + ), + ProcessorUpgradeOther, // Processor Upgrade + SMBIOS_HANDLE_L1I_CACHE, // L1 Cache handle + SMBIOS_HANDLE_L2_CACHE, // L2 Cache handle + SMBIOS_HANDLE_L3_CACHE, // L3 Cache handle + 0, // Processor serial number not set + 0, // Processor asset tag not set + PartNumber, // Part number, update dynamically + 0, // Core count, update dynamically + 0, // Enabled core count, update dynamically + 0, // Thread per socket count + ( // Processor characteristics + (1 << 2) | // 64-bit Capable + (1 << 3) | // Multi-Core + (1 << 5) | // Execute Protection + (1 << 6) | // Enhanced Virtualization + (1 << 7) // Power/Performance Control + ), + ProcessorFamilyARM // Processor Family 2 + }, + TYPE4_STRINGS +}; + +/** + Update the part-number string. + + Get the part number from ProcessorId and update TYPE4_STRINGS + + @param ProcessorId The processor Id read from MIDR register +**/ +STATIC +VOID +UpdatePartNumber ( + IN UINT64 ProcessorId + ) +{ + CHAR8 PartNumber[6] =3D {0}; + UINT16 PartNum; + + PartNum =3D (UINT16)((ProcessorId >> 4) & 0xFFF); + + /* Convert 3 digit hexadecimal partnumber to ASCII and update TYPE4_STRI= NGS */ + AsciiSPrint (PartNumber, sizeof (PartNumber), "0x%03x", PartNum); + CopyMem (&mArmRdSmbiosType4.Strings[0], PartNumber, sizeof (PartNumber)); +} + +/** + Install SMBIOS Processor information Table + + Install the SMBIOS Processor information (type 4) table for Arm's Refere= nce + Design platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_NOT_FOUND Unknown product id. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +InstallType4ProcessorInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + UINT8 ProductId; + UINT32 CoreCount; + UINT64 *ProcessorId =3D (UINT64 *)&(mArmRdSmbiosType4.Base.ProcessorId); + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType4)->Handle; + CoreCount =3D (FixedPcdGet32 (PcdCoreCount) * FixedPcdGet32 (PcdClusterC= ount)); + ProductId =3D SgiGetProductId (); + + /* Set the core count and processor speed for all platforms */ + switch (ProductId) { + case Sgi575: + case RdN1Edge: + case RdV1: + mArmRdSmbiosType4.Base.CoreCount =3D CoreCount; + mArmRdSmbiosType4.Base.EnabledCoreCount =3D CoreCount; + mArmRdSmbiosType4.Base.ThreadCount =3D CoreCount; + break; + case RdN2: + mArmRdSmbiosType4.Base.CoreCount =3D CoreCount; + mArmRdSmbiosType4.Base.EnabledCoreCount =3D CoreCount; + mArmRdSmbiosType4.Base.ThreadCount =3D CoreCount; + mArmRdSmbiosType4.Base.MaxSpeed =3D 3200; // Frequency in MHz + mArmRdSmbiosType4.Base.CurrentSpeed =3D 3200; // Frequency in MHz + break; + case RdN1EdgeX2: + case RdV1Mc: + mArmRdSmbiosType4.Base.CoreCount =3D CoreCount * FixedPcdGet32 (PcdChi= pCount); + mArmRdSmbiosType4.Base.EnabledCoreCount =3D CoreCount * FixedPcdGet32 = (PcdChipCount); + mArmRdSmbiosType4.Base.ThreadCount =3D CoreCount * FixedPcdGet32 (PcdC= hipCount); + break; + case RdE1Edge: + mArmRdSmbiosType4.Base.CoreCount =3D CoreCount / NEOVERSE_E1_THREADS_P= ER_CORE; + mArmRdSmbiosType4.Base.EnabledCoreCount =3D CoreCount / NEOVERSE_E1_TH= READS_PER_CORE; + mArmRdSmbiosType4.Base.ThreadCount =3D CoreCount; + mArmRdSmbiosType4.Base.MaxSpeed =3D 2300; // Frequency in MHz + mArmRdSmbiosType4.Base.CurrentSpeed =3D 2300; // Frequency in MHz + break; + } + + mArmRdSmbiosType4.Base.ProcessorVersion =3D ProcessorVersionBase + Produ= ctId; + mArmRdSmbiosType4.Base.SerialNumber =3D SerialNumberBase + ProductId; + + /* Update processor-id and part number */ + *ProcessorId =3D ArmReadMidr (); + UpdatePartNumber (*ProcessorId); + + /* Install type 4 table */ + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType4 + ); + if (Status !=3D EFI_SUCCESS) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to install Type4 SMBIOS table.\n" + )); + } + + return Status; +} --=20 2.17.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 (#75528): https://edk2.groups.io/g/devel/message/75528 Mute This Topic: https://groups.io/mt/83052326/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- From nobody Sun May 19 08:30:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+75529+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75529+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621866521; cv=none; d=zohomail.com; s=zohoarc; b=W7XpORaTqNeBEXXqdtSJd0UHSbh1Kj3D7CczjC0Wkrc5FimAg1J6kFQ/vmPkGUVf7Xh3UCY163AAe3cmt3KCZeNFCcPqs2z9W2T6Vn0YhCDTnXC2Wl2aIxfpgmAjGaG+eS3xg7Hay0HEbZuPt23ZQYvHYb1OIqcN7qW6TCMz5UM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621866521; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=ahNf2tOgYKOMwh1w4HfrGz1LdikSX/Eystw++B1Vn+Q=; b=QajPNjDn8F7j51pP3XbSxXayVwutv/+HVL0qPnZs/iMZxMfG/jtMPWChkHnvn/H12A0NPsDrHOYFR3jYd3Or5aVcDOazS3zYG819n6PlNW2hMhICnh8tzwgGYCq4c8FQ9on3tjYZ/2DtNL4rVuTII1R6FNcIYDBnuFgF1r5E3tY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75529+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1621866521886833.0648725793377; Mon, 24 May 2021 07:28:41 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id ZIu9YY1788612x0CVm3VUH8s; Mon, 24 May 2021 07:28:41 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.23867.1621866519512530028 for ; Mon, 24 May 2021 07:28:39 -0700 X-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 2A838ED1; Mon, 24 May 2021 07:28:39 -0700 (PDT) X-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 BD1213F719; Mon, 24 May 2021 07:28:37 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V4 07/11] Platform/Sgi: Add SMBIOS Type7 Table Date: Mon, 24 May 2021 19:58:12 +0530 Message-Id: <20210524142816.9967-8-pranav.madhu@arm.com> In-Reply-To: <20210524142816.9967-1-pranav.madhu@arm.com> References: <20210524142816.9967-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,pranav.madhu@arm.com X-Gm-Message-State: lYr1RYiTuzpct6VuOomQDDH8x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621866521; bh=7B9mZ5q/CM4iYQ6YmHUb8xONHk2RABNE9ohfkIaE8yA=; h=Cc:Date:From:Reply-To:Subject:To; b=SK521DgrL0tR2ZVM8s5vRXiLDfg4XMwLw2yRQhjw4LdKv/NoD9AlU5dxNpY2qeLie0R s+Qt6pg3F7Sp6+e7JW2FuNYJhrwyxI2bIqU/fAg2Kh33cOL5RjTePCa4cJIXgv7mFkn0r 4+gJavA08YrjGPlJKfCLkEPxhkvj6ZeubG0= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add the SMBIOS type 7 table (Cache Information) that includes information about cache levels implemented, cache configuration, ways of associativity and other information related to cache memory installed. Signed-off-by: Pranav Madhu Reviewed-by: Sami Mujawar --- Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | = 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 1= 9 ++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | = 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type7CacheInformation.c | 34= 2 ++++++++++++++++++++ 4 files changed, 363 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index 4652a9c62b88..ee00b773912b 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -19,6 +19,7 @@ Type1SystemInformation.c Type3SystemEnclosure.c Type4ProcessorInformation.c + Type7CacheInformation.c =20 [Packages] ArmPkg/ArmPkg.dec diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h index 7c2164ae04bf..43f35ea0518f 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -85,6 +85,25 @@ InstallType4ProcessorInformation ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +/** + Install SMBIOS Cache information Table + + Install the SMBIOS Cache information (type 7) table for Arm's Reference + Design platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_NOT_FOUND Unknown product id. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +EFIAPI +InstallType7CacheInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + typedef enum { SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, SMBIOS_HANDLE_CLUSTER1, diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index 7ef6f88a783d..d3b161b77550 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -30,6 +30,7 @@ ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D { &InstallType1SystemInformation, &InstallType3SystemEnclosure, &InstallType4ProcessorInformation, + &InstallType7CacheInformation, }; =20 /** diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type7CacheInform= ation.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type7CacheInformati= on.c new file mode 100644 index 000000000000..6be62900bd71 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type7CacheInformation.c @@ -0,0 +1,342 @@ +/** @file + SMBIOS Type 7 (Cache information) table for ARM RD platforms. + + This file installs SMBIOS Type 7 (Cache information) table for Arm's + Reference Design platforms. It includes information about cache levels + implemented, cache configuration, ways of associativity and other + information related to cache memory installed. + + Copyright (c) 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Specification Reference: + - SMBIOS Reference Specification 3.4.0, Chapter 7.8 +**/ + +#include +#include + +#include "SgiPlatform.h" +#include "SmbiosPlatformDxe.h" + +#define TYPE7_STRINGS \ + "L1 Instruction\0" /* L1I */ \ + "L1 Data\0" /* L1D */ \ + "L2\0" /* L2 */ \ + "L3\0" /* L3 */ \ + "SLC\0" /* L4 */ + +typedef enum { + L1Instruction =3D 1, + L1Data, + L2, + L3, + SLC, +} TYPE7_STRING_ELEMENTS; + +/* SMBIOS Type7 structure */ +#pragma pack(1) +typedef struct { + SMBIOS_TABLE_TYPE7 Base; + CHAR8 Strings[sizeof (TYPE7_STRINGS)]; +} ARM_RD_SMBIOS_TYPE7; +#pragma pack() + +/* Cache information */ +STATIC ARM_RD_SMBIOS_TYPE7 mArmRdSmbiosType7[] =3D { + { // Entry 0, L1 instruction cache + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_CACHE_INFORMATION, // Type 7 + sizeof (SMBIOS_TABLE_TYPE7), // Length + SMBIOS_HANDLE_L1I_CACHE, // Handle number + }, + L1Instruction, + ( + (1 << 8) | // Write-back + (1 << 7) | // Cache enabled + (1 << 3) | // Cache socketed + 0x0 // Cache level 1 + ), + 0xFFFF, // Uses Maximum cache size 2 field + 0xFFFF, // Uses Installed cache size 2 field + {0, 1}, // Supported SRAM type unknown + {0, 1}, // Current SRAM type unknown + 0, // Cache Speed Unknown + 0x02, // Error correction type unknown + 0x03, // Instruction cache + 0, // Associativity, update dynamically + 0, // Maximum cache size 2, update dynamically + 0 // Installed cache size 2, update dynamically + }, + // Text strings (unformatted area) + TYPE7_STRINGS + }, + { // Entry 1, L1 data cache + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_CACHE_INFORMATION, // Type 7 + sizeof (SMBIOS_TABLE_TYPE7), // Length + SMBIOS_HANDLE_L1D_CACHE, // Handle number + }, + L1Data, + ( + (1 << 8) | // Write-back + (1 << 7) | // Cache enabled + (1 << 3) | // Cache socketed + 0x0 // Cache level 1 + ), + 0xFFFF, // Uses Maximum cache size 2 field + 0xFFFF, // Uses Installed cache size 2 field + {0, 1}, // Supported SRAM type unknown + {0, 1}, // Current SRAM type unknown + 0, // Cache Speed Unknown + 0x02, // Error correction type unknown + 0x04, // Data cache + 0, // Associativity, update dynamically + 0, // Maximum cache size 2, update dynamically + 0 // Installed cache size 2, update dynamically + }, + // Text strings (unformatted area) + TYPE7_STRINGS + }, + { // Entry 2, L2 cache + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_CACHE_INFORMATION, // Type 7 + sizeof (SMBIOS_TABLE_TYPE7), // Length + SMBIOS_HANDLE_L2_CACHE, // Handle number + }, + L2, + ( + (1 << 8) | // Write-back + (1 << 7) | // Cache enabled + (1 << 3) | // Cache socketed + 0x1 // Cache level 2 + ), + 0xFFFF, // Uses Maximum cache size 2 field + 0xFFFF, // Uses Installed cache size 2 field + {0, 1}, // Supported SRAM type unknown + {0, 1}, // Current SRAM type unknown + 0, // Cache Speed Unknown + 0x02, // Error correction type unknown + 0x05, // Unified cache + 0, // Associativity, update dynamically + 0, // Maximum cache size 2, update dynamically + 0 // Installed cache size 2, update dynamically + }, + // Text strings (unformatted area) + TYPE7_STRINGS + }, + { // Entry 3, L3 cache + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_CACHE_INFORMATION, // Type 7 + sizeof (SMBIOS_TABLE_TYPE7), // Length + SMBIOS_HANDLE_L3_CACHE, // Handle number + }, + L3, + ( + (1 << 8) | // Write-back + (1 << 7) | // Cache enabled + (1 << 3) | // Cache socketed + 0x2 // Cache level 3 + ), + 0xFFFF, // Uses Maximum cache size 2 field + 0xFFFF, // Uses Installed cache size 2 field + {0, 1}, // Supported SRAM type unknown + {0, 1}, // Current SRAM type unknown + 0, // Cache Speed Unknown + 0x02, // Error correction type unknown + 0x05, // Unified cache + 0, // Associativity, update dynamically + 0, // Maximum cache size 2, update dynamically + 0 // Installed cache size 2, update dynamically + }, + // Text strings (unformatted area) + TYPE7_STRINGS + }, + { // Entry 4, SLC Cache + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_CACHE_INFORMATION, // Type 7 + sizeof (SMBIOS_TABLE_TYPE7), // Length + SMBIOS_HANDLE_L4_CACHE, // Handle number + }, + SLC, + ( + (1 << 8) | // Write-back + (1 << 7) | // Cache enabled + (1 << 3) | // Cache socketed + 0x3 // Cache level 4 + ), + 0xFFFF, // Uses Maximum cache size 2 field + 0xFFFF, // Uses Installed cache size 2 field + {0, 1}, // Supported SRAM type unknown + {0, 1}, // Current SRAM type unknown + 0, // Cache Speed Unknown + 0x02, // Error correction type unknown + 0x05, // Unified cache + 0, // Associativity, update dynamically + 0, // Maximum cache size 2, update dynamically + 0 // Installed cache size 2, update dynamically + }, + // Text strings (unformatted area) + TYPE7_STRINGS + } +}; + +/** + Install SMBIOS Cache information Table + + Install the SMBIOS Cache information (type 7) table for Arm's Reference + Design platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_NOT_FOUND Unknown product id. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +InstallType7CacheInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + UINT8 CacheIdx; + + /* Update the cache attributes based on the product */ + switch (SgiGetProductId ()) { + case Sgi575: + /* L1 instruction cache */ + mArmRdSmbiosType7[0].Base.MaximumCacheSize2 =3D 64; // 64KB + mArmRdSmbiosType7[0].Base.InstalledSize2 =3D 64; // 64KB + mArmRdSmbiosType7[0].Base.Associativity =3D CacheAssociativity4Way; + /* L1 data cache */ + mArmRdSmbiosType7[1].Base.MaximumCacheSize2 =3D 64; // 64KB + mArmRdSmbiosType7[1].Base.InstalledSize2 =3D 64; // 64KB + mArmRdSmbiosType7[1].Base.Associativity =3D CacheAssociativity16Way; + /* L2 cache */ + mArmRdSmbiosType7[2].Base.MaximumCacheSize2 =3D 512; // 512KB + mArmRdSmbiosType7[2].Base.InstalledSize2 =3D 512; // 512KB + mArmRdSmbiosType7[2].Base.Associativity =3D CacheAssociativity8Way; + /* L3 cache */ + mArmRdSmbiosType7[3].Base.MaximumCacheSize2 =3D 2048; // 2MB + mArmRdSmbiosType7[3].Base.InstalledSize2 =3D 2048; // 2MB + mArmRdSmbiosType7[3].Base.Associativity =3D CacheAssociativity16Way; + break; + case RdN1Edge: + case RdN1EdgeX2: + /* L1 instruction cache */ + mArmRdSmbiosType7[0].Base.MaximumCacheSize2 =3D 64; // 64KB + mArmRdSmbiosType7[0].Base.InstalledSize2 =3D 64; // 64KB + mArmRdSmbiosType7[0].Base.Associativity =3D CacheAssociativity4Way; + /* L1 data cache */ + mArmRdSmbiosType7[1].Base.MaximumCacheSize2 =3D 64; // 64KB + mArmRdSmbiosType7[1].Base.InstalledSize2 =3D 64; // 64KB + mArmRdSmbiosType7[1].Base.Associativity =3D CacheAssociativity4Way; + /* L2 cache */ + mArmRdSmbiosType7[2].Base.MaximumCacheSize2 =3D 512; // 512KB + mArmRdSmbiosType7[2].Base.InstalledSize2 =3D 512; // 512KB + mArmRdSmbiosType7[2].Base.Associativity =3D CacheAssociativity8Way; + /* L3 cache */ + mArmRdSmbiosType7[3].Base.MaximumCacheSize2 =3D 2048; // 2MB + mArmRdSmbiosType7[3].Base.InstalledSize2 =3D 2048; // 2MB + mArmRdSmbiosType7[3].Base.Associativity =3D CacheAssociativity16Way; + /* System level cache */ + mArmRdSmbiosType7[4].Base.MaximumCacheSize2 =3D 8192; // 8MB SLC per = chip + mArmRdSmbiosType7[4].Base.InstalledSize2 =3D 8192; // 8MB SLC per = chip + mArmRdSmbiosType7[4].Base.Associativity =3D CacheAssociativity16Way; + break; + case RdE1Edge: + /* L1 instruction cache */ + mArmRdSmbiosType7[0].Base.MaximumCacheSize2 =3D 32; // 32KB + mArmRdSmbiosType7[0].Base.InstalledSize2 =3D 32; // 32KB + mArmRdSmbiosType7[0].Base.Associativity =3D CacheAssociativity4Way; + /* L1 data cache */ + mArmRdSmbiosType7[1].Base.MaximumCacheSize2 =3D 32; // 32KB + mArmRdSmbiosType7[1].Base.InstalledSize2 =3D 32; // 32KB + mArmRdSmbiosType7[1].Base.Associativity =3D CacheAssociativity4Way; + /* L2 cache */ + mArmRdSmbiosType7[2].Base.MaximumCacheSize2 =3D 256; // 256KB + mArmRdSmbiosType7[2].Base.InstalledSize2 =3D 256; // 256KB + mArmRdSmbiosType7[2].Base.Associativity =3D CacheAssociativity4Way; + /* L3 cache */ + mArmRdSmbiosType7[3].Base.MaximumCacheSize2 =3D 2048; // 2MB + mArmRdSmbiosType7[3].Base.InstalledSize2 =3D 2048; // 2MB + mArmRdSmbiosType7[3].Base.Associativity =3D CacheAssociativity16Way; + /* System level cache */ + mArmRdSmbiosType7[4].Base.MaximumCacheSize2 =3D 8192; // 8MB SLC + mArmRdSmbiosType7[4].Base.InstalledSize2 =3D 8192; // 8MB SLC + mArmRdSmbiosType7[4].Base.Associativity =3D CacheAssociativity16Way; + break; + case RdV1: + case RdV1Mc: + /* L1 instruction cache */ + mArmRdSmbiosType7[0].Base.MaximumCacheSize2 =3D 64; // 64KB + mArmRdSmbiosType7[0].Base.InstalledSize2 =3D 64; // 64KB + mArmRdSmbiosType7[0].Base.Associativity =3D CacheAssociativity4Way; + /* L1 data cache */ + mArmRdSmbiosType7[1].Base.MaximumCacheSize2 =3D 64; // 64KB + mArmRdSmbiosType7[1].Base.InstalledSize2 =3D 64; // 64KB + mArmRdSmbiosType7[1].Base.Associativity =3D CacheAssociativity4Way; + /* L2 cache */ + mArmRdSmbiosType7[2].Base.MaximumCacheSize2 =3D 1024; // 1MB + mArmRdSmbiosType7[2].Base.InstalledSize2 =3D 1024; // 1MB + mArmRdSmbiosType7[2].Base.Associativity =3D CacheAssociativity8Way; + /* System level cache */ + mArmRdSmbiosType7[4].Base.MaximumCacheSize2 =3D 16384; // 16MB SLC per= chip + mArmRdSmbiosType7[4].Base.InstalledSize2 =3D 16384; // 16MB SLC per= chip + mArmRdSmbiosType7[4].Base.Associativity =3D CacheAssociativity16Way; + break; + case RdN2: + /* L1 instruction cache */ + mArmRdSmbiosType7[0].Base.MaximumCacheSize2 =3D 64; // 64KB + mArmRdSmbiosType7[0].Base.InstalledSize2 =3D 64; // 64KB + mArmRdSmbiosType7[0].Base.Associativity =3D CacheAssociativity4Way; + /* L1 data cache */ + mArmRdSmbiosType7[1].Base.MaximumCacheSize2 =3D 64; // 64KB + mArmRdSmbiosType7[1].Base.InstalledSize2 =3D 64; // 64KB + mArmRdSmbiosType7[1].Base.Associativity =3D CacheAssociativity4Way; + /* L2 cache */ + mArmRdSmbiosType7[2].Base.MaximumCacheSize2 =3D 1024; // 1MB + mArmRdSmbiosType7[2].Base.InstalledSize2 =3D 1024; // 1MB + mArmRdSmbiosType7[2].Base.Associativity =3D CacheAssociativity8Way; + /* System level cache */ + mArmRdSmbiosType7[4].Base.MaximumCacheSize2 =3D 32768; // 32MB SLC + mArmRdSmbiosType7[4].Base.InstalledSize2 =3D 32768; // 32MB SLC + mArmRdSmbiosType7[4].Base.Associativity =3D CacheAssociativity16Way; + break; + } + + /* Install valid cache information tables */ + for (CacheIdx =3D 0; CacheIdx < ARRAY_SIZE (mArmRdSmbiosType7); CacheIdx= ++) { + if (mArmRdSmbiosType7[CacheIdx].Base.MaximumCacheSize2 =3D=3D 0) { + continue; + } + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType7[CacheI= dx])->Handle; + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType7[Cache= Idx] + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to install Type7 SMBIOS table.\n" + )); + } + } + + return Status; +} --=20 2.17.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 (#75529): https://edk2.groups.io/g/devel/message/75529 Mute This Topic: https://groups.io/mt/83052327/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- From nobody Sun May 19 08:30:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+75530+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75530+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621866523; cv=none; d=zohomail.com; s=zohoarc; b=GhLHZ+96ve1nSzystz7eL7qRr2BwQ5qWwTPYxDsBAIwvq4iGKGYGbJxFi/Ej2N/Y5bvxGo6O81A17mGf4JXCKM42ZGRdB6kcvgK9nxPk5nfLfzWslmp2gv3CkSWQvf9vfKX7iJPEBU0bOyljF4J7prYUu+HY9v/+shTYMMh4QDk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621866523; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=mrfS6H+FN4bTuGVR+EJDItEeDAuxyHQnxr1XgF3B2j8=; b=AJEDBTBN0CFNeDef1fulbFXpwZdP3ql+lyEki3Qbt330OSM+5CC9finQpkfIUYykAzffCP21zTnyRACKcuzZ/j8QSfTz9ZWMpivJsxxhKFcLvNTIlsup5L8iEO9xGwt8p2fIDoOTK+FtvYXUeYyJf3YcXEkh+c9P4Apwhf/SobU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75530+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1621866523574644.1808040734611; Mon, 24 May 2021 07:28:43 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 3C16YY1788612xH4mjERo6QH; Mon, 24 May 2021 07:28:43 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.23865.1621866521176803399 for ; Mon, 24 May 2021 07:28:41 -0700 X-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 C0D61139F; Mon, 24 May 2021 07:28:40 -0700 (PDT) X-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 96F843F719; Mon, 24 May 2021 07:28:39 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V4 08/11] Platform/Sgi: Add SMBIOS Type16 Table Date: Mon, 24 May 2021 19:58:13 +0530 Message-Id: <20210524142816.9967-9-pranav.madhu@arm.com> In-Reply-To: <20210524142816.9967-1-pranav.madhu@arm.com> References: <20210524142816.9967-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,pranav.madhu@arm.com X-Gm-Message-State: ST4dBxzehxO78u1xRSmkQcZAx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621866523; bh=Q1XlalFkqrlbQbrg44MxpbH014EdfI1qHoebR/23SuY=; h=Cc:Date:From:Reply-To:Subject:To; b=qSe0Sw6Hi0RftLU9gURHNTBioSYoFFJVBSHNLGa8y0ZIoLADh2mQh5Z+qREc4T7bclI cSQHau6DkePRU5nidkp3Hc4jQe8vruLAuPs4NzOOi4Blpyp3NdtPrUNyFLyNzOaDHOwvr evq0BHJ4OxHWEx4XoomkF4I+IGmBVytTbG4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add the SMBIOS type 16 table (Physical Memory Array) describes a collection of memory devices that operate together to form a memory address. It includes information about number of devices, total memory installed, error correction mechanism used and other related information. Signed-off-by: Pranav Madhu Reviewed-by: Sami Mujawar --- Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf = | 4 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h = | 19 ++++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type16PhysicalMemoryArray.c = | 106 ++++++++++++++++++++ 4 files changed, 130 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index ee00b773912b..ebd19c1882bb 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -20,6 +20,7 @@ Type3SystemEnclosure.c Type4ProcessorInformation.c Type7CacheInformation.c + Type16PhysicalMemoryArray.c =20 [Packages] ArmPkg/ArmPkg.dec @@ -44,6 +45,9 @@ gArmPlatformTokenSpaceGuid.PcdClusterCount gArmPlatformTokenSpaceGuid.PcdCoreCount gArmSgiTokenSpaceGuid.PcdChipCount + gArmSgiTokenSpaceGuid.PcdDramBlock2Size + gArmTokenSpaceGuid.PcdSystemMemoryBase + gArmTokenSpaceGuid.PcdSystemMemorySize gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareRevision =20 [Protocols] diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h index 43f35ea0518f..95bb2c4bfc70 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -104,6 +104,24 @@ InstallType7CacheInformation ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +/** + Install SMBIOS physical memory array table. + + Install the SMBIOS physical memory array (type 16) table for Arm's Refer= ence + Design platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +EFIAPI +InstallType16PhysicalMemoryArray ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + typedef enum { SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, SMBIOS_HANDLE_CLUSTER1, @@ -112,6 +130,7 @@ typedef enum { SMBIOS_HANDLE_L2_CACHE, SMBIOS_HANDLE_L3_CACHE, SMBIOS_HANDLE_L4_CACHE, + SMBIOS_HANDLE_PHYSICAL_MEMORY, } SMBIOS_REFRENCE_HANDLES; =20 #endif // SMBIOS_PLATFORM_DXE_H_ diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index d3b161b77550..4f14be165c94 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -31,6 +31,7 @@ ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D { &InstallType3SystemEnclosure, &InstallType4ProcessorInformation, &InstallType7CacheInformation, + &InstallType16PhysicalMemoryArray, }; =20 /** diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type16PhysicalMe= moryArray.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type16PhysicalM= emoryArray.c new file mode 100644 index 000000000000..b1b41bf405a2 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type16PhysicalMemoryArr= ay.c @@ -0,0 +1,106 @@ +/** @file + SMBIOS Type 16 (Physical Memory Array) table for ARM RD platforms. + + This file installs SMBIOS Type 16 (Physical Memory Array) table for Arm's + Reference Design platforms. It describes a collection of memory devices = that + operate together to form a memory address. It includes information about + number of devices, total memory installed, error correction mechanism us= ed + and other related information. + + Copyright (c) 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Specification Reference: + - SMBIOS Reference Specification 3.4.0, Chapter 7.17 +**/ + +#include +#include +#include + +#include "SmbiosPlatformDxe.h" + +#define TYPE16_STRINGS \ + "\0" /* Null string */ + +/* SMBIOS Type16 structure */ +#pragma pack(1) +typedef struct { + SMBIOS_TABLE_TYPE16 Base; + CHAR8 Strings[sizeof (TYPE16_STRINGS)]; +} ARM_RD_SMBIOS_TYPE16; +#pragma pack() + +/* Physical Memory Array */ +STATIC ARM_RD_SMBIOS_TYPE16 mArmRdSmbiosType16 =3D { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_PHYSICAL_MEMORY_ARRAY, // Type 16 + sizeof (SMBIOS_TABLE_TYPE16), // Length + SMBIOS_HANDLE_PHYSICAL_MEMORY + }, + MemoryArrayLocationSystemBoard, // Location + MemoryArrayUseSystemMemory, // Used as system memory + MemoryErrorCorrectionUnknown, // Error correction + 0x80000000, // Maximum capacity in KiB, uses Extended Maximum capacity= field + 0xFFFE, // Memory error info handle, does not provide this info + 0, // Num of memory devices, update dymamically + 0 // Extended Maximum capacity, update dymamically + }, + // Text strings (unformatted area) + TYPE16_STRINGS +}; + +/** + Install SMBIOS physical memory array table. + + Install the SMBIOS physical memory array (type 16) table for Arm's Refer= ence + Design platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +InstallType16PhysicalMemoryArray ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + UINT16 NumOfMemoryDevices =3D 1; + UINT64 InstalledMemory; + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType16)->Handl= e; + + /* Include 16MB of Trusted DRAM as well */ + InstalledMemory =3D PcdGet64 (PcdSystemMemorySize) + SIZE_16MB; + if (PcdGet64 (PcdDramBlock2Size) !=3D 0) { + NumOfMemoryDevices++; + InstalledMemory +=3D PcdGet64 (PcdDramBlock2Size); + } + + mArmRdSmbiosType16.Base.ExtendedMaximumCapacity =3D + InstalledMemory * FixedPcdGet32 (PcdChipCount); + mArmRdSmbiosType16.Base.NumberOfMemoryDevices =3D + NumOfMemoryDevices * FixedPcdGet32 (PcdChipCount); + + /* Install type 16 table */ + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType16 + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to install Type16 SMBIOS table.\n" + )); + } + + return Status; +} --=20 2.17.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 (#75530): https://edk2.groups.io/g/devel/message/75530 Mute This Topic: https://groups.io/mt/83052328/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- From nobody Sun May 19 08:30:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+75531+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75531+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621866524; cv=none; d=zohomail.com; s=zohoarc; b=abb0zZ0vzEYnRGAxMO9Zjhmo7YrodrkxMv0jz/XKofFCWt/9c2m2/CvROtF1+Nlc79cqPnaUHiv1AhBXH2vCS3p9wXx8eBaQr8CSp5CVLkFosGy564sjP5HbEcgu1mDoQzrzHAmtigNcDLysH4+3fb3E0Aug+PTapRFknCwRjfg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621866524; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=OhhG11z6jNMj5oCRmMf0XBFtsmAGwnk5SEs80v3hrHI=; b=gQRozMJJLau7Lftz4yDUZbg4cViejkGbX/+MKafYGH+2mb/2g1slAUv/ClCCEnb8PuSKsW9ekssBjvpksJ1by/kkJQYH4rIppVr+mCByRK8IP4k0zy1AnEeocNIybfZNAxUp27nOmJ1IKZyFRsEHB2PMk7z7TrKQgxBcrj7FfaU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75531+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1621866524761674.8097619528485; Mon, 24 May 2021 07:28:44 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 52aSYY1788612xT8rMFukvad; Mon, 24 May 2021 07:28:44 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.24094.1621866522741802697 for ; Mon, 24 May 2021 07:28:42 -0700 X-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 62D35ED1; Mon, 24 May 2021 07:28:42 -0700 (PDT) X-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 38E8A3F719; Mon, 24 May 2021 07:28:41 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V4 09/11] Platform/Sgi: Add SMBIOS Type17 Table Date: Mon, 24 May 2021 19:58:14 +0530 Message-Id: <20210524142816.9967-10-pranav.madhu@arm.com> In-Reply-To: <20210524142816.9967-1-pranav.madhu@arm.com> References: <20210524142816.9967-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,pranav.madhu@arm.com X-Gm-Message-State: wmMAliiFVJfLQnOTEtT67bKZx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621866524; bh=7ZvZpO6sb1ekMPlu+qMAV/DWLqo8rsM3+qZmy1xATOM=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=gIzk6/4NNGnk5xayNlfDYSgpi/PhMwqPzfxYyx+pklSiurGNLVb/RV0HzzELBtkTzWf tNaCMG84i3dzEUmNgKgTgm0zHEgSltpmlOkrVRH3cBEMwIY75u2ExuvDFy9F/wZhvvSOD NJmiz/wykD/GF6wau303QWdMV8/iPis8LVU= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add the SMBIOS type 17 table (Memory Device) that includes the specification of each installed memory device such as size of each device, bank locator, memory device type, and other related information. Signed-off-by: Pranav Madhu Reviewed-by: Sami Mujawar --- Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 26 = ++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type17MemoryDevice.c | 409 = ++++++++++++++++++++ 4 files changed, 437 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index ebd19c1882bb..9061c491d461 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -21,6 +21,7 @@ Type4ProcessorInformation.c Type7CacheInformation.c Type16PhysicalMemoryArray.c + Type17MemoryDevice.c =20 [Packages] ArmPkg/ArmPkg.dec diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h index 95bb2c4bfc70..4e663033d515 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -122,6 +122,24 @@ InstallType16PhysicalMemoryArray ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 + +/** + Install SMBIOS memory device table. + + Install the SMBIOS memory device (type 17) table for RD platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +EFIAPI +InstallType17MemoryDevice ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + typedef enum { SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, SMBIOS_HANDLE_CLUSTER1, @@ -131,6 +149,14 @@ typedef enum { SMBIOS_HANDLE_L3_CACHE, SMBIOS_HANDLE_L4_CACHE, SMBIOS_HANDLE_PHYSICAL_MEMORY, + SMBIOS_HANDLE_MEMORY_DEVICE0000, // Chip 0 Bank 0 + SMBIOS_HANDLE_MEMORY_DEVICE0001, // Chip 0 Bank 1 + SMBIOS_HANDLE_MEMORY_DEVICE0100, // Chip 1 Bank 0 + SMBIOS_HANDLE_MEMORY_DEVICE0101, // Chip 1 Bank 1 + SMBIOS_HANDLE_MEMORY_DEVICE0200, // Chip 2 Bank 0 + SMBIOS_HANDLE_MEMORY_DEVICE0201, // Chip 2 Bank 1 + SMBIOS_HANDLE_MEMORY_DEVICE0300, // Chip 3 Bank 0 + SMBIOS_HANDLE_MEMORY_DEVICE0301, // Chip 3 Bank 1 } SMBIOS_REFRENCE_HANDLES; =20 #endif // SMBIOS_PLATFORM_DXE_H_ diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index 4f14be165c94..4e6a6b250813 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -32,6 +32,7 @@ ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D { &InstallType4ProcessorInformation, &InstallType7CacheInformation, &InstallType16PhysicalMemoryArray, + &InstallType17MemoryDevice, }; =20 /** diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type17MemoryDevi= ce.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type17MemoryDevice.c new file mode 100644 index 000000000000..b51e2b3fa1a6 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type17MemoryDevice.c @@ -0,0 +1,409 @@ +/** @file + SMBIOS Type 17 (Memory Device) table for ARM RD platforms. + + This file installs SMBIOS Type 17 (Memory Device) table for Arm's Refere= nce + Design platforms. It includes the specification of each installed memory + device such as size of each device, bank locator, memory device type, and + other related information. + + Copyright (c) 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Specification Reference: + - SMBIOS Reference Specification 3.4.0, Chapter 7.18 +**/ + +#include +#include +#include + +#include "SmbiosPlatformDxe.h" + +#define TYPE17_STRINGS \ + "Chip 0 Bank 0\0" \ + "Chip 1 Bank 0\0" \ + "Chip 2 Bank 0\0" \ + "Chip 3 Bank 0\0" \ + "Chip 0 Bank 1\0" \ + "Chip 1 Bank 1\0" \ + "Chip 2 Bank 1\0" \ + "Chip 3 Bank 1\0" + +typedef enum { + Chip0Bank0 =3D 1, + Chip1Bank0, + Chip2Bank0, + Chip3Bank0, + Chip0Bank1, + Chip1Bank1, + Chip2Bank1, + Chip3Bank1 +} TYPE17_STRING_ELEMENTS; + +/* SMBIOS Type17 structure */ +#pragma pack(1) +typedef struct { + SMBIOS_TABLE_TYPE17 Base; + CHAR8 Strings[sizeof (TYPE17_STRINGS)]; +} ARM_RD_SMBIOS_TYPE17; +#pragma pack() + +/* Memory Device */ +STATIC ARM_RD_SMBIOS_TYPE17 mArmRdSmbiosType17[] =3D { + { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_DEVICE, // Type 17 + sizeof (SMBIOS_TABLE_TYPE17), // Length + SMBIOS_HANDLE_MEMORY_DEVICE0000 + }, + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Physical memory array handle + 0xFFFE, // Memory error info handle + 0xFFFF, // Total width unknown + 0xFFFF, // Data width unknown + 0, // Size, Update dynamically + MemoryFormFactorOther, // Form Factor + 0, // Device set, not part of a set + 0, // Device locator + Chip0Bank0, // Chip 0 Bank 0 + MemoryTypeDram, // Memory type + {0, 1}, // Type details others + }, + // Text strings (unformatted area) + TYPE17_STRINGS + }, + { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_DEVICE, // Type 17 + sizeof (SMBIOS_TABLE_TYPE17), // Length + SMBIOS_HANDLE_MEMORY_DEVICE0001 + }, + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Physical memory array handle + 0xFFFE, // Memory error info handle + 0xFFFF, // Total width unknown + 0xFFFF, // Data width unknown + 0, // Size, Update dynamically + MemoryFormFactorOther, // Form Factor + 0, // Device set, not part of a set + 0, // Device locator + Chip0Bank1, // Chip 0 Bank 1 + MemoryTypeDram, // Memory type + {0, 1}, // Type details others + }, + // Text strings (unformatted area) + TYPE17_STRINGS + }, + { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_DEVICE, // Type 17 + sizeof (SMBIOS_TABLE_TYPE17), // Length + SMBIOS_HANDLE_MEMORY_DEVICE0100 + }, + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Physical memory array handle + 0xFFFE, // Memory error info handle + 0xFFFF, // Total width unknown + 0xFFFF, // Data width unknown + 0, // Size, Update dynamically + MemoryFormFactorOther, // Form Factor + 0, // Device set, not part of a set + 0, // Device locator + Chip1Bank0, // Chip 1 Bank 0 + MemoryTypeDram, // Memory type + {0, 1}, // Type details others + }, + // Text strings (unformatted area) + TYPE17_STRINGS + }, + { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_DEVICE, // Type 17 + sizeof (SMBIOS_TABLE_TYPE17), // Length + SMBIOS_HANDLE_MEMORY_DEVICE0101 + }, + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Physical memory array handle + 0xFFFE, // Memory error info handle + 0xFFFF, // Total width unknown + 0xFFFF, // Data width unknown + 0, // Size, Update dynamically + MemoryFormFactorOther, // Form Factor + 0, // Device set, not part of a set + 0, // Device locator + Chip1Bank1, // Chip 1 Bank 1 + MemoryTypeDram, // Memory type + {0, 1}, // Type details others + }, + // Text strings (unformatted area) + TYPE17_STRINGS + }, + { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_DEVICE, // Type 17 + sizeof (SMBIOS_TABLE_TYPE17), // Length + SMBIOS_HANDLE_MEMORY_DEVICE0200 + }, + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Physical memory array handle + 0xFFFE, // Memory error info handle + 0xFFFF, // Total width unknown + 0xFFFF, // Data width unknown + 0, // Size, Update dynamically + MemoryFormFactorOther, // Form Factor + 0, // Device set, not part of a set + 0, // Device locator + Chip2Bank0, // Chip 2 Bank 0 + MemoryTypeDram, // Memory type + {0, 1}, // Type details others + }, + // Text strings (unformatted area) + TYPE17_STRINGS + }, + { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_DEVICE, // Type 17 + sizeof (SMBIOS_TABLE_TYPE17), // Length + SMBIOS_HANDLE_MEMORY_DEVICE0201 + }, + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Physical memory array handle + 0xFFFE, // Memory error info handle + 0xFFFF, // Total width unknown + 0xFFFF, // Data width unknown + 0, // Size, Update dynamically + MemoryFormFactorOther, // Form Factor + 0, // Device set, not part of a set + 0, // Device locator + Chip2Bank1, // Chip 2 Bank 1 + MemoryTypeDram, // Memory type + {0, 1}, // Type details others + }, + // Text strings (unformatted area) + TYPE17_STRINGS + }, + { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_DEVICE, // Type 17 + sizeof (SMBIOS_TABLE_TYPE17), // Length + SMBIOS_HANDLE_MEMORY_DEVICE0300 + }, + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Physical memory array handle + 0xFFFE, // Memory error info handle + 0xFFFF, // Total width unknown + 0xFFFF, // Data width unknown + 0, // Size, Update dynamically + MemoryFormFactorOther, // Form Factor + 0, // Device set, not part of a set + 0, // Device locator + Chip3Bank0, // Chip 3 Bank 0 + MemoryTypeDram, // Memory type + {0, 1}, // Type details others + }, + // Text strings (unformatted area) + TYPE17_STRINGS + }, + { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_DEVICE, // Type 17 + sizeof (SMBIOS_TABLE_TYPE17), // Length + SMBIOS_HANDLE_MEMORY_DEVICE0301 + }, + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Physical memory array handle + 0xFFFE, // Memory error info handle + 0xFFFF, // Total width unknown + 0xFFFF, // Data width unknown + 0, // Size, Update dynamically + MemoryFormFactorOther, // Form Factor + 0, // Device set, not part of a set + 0, // Device locator + Chip3Bank1, // Chip 3 Bank 1 + MemoryTypeDram, // Memory type + {0, 1}, // Type details others + }, + // Text strings (unformatted area) + TYPE17_STRINGS + }, +}; + +/** Update the memory size fields in SMBIOS Memory Device (Type 17) table. + + @param [in] Type17Table Pointer to the Type 17 table. + @param [in] MemorySize Memory size available on the platform. + - If no memory device is installed, this value + is 0. + - If size is unknown, this value is MAX_UINT6= 4. + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER Invalid Type 17 Table pointer. +**/ +STATIC +UINTN +UpdateMemorySize ( + IN SMBIOS_TABLE_TYPE17 *Type17Table, + IN UINT64 MemorySize + ) +{ + if (Type17Table =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + /* Ref: SMBIOS Specifiation, Version 3.4.0, Document Identifier: DSP0134, + Table 75 =E2=80=93 Memory Device (Type 17) structure, description for= Size field. + If the value is 0, no memory device is installed in the socket; if + the size is unknown, the field value is FFFFh. + */ + if (MemorySize =3D=3D 0) { + Type17Table->Size =3D 0; + Type17Table->ExtendedSize =3D 0; + return EFI_SUCCESS; + } + + if (MemorySize =3D=3D MAX_UINT64) { + Type17Table->Size =3D MAX_UINT16; + Type17Table->ExtendedSize =3D 0; + return EFI_SUCCESS; + } + + /* Ref: SMBIOS Specifiation, Version 3.4.0, Document Identifier: DSP0134, + Table 75 =E2=80=93 Memory Device (Type 17) structure, description for= Size field. + If the size is 32 GB-1 MB or greater, the field value is 7FFFh and the + actual size is stored in the Extended Size field. + */ + if (MemorySize < (SIZE_32GB - SIZE_1MB)) { + /* Ref: SMBIOS Specifiation, Version 3.4.0, Document Identifier: DSP01= 34, + section 7.18.5 Memory Device =E2=80=94 Extended Size + For compatibility with older SMBIOS parsers, memory devices + smaller than (32 GB - 1 MB) should be represented using their + size in the Size field, leaving the Extended Size field set to 0. + */ + Type17Table->ExtendedSize =3D 0; + + /* Ref: SMBIOS Specifiation, Version 3.4.0, Document Identifier: DSP01= 34, + Table 75 =E2=80=93 Memory Device (Type 17) structure, description f= or Size field. + The granularity in which the value is specified depends on the sett= ing + of the most-significant bit (bit 15). If the bit is 0, the value is + specified in megabyte units; if the bit is 1, the value is specified + in kilobyte units. + For example, the value 8100h identifies a 256 KB memory device + and 0100h identifies a 256 MB memory device. + */ + if (MemorySize < SIZE_1MB) { + Type17Table->Size =3D MemorySize >> 10; + Type17Table->Size |=3D BIT15; + } else { + Type17Table->Size =3D MemorySize >> 20; + } + return EFI_SUCCESS; + } + + /* Ref: SMBIOS Specifiation, Version 3.4.0, Document Identifier: DSP0134, + section 7.18.5 Memory Device =E2=80=94 Extended Size + The Extended Size field is intended to represent memory devices + larger than 32,767 MB (32 GB - 1 MB), which cannot be described + using the Size field. This field is only meaningful if the value + in the Size field is 7FFFh. + */ + Type17Table->Size =3D 0x7FFF; + + /* Ref: SMBIOS Specifiation, Version 3.4.0, Document Identifier: DSP0134, + section 7.18.5 Memory Device =E2=80=94 Extended Size + Bit 31 is reserved for future use and must be set to 0. + Bits 30:0 represent the size of the memory device in megabytes. + EXAMPLE: 0000_8000h indicates a 32 GB memory device (32,768 MB), + 0002_0000h represents a 128 GB memory device (131,072 MB), a= nd + 0000_7FFFh represents a 32,767 MB (32 GB =E2=80=93 1 MB) dev= ice. + */ + Type17Table->ExtendedSize =3D (MemorySize >> 20) & (~BIT31); + return EFI_SUCCESS; +} + +/** + Install SMBIOS memory device Table. + + Install the SMBIOS memory device (type 17) table for RD platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +InstallType17MemoryDevice ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + UINT8 Idx; + + /* Get system memory information */ + for (Idx =3D 0; Idx < (FixedPcdGet32 (PcdChipCount) * 2); Idx +=3D 2) { + Status =3D UpdateMemorySize ( + &mArmRdSmbiosType17[Idx].Base, + PcdGet64 (PcdSystemMemorySize) + SIZE_16MB + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to update DRAM size for chip%d.\n", + Idx / 2 + )); + } else { + mArmRdSmbiosType17[Idx].Base.MemoryTechnology =3D MemoryTechnologyDr= am; + mArmRdSmbiosType17[Idx].Base.MemoryOperatingModeCapability.Bits. + VolatileMemory =3D 1; + } + + if (PcdGet64 (PcdDramBlock2Size) !=3D 0) { + Status =3D UpdateMemorySize ( + &mArmRdSmbiosType17[Idx + 1].Base, + PcdGet64 (PcdDramBlock2Size) + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to update DRAM block 2 size for chip%d.\n", + Idx / 2 + )); + } else { + mArmRdSmbiosType17[Idx + 1].Base.MemoryTechnology =3D + MemoryTechnologyDram; + mArmRdSmbiosType17[Idx + 1].Base.MemoryOperatingModeCapability.Bit= s. + VolatileMemory =3D 1; + } + } + } + + /* Install valid entries */ + for (Idx =3D 0; Idx < (FixedPcdGet32 (PcdChipCount) * 2); Idx++) { + SmbiosHandle =3D + ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType17[Idx])->Handle; + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType17[Idx] + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to install Type17 SMBIOS table.\n" + )); + break; + } + } + + return Status; +} --=20 2.17.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 (#75531): https://edk2.groups.io/g/devel/message/75531 Mute This Topic: https://groups.io/mt/83052329/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- From nobody Sun May 19 08:30:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+75532+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75532+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621866525; cv=none; d=zohomail.com; s=zohoarc; b=IZaARAHgpOmH2t3mnCBFZjUkkp7VEgzeknjzyfQOwTJjjFdpf1eCRJtNUjZsbPP2PCHguKDENKL4vdKLpkuqJVdwpNKltFL2KqAHESsRThNcXXMEfPzOqLX7CCIasKCpZsI9R9HGow97/jBCIOorsObyT92Gwh2GmCUcOekRuSA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621866525; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=VE10ZTkWWA4qwvYijfb9CxeQAfAxvOtAAFSWOvTv7Sw=; b=bDiON5par9k3VF5Qsno5bZrFqr5Ty9M6a7YyOVQ6Ehfzc/8x3nzoVlLiL9DpBDC6KZl3MS94BSWMANwNzuX2agRaQ9wr6e3XjFnMeUcSh3UyRBe99BTpoZLtHcRQV2ycevaAjuZTrIKyJxZJcp1edRrddjOsubMh5xI+5PED7PM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75532+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1621866525424329.09790475878174; Mon, 24 May 2021 07:28:45 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id hiTCYY1788612xkxB4feqAiq; Mon, 24 May 2021 07:28:45 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.24048.1621866524380654555 for ; Mon, 24 May 2021 07:28:44 -0700 X-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 047B4139F; Mon, 24 May 2021 07:28:44 -0700 (PDT) X-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 CED2B3F719; Mon, 24 May 2021 07:28:42 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V4 10/11] Platform/Sgi: Add SMBIOS Type19 Table Date: Mon, 24 May 2021 19:58:15 +0530 Message-Id: <20210524142816.9967-11-pranav.madhu@arm.com> In-Reply-To: <20210524142816.9967-1-pranav.madhu@arm.com> References: <20210524142816.9967-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,pranav.madhu@arm.com X-Gm-Message-State: TaOlC0j11eMTTJCs3f0EFLu7x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621866525; bh=iNv7tUYi7+vq5tjvnDpLm2gcntIThLxJsioBGcZ9ilQ=; h=Cc:Date:From:Reply-To:Subject:To; b=fYkkNpZkjzyDc5fUy+mr3h52JRN/9f7wxijJJqH5S/pTzfcu0XUmV8TyFh3/lqiJxeN VUDutP7Ku2Z01+58VbAMhxQT5jIgtL8VBAn1GeIHtZQrAcJLE3HDomNjXopfCQ//Q2nOI kGJoHEno0ben8XxaXGEFu9edigoZyHjLa3Q= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Sami Mujawar --- Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h = | 18 ++++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type19MemoryArrayMappedAddre= ss.c | 97 ++++++++++++++++++++ 4 files changed, 117 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index 9061c491d461..f81494114188 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -22,6 +22,7 @@ Type7CacheInformation.c Type16PhysicalMemoryArray.c Type17MemoryDevice.c + Type19MemoryArrayMappedAddress.c =20 [Packages] ArmPkg/ArmPkg.dec diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h index 4e663033d515..d4b838689a32 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -140,6 +140,24 @@ InstallType17MemoryDevice ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +/** + Install SMBIOS memory array mapped address table + + Install the SMBIOS memory array mapped address (type 19) table for RD + platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +EFIAPI +InstallType19MemoryArrayMappedAddress ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + typedef enum { SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, SMBIOS_HANDLE_CLUSTER1, diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index 4e6a6b250813..bed5da77786d 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -33,6 +33,7 @@ ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D { &InstallType7CacheInformation, &InstallType16PhysicalMemoryArray, &InstallType17MemoryDevice, + &InstallType19MemoryArrayMappedAddress, }; =20 /** diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type19MemoryArra= yMappedAddress.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type19Memo= ryArrayMappedAddress.c new file mode 100644 index 000000000000..301208c4bc03 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type19MemoryArrayMapped= Address.c @@ -0,0 +1,97 @@ +/** @file + SMBIOS Type 19 (Memory Array Mapped Address) table for ARM RD platforms. + + This file installs SMBIOS Type 19 (Memory Array Mapped Address) table fo= r Arm's + Reference Design platforms. It includes information about the address ma= pping + for a Physical Memory Array. + + Copyright (c) 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Specification Reference: + - SMBIOS Reference Specification 3.4.0, Chapter 7.20 +**/ + +#include +#include +#include + +#include "SmbiosPlatformDxe.h" + +#define TYPE19_STRINGS \ + "\0" /* Null string */ + +/* SMBIOS Type19 structure */ +#pragma pack(1) +typedef struct { + SMBIOS_TABLE_TYPE19 Base; + CHAR8 Strings[sizeof (TYPE19_STRINGS)]; +} ARM_RD_SMBIOS_TYPE19; +#pragma pack() + +/* Memory Array Mapped Address */ +STATIC ARM_RD_SMBIOS_TYPE19 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 number + }, + 0, // Starting address + 0, // Ending address + SMBIOS_HANDLE_PHYSICAL_MEMORY, // Memory array handle + 1 // Partition width + }, + // Text strings (unformatted area) + TYPE19_STRINGS +}; + +/** + Install SMBIOS memory array mapped address table + + Install the SMBIOS memory array mapped address (type 19) table for RD + platforms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +InstallType19MemoryArrayMappedAddress ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType19)->Handl= e; + + mArmRdSmbiosType19.Base.StartingAddress =3D 0xFFFFFFFF; + mArmRdSmbiosType19.Base.EndingAddress =3D 0xFFFFFFFF; + mArmRdSmbiosType19.Base.ExtendedStartingAddress =3D + PcdGet64 (PcdSystemMemoryBase); + mArmRdSmbiosType19.Base.ExtendedEndingAddress =3D + (PcdGet64 (PcdSystemMemoryBase) + + PcdGet64 (PcdSystemMemorySize) + + SIZE_16MB // 16MB Trusted DRAM + ) - 1; + + /* Install type 19 table */ + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType19 + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to install Type19 SMBIOS table.\n" + )); + } + + return Status; +} --=20 2.17.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 (#75532): https://edk2.groups.io/g/devel/message/75532 Mute This Topic: https://groups.io/mt/83052332/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- From nobody Sun May 19 08:30:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+75533+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75533+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621866527; cv=none; d=zohomail.com; s=zohoarc; b=FENDCjYQUy1BSmOmbFRE4vBghBGxvL2Ta3egfyUvgjbTEOwTeiJtoLCB8w9B1xffJU+mt0qmAA3w7zjezZBPqKUz2r0ctli1gtIGTE04AJixetMTtF+5gkKgjj3XHQ61/ydlWuXY5DFbn8JHWpSRs6O0xZBnfe7b4ho7ZagYJCE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621866527; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=W6uE9KOlUKrBdWu9ap+Hs+6MkAIMLsv6+u9hME/mSOA=; b=al0obBNnAZE9RR4imvYbUMmWTYj5X5cdCkMWjQR8jg+i27DAJeiB1va4vOJSCVfNGKjlUL/xmcXoxSQBLmpBIT7nEP1elj8wer8LeBb36UDCQpP/wgCM7ZgWAj+zoYLnNvosh4viWCuxbU65eKm/IZoN3fNz0oiYrJ+zQuWVpgE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+75533+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1621866527028973.1314010526938; Mon, 24 May 2021 07:28:47 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id D7GMYY1788612xtJUuFcQ5jC; Mon, 24 May 2021 07:28:46 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.24050.1621866526017084704 for ; Mon, 24 May 2021 07:28:46 -0700 X-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 9A0CCED1; Mon, 24 May 2021 07:28:45 -0700 (PDT) X-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 709533F719; Mon, 24 May 2021 07:28:44 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V4 11/11] Platform/Sgi: Add SMBIOS Type32 Table Date: Mon, 24 May 2021 19:58:16 +0530 Message-Id: <20210524142816.9967-12-pranav.madhu@arm.com> In-Reply-To: <20210524142816.9967-1-pranav.madhu@arm.com> References: <20210524142816.9967-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,pranav.madhu@arm.com X-Gm-Message-State: bhOvT4LA8e2RRCz6K5rbhxYVx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621866526; bh=BfrnDzcvxGYsXXl+9XKx8bPoIbQDaY0qcrZwVI1oG3o=; h=Cc:Date:From:Reply-To:Subject:To; b=rzpfp9vz3bY6x38Sv9/S0gMICrz9ohIA65QKuESbAzwal3d+7/MBHX7ViVLkNgAq5Dd OsPTp92yUAY4dfrFXoPBHAfJx4Wd5kVC6BozP06SUnoxmjL65lqGNmPEjiSk9fStlwkbZ 6ozvmNJpK2QcNOI4vmTHmRVXK5WZ0vAdCaY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add the SMBIOS type 32 table (System Boot Information) that includes information about the System Boot Status. Signed-off-by: Pranav Madhu Reviewed-by: Sami Mujawar --- Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h = | 17 ++++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32SystemBootInformation.= c | 84 ++++++++++++++++++++ 4 files changed, 103 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index f81494114188..4258eb9deadb 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -23,6 +23,7 @@ Type16PhysicalMemoryArray.c Type17MemoryDevice.c Type19MemoryArrayMappedAddress.c + Type32SystemBootInformation.c =20 [Packages] ArmPkg/ArmPkg.dec diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h index d4b838689a32..f8f69f0785b9 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -158,6 +158,23 @@ InstallType19MemoryArrayMappedAddress ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +/** + Install SMBIOS system boot information + + Install the SMBIOS system boot information (type 32) table for RD platfo= rms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +EFIAPI +InstallType32SystemBootInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + typedef enum { SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, SMBIOS_HANDLE_CLUSTER1, diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index bed5da77786d..29535b247b7c 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -34,6 +34,7 @@ ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D { &InstallType16PhysicalMemoryArray, &InstallType17MemoryDevice, &InstallType19MemoryArrayMappedAddress, + &InstallType32SystemBootInformation, }; =20 /** diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32SystemBoot= Information.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32SystemB= ootInformation.c new file mode 100644 index 000000000000..e98e23fe8fe0 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32SystemBootInforma= tion.c @@ -0,0 +1,84 @@ +/** @file + SMBIOS Type 32 (System Boot Information) table for ARM RD platforms. + + This file installs SMBIOS Type 32 (System Boot Information) table for Ar= m's + Reference Design platforms. It includes information about the System Boot + Status. + + Copyright (c) 2021, ARM Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Specification Reference: + - SMBIOS Reference Specification 3.4.0, Chapter 7.33 +**/ + +#include +#include +#include + +#include "SmbiosPlatformDxe.h" + +#define TYPE32_STRINGS \ + "\0" /* Null string */ + +/* SMBIOS Type32 structure */ +#pragma pack(1) +typedef struct { + SMBIOS_TABLE_TYPE32 Base; + CHAR8 Strings[sizeof (TYPE32_STRINGS)]; +} ARM_RD_SMBIOS_TYPE32; +#pragma pack() + +/* System Boot Information */ +STATIC ARM_RD_SMBIOS_TYPE32 mArmRdSmbiosType32 =3D { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION, // Type 32 + sizeof (SMBIOS_TABLE_TYPE32), // Length + SMBIOS_HANDLE_PI_RESERVED + }, + {0}, // Reserved field + BootInformationStatusNoError // Boot status + }, + // Text strings (unformatted area) + TYPE32_STRINGS +}; + +/** + Install SMBIOS system boot information + + Install the SMBIOS system boot information (type 32) table for RD platfo= rms. + + @param[in] Smbios SMBIOS protocol. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed is already in use. +**/ +EFI_STATUS +InstallType32SystemBootInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType32)->Handl= e; + + /* Install type 32 table */ + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType32 + ); + if (EFI_ERROR (Status)) { + DEBUG (( + DEBUG_ERROR, + "SMBIOS: Failed to install Type32 SMBIOS table.\n" + )); + } + + return Status; +} --=20 2.17.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 (#75533): https://edk2.groups.io/g/devel/message/75533 Mute This Topic: https://groups.io/mt/83052334/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-