From nobody Wed May 1 03:39:17 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+70438+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+70438+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1610735231; cv=none; d=zohomail.com; s=zohoarc; b=ArUoU0nPK+zzJize9Q32w4x+gSE/fErUZfkGM648l2U6ZirympDQw6O1XwZtqUbnKN1rgoqIwEMjg6TJC9boML4E0XLbNVhD818E9VLMguYMMDgcRuyRb0w2WsTictS0eFUXhIbvviebWgu9oQ4TeqxWoPZiRPI1Q9JGe/ARgO0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610735231; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=pTP2+QmQ8bW8asqLH98LzPkdu34pHSFNZxsWLaMas8k=; b=e7nMuTOI1qDVUQ8gTJNUdYoIoxFJlixrjUHtXDEW4s7jZ/66z+mjJiwlGBx56MnEKxV4krWU5VAm0RLfXBGMHc2fbxzhjx3IoCzPpAgQfpWAZLbmW04IywGI/nfU8se2xJeHVEQ/CGGARKJC5+Ar2A6fhwYOuRwd02sljhyHfFw= 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+70438+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 1610735231291823.4978604946527; Fri, 15 Jan 2021 10:27:11 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id XD9SYY1788612xYntwpyVazX; Fri, 15 Jan 2021 10:27:10 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.55.1610735225533475127 for ; Fri, 15 Jan 2021 10:27:05 -0800 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 3B378ED1; Fri, 15 Jan 2021 10:27:05 -0800 (PST) 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 03E313F719; Fri, 15 Jan 2021 10:27:03 -0800 (PST) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm Subject: [edk2-devel] [edk2-platforms][PATCH V1 01/11] Platform/ARM/SgiPkg: Define RD-N2 platform id values Date: Fri, 15 Jan 2021 23:56:38 +0530 Message-Id: <20210115182648.20938-2-pranav.madhu@arm.com> In-Reply-To: <20210115182648.20938-1-pranav.madhu@arm.com> References: <20210115182648.20938-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pranav.madhu@arm.com X-Gm-Message-State: LiLTIwNR3OHVMVx1GNkrZM8ux1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610735230; bh=K54RDKpPOxFhlZSj0aOoByDYfo9Nw5MBraLEqN5xP/M=; h=Cc:Date:From:Reply-To:Subject:To; b=K2wBI+yWtXzWPWeYbd3RFHn6+7SM1TGDKToxufh7i7+RtbAgLOpyY/p0TBZ+P6G3jOx LTzRelnWFt0Kdp2mBsPtC0qP675K+DEoGcVpPcfsb7sKQ5+2f6ohxV9HjMpstZP66atCR 1Ob8W/v4UJ+gC7AhRHNrwCzPyJ028pFAam0= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add the 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: Thomas Abraham --- 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 d6ab585cce80..e0bb0b4bbe07 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 * @@ -43,6 +43,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 (#70438): https://edk2.groups.io/g/devel/message/70438 Mute This Topic: https://groups.io/mt/79709181/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 Wed May 1 03:39:17 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+70439+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+70439+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1610735233; cv=none; d=zohomail.com; s=zohoarc; b=PJotzHWz8p6LeBOCjbUDzRFx3K1Ec5aIqTsv/U5MYq0cvCckwQJaq4swxjslJzSKWUUOaX3IoaLVA+LmKCOQPbF9anLi5ZhX3lTJr7XQ+bS1vJdlkgUjxKkdcNw5fncMRTPLK1fjJqybAEXBHhK/9U/xUChlyBOVM7rg6F63Ouk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610735233; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=VfKlDPdw8VHhDrLM69EZCzmzEjsgqFVyeRRtOmmC1D8=; b=JFaYjih48L9PP8+sqIfvvvDGziroH0VW36xpOu7tHYvPKr4KWjNysSrFcUKNTf3igsfOU8Yz8IG2Uv2Mww5KGbmc3SEEBqtbRqGl8QzgcNNH6VNLwVsDp16Q3mpC/8xAnJax+dTQXdfx1lKxlfbmaNTtp0uKdHbAPYo8/+Svjpw= 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+70439+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 1610735233061850.1179354501073; Fri, 15 Jan 2021 10:27:13 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id kgO1YY1788612xgkyC5IrkKV; Fri, 15 Jan 2021 10:27:12 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.67.1610735227181618743 for ; Fri, 15 Jan 2021 10:27:07 -0800 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 D99AAED1; Fri, 15 Jan 2021 10:27:06 -0800 (PST) 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 AB3F73F719; Fri, 15 Jan 2021 10:27:05 -0800 (PST) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm Subject: [edk2-devel] [edk2-platforms][PATCH V1 02/11] Platform/ARM/SgiPkg: Add GetProductId API for SGI/RD Platforms Date: Fri, 15 Jan 2021 23:56:39 +0530 Message-Id: <20210115182648.20938-3-pranav.madhu@arm.com> In-Reply-To: <20210115182648.20938-1-pranav.madhu@arm.com> References: <20210115182648.20938-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pranav.madhu@arm.com X-Gm-Message-State: HNUyYkT6F1u9kB7ALQO6xVLJx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610735232; bh=1tDpEapNsrZSsB0hYSJgYQOZG7M2YqTXbZbrWLeIMao=; h=Cc:Date:From:Reply-To:Subject:To; b=DJmTiiXuUCOFueJo4bjCuSi2iobTm8RXl527d05nvi8FEYFbYft3qv/AOuVCc8iQeI/ uv4G/9hLqlluPz6c9G1uqYI7eVwtWFGxkcqsIyIAyWvji2U3DD3nKo+uOExx0VwQnIk0I qVd7iTa8Tb+76Ax/UpI1/vkTGcNVcIjyV/Y= 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: Thomas Abraham --- Platform/ARM/SgiPkg/Include/SgiPlatform.h | 21 +++++ Platform/ARM/SgiPkg/Library/PlatformLib/PlatformLib.c | 83 +++++++++++++++= ++++- 2 files changed, 103 insertions(+), 1 deletion(-) diff --git a/Platform/ARM/SgiPkg/Include/SgiPlatform.h b/Platform/ARM/SgiPk= g/Include/SgiPlatform.h index e0bb0b4bbe07..dfcc616fb08b 100644 --- a/Platform/ARM/SgiPkg/Include/SgiPlatform.h +++ b/Platform/ARM/SgiPkg/Include/SgiPlatform.h @@ -72,4 +72,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..f2accb7dd098 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_CONF_ID, + 1 + }, + { + RdN2, + RD_N2_PART_NUM, + RD_N2_CONF_ID, + 0 + } +}; + EFI_BOOT_MODE ArmPlatformGetBootMode ( VOID @@ -75,3 +123,36 @@ ArmPlatformGetPlatformPpiList ( *PpiListSize =3D sizeof (gPlatformPpiTable); *PpiList =3D gPlatformPpiTable; } + +/** + Update the product Id by reading platform id descriptor + + @retval Zero Failed identify platform + @retval Others Platform identified, and return ARM_PRODUCT_ID +**/ +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 (#70439): https://edk2.groups.io/g/devel/message/70439 Mute This Topic: https://groups.io/mt/79709183/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 Wed May 1 03:39:17 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+70440+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+70440+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1610735229; cv=none; d=zohomail.com; s=zohoarc; b=MHg81e1Cr7lDvIShDRBvKBgCG1nIGzkQd1C8jtldNu0cbuXvPKk49MtJiMcFHt7ZfZXdZW1MoSSQ84IM8D+hdrr9g6v/nbP30icpShMn+403uuCpWXMAJUn0507n6fypymcCap/RuE+Hst6N2a545i0xryh2QydqmdvUDKlY/CA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610735229; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=qYCo28iOszlM99BBJEH+aOlICPt/f2CwV1Ul8pKIbYM=; b=k/yJzoeytVwrpS0zThBdYw7ADBuCi9StVovZY8VYVORcPrbcaA1VZ2sELy2V+uJvlcNmZA5js1To7ONbAA8zRoGicZk9JnKOxYDCxAUXA1gN0HwkOLDP4JkOcnbleLrVg5E8+Hv4AoJ7mwByGFjquJwTX0AfDdiNQ4BUwOo7I8g= 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+70440+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 1610735229773393.3567561879885; Fri, 15 Jan 2021 10:27:09 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id a7Q0YY1788612xgVSqrqPWYZ; Fri, 15 Jan 2021 10:27:09 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.64.1610735228826984530 for ; Fri, 15 Jan 2021 10:27:09 -0800 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 8405C11B3; Fri, 15 Jan 2021 10:27:08 -0800 (PST) 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 559733F719; Fri, 15 Jan 2021 10:27:07 -0800 (PST) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm Subject: [edk2-devel] [edk2-platforms][PATCH V1 03/11] Platform/ARM/SgiPkg: Add Initial SMBIOS support Date: Fri, 15 Jan 2021 23:56:40 +0530 Message-Id: <20210115182648.20938-4-pranav.madhu@arm.com> In-Reply-To: <20210115182648.20938-1-pranav.madhu@arm.com> References: <20210115182648.20938-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pranav.madhu@arm.com X-Gm-Message-State: 1JJ5WOXCXYDMpeomNJEOX8V8x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610735229; bh=8/8b0Lwwr+rllvlxbqLgwsWVdLQnPGCbHuh5QXTupQw=; h=Cc:Date:From:Reply-To:Subject:To; b=miXH8U9lnE5ygTS9suuPdr9uVgdYBosJ6464LyQftLyww8fRvwyh70wg5unQP81bDiP q95FwrRmXiSgIJ++Q3vKJ8K+dYplUhQroH0t6jlSPlkJkeQGgS1G7DtPRVBE23UcA2bKm v08tHCd0WcI1bEOnrEzXkx44qlLyyKRi3tw= 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: Thomas Abraham --- Platform/ARM/SgiPkg/SgiPlatform.dsc.inc | 10= ++ Platform/ARM/SgiPkg/SgiPlatform.fdf | 8= +- Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf | 56= ++++++++++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h | 18= ++++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c | 74= ++++++++++++++ Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type0BiosInformation.c | 108= ++++++++++++++++++++ 6 files changed, 273 insertions(+), 1 deletion(-) diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc b/Platform/ARM/SgiPkg/= SgiPlatform.dsc.inc index f5c3ccd13069..806f570c637f 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc @@ -119,6 +119,10 @@ # ACPI Table Version gEfiMdeModulePkgTokenSpaceGuid.PcdAcpiExposedTableVersions|0x20 =20 + # SMBIOS entry point version + gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosVersion|0x0304 + gEfiMdeModulePkgTokenSpaceGuid.PcdSmbiosDocRev|0x0 + # # PCIe # @@ -260,6 +264,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 18fd09e5d2e2..d94e4633e36c 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 # @@ -109,6 +109,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..8996c521de54 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -0,0 +1,56 @@ +## @file +# This driver installs SMBIOS information for RD Platforms +# +# Copyright (c) 2020-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 + +# +# The following information is for reference only and not required by the = build +# tools. +# +# VALID_ARCHITECTURES =3D AARCH64 +# + +[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..9a10bbf15e9e --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -0,0 +1,18 @@ +/** @file +* +* Copyright (c) 2020-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..f00ef5f8c415 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -0,0 +1,74 @@ +/** @file + Install SMBIOS information for Arm's SGI/RD platforms + + Copyright (c) 2020-2021, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#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 + + @param ImageHandle Module's image handle + @param SystemTable Pointer of EFI_SYSTEM_TABLE + + @retval EFI_SUCCESS SMBIOS data successfully installed + @retval Other SMBIOS data was not installed +**/ +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) { + return EFI_NOT_FOUND; + } + + /* Find the SMBIOS protocol */ + Status =3D gBS->LocateProtocol ( + &gEfiSmbiosProtocolGuid, + NULL, + (VOID **)&Smbios + ); + if (EFI_ERROR (Status)) { + 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 SMBIOS tables\n", + ARRAY_SIZE (mSmbiosTableList) - CountFail)); + return Status; +} 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..ef39178b595e --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type0BiosInformation.c @@ -0,0 +1,108 @@ +/** @file + SMBIOS Type 0 (BIOS information) table for ARM RD platforms. + + Copyright (c) 2020-2021, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#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 (SMBIOS 3.4 spec, section 7.1) */ +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 + + @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 dynamicaly */ + mArmRdSmbiosType0.Base.SystemBiosMajorRelease =3D + (PcdGet32 ( PcdFirmwareRevision ) >> 16) & 0xFF; + mArmRdSmbiosType0.Base.SystemBiosMinorRelease =3D + PcdGet32 ( PcdFirmwareRevision ) & 0xFF; + + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType0 + ); + + 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 (#70440): https://edk2.groups.io/g/devel/message/70440 Mute This Topic: https://groups.io/mt/79709185/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 Wed May 1 03:39:17 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+70441+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+70441+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1610735231; cv=none; d=zohomail.com; s=zohoarc; b=iAYiEPxmVyrhU3EIw/SHEaUfamY3IRBj8syn2BspzCkiDKpSMeAGztWshSQksqjfYJip3hjF8Jk72tEBu7XhYJRTVkajgDVA4XX0SFIvw5fRDFcC+io3VCOhs1SM2ZxwTOz2GsGAu9WiTA42DRc/2cVyzq+O0nV3POdCVT36kIM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610735231; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=87RzcSr8kdvd1sUUCAVjHfYiX3Pm3LcvdEmlYQTDAJo=; b=aPp3xOWU2SpK0CmnVcp3W1/4l02Ehr15tLlvgotyGSdvpUeWZKuWSKCgOqmSgvOAEdU1rRsIO92XtowP29EBwidiI27062/4qA+dxmDWYrnHA74VE8IFgeRXvqYxkga+gk/CGUkICm6cQM1+Lf/PngW3JIiCcc0fqLkO7Y+vOL0= 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+70441+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 16107352313541013.5610085446697; Fri, 15 Jan 2021 10:27:11 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id S78CYY1788612xwWZ9LbJAcF; Fri, 15 Jan 2021 10:27:11 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.74.1610735230516187397 for ; Fri, 15 Jan 2021 10:27:10 -0800 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 2EB54ED1; Fri, 15 Jan 2021 10:27:10 -0800 (PST) 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 005B13F719; Fri, 15 Jan 2021 10:27:08 -0800 (PST) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm Subject: [edk2-devel] [edk2-platforms][PATCH V1 04/11] Platform/ARM/SgiPkg: Add SMBIOS Type1 Table Date: Fri, 15 Jan 2021 23:56:41 +0530 Message-Id: <20210115182648.20938-5-pranav.madhu@arm.com> In-Reply-To: <20210115182648.20938-1-pranav.madhu@arm.com> References: <20210115182648.20938-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pranav.madhu@arm.com X-Gm-Message-State: ygPWDWH1zLEY2SpAH3MnzB3wx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610735231; bh=pm3vYmhz05dBTfRB1BVdInFFktB0Hb+y+VFPtxBpbBs=; h=Cc:Date:From:Reply-To:Subject:To; b=e0+KklNvUoVcvokKnodwbY266nK6+XSQf/2lM40r8s9lro+7k1eKf67RUNSe8k2ypaz vcv3OluRnH1ryZCCAcnaDA4RhkvJ26N3lnovLqlWkNac+ZDWeem72kDUQwIS/vJMsQMJ6 R27V9bm84S/IaHzVt8OCw8M0ie0xNra45PY= 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: Thomas Abraham --- 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= 14 ++++++++++++++++++++ 4 files changed, 122 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index 8996c521de54..6a00912ab742 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -26,6 +26,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 9a10bbf15e9e..43427158106d 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -15,4 +15,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 f00ef5f8c415..1068398bcba3 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -22,6 +22,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..21b3ad863719 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type1SystemInformation.c @@ -0,0 +1,114 @@ +/** @file + SMBIOS Type 1 (System information) table for ARM RD platforms. + + Copyright (c) 2020-2021, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#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 (SMBIOS 3.4 spec, section 7.2) */ +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 + + @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; + + if (SgiGetProductId () !=3D UnknownId) { + mArmRdSmbiosType1.Base.ProductName =3D + PRODUCT_NAME_BASE + (SgiGetProductId () - 1); // from TYPE1_STRINGS + CopyGuid (&mArmRdSmbiosType1.Base.Uuid, + &mSmbiosUid[SgiGetProductId () - 1]); + } else { + return EFI_NOT_FOUND; + } + + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType1 + ); + + 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 (#70441): https://edk2.groups.io/g/devel/message/70441 Mute This Topic: https://groups.io/mt/79709186/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 Wed May 1 03:39:17 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+70442+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+70442+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1610735233; cv=none; d=zohomail.com; s=zohoarc; b=OfUv+diPubtHoTesp3Qp9eKRRKn4Kr/DHKaaowt82jmzH58I7VFKUl4/VvXW7UilFTv3viB1ACbHAoOsUncEzlbzIM3kxtR8WXhUtyRqeMWCs0Yi5pbUvxA53uvE6yn7Vu4UJNXlmGmgV8bwR6vVWeuYsKSp5BAfzHvgjZpsLrw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610735233; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=nh9sTRmTcjJGCITlY93Jdeuerc4sV1wyqxpdbYhku5U=; b=Pa/jCSkIEY5+VCmeHd41/fe56vqtmp1PyzNAusBKOcFxPqmqZ9guVc8EMlWrGugW6P+Nlo4DPc3HQRNRvC28pgYwH3Kg5eMofdo/X38nfhvct2pUpiIZlHt0MiSBR4jHuNe9RKjYU3a5mnenAMOQG6gMB9zDLKzTyL6van59a0I= 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+70442+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 1610735233182191.00122283945905; Fri, 15 Jan 2021 10:27:13 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 3w3dYY1788612xFmvbCFFh5F; Fri, 15 Jan 2021 10:27:12 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.72.1610735232206214193 for ; Fri, 15 Jan 2021 10:27:12 -0800 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 CE284ED1; Fri, 15 Jan 2021 10:27:11 -0800 (PST) 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 9EEFA3F719; Fri, 15 Jan 2021 10:27:10 -0800 (PST) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm Subject: [edk2-devel] [edk2-platforms][PATCH V1 05/11] Platform/ARM/SgiPkg: Add SMBIOS Type3 Table Date: Fri, 15 Jan 2021 23:56:42 +0530 Message-Id: <20210115182648.20938-6-pranav.madhu@arm.com> In-Reply-To: <20210115182648.20938-1-pranav.madhu@arm.com> References: <20210115182648.20938-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pranav.madhu@arm.com X-Gm-Message-State: OcLOLAYuqp0R0m03u5VxFYLbx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610735232; bh=39isa0kBYM0D1q2X5ZfnrU/h2iv/slkiN62gQ8uGuU4=; h=Cc:Date:From:Reply-To:Subject:To; b=t78q1EZaP9zNbAeNCYqtmty3FyRyqNh12uTCKBgxgBmCrfkUVKVSvpIekSAuMM45AYG 236Pp2fNDmUdmNSrs/XLcmrXtvoNCur6GN+T1AobWTVHLdw7QXzqNQv9PLYTD0r468SQc NWvraNostGnGdLBcRmcyYH0NJoYD3arSrEM= 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: Thomas Abraham --- 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 | 77 = ++++++++++++++++++++ 4 files changed, 89 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index 6a00912ab742..8095257a4c94 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -27,6 +27,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 43427158106d..749439f939ee 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -21,4 +21,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 1068398bcba3..2eff18630030 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -23,6 +23,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..c6d134e5af59 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type3SystemEnclosure.c @@ -0,0 +1,77 @@ +/** @file + SMBIOS Type 3 (System enclosure) table for ARM RD platforms. + + Copyright (c) 2020-2021, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#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 (SMBIOS 3.4 spec, section 7.4) */ +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 + + @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; + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType3 + ); + + 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 (#70442): https://edk2.groups.io/g/devel/message/70442 Mute This Topic: https://groups.io/mt/79709187/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 Wed May 1 03:39:17 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+70443+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+70443+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1610735239; cv=none; d=zohomail.com; s=zohoarc; b=lRCljHENVxmJJSV8//+9IKKiyE7Y+W5n8pZKSSDnjXXWoDHy+7d+/KgL+dysqa+9qdXCD4u5ZzP2ngFvjB5BoQho74p7EKKcdJsaikh6YT8HooDCZ2dMQgjqfCSVBz6Xh0xi59MbHuY9PpwWITWbnkKXh7sMVBhWaGz2QNFuoBE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610735239; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=dtKnXex/ZDSA2C9ZW7KoqyZY9ZiLZ9Wk8kcDy9Wy0eg=; b=EFsZ5yQM/gywUh19r9CiYvfJklEdpGPV3vyTt4BvKLxKWmKwKJ+eMDlKgHEAZM6BHUKCaazI+f264EzQ5aPp9B3IRz2ukSe5iAsQGEfK2fSTCq6PbI9hZwqFpLb2JQb2jwu19dnwA6lq5fkjQvWOjWITYj/ApjRGaMkGJkB+WDM= 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+70443+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 1610735239676486.6527532171907; Fri, 15 Jan 2021 10:27:19 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id ZussYY1788612xtob9B9KXSJ; Fri, 15 Jan 2021 10:27:19 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.77.1610735233817567619 for ; Fri, 15 Jan 2021 10:27:13 -0800 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 77DBDED1; Fri, 15 Jan 2021 10:27:13 -0800 (PST) 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 494653F719; Fri, 15 Jan 2021 10:27:12 -0800 (PST) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm Subject: [edk2-devel] [edk2-platforms][PATCH V1 06/11] Platform/ARM/SgiPkg: Add SMBIOS Type4 Table Date: Fri, 15 Jan 2021 23:56:43 +0530 Message-Id: <20210115182648.20938-7-pranav.madhu@arm.com> In-Reply-To: <20210115182648.20938-1-pranav.madhu@arm.com> References: <20210115182648.20938-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pranav.madhu@arm.com X-Gm-Message-State: WfeidiA7gwbEy806Npmu681px1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610735239; bh=zRWIgnDun/3bfqkkH36Vcb67KVw1+AjmBcRbn9+k/LQ=; h=Cc:Date:From:Reply-To:Subject:To; b=R6jAKK3DUnFZF40hriJP8Q6Un4PlzbcPrPKfkQvteF4ne0SHDuKEeyTM6XQeblot0EG c+tI9H0seAGYu5saqEEkImrkBPtIuzzmO78czQ0CiBYmBXV/5cDOp2enPXRtmtaodqvO1 D/7qecBvbsTgfb1FV1qV+/rObszgR4xPRag= 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: Thomas Abraham --- 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 = | 182 ++++++++++++++++++++ 5 files changed, 202 insertions(+) diff --git a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc b/Platform/ARM/SgiPkg/= SgiPlatform.dsc.inc index 806f570c637f..de1a4be0605a 100644 --- a/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc +++ b/Platform/ARM/SgiPkg/SgiPlatform.dsc.inc @@ -63,6 +63,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 8095257a4c94..883f6a49243d 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -28,6 +28,7 @@ Type0BiosInformation.c Type1SystemInformation.c Type3SystemEnclosure.c + Type4ProcessorInformation.c =20 [Packages] ArmPkg/ArmPkg.dec @@ -37,9 +38,11 @@ Platform/ARM/SgiPkg/SgiPlatform.dec =20 [LibraryClasses] + ArmLib ArmPlatformLib DebugLib HobLib + PrintLib UefiDriverEntryPoint =20 [Guids] @@ -47,6 +50,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 749439f939ee..161bd7ba4090 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -27,8 +27,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 2eff18630030..12c54f31e149 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -24,6 +24,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..0d66258c2884 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type4ProcessorInformati= on.c @@ -0,0 +1,182 @@ +/** @file + SMBIOS Type 4 (Processor information) table for ARM RD platforms. + + Copyright (c) 2020-2021, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#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 (SMBIOS 3.4 spec, section 7.5) */ +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 +}; + +/** + 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 + + @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)); + + switch (SgiGetProductId ()) { + case Sgi575: + case RdN1Edge: + case RdV1: + case RdN2: + mArmRdSmbiosType4.Base.CoreCount =3D CoreCount; + mArmRdSmbiosType4.Base.EnabledCoreCount =3D CoreCount; + mArmRdSmbiosType4.Base.ThreadCount =3D CoreCount; + 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); + + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType4 + ); + + 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 (#70443): https://edk2.groups.io/g/devel/message/70443 Mute This Topic: https://groups.io/mt/79709190/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 Wed May 1 03:39:17 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+70444+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+70444+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1610735236; cv=none; d=zohomail.com; s=zohoarc; b=d7O7JElLUjY55LaQ3g84O702Q7CovMKjPw+yE6Wltuvsx9Dvbsa5FKDI4eWiIwsWPVhZaDz3mjTrB31w8BvSMaUGs7+DHY+vGRBAGZK1aQdHhlp1s1xQvWefC0Y97rWBFcqO8fQrUgiXkzd9ReNTClTs5iMXa9qD+/nKNMTRxPU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610735236; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=6uo6reuHBwXVR4zZKjnlQ6gB32PBI8NixNNlxJ2MrEw=; b=nupir/8LZ8F0e5agkuwgtObTsTZe7zFnOgHZpWJzL/OLLcbpcJPDbBteMsGeYF4TH/6GMZ9gKelACmSkRfV7N8U/dctQQ6UepF/qv5Ecwi7imliN+2ZaTWnJmyGYmRenJ6tZ2cAI0sKolIJK691XznRCZVX7+1YjobXVTPVrixU= 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+70444+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 1610735236756756.8721616312362; Fri, 15 Jan 2021 10:27:16 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id RfDhYY1788612xPyiwIToGZ2; Fri, 15 Jan 2021 10:27:16 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web09.79.1610735235704222860 for ; Fri, 15 Jan 2021 10:27:15 -0800 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 64FA8ED1; Fri, 15 Jan 2021 10:27:15 -0800 (PST) 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 E83C63F719; Fri, 15 Jan 2021 10:27:13 -0800 (PST) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm Subject: [edk2-devel] [edk2-platforms][PATCH V1 07/11] Platform/ARM/SgiPkg: Add SMBIOS Type7 Table Date: Fri, 15 Jan 2021 23:56:44 +0530 Message-Id: <20210115182648.20938-8-pranav.madhu@arm.com> In-Reply-To: <20210115182648.20938-1-pranav.madhu@arm.com> References: <20210115182648.20938-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pranav.madhu@arm.com X-Gm-Message-State: 6qP1mAW07twNLUOiQl6TFvzmx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610735236; bh=JOpqVTFuEbj4gy72WRzuJkXLSsAL+KhvAPktIWLhgnw=; h=Cc:Date:From:Reply-To:Subject:To; b=vAGMmIuNN7gGRVqM+ILVBwGO7iYzsTKLeOAlgo3R8DXbcqoOvCocy1nomRoelMNVj/i u/CAqDwpJmrt/l7/oILh84HAHBtISvyj34SUddktnHEJsEmCPlWXN/9lJ2K3pXB/9u468 6Y1pgFevCo71d4iUHIWnM+kfL5uexMMNcQE= 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: Thomas Abraham --- 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 | 29= 7 ++++++++++++++++++++ 4 files changed, 305 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index 883f6a49243d..162b9c68cfcc 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -29,6 +29,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 161bd7ba4090..85a765cfe0c0 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -33,6 +33,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 12c54f31e149..c2e45e7877d0 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -25,6 +25,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..b8d0af54678c --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type7CacheInformation.c @@ -0,0 +1,297 @@ +/** @file + SMBIOS Type 7 (Cache information) table for ARM RD platforms. + + Copyright (c) 2020-2021, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#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 (SMBIOS 3.4 spec, section 7.8) */ +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 + + @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: + mArmRdSmbiosType7[0].Base.MaximumCacheSize2 =3D 64; // 64KB + mArmRdSmbiosType7[0].Base.InstalledSize2 =3D 64; // 64KB + mArmRdSmbiosType7[0].Base.Associativity =3D CacheAssociativity4Way; + mArmRdSmbiosType7[1].Base.MaximumCacheSize2 =3D 64; // 64KB + mArmRdSmbiosType7[1].Base.InstalledSize2 =3D 64; // 64KB + mArmRdSmbiosType7[1].Base.Associativity =3D CacheAssociativity16Way; + mArmRdSmbiosType7[2].Base.MaximumCacheSize2 =3D 512; // 512KB + mArmRdSmbiosType7[2].Base.InstalledSize2 =3D 512; // 512KB + mArmRdSmbiosType7[2].Base.Associativity =3D CacheAssociativity8Way; + 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: + mArmRdSmbiosType7[0].Base.MaximumCacheSize2 =3D 64; // 64KB + mArmRdSmbiosType7[0].Base.InstalledSize2 =3D 64; // 64KB + mArmRdSmbiosType7[0].Base.Associativity =3D CacheAssociativity4Way; + mArmRdSmbiosType7[1].Base.MaximumCacheSize2 =3D 64; // 64KB + mArmRdSmbiosType7[1].Base.InstalledSize2 =3D 64; // 64KB + mArmRdSmbiosType7[1].Base.Associativity =3D CacheAssociativity4Way; + mArmRdSmbiosType7[2].Base.MaximumCacheSize2 =3D 512; // 512KB + mArmRdSmbiosType7[2].Base.InstalledSize2 =3D 512; // 512KB + mArmRdSmbiosType7[2].Base.Associativity =3D CacheAssociativity8Way; + mArmRdSmbiosType7[3].Base.MaximumCacheSize2 =3D 2048; // 2MB + mArmRdSmbiosType7[3].Base.InstalledSize2 =3D 2048; // 2MB + mArmRdSmbiosType7[3].Base.Associativity =3D CacheAssociativity16Way; + 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: + mArmRdSmbiosType7[0].Base.MaximumCacheSize2 =3D 32; // 32KB + mArmRdSmbiosType7[0].Base.InstalledSize2 =3D 32; // 32KB + mArmRdSmbiosType7[0].Base.Associativity =3D CacheAssociativity4Way; + mArmRdSmbiosType7[1].Base.MaximumCacheSize2 =3D 32; // 32KB + mArmRdSmbiosType7[1].Base.InstalledSize2 =3D 32; // 32KB + mArmRdSmbiosType7[1].Base.Associativity =3D CacheAssociativity4Way; + mArmRdSmbiosType7[2].Base.MaximumCacheSize2 =3D 256; // 256KB + mArmRdSmbiosType7[2].Base.InstalledSize2 =3D 256; // 256KB + mArmRdSmbiosType7[2].Base.Associativity =3D CacheAssociativity4Way; + mArmRdSmbiosType7[3].Base.MaximumCacheSize2 =3D 2048; // 2MB + mArmRdSmbiosType7[3].Base.InstalledSize2 =3D 2048; // 2MB + mArmRdSmbiosType7[3].Base.Associativity =3D CacheAssociativity16Way; + 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: + mArmRdSmbiosType7[0].Base.MaximumCacheSize2 =3D 64; // 64KB + mArmRdSmbiosType7[0].Base.InstalledSize2 =3D 64; // 64KB + mArmRdSmbiosType7[0].Base.Associativity =3D CacheAssociativity4Way; + mArmRdSmbiosType7[1].Base.MaximumCacheSize2 =3D 64; // 64KB + mArmRdSmbiosType7[1].Base.InstalledSize2 =3D 64; // 64KB + mArmRdSmbiosType7[1].Base.Associativity =3D CacheAssociativity4Way; + mArmRdSmbiosType7[2].Base.MaximumCacheSize2 =3D 1024; // 1MB + mArmRdSmbiosType7[2].Base.InstalledSize2 =3D 1024; // 1MB + mArmRdSmbiosType7[2].Base.Associativity =3D CacheAssociativity8Way; + 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: + mArmRdSmbiosType7[0].Base.MaximumCacheSize2 =3D 64; // 64KB + mArmRdSmbiosType7[0].Base.InstalledSize2 =3D 64; // 64KB + mArmRdSmbiosType7[0].Base.Associativity =3D CacheAssociativity4Way; + mArmRdSmbiosType7[1].Base.MaximumCacheSize2 =3D 64; // 64KB + mArmRdSmbiosType7[1].Base.InstalledSize2 =3D 64; // 64KB + mArmRdSmbiosType7[1].Base.Associativity =3D CacheAssociativity4Way; + mArmRdSmbiosType7[2].Base.MaximumCacheSize2 =3D 1024; // 1MB + mArmRdSmbiosType7[2].Base.InstalledSize2 =3D 1024; // 1MB + mArmRdSmbiosType7[2].Base.Associativity =3D CacheAssociativity8Way; + mArmRdSmbiosType7[4].Base.MaximumCacheSize2 =3D 32768; // 32MB SLC + mArmRdSmbiosType7[4].Base.InstalledSize2 =3D 32768; // 32MB SLC + mArmRdSmbiosType7[4].Base.Associativity =3D CacheAssociativity16Way; + break; + } + + for (CacheIdx =3D 0; CacheIdx < ARRAY_SIZE (mArmRdSmbiosType7); CacheIdx= ++) { + if (mArmRdSmbiosType7[CacheIdx].Base.MaximumCacheSize2 =3D=3D 0) { + continue; + } + + SmbiosHandle =3D ((EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType7[CacheI= dx])->Handle; + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType7[Cache= Idx] + ); + if (EFI_ERROR (Status)) { + 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 (#70444): https://edk2.groups.io/g/devel/message/70444 Mute This Topic: https://groups.io/mt/79709192/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 Wed May 1 03:39:17 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+70445+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+70445+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1610735238; cv=none; d=zohomail.com; s=zohoarc; b=mXV0ASpWB2fXMbFVhqxee/3O36YqKV15+63yIM8/Bu0IUs7rjZMe/yvBnTAScodJF5j2tCsM+2gzI02gN4N09VfbPrOtTWWMCE/HZ71HoK++sbsuQGitaCEzpJOrI12EqQbGjZPxlsWsxqpwPyjc/pTgQqFOr7kVf+aepLVwseg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610735238; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=J0OVNxg1qisMkI6UKuTANTkQFEXqnQbTECtyoGWH8fc=; b=MttE/n9EAgJoQaDByoM7ye4fh8hYEzke2tSgkbdruV/lqw8fB+APhoqyNLNU2jqURr/4ulrgijPu9j+IZEn7ukCNcZ71qicOTg3OjopQzaKEkZJjTojSWCBkul1Lo2syNHAXeOLsi3bL2xFX7A9B12yzqA1qk7ln01nx+Qc+n2o= 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+70445+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 1610735238550872.0284557376779; Fri, 15 Jan 2021 10:27:18 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id hCrsYY1788612x1mRgUaBUKC; Fri, 15 Jan 2021 10:27:18 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web11.82.1610735237354791091 for ; Fri, 15 Jan 2021 10:27:17 -0800 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 0F45411B3; Fri, 15 Jan 2021 10:27:17 -0800 (PST) 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 D51EC3F719; Fri, 15 Jan 2021 10:27:15 -0800 (PST) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm Subject: [edk2-devel] [edk2-platforms][PATCH V1 08/11] Platform/ARM/SgiPkg: Add SMBIOS Type16 Table Date: Fri, 15 Jan 2021 23:56:45 +0530 Message-Id: <20210115182648.20938-9-pranav.madhu@arm.com> In-Reply-To: <20210115182648.20938-1-pranav.madhu@arm.com> References: <20210115182648.20938-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pranav.madhu@arm.com X-Gm-Message-State: hnp5OXMTyZxAA0sWGOikghXSx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610735238; bh=lPFQUaLRSutQH+MqfdPqk3qlAkXDrFzVP27NrYy9rq0=; h=Cc:Date:From:Reply-To:Subject:To; b=N8Zrr55uq2AOaCsvRlAXU4suQDaqSh/5hZJrbrbKxYnDk9KRBMiH3GcWD41TsbWecsZ hXhQlgEIa5X1xAVlWGQdXPQg9U28T2hGiFQKJMhIvq2PIVcJRrXibdlicttb2isH6v53i sfZI87dZxScvmht/IPQQTySfYn+b2+HW5Cc= 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: Thomas Abraham --- 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 = | 85 ++++++++++++++++++++ 4 files changed, 97 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index 162b9c68cfcc..83bcb40531fe 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -30,6 +30,7 @@ Type3SystemEnclosure.c Type4ProcessorInformation.c Type7CacheInformation.c + Type16PhysicalMemoryArray.c =20 [Packages] ArmPkg/ArmPkg.dec @@ -54,6 +55,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 85a765cfe0c0..e7ecb5d56704 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -39,6 +39,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, @@ -47,6 +53,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 c2e45e7877d0..accc9fe2e560 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -26,6 +26,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..90895f0ad268 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type16PhysicalMemoryArr= ay.c @@ -0,0 +1,85 @@ +/** @file + SMBIOS Type 16 (Physical Memory Array) table for ARM RD platforms. + + Copyright (c) 2020-2021, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#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 (SMBIOS 3.4 spec, section 7.17) */ +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 Bios information Table + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed in is already in 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); + + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType16 + ); + 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 (#70445): https://edk2.groups.io/g/devel/message/70445 Mute This Topic: https://groups.io/mt/79709195/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 Wed May 1 03:39:17 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+70446+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+70446+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1610735240; cv=none; d=zohomail.com; s=zohoarc; b=NMwXvdfR9IjhhTxcxhGdDosTMb3EirnPkPbMGbWJFCuJ24b1bTL3q0dwRcVf3NUkuVGCmIrD8p+9Ow1tRJJ0pp2O8Ab4ODTf9bTk1BDYbpJUZtlgdO8oHMidNU8qfkUXC4FuDtEn+pSmp+70l+rRGiPEUu4XCmon6Sw+mTW/nM4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610735240; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=N2HIiYojfoQ7mZBh2pybuK4TwOg+NiqjZvaWloUcZUM=; b=jwa+wDjRWSfDF9XKNq1W8YpFMPX6GgMopfX1xNPg+SreOZQ4W50sd4SZqqJcHTB44payZycBfWgCn6zLy/3SRoUODyfu1jB/tsxCkHpaZUrV1dLyGTzZ6+qtumJQ1DpXHQtgfpbaj5Z6mQ5w3WQb2jdS0k/sOJiOTdNZJ+eDcFE= 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+70446+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 1610735240176983.5927305231846; Fri, 15 Jan 2021 10:27:20 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id L2ckYY1788612xDEXmgBWgLW; Fri, 15 Jan 2021 10:27:19 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web08.68.1610735239002086929 for ; Fri, 15 Jan 2021 10:27:19 -0800 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 AF8F0ED1; Fri, 15 Jan 2021 10:27:18 -0800 (PST) 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 7FAA33F719; Fri, 15 Jan 2021 10:27:17 -0800 (PST) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm Subject: [edk2-devel] [edk2-platforms][PATCH V1 09/11] Platform/ARM/SgiPkg: Add SMBIOS Type17 Table Date: Fri, 15 Jan 2021 23:56:46 +0530 Message-Id: <20210115182648.20938-10-pranav.madhu@arm.com> In-Reply-To: <20210115182648.20938-1-pranav.madhu@arm.com> References: <20210115182648.20938-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pranav.madhu@arm.com X-Gm-Message-State: ksra9Wk6C9zR8tfHfyCZ3JQVx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610735239; bh=u1b7WUSHLozYcWSXTMbEXWfYfdv09KcOuAX9tleRT4E=; h=Cc:Date:From:Reply-To:Subject:To; b=Pyj6kKRHgICeWSInyZHsZg7AmmyidbMGWGzymnIMqGU0M1+4AU9IHlETESaWehXHZOX THuIOnTWBtnzD9OeM3x+loyQMkTSAOjh0QTNbZYKJaQ39Y3OzSf7hxSUSgeE8mFFE0VoX NC4GXTbNCsPWiHgacbpQbtJg2LR47+rmmEU= 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: Thomas Abraham --- 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 | 273 = ++++++++++++++++++++ 4 files changed, 289 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index 83bcb40531fe..7f16aef64c8e 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -31,6 +31,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 e7ecb5d56704..c56429541504 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -45,6 +45,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, @@ -54,6 +60,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 accc9fe2e560..464fb62d06fa 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -27,6 +27,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..283ff6eaa236 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type17MemoryDevice.c @@ -0,0 +1,273 @@ +/** @file + SMBIOS Type 17 (Memory Device) table for ARM RD platforms. + + Copyright (c) 2020-2021, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#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 (SMBIOS 3.4 spec, section 7.18) */ +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 Bios information Table + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed in is already in u= se. +**/ +EFI_STATUS +InstallMemoryDevice ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + UINT8 Idx; + + 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 (EFI_ERROR (Status)) { + 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 (#70446): https://edk2.groups.io/g/devel/message/70446 Mute This Topic: https://groups.io/mt/79709197/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 Wed May 1 03:39:17 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+70447+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+70447+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1610735241; cv=none; d=zohomail.com; s=zohoarc; b=iKlxJbigW4N9NKvY9j+yKnqBGgHp3Ewccd+csODg5jnYA9JDpcaQcueAQHnEnP/ue4s+WrhE5kbYxeM3XoMECnt7AX+N65Q4CH5d5Qdbz4hYncbmh4BXTHbITOCLfWRpmNbUGSXEYr243/9G6UxufsffgpqkcHzlmT4Km7ZM1TA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610735241; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=Se8jZjeRjoupmIkgFDb+n+vKvFg3V40NEK1cZixFfD0=; b=npDwhXeaACuUbGVdFbGHxhCBqbV+QofjvmQXxc2md7q2Ou5JJhJkn8mbopoHelqoGNQkh2prDX+4bex9tSeY0ps598S72VJVOPK4bS8e/WSyyhHug52MVNlMqi1i2Aj6sFFN/Wj2/gbmrX+YbgK73/4JS4mXv1Fn9e4OQeXVwmQ= 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+70447+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 1610735241549225.5909204577897; Fri, 15 Jan 2021 10:27:21 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id fWQKYY1788612x8scyLnTJgd; Fri, 15 Jan 2021 10:27:21 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.77.1610735240629096315 for ; Fri, 15 Jan 2021 10:27:20 -0800 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 5A9FA11B3; Fri, 15 Jan 2021 10:27:20 -0800 (PST) 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 2C0D93F719; Fri, 15 Jan 2021 10:27:18 -0800 (PST) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm Subject: [edk2-devel] [edk2-platforms][PATCH V1 10/11] Platform/ARM/SgiPkg: Add SMBIOS Type19 Table Date: Fri, 15 Jan 2021 23:56:47 +0530 Message-Id: <20210115182648.20938-11-pranav.madhu@arm.com> In-Reply-To: <20210115182648.20938-1-pranav.madhu@arm.com> References: <20210115182648.20938-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pranav.madhu@arm.com X-Gm-Message-State: KgOTsVHfdWMtGcgXR21QJcjix1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610735241; bh=k8P0Vg2JnDGlDMiRzyK1LLrat7gFQe6qentQ2xxzUSQ=; h=Cc:Date:From:Reply-To:Subject:To; b=Opf/6Kvi8LW2copWJ7kiOSSvduQlc0RpdIDhDnX2X0MvbkERWtVZ1dGjmJKbC7oDQaF F9y+q/DLWiaKLHXT2nUGWpPOtt42ifgYbpn3oRbyI1e58oeU+pP4zTQL0wUYra2pnhO1V cTaqPeD4bZpyHoLeGUn3Kp9g+8qvv1sj5Ko= 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: Thomas Abraham --- 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 | 73 ++++++++++++++++++++ 4 files changed, 81 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index 7f16aef64c8e..15db3d05b6b6 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -32,6 +32,7 @@ Type7CacheInformation.c Type16PhysicalMemoryArray.c Type17MemoryDevice.c + Type19MemoryArrayMappedAddress.c =20 [Packages] ArmPkg/ArmPkg.dec diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.h b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h index c56429541504..1cd66b759446 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -51,6 +51,12 @@ InstallMemoryDevice ( IN EFI_SMBIOS_PROTOCOL *Smbios ); =20 +EFI_STATUS +EFIAPI +InstallMemoryArrayMappedAddress ( + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + enum SMBIOS_REFRENCE_HANDLES { SMBIOS_HANDLE_ENCLOSURE =3D 0x1000, SMBIOS_HANDLE_CLUSTER1, diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c index 464fb62d06fa..847260b24750 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.c @@ -28,6 +28,7 @@ ARM_RD_SMBIOS_TABLE_INSTALL_FPTR mSmbiosTableList[] =3D { &InstallCacheInformation, &InstallPhysicalMemoryArray, &InstallMemoryDevice, + &InstallMemoryArrayMappedAddress, }; =20 /** diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type19MemoryArra= yMappedAddress.c b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type19Memo= ryArrayMappedAddress.c new file mode 100644 index 000000000000..b34fdf754900 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type19MemoryArrayMapped= Address.c @@ -0,0 +1,73 @@ +/** @file + SMBIOS Type 19 (Memory Array Mapped Address) table for ARM RD platforms. + + Copyright (c) 2020-2021, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include + +#include "SmbiosPlatformDxe.h" + +#define TYPE19_STRINGS \ + "\0" /* Null string */ + +/* SMBIOS Type19 structure */ +#pragma pack(1) +struct ArmRdSmbiosType19 { + SMBIOS_TABLE_TYPE19 Base; + UINT8 Strings[sizeof (TYPE19_STRINGS)]; +}; +#pragma pack() + +/* Memory Array Mapped Address (SMBIOS 3.4 spec, section 7.20 */ +static struct ArmRdSmbiosType19 mArmRdSmbiosType19 =3D { + { + { + // SMBIOS header + EFI_SMBIOS_TYPE_MEMORY_ARRAY_MAPPED_ADDRESS, // Type 19 + sizeof (SMBIOS_TABLE_TYPE19), // Length + SMBIOS_HANDLE_PI_RESERVED, // Assign an unused handle 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 Bios information Table + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed in is already in 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; + + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType19 + ); + 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 (#70447): https://edk2.groups.io/g/devel/message/70447 Mute This Topic: https://groups.io/mt/79709199/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 Wed May 1 03:39:17 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+70448+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+70448+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1610735249; cv=none; d=zohomail.com; s=zohoarc; b=YZSywUKVtc9cQx53t4ivpdoz+LQNCm6PDvdNlmafkitiDUcjAEANruk9FKdZkv1BkCoOeQTh/MvfrD5McjXB9G8oLFHkyzLqYj8zi3tWbufCkjkCstMZ/oOhi6FZK/CET7nNYdlNaX/jIiEdO49n3fYRyM4juSfckvrHeE+kGas= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610735249; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=92xZV9+w42sQhSJp/zx1Ul4GZVxyaby6xSfRfYnIyag=; b=LBcHaJQ8KPzFX1CdOsH0JLlMywRzth62+Oe4iEkRYPl2rwMcDGHHm5O8l43eiuycolh9OqlybB4H4Yaex2+iHoZ5qpzhFvKu8PSRtMYjQvgDnvLN/p0mVl9Wxis/5RSUVBWLTDnM0RkgsPMBfneRZNEQdcfcy1mCw8NZK7SN3jw= 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+70448+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 1610735249259691.2739162221231; Fri, 15 Jan 2021 10:27:29 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 2fiVYY1788612xQ6fFLGlzyd; Fri, 15 Jan 2021 10:27:27 -0800 X-Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.78.1610735242267109991 for ; Fri, 15 Jan 2021 10:27:22 -0800 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 04C95ED1; Fri, 15 Jan 2021 10:27:22 -0800 (PST) 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 CA9CD3F719; Fri, 15 Jan 2021 10:27:20 -0800 (PST) From: "Pranav Madhu" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Leif Lindholm Subject: [edk2-devel] [edk2-platforms][PATCH V1 11/11] Platform/ARM/SgiPkg: Add SMBIOS Type32 Table Date: Fri, 15 Jan 2021 23:56:48 +0530 Message-Id: <20210115182648.20938-12-pranav.madhu@arm.com> In-Reply-To: <20210115182648.20938-1-pranav.madhu@arm.com> References: <20210115182648.20938-1-pranav.madhu@arm.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,pranav.madhu@arm.com X-Gm-Message-State: WAGP0UJBhbAJ2NKXTI1WV9Ctx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610735247; bh=gQyhtbqU+HA4Ms5hmE0DftayY599OpjI3arnnlMt+S0=; h=Cc:Date:From:Reply-To:Subject:To; b=G7mPPEarF0iKsZctCcd1yKRbFws6SI5/tiu4OGdYX2gSX1yDY/vdpAjMX7++CQgS+QA 2EFWwrlM33rpKoaUSFL1kJGsong3EVLXq0sJjm3Rd/fhNTohVHq4rse17nVQB2Zdotg6n OxEe0TzjkNE/wczD1boHV+sAUYGG2f5w1Rk= 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: Thomas Abraham --- 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 | 66 ++++++++++++++++++++ 4 files changed, 74 insertions(+) diff --git a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDx= e.inf b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf index 15db3d05b6b6..bb4cbbaf9ddd 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.inf @@ -33,6 +33,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 1cd66b759446..924b4f77f5f5 100644 --- a/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/SmbiosPlatformDxe.h @@ -57,6 +57,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 847260b24750..3b56edc13ef2 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 { &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..4fec8a833141 --- /dev/null +++ b/Platform/ARM/SgiPkg/Drivers/SmbiosPlatformDxe/Type32SystemBootInforma= tion.c @@ -0,0 +1,66 @@ +/** @file + SMBIOS Type 32 (System Boot Information) table for ARM RD platforms. + + Copyright (c) 2020-2021, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#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 (SMBIOS 3.4 spec, section 7.33) */ +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 Bios information Table + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed in is already in 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; + + Status =3D Smbios->Add ( + Smbios, + NULL, + &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)&mArmRdSmbiosType32 + ); + 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 (#70448): https://edk2.groups.io/g/devel/message/70448 Mute This Topic: https://groups.io/mt/79709200/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-