From nobody Sun May 19 11:37:25 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+75145+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+75145+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621157377; cv=none; d=zohomail.com; s=zohoarc; b=CTPGaUpFnhWecypH7L1F/MAMkyVADo6wXhaX/+zk5SV549hsb+Hjupy3fKiINTDw0kKEO6G3E2hrOfi4qiBp4Xa9rVe4IstBuGULetHQtxtNc+CeXIs8Ee3AZRASwhqR+bIyc+tt+N0ZZPIOsLxeIeWjgzzeaFngRLfj1Ht87w8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621157377; 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=1k6Q4nEb1/jqUVhEkih3Wc3mo5ayJSfD9nVMNnElmc4=; b=e6xh3P3QEwVOXuFoyHJ/OaIcZY7i60ta6MgZyeoJdKZlNp42sBgSKTp9H8jMmYPfjZAuENalF6DQoJdyctCruU+QvhRFrzOajsOZ50zbVtIFQHxcz99GrSiAwEPFB+2pCsCXmi0rRa8uz/rLmc8hbz8I63Ei8Muyc+8OYHO92R8= 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+75145+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 1621157377064946.7125089053607; Sun, 16 May 2021 02:29:37 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 25WfYY1788612x0Ni5dLk6P4; Sun, 16 May 2021 02:29:36 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.4148.1621157370732808769 for ; Sun, 16 May 2021 02:29: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 8A7211063; Sun, 16 May 2021 02:29:25 -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 568D73F73B; Sun, 16 May 2021 02:29:24 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V2 01/11] Platform/Sgi: Define RD-N2 platform id values Date: Sun, 16 May 2021 14:59:07 +0530 Message-Id: <20210516092917.21124-2-pranav.madhu@arm.com> In-Reply-To: <20210516092917.21124-1-pranav.madhu@arm.com> References: <20210516092917.21124-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: PhoXKgDWW6OgxTcaUD5IWqNBx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621157376; bh=XUaurKONc5lu37dc84cFtXI49ZveWnsUdOM8wQERpNM=; h=Cc:Date:From:Reply-To:Subject:To; b=tLsEM4sHZIMM07ZD2+TdwKUDl6LLedNAqNi3APjgjo4UWC4mRFSsk9jhQgNYOhjTZ6o C9yCzmLtyCeBd87OimZhyUXmQmg9AX4LoLD+WX/7yVTWqhCNgayYLn1MWzCMcXgkqif2K YdKyrLvieR4/wYH/MoRaJ34z3w4AEFJczXM= 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 (#75145): https://edk2.groups.io/g/devel/message/75145 Mute This Topic: https://groups.io/mt/82861597/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 11:37:25 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+75148+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+75148+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621157374; cv=none; d=zohomail.com; s=zohoarc; b=a4/cAHnGGhECDmI3OnDrUzM3TpE4Q6kw8l98dh4DluFF6GJStF2q/TirYQ19/o7qoaPr2QelrQcS8Bpx9BwnSCq4KL59Qysx5DCP3UKhEj0AdsJLyOjPkWecf7wPsPxP6VhejrTxxL51RpphA6NEUQGfIMug+OrCPeImOywZDys= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621157374; 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=MAOTjL7R9OuWqK3/OEgPczcryGKs1lzoIwcsuAw/rCM=; b=MwK7ncAa5NpWXoVy3r0AP6aztvSSuQZZwzIAimQ8k2vBRurzDnlwoHNTYbwp/JZeycO7OJyg3E7K+O6X8ZsThxP/wrPm65eL2nnZbftgCb3HoPULzyqeAhk//+arw1Xocp5/ENUpSS2u2GK7sPTFMbgiHcEEiKqlO8QfUEy78ms= 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+75148+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 1621157374667834.530939544607; Sun, 16 May 2021 02:29:34 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id liJfYY1788612xnmDlxVAxhh; Sun, 16 May 2021 02:29:34 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.4094.1621157372690071110 for ; Sun, 16 May 2021 02:29:32 -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 2EA1211D4; Sun, 16 May 2021 02:29:27 -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 036FF3F73B; Sun, 16 May 2021 02:29:25 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V2 02/11] Platform/Sgi: Add GetProductId API for SGI/RD Platforms Date: Sun, 16 May 2021 14:59:08 +0530 Message-Id: <20210516092917.21124-3-pranav.madhu@arm.com> In-Reply-To: <20210516092917.21124-1-pranav.madhu@arm.com> References: <20210516092917.21124-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: tQsmRfMsNk1UOYgipZxVU7ffx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621157374; bh=uYuA0oMoyZXWxYFNvRQSGw667rZGGFth3qEq84fR3KY=; h=Cc:Date:From:Reply-To:Subject:To; b=Ps/BcBP0IhMX1lwgXXI7r5q5WfCqbzTmkyCODnERyMdCIDwvlJSXnGB9noi75vpc7sm VGxWO0RgNgQWYvCnITz7a7no/9VkVjOWD1h3F/vIJd19cMsPw9hwviIN9hrLeDTigph2M UNUAFwTxyaKHBrgg9I8/fTkYaKHC6TkHWz8= 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 | 21 +++++ Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c | 86 +++++++++++++++= ++++- 2 files changed, 106 insertions(+), 1 deletion(-) diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h b/Platform/ARM/SgiPk= g/Include/SgiPlatform.h index 1c5366878712..142fa29bb9fa 100644 --- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h +++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h @@ -68,4 +68,25 @@ typedef struct { UINTN MultiChipMode; } SGI_PLATFORM_DESCRIPTOR; =20 +// Arm SGI/RD Product IDs +enum ARM_RD_PRODUCT_ID { + UnknownId =3D 0, + Sgi575, + RdN1Edge, + RdN1EdgeX2, + RdE1Edge, + RdV1, + RdV1Mc, + RdN2 +}; + +// Arm ProductId look-up table +typedef struct { + UINTN ProductId; + UINTN PlatformId; + UINTN ConfigId; + UINTN MultiChipMode; +} SGI_PRODUCT_ID_LOOKUP; + +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..57b1658ab0af 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 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 (#75148): https://edk2.groups.io/g/devel/message/75148 Mute This Topic: https://groups.io/mt/82861600/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 11:37:25 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+75149+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+75149+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621157379; cv=none; d=zohomail.com; s=zohoarc; b=BUBYqs6tpusBA6JkQsDW3+YKc8s5ViKXlYFdpAvTmi655YD6fQdTLuViV44cOd492fYfU3ARP2QdwpKTClY6k7TCpahwxAjjDo3318zBqXWnY7E6ShwYB/iEb1SMn/supZSEDShBzyAq+8KG1G2CgHKw/qRldyB5oO6pWHmTBe0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621157379; 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=Ek1rYD39OVBDfL5Kd/NGVktbZtD1I0TMbOorJ/MapNY=; b=atDx6WYCGOYB8OFxG2C6r14DXN1vSam7tkJxFJo076OCLzEgKX8VWggxnNsf5Z+2+424wrsOcCdvJyD0QwSYgPGB8DqOT5Nc//XmBf1oRajPciHwlujAEBMNKG6rAtnH8dvPb6XGnR/CU9T7XBeeKsI7bpu+VBqPkIJuZl0FbY8= 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+75149+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 1621157379857673.7129644359738; Sun, 16 May 2021 02:29:39 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id Z1YvYY1788612xfSzukNR0vY; Sun, 16 May 2021 02:29:39 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.4149.1621157373763433238 for ; Sun, 16 May 2021 02:29: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 C688511FB; Sun, 16 May 2021 02:29:28 -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 9B7363F73B; Sun, 16 May 2021 02:29:27 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V2 03/11] Platform/Sgi: Add Initial SMBIOS support Date: Sun, 16 May 2021 14:59:09 +0530 Message-Id: <20210516092917.21124-4-pranav.madhu@arm.com> In-Reply-To: <20210516092917.21124-1-pranav.madhu@arm.com> References: <20210516092917.21124-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: jY0SP1O7iia3SOFvO23Zfrubx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621157379; bh=Tn2gpAe+gTEKWGmDQ4gRuWkAN65FhChWGVl/6Dymmqc=; h=Cc:Date:From:Reply-To:Subject:To; b=ngmtB9u6eB1vz1SVFfhvroqCS6TUjmKVOc/qE2ZBqR5w5iUEwWO0sI2P1ZvDJN87LmK ikNZoDkDACOKLypoW9TvRUIcVuDV58KfhmAO+JJSDYZwrSkqRHhuKlBsvqt+21v2nmdnZ QLolzMSNx3+FKXAbbZe1/5nr2nOf5geC6EA= 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 | 20= ++++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 98= +++++++++++++++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type0BiosInformation.c | 125= ++++++++++++++++++++ 6 files changed, 306 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..091e0ec8314e --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -0,0 +1,20 @@ +/** @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_ + +EFI_STATUS +EFIAPI +InstallBiosInformation ( + 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..eb3ba45ca654 --- /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 +ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D { + &InstallBiosInformation, +}; + +/** + 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 (Status !=3D EFI_SUCCESS) { + 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..67c20c336c3d --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type0BiosInformation.c @@ -0,0 +1,125 @@ +/** @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" + +/* SMBIOS Type0 structure */ +#pragma pack(1) +struct ArmRdSmbiosType0 { + SMBIOS_TABLE_TYPE0 Base; + INT8 Strings[sizeof (TYPE0_STRINGS)]; +}; +#pragma pack() + +/* BIOS information */ +static struct ArmRdSmbiosType0 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 + }, + 1, // String number of vendor name in TYPE0_STRINGS + 2, // String number of BiosVersion + 0, // Bios starting address segment + 3, // String number of BiosReleaseDate + 0, // Bios ROM size + { // MISC_BIOS_CHARACTERISTICS BiosCharacteristics + 0, // Reserved + 0, // Unknown + 0, // BIOS Characteristics are not supported + 0, // ISA is supported + 0, // MCA is supported + 0, // EISA is supported + 1, // PCI supported + 0, // PC card (PCMCIA) is supported + 1, // Plug and Play is supported + 0, // APM is supported + 1, // BIOS upgradable + 0, // BIOS shadowing is allowed + 0, // VL-VESA is supported + 0, // ESCD support is available + 0, // Boot from CD is 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 + }, + // 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 in is already in u= se. +**/ +EFI_STATUS +InstallBiosInformation ( + 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 (Status !=3D EFI_SUCCESS) { + 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 (#75149): https://edk2.groups.io/g/devel/message/75149 Mute This Topic: https://groups.io/mt/82861601/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 11:37:25 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+75146+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+75146+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621157377; cv=none; d=zohomail.com; s=zohoarc; b=Sp5NDQ6qhnKNMZbaVpsS94xPTSqb7RYVkD6dvceuGNySYBRDD4pvyLJ/RPDXWruUHOB1Siw8CIZ44MsqDJpO+BS9Nb4QU2o3s3xQaozg7IMq6GU4g+l6eLToQ7lXOnay8E/qajHqZXT3DO4QFVcRLVnhCwkOT60XfFivMJTD2o0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621157377; 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=79Y7z2x4zCWiOFIZH75hfN8rC8m9faZqY7luKcAlc60=; b=kqbvfOVuSqsgA43msk3fgOaq5uXq8bSPniydzCz7QZeKPOFtgVKL3IITkKFUyxq9MD5+HHPfnT01Xd5xAxeb85jPw0PU405C7uyttyh+u7HGubzl209ul1NP50SHBjYh0lIkPh7cv8mjF7fXvTFWcNY+nwjSMtIchMvWcLGvDtk= 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+75146+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 1621157377401168.68506141458226; Sun, 16 May 2021 02:29:37 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id OoWjYY1788612xrW9FU7LC4K; Sun, 16 May 2021 02:29:37 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.4145.1621157370903492201 for ; Sun, 16 May 2021 02:29: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 6A3C413D5; Sun, 16 May 2021 02:29: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 3F6DB3F73B; Sun, 16 May 2021 02:29:29 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V2 04/11] Platform/Sgi: Add SMBIOS Type1 Table Date: Sun, 16 May 2021 14:59:10 +0530 Message-Id: <20210516092917.21124-5-pranav.madhu@arm.com> In-Reply-To: <20210516092917.21124-1-pranav.madhu@arm.com> References: <20210516092917.21124-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: FLTAEUqbmnJ6EFKUohhlLqzVx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621157377; bh=iTQ9n5+YtUAp88WDIJ+VZRYalOVnAB16JqQ8n5XFiNI=; h=Cc:Date:From:Reply-To:Subject:To; b=oxbPZ2O8i1lZ5h3oyCPnDgCLDOr/WR+383j0d5+d0xBwruKfWIZSClA7+i/gGMihuU4 mYkyZju+mNBOfnbUtOKx5ZmWfM4W5Wf3NCKjoIHRfZUUS3nBSRmy9NX3WnyoHaPG4t6Fc gkqwmet2R2JujXLOZVtz4M1zJD+TwX19V2g= 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 | = 6 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | = 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type1SystemInformation.c | 1= 32 ++++++++++++++++++++ 4 files changed, 140 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 091e0ec8314e..d7b3aadba948 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -17,4 +17,10 @@ InstallBiosInformation ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +EFI_STATUS +EFIAPI +InstallSystemInformation ( + 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 eb3ba45ca654..7b478063e223 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 ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D { &InstallBiosInformation, + &InstallSystemInformation, }; =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..4559af81046b --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type1SystemInformation.c @@ -0,0 +1,132 @@ +/** @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 PRODUCT_NAME_BASE 6 /* Product name base from TYPE1_STRINGS */ +#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" + +/* SMBIOS Type1 structure */ +#pragma pack(1) +struct ArmRdSmbiosType1 { + SMBIOS_TABLE_TYPE1 Base; + UINT8 Strings[sizeof (TYPE1_STRINGS)]; +} ARM_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 struct ArmRdSmbiosType1 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 + }, + 1, // Manufacturer + PRODUCT_NAME_BASE, // Product Name, update dynamically + 2, // Version + 3, // Serial + {0}, // UUID, Update dymanically + 1, // Wakeup type other + 4, // SKU + 5, // 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 in is already in u= se. +**/ +EFI_STATUS +InstallSystemInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType1)->Handle; + + /* Choose the product name from TYPE1_STRINGS based on the product ID */ + if (SgiGetProductId () !=3D UnknownId) { + mArmRdSmbiosType1.Base.ProductName =3D + PRODUCT_NAME_BASE + (SgiGetProductId () - 1); + CopyGuid (&mArmRdSmbiosType1.Base.Uuid, + &mSmbiosUid[SgiGetProductId () - 1]); + } else { + return EFI_NOT_FOUND; + } + + /* Install type 1 table */ + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType1 + ); + if (Status !=3D EFI_SUCCESS) { + 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 (#75146): https://edk2.groups.io/g/devel/message/75146 Mute This Topic: https://groups.io/mt/82861598/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 11:37:25 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+75147+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+75147+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621157373; cv=none; d=zohomail.com; s=zohoarc; b=TWRQI6Q7JeMslPk6bJ+K4OKi232Gc/lLFcN8TXCN1caMv1U4K43ewUXNLvoRr6G97sj9o7Did2EsoRdACcZIl3lewNjk/NiOV+wB2pKbLWDOpdW222g9H1BQtugzMUD5qtTwAAvblojl9JgarMyLovtWLz7sKN8UImjI8AuzOXI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621157373; 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=sswlHJ9OZAIYBgnR4kXSjo+CQXqAtba7c7SgGZxdrJA=; b=e6NKpzKVZSsa9ESEMhAoOybLKHpnelOs1T9mika5+oeSrgoaS1hzDcroGv8GlP/+7FwMpwdJa4Ebqb6PE8XgFljxdQ2vf+PdMwPJkEZ1WYhY/qSY66cc0qo7lgQdxn93i4CehCQpX82BabmYnVeftwYhprNiduu5ztc8Eht6O6k= 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+75147+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 16211573734529.853924599771972; Sun, 16 May 2021 02:29:33 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id zRv5YY1788612xMGgp2KVUIJ; Sun, 16 May 2021 02:29:33 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.4132.1621157372359591793 for ; Sun, 16 May 2021 02:29:32 -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 0D8F01063; Sun, 16 May 2021 02:29: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 D70563F73B; Sun, 16 May 2021 02:29:30 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V2 05/11] Platform/Sgi: Add SMBIOS Type3 Table Date: Sun, 16 May 2021 14:59:11 +0530 Message-Id: <20210516092917.21124-6-pranav.madhu@arm.com> In-Reply-To: <20210516092917.21124-1-pranav.madhu@arm.com> References: <20210516092917.21124-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: GpUx7cEgknb3Ar9pm116HkKZx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621157373; bh=Di9cXTnqink0D+jEMplBO2ylF2r2ytIkxAJOySJgtA4=; h=Cc:Date:From:Reply-To:Subject:To; b=l+49c2zmrYsKPk1qh8N67HMNEPNqkuxwEy1nSE+abuqZb4bsjTTxXHudcRLHGXuQLoW CxYdFERLv8Mb9dcS043htd5cIhaIhKzmgYbj1dZmHv0xByU4Q5Qrt6GhFnBkcTCnf6zsY Z68uGI3H5Dp69RSntjtK1Dn9dZHOxgO52KI= 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 | 10 = ++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type3SystemEnclosure.c | 96 = ++++++++++++++++++++ 4 files changed, 108 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 d7b3aadba948..4a6f8be2a2c2 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -23,4 +23,14 @@ InstallSystemInformation ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +EFI_STATUS +EFIAPI +InstallSystemEnclosure ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + +enum SMBIOS_REFRENCE_HANDLES { + SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, +}; + #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 7b478063e223..5f4b833dc9fe 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -28,6 +28,7 @@ STATIC ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D { &InstallBiosInformation, &InstallSystemInformation, + &InstallSystemEnclosure, }; =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..ef0c36d37923 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type3SystemEnclosure.c @@ -0,0 +1,96 @@ +/** @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 */ + +/* SMBIOS Type3 structure */ +#pragma pack(1) +struct ArmRdSmbiosType3 { + SMBIOS_TABLE_TYPE3 Base; + UINT8 Strings[sizeof (TYPE3_STRINGS)]; +}; +#pragma pack() + +/* System information */ +static struct ArmRdSmbiosType3 mArmRdSmbiosType3 =3D { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE, // Type 3 + sizeof (SMBIOS_TABLE_TYPE1), // Length + SMBIOS_HANDLE_ENCLOSURE, // Assign an unused handle number + }, + 1, // Manufacturer + 2, // Enclosure type unknown + 2, // Version + 3, // Serial + 4, // 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 in is already in u= se. +**/ +EFI_STATUS +InstallSystemEnclosure ( + 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 (Status !=3D EFI_SUCCESS) { + 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 (#75147): https://edk2.groups.io/g/devel/message/75147 Mute This Topic: https://groups.io/mt/82861599/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 11:37:25 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+75150+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+75150+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621157375; cv=none; d=zohomail.com; s=zohoarc; b=ir/9Yko5nkvf8GVwefXrs3OSEvQ/eFUbBPbad2/JfCH8ruELp03oRnpws6hxXtc5uMDfJjOyMdgoK48RM7lzs+icXSNdZn+DyE+q6yJLyM7XSa/UhspxBb1HK3yMLInc2bOzkcReqfRyqVskWdOANXd5QYSJzn+f2GSqDEC7iRw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621157375; 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=orTd6E106SPkJiythWkAWUwTP6xKJrm/p3sh9dXb5dU=; b=e9jlUglmzOThGXRcxGj3U12C3PjWo9lzZk+XWj/BOD8PqJcGO6t1ijl58WHeZqW0a7C8rJ/ovDu1ydGHqZ27LINeDeD4gUeMrDnLCYl1Qf5QZVMzYLkcGOepQcAiQz7rBGoE88+IvbB0wMHjgOQUP0XEOgTMF7ENB4VNHLUGYuY= 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+75150+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 1621157375409624.0388553751764; Sun, 16 May 2021 02:29:35 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id JC9yYY1788612xlc5vvdRyOX; Sun, 16 May 2021 02:29:34 -0700 X-Received: from foss.arm.com (foss.arm.com []) by mx.groups.io with SMTP id smtpd.web08.4132.1621157372359591793 for ; Sun, 16 May 2021 02:29: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 A579A1063; Sun, 16 May 2021 02:29:33 -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 7A4A73F73B; Sun, 16 May 2021 02:29:32 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V2 06/11] Platform/Sgi: Add SMBIOS Type4 Table Date: Sun, 16 May 2021 14:59:12 +0530 Message-Id: <20210516092917.21124-7-pranav.madhu@arm.com> In-Reply-To: <20210516092917.21124-1-pranav.madhu@arm.com> References: <20210516092917.21124-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: jT3MoomzLqLXr8v4pbGlRoi8x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621157374; bh=W1QWZHT7yP1Mue9qLIlkybtlL5UNF+/WDHG2T03Hkgw=; h=Cc:Date:From:Reply-To:Subject:To; b=mWYJ5dYTEUX3dibMAxhPBBO5pIUZ5XSxS/FgpolenVx3+9cn8n8mUNh9L6I2JdebIEM 8gLZoRn7inn1WPTT+Z1Z4Ktqnd3WHf7HHEV05NSeNU1WHPMiMPazbft6YZuD6aCR5+5U2 SeWumNShqUZ47dTBc56wonXSRC/y2wKmCuA= 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 = | 12 ++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type4ProcessorInformation.c = | 209 ++++++++++++++++++++ 5 files changed, 229 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 4a6f8be2a2c2..8a9be0cfc4c8 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -29,8 +29,20 @@ InstallSystemEnclosure ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +EFI_STATUS +EFIAPI +InstallProcessorInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + enum SMBIOS_REFRENCE_HANDLES { 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, }; =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 5f4b833dc9fe..269bd0f9d843 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 { &InstallBiosInformation, &InstallSystemInformation, &InstallSystemEnclosure, + &InstallProcessorInformation, }; =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..fda532b558af --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type4ProcessorInformati= on.c @@ -0,0 +1,209 @@ +/** @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" + +/* SMBIOS Type4 structure */ +#pragma pack(1) +struct ArmRdSmbiosType4 { + SMBIOS_TABLE_TYPE4 Base; + UINT8 Strings[sizeof (TYPE4_STRINGS)]; +} ARM_TYPE4; +#pragma pack() + +/* Processor information */ +static struct ArmRdSmbiosType4 mArmRdSmbiosType4 =3D { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION, // Type 4 + sizeof (SMBIOS_TABLE_TYPE4), // Length + SMBIOS_HANDLE_CLUSTER1, // handle number + }, + SOCKET_TYPE_BASE, // Socket type + CentralProcessor, // Processor type + ProcessorFamilyIndicatorFamily2, + // Use Processor Family 2 field + 2, // Manufacturer string number + {{0}, {0}}, // Processor id, update dynamically + PROCESSOR_VERSION_BASE, // 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 + 1, // 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[4] =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), "%03x", PartNum); + CopyMem (&mArmRdSmbiosType4.Strings[2], 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 in is already in u= se. +**/ +EFI_STATUS +InstallProcessorInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + UINT32 CoreCount; + UINT64 *ProcessorId =3D (UINT64 *)&(mArmRdSmbiosType4.Base.ProcessorId); + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType4)->Handle; + CoreCount =3D (FixedPcdGet32 (PcdCoreCount) * FixedPcdGet32 (PcdClusterC= ount)); + + /* Set the core count and processor speed for all platforms */ + switch (SgiGetProductId ()) { + 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 PROCESSOR_VERSION_BASE + Sgi= GetProductId (); + mArmRdSmbiosType4.Base.SerialNumber =3D SERIAL_NUMBER_BASE + SgiGetProdu= ctId (); + + /* 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 (#75150): https://edk2.groups.io/g/devel/message/75150 Mute This Topic: https://groups.io/mt/82861602/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 11:37:25 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+75152+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+75152+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621157381; cv=none; d=zohomail.com; s=zohoarc; b=HTypD38JOPKBUcNGWBBLc3PBUQOLpDOD+gDmmmIkZWxkQ2Vd90GXpgfct4EIAHHsvtqOxFi/l+NPvXAmN6oEISthf4oaatJYiBtP6X/WrOrLT/Cf+J7Maz0JvR8ddWhTq12vAJPLyCmQIEXx6zIoyx0moYTs5LD9Z8am6eL7F7Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621157381; 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=irNtLkzD6buoCsuhRL9xwxcnCevzN+XrsidSKPUh7Bw=; b=nj7LFuEBWJRvVPvzyNpoIuk8W1CWHc/Ni4PZcYtUaCpVeA+YUCNwVOLtQlqp9C5iXxgxmJwmkH+/POA5vfqBu5dhvLZ7UytlwHNOEXl0B2FNzpbAtSxDlTpIPU3+SBNVgvCQXnjmopeRZbFrLRlJJVeGjxjqN/Zx4SZ2/1PpB/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+75152+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 1621157381906217.4099067732053; Sun, 16 May 2021 02:29:41 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id lrXYYY1788612xWcYkuqws1C; Sun, 16 May 2021 02:29:41 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.4095.1621157375908360993 for ; Sun, 16 May 2021 02:29: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 8AAA31042; Sun, 16 May 2021 02:29: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 1E6153F73B; Sun, 16 May 2021 02:29:33 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V2 07/11] Platform/Sgi: Add SMBIOS Type7 Table Date: Sun, 16 May 2021 14:59:13 +0530 Message-Id: <20210516092917.21124-8-pranav.madhu@arm.com> In-Reply-To: <20210516092917.21124-1-pranav.madhu@arm.com> References: <20210516092917.21124-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: 2VLvqFXnODKMqnf9TTpSaukEx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621157381; bh=CoSZED1AFvYnCMhT7dyDBftxEFyRQKNgCc5VlBIPwto=; h=Cc:Date:From:Reply-To:Subject:To; b=lclEEZJ5dVFUaFX0VLZrJeux9fwF9s4/+N5pHQaxdu3Diu5wlMXSqKYSlJJACXXWEbH vPQMffTq9MD7+ERvgXF60cejQtRsBvZUVFXivNyaeG5igpP4XCv0nt+oJbLBUVA3nGy9q C9SIlPPnTBhMiXsYP1kU7rAbAGjgmE6RbF8= 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 | = 6 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | = 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type7CacheInformation.c | 33= 4 ++++++++++++++++++++ 4 files changed, 342 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 8a9be0cfc4c8..6f3ad29f0797 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -35,6 +35,12 @@ InstallProcessorInformation ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +EFI_STATUS +EFIAPI +InstallCacheInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + enum SMBIOS_REFRENCE_HANDLES { SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, SMBIOS_HANDLE_CLUSTER1, diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index 269bd0f9d843..62d0f5ce8033 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 { &InstallSystemInformation, &InstallSystemEnclosure, &InstallProcessorInformation, + &InstallCacheInformation, }; =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..8b42ed3d622c --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type7CacheInformation.c @@ -0,0 +1,334 @@ +/** @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 */ + +/* SMBIOS Type7 structure */ +#pragma pack(1) +struct ArmRdSmbiosType7 { + SMBIOS_TABLE_TYPE7 Base; + UINT8 Strings[sizeof (TYPE7_STRINGS)]; +} ARM_TYPE7; +#pragma pack() + +/* Cache information */ +static struct ArmRdSmbiosType7 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 + }, + 1, + ( + (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 + }, + 2, + ( + (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 + }, + 3, + ( + (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 + }, + 4, + ( + (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 + }, + 5, + ( + (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 in is already in u= se. +**/ +EFI_STATUS +InstallCacheInformation ( + 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 (Status !=3D EFI_SUCCESS) { + 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 (#75152): https://edk2.groups.io/g/devel/message/75152 Mute This Topic: https://groups.io/mt/82861604/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 11:37:25 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+75153+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+75153+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621157383; cv=none; d=zohomail.com; s=zohoarc; b=fv6KVQADDufzfEvzMYMR2irqo0OmuJpvnf6fjeKC5XlsFdNfcRJi+41X3UXRYG15T/EeP4Rd9k2cB7rV5NLw4hFPUVyBMS8iLgHProdmws2J7GW84fcZ3t+M4Xw6qZpPaNb16ip1TLjjb8hvj48b/H2ZadaxhfugCRq99PsPrOU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621157383; 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=0RasjzMiWxL7QNRLNE+UIBJ40Lq1kN3+UdUOALc69Fo=; b=fcZNh8GhdNmWw+IbDM+BGCGx/Ww0K/px2vW+RChd44Ks6iWzJg9tmiRHV6vdJwb0Ul/mpY8lSnLmL13jXeTU0xvjR8IJ1zf96u/wbDc8J37Gyp92akC7xXtF6p9wX5RpkW9gMwvQPtZmVKZ/AtyfC51qtsFobpKEJe72sgKqlcY= 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+75153+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 1621157383471643.8367343965572; Sun, 16 May 2021 02:29:43 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id PiKmYY1788612xggzkXI26RH; Sun, 16 May 2021 02:29:43 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.4146.1621157377482255659 for ; Sun, 16 May 2021 02:29: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 2DF901042; Sun, 16 May 2021 02:29: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 034DD3F73B; Sun, 16 May 2021 02:29:35 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V2 08/11] Platform/Sgi: Add SMBIOS Type16 Table Date: Sun, 16 May 2021 14:59:14 +0530 Message-Id: <20210516092917.21124-9-pranav.madhu@arm.com> In-Reply-To: <20210516092917.21124-1-pranav.madhu@arm.com> References: <20210516092917.21124-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: QQMMytqddmcxWSERKiB6Nrzkx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621157383; bh=H/01p5DgqYwt7TxM+5R+pRNrML+rur0i2QOxEZF03cA=; h=Cc:Date:From:Reply-To:Subject:To; b=nAXyoYHbpa5reNXF822O8OSg/4h6QW5qq/hJEL1cEEbCMZDrcBEi043OKG0SVlYwQvf kJFg7gAaq928oaoIT7iTJ/cdLvGgx48eCK2jmooPitIn0aEWPOi3LAgRFaHEA3apiE+P8 geT5IzjHbQAdxN7IebCds1WrVLFgeEJ5wxc= 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 = | 7 ++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type16PhysicalMemoryArray.c = | 106 ++++++++++++++++++++ 4 files changed, 118 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 6f3ad29f0797..e195fdea35af 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -41,6 +41,12 @@ InstallCacheInformation ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +EFI_STATUS +EFIAPI +InstallPhysicalMemoryArray ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + enum SMBIOS_REFRENCE_HANDLES { SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, SMBIOS_HANDLE_CLUSTER1, @@ -49,6 +55,7 @@ enum SMBIOS_REFRENCE_HANDLES { SMBIOS_HANDLE_L2_CACHE, SMBIOS_HANDLE_L3_CACHE, SMBIOS_HANDLE_L4_CACHE, + SMBIOS_HANDLE_PHYSICAL_MEMORY, }; =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 62d0f5ce8033..48073ad0ad27 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 { &InstallSystemEnclosure, &InstallProcessorInformation, &InstallCacheInformation, + &InstallPhysicalMemoryArray, }; =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..44a71fa8d18d --- /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) +struct ArmRdSmbiosType16 { + SMBIOS_TABLE_TYPE16 Base; + UINT8 Strings[sizeof (TYPE16_STRINGS)]; +} ARM_TYPE16; +#pragma pack() + +/* Physical Memory Array */ +static struct ArmRdSmbiosType16 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 in is already in u= se. +**/ +EFI_STATUS +InstallPhysicalMemoryArray ( + 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 (Status !=3D EFI_SUCCESS) { + 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 (#75153): https://edk2.groups.io/g/devel/message/75153 Mute This Topic: https://groups.io/mt/82861605/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 11:37:25 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+75154+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+75154+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621157380; cv=none; d=zohomail.com; s=zohoarc; b=eyt1AmKbsArUv1xWQ4DfsnBTahxROrR8oOdbmSfTa9sQOeBKtYhdjfHtHCAJIq1UAViEUEwMSgqk1OpQ93ykEXbAStkZkQSWqPhsPpn6dsojY6yMKcZOImQfgPx25kU7lXBo12xwHCeL4AzBjdI4afFDBq20Mf4m+D5nxxonO64= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621157380; 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=ZEvMo6HFwD99Dej1Ym/RpwbwRI1zVdrwsJ14SjCvKO4=; b=lZjUFnC9+D8M2aGGZbQ33hrUMuHkX4AFhSpKRtULFhFOn4WsZiuhHVp4a3GNNPdrMOuMVVye9IpZ+g1cehl+yBdzK+jc33dVY+BwFmz+0j9E+kJyBcbMCYF91NF5Za/frV0PsZIGVu2LWOji9u/58H+LWlcHOGdslzMUsDhXx0U= 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+75154+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 16211573808191013.9365276374212; Sun, 16 May 2021 02:29:40 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id GfEYYY1788612x2VzSmMgIhI; Sun, 16 May 2021 02:29:40 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.4096.1621157379194952876 for ; Sun, 16 May 2021 02:29: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 C5F161063; Sun, 16 May 2021 02:29:38 -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 9ADA83F73B; Sun, 16 May 2021 02:29:37 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V2 09/11] Platform/Sgi: Add SMBIOS Type17 Table Date: Sun, 16 May 2021 14:59:15 +0530 Message-Id: <20210516092917.21124-10-pranav.madhu@arm.com> In-Reply-To: <20210516092917.21124-1-pranav.madhu@arm.com> References: <20210516092917.21124-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: UQY0KYsVwU3qQLEmAcjNpLwSx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621157380; bh=4le3ePrRvEYN8Yl9A48vt4Jv0PlUBz/gTS4VlSwYjtU=; h=Cc:Date:From:Reply-To:Subject:To; b=qHRvvQm9wwShwzXzQEaPKD8T3PB7p1kTAmFVctFdXH7oTbsVw9XTdipQogCOlHLm8Yf cdhGXepFSZiUvXRUPmsZDTSOQKr1wITOZbufCvqU6gq58HOKXvTaVNGDs8eophf5qvsAh MgNoxFzKtqb24STZdQW0AwoLFqpzMjZrnQs= 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 | 14 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type17MemoryDevice.c | 288 = ++++++++++++++++++++ 4 files changed, 304 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 e195fdea35af..5413982e233b 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -47,6 +47,12 @@ InstallPhysicalMemoryArray ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +EFI_STATUS +EFIAPI +InstallMemoryDevice ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + enum SMBIOS_REFRENCE_HANDLES { SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, SMBIOS_HANDLE_CLUSTER1, @@ -56,6 +62,14 @@ enum SMBIOS_REFRENCE_HANDLES { 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 }; =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 48073ad0ad27..223bf1d114e4 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 { &InstallProcessorInformation, &InstallCacheInformation, &InstallPhysicalMemoryArray, + &InstallMemoryDevice, }; =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..fc7422f432a6 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type17MemoryDevice.c @@ -0,0 +1,288 @@ +/** @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 MAX_CHIP_COUNT 4 +#define BANK0_BASE 1 +#define BANK1_BASE (BANK0_BASE + MAX_CHIP_COUNT) +#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" + +/* SMBIOS Type17 structure */ +#pragma pack(1) +struct ArmRdSmbiosType17 { + SMBIOS_TABLE_TYPE17 Base; + UINT8 Strings[sizeof (TYPE17_STRINGS)]; +}; +#pragma pack() + +/* Memory Device */ +static struct ArmRdSmbiosType17 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 + BANK0_BASE, // 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 + BANK1_BASE, // 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 + BANK0_BASE + 1, // 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 + BANK1_BASE + 1, // 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 + BANK0_BASE + 2, // 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 + BANK1_BASE + 2, // 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 + BANK0_BASE + 3, // 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 + BANK1_BASE + 3, // Chip 3 Bank 1 + MemoryTypeDram, // Memory type + {0, 1}, // Type details others + }, + // Text strings (unformatted area) + TYPE17_STRINGS + }, +}; + +/** + 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 in is already in u= se. +**/ +EFI_STATUS +InstallMemoryDevice ( + 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) { + mArmRdSmbiosType17[Idx].Base.Size =3D + (PcdGet64 (PcdSystemMemorySize) + SIZE_16MB) / SIZE_1MB; + mArmRdSmbiosType17[Idx].Base.MemoryTechnology =3D MemoryTechnologyDram; + mArmRdSmbiosType17[Idx].Base.MemoryOperatingModeCapability.Bits.Volati= leMemory =3D 1; + + if (PcdGet64 (PcdDramBlock2Size) !=3D 0) { + mArmRdSmbiosType17[Idx + 1].Base.Size =3D + PcdGet64 (PcdDramBlock2Size) / SIZE_1MB; + mArmRdSmbiosType17[Idx + 1].Base.MemoryTechnology =3D MemoryTechnolo= gyDram; + mArmRdSmbiosType17[Idx + 1].Base.MemoryOperatingModeCapability.Bits.= VolatileMemory =3D 1; + } + } + + /* Install valid entries */ + for (Idx =3D 0; Idx < ARRAY_SIZE (mArmRdSmbiosType17); Idx++) { + if (mArmRdSmbiosType17[Idx].Base.Size !=3D 0) { + SmbiosHandle =3D + ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType17[Idx])->Handle; + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType17[Id= x] + ); + if (Status !=3D EFI_SUCCESS) { + 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 (#75154): https://edk2.groups.io/g/devel/message/75154 Mute This Topic: https://groups.io/mt/82861606/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 11:37:25 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+75155+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+75155+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621157386; cv=none; d=zohomail.com; s=zohoarc; b=UZVqybJNEYyIq37Eq+lw2XYA5uSKr6Pqdwbc8rjj4IHr3O342MXv2aybc79TlJZws2gA+/5uH/Dp2K0HpeBRlNukTv24wWAr78RLvxTOkOwg0287vPYYMdgXgepuS/T855MawQev1DGHU/qDSBM8RaTqDWkDuQ8UztOuF0qQeCc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621157386; 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=CH8rVYWig0XC/Hgcg8lIrunJaX+gFpzltSu2+JEEHPA=; b=SiXWpJk54XCowxgXKO2i//MHAdw6BiWpG8my6lNDhsijrsG5jKDo7VAphtBJ/EDPNDIF3YXoJrx7sJkDhtuxw7lfmgLEQrnEACa73tTiRa9GZlIflWWecC5GTH+GU8mfsSoJ4Vtry4sO8vlhYD5MzyaCn1anAJ6JnSGZKOIySbI= 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+75155+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 1621157386840667.0607736444757; Sun, 16 May 2021 02:29:46 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id TPdfYY1788612xkQF6RNCGWx; Sun, 16 May 2021 02:29:46 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.4133.1621157380728292143 for ; Sun, 16 May 2021 02:29:40 -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 695671042; Sun, 16 May 2021 02:29: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 3E8973F73B; Sun, 16 May 2021 02:29:39 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V2 10/11] Platform/Sgi: Add SMBIOS Type19 Table Date: Sun, 16 May 2021 14:59:16 +0530 Message-Id: <20210516092917.21124-11-pranav.madhu@arm.com> In-Reply-To: <20210516092917.21124-1-pranav.madhu@arm.com> References: <20210516092917.21124-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: bfZr2eoadARHiXHdY2gavX9dx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621157386; bh=66J1Pkhex8EDD4ad5KmbdeGQakXLX+09M60XVj7j44A=; h=Cc:Date:From:Reply-To:Subject:To; b=IVFWtr05IA5OMBt19pH2ltIVUcOii/zibg8MKDPoJVrK4ysiyotBrsF/WukMYSY0yb7 Sq20za0RjEOAAGKdhXwgU/WUXwmMvSU2J6r2pl6tBZUkL7dWI3JcYLUdwDxNxWhkK604I dc9Qixsl1MDxCNNKULSWkknJVINAvI2wiyc= 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 = | 6 ++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type19MemoryArrayMappedAddre= ss.c | 92 ++++++++++++++++++++ 4 files changed, 100 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 5413982e233b..c6dd72cb6b99 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -53,6 +53,12 @@ InstallMemoryDevice ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +EFI_STATUS +EFIAPI +InstallMemoryArrayMappedAddress ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + enum SMBIOS_REFRENCE_HANDLES { SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, SMBIOS_HANDLE_CLUSTER1, diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index 223bf1d114e4..d5d1e6393184 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 { &InstallCacheInformation, &InstallPhysicalMemoryArray, &InstallMemoryDevice, + &InstallMemoryArrayMappedAddress, }; =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..de458ab29e68 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type19MemoryArrayMapped= Address.c @@ -0,0 +1,92 @@ +/** @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) +struct ArmRdSmbiosType19 { + SMBIOS_TABLE_TYPE19 Base; + UINT8 Strings[sizeof (TYPE19_STRINGS)]; +}; +#pragma pack() + +/* Memory Array Mapped Address */ +static struct ArmRdSmbiosType19 mArmRdSmbiosType19 =3D { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS, // Type 19 + sizeof (SMBIOS_TABLE_TYPE19), // Length + SMBIOS_HANDLE_PI_RESERVED, // Assign an unused handle 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 in is already in u= se. +**/ +EFI_STATUS +InstallMemoryArrayMappedAddress ( + 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 PcdGet64 (PcdSystemMemoryBas= e) / SIZE_1KB; + mArmRdSmbiosType19.Base.EndingAddress =3D ((PcdGet64 (PcdSystemMemoryBas= e) + + (PcdGet64 (PcdSystemMemorySize) + SIZE_16MB)) / // 16MB Trusted D= RAM + SIZE_1KB) - 1; + + /* Install type 19 table */ + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType19 + ); + if (Status !=3D EFI_SUCCESS) { + 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 (#75155): https://edk2.groups.io/g/devel/message/75155 Mute This Topic: https://groups.io/mt/82861607/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 11:37:25 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+75156+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+75156+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1621157388; cv=none; d=zohomail.com; s=zohoarc; b=jOtLQK5OHBXvnQFg5n9+hFFCBPr+QURXYH6/b3NZ1GyuAGavHpgabMOfKEJQInpb5CCapHowgBJZ19JGFHTptcJFyqEvxZ5zPzoH/PlbVn/yhgbag/lADW1CrXWdvTbkMgwnT64Z7LrHfYMoxs7kBVILq6yyx+fHHCNIzDGh5To= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621157388; 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=qZqV512EstP9o8jnF817erQsTZymzWHWfu6SB3PHAb4=; b=hPdACvOTDGxTfkriAoUjFu+TCZV43CciXPjO1Zw+FnBxBfZcrmSIHH+T3jWKSLYCcmWAq4yQmGz4bTGcTB/VwpOYJ7S8qOfkRzS2W3GC/BhiyS4nbk+nWCjsYUvoEUb56bRPv8EUXmNJTlWbiBx84qf5S2pWEODTZdSd64ZpYQM= 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+75156+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 1621157388404675.4060734741365; Sun, 16 May 2021 02:29:48 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id MGdRYY1788612xZclPihqAQS; Sun, 16 May 2021 02:29:48 -0700 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.4134.1621157382391238998 for ; Sun, 16 May 2021 02:29: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 0CC0B1042; Sun, 16 May 2021 02:29: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 D61C73F73B; Sun, 16 May 2021 02:29:40 -0700 (PDT) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [edk2-platforms][PATCH V2 11/11] Platform/Sgi: Add SMBIOS Type32 Table Date: Sun, 16 May 2021 14:59:17 +0530 Message-Id: <20210516092917.21124-12-pranav.madhu@arm.com> In-Reply-To: <20210516092917.21124-1-pranav.madhu@arm.com> References: <20210516092917.21124-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: qrDKfvxRpnQNvsRfdEQaTQOpx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1621157388; bh=cZIkV6cfUyp1RoVxjCtqyWuud00AjQwX9R0H+skiQ2Y=; h=Cc:Date:From:Reply-To:Subject:To; b=cN5w/pzxtRcxi8FYWou0ZosL5bOWUzilKutfilfIaW03bj3dEGQsrN/2uJ/9XMl9BwQ 28n0nPF5LhBlH+mBe3xMGAPTwAr8lsRFTm2nEvhmi1eO5xAioSxYef7U323RwJd5aB+4Q OSpKyPWWD1/khgB2SmZ+hYhKxj3vUfvTDnk= 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 = | 6 ++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c = | 1 + Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32SystemBootInformation.= c | 84 ++++++++++++++++++++ 4 files changed, 92 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 c6dd72cb6b99..0bbda4b4b45d 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -59,6 +59,12 @@ InstallMemoryArrayMappedAddress ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +EFI_STATUS +EFIAPI +InstallSystemBootInformation ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + enum SMBIOS_REFRENCE_HANDLES { SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, SMBIOS_HANDLE_CLUSTER1, diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index d5d1e6393184..77b22678f62a 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 { &InstallPhysicalMemoryArray, &InstallMemoryDevice, &InstallMemoryArrayMappedAddress, + &InstallSystemBootInformation, }; =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..1d3eaab810eb --- /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) +struct ArmRdSmbiosType32 { + SMBIOS_TABLE_TYPE32 Base; + UINT8 Strings[sizeof (TYPE32_STRINGS)]; +}; +#pragma pack() + +/* System Boot Information */ +static struct ArmRdSmbiosType32 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 in is already in u= se. +**/ +EFI_STATUS +InstallSystemBootInformation ( + 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 (Status !=3D EFI_SUCCESS) { + 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 (#75156): https://edk2.groups.io/g/devel/message/75156 Mute This Topic: https://groups.io/mt/82861608/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-