From nobody Mon Nov 25 10:42:56 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+70296+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+70296+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642196; cv=none; d=zohomail.com; s=zohoarc; b=F3UqX7/RwD2xbGEZ5AJHBQMvjqE9q91TDlmVZGbzxJspG9mqSiIN5AhXuz16R/JUvdvPezb7D2sQFPf1GIM7knAVWABGfFuWR5fRFvZEOdnol7Wokhqwvv1HIxorsELTv/I4+oF6tKqF+zCBul8BapMipElD65YJUQTuD9IsAzc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642196; 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=eaAqWkHdOal05SPZCVw3puxSaCfam3oT0eI8U5l5j0A=; b=J7TYt/efzhvCsnc/qvC7IaL8GQVAVIsEl4KaNEuOIKcfd28E8rhKZtg9zhKjqcoKO16MQjMyels/7yaBjO1YQw6XiBvPsEdz+6UjVOM7Zq2cMC5A2Pms809EqjjvCdHTlPSi154UqCanph9K4Iy4MANJGsDNU9IujyNQslBwTb0= 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+70296+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642196717558.4642380186692; Thu, 14 Jan 2021 08:36:36 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id v7nvYY1788612xwob4m6a1Xi; Thu, 14 Jan 2021 08:36:36 -0800 X-Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) by mx.groups.io with SMTP id smtpd.web11.4144.1610642195739078564 for ; Thu, 14 Jan 2021 08:36:35 -0800 X-Received: by mail-io1-f41.google.com with SMTP id y19so12416903iov.2 for ; Thu, 14 Jan 2021 08:36:35 -0800 (PST) X-Gm-Message-State: nqmYckJYOALQITg2BiCuXa7cx1787277AA= X-Google-Smtp-Source: ABdhPJwRVOmTwDOX0Mxan+5x4eaoGrZKFDmGRmZS+3s/mVJ//HEHT/oANixLtcjCEgLRPkPZUPH1tw== X-Received: by 2002:a5e:d717:: with SMTP id v23mr5833146iom.60.1610642194934; Thu, 14 Jan 2021 08:36:34 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:34 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Bob Feng , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu , Yuwei Chen Subject: [edk2-devel] [PATCH v6 01/22] BaseTools: Fix the build report crash issue Date: Thu, 14 Jan 2021 09:36:07 -0700 Message-Id: <20210114163628.31952-2-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642196; bh=0w18qtTcvFBCmju6h6/DfLd1ubxY7T6wpxoGfRBrrbo=; h=Cc:Date:From:Reply-To:Subject:To; b=un2MFG3ICsHsoW/nba1fpxNhZk+L/0fFbhRlCKi1CoQJPUP493I2l+0nbBp0SInrR6B YkJLePGOmSz5gvleGZy4DtUzy6ibUtg5jGBEORl7KuiyvW4TDAKBDV0ysIm3FtwDUipWU azNJ4ZzxZ/YlAdJCTj0zQdKmyAdIEWKdkAY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" From: Bob Feng In the following corner case, the build report will crash. This patch is to fix this problem. Case: Multiple SKU are used and 2 more DynamicHii structure Pcds are set in dsc file under different SKU. And 1 more of those Pcds are not used in any INF file. Signed-off-by: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Reviewed-by: Liming Gao Reviewed-by: Yuwei Chen --- BaseTools/Source/Python/build/BuildReport.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Sourc= e/Python/build/BuildReport.py index 3b1add9999d2..468772930ca1 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -1125,10 +1125,11 @@ class PcdReport(object): if SkuInfo.DefaultStoreDict: DefaultStoreList =3D sorte= d(SkuInfo.DefaultStoreDict.keys()) for DefaultStore in Defaul= tStoreList: - OverrideValues =3D Pcd= .SkuOverrideValues[Sku] - DscOverride =3D self.P= arseStruct(OverrideValues[DefaultStore]) - if DscOverride: - break + OverrideValues =3D Pcd= .SkuOverrideValues.get(Sku) + if OverrideValues: + DscOverride =3D se= lf.ParseStruct(OverrideValues[DefaultStore]) + if DscOverride: + break if DscOverride: break if DscOverride: @@ -1388,9 +1389,10 @@ class PcdReport(object): FileWrite(File, ' %-*s : %6s %10= s %10s %10s =3D %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')= ', '(' + SkuIdName + ')', '(' + DefaultStore + ')', Value)) FileWrite(File, '%*s: %s: %s' % (self.MaxLen += 4, SkuInfo.VariableGuid, SkuInfo.VariableName, SkuInfo.VariableOffset)) if IsStructure: - OverrideValues =3D Pcd.SkuOverrideValues[S= ku] - OverrideFieldStruct =3D self.OverrideField= Value(Pcd, OverrideValues[DefaultStore]) - self.PrintStructureInfo(File, OverrideFiel= dStruct) + OverrideValues =3D Pcd.SkuOverrideValues.g= et(Sku) + if OverrideValues: + OverrideFieldStruct =3D self.OverrideF= ieldValue(Pcd, OverrideValues[DefaultStore]) + self.PrintStructureInfo(File, Override= FieldStruct) self.PrintPcdDefault(File, Pcd, IsStructure, D= scMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultVa= lue) else: Value =3D SkuInfo.DefaultValue --=20 2.26.2 -=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 (#70296): https://edk2.groups.io/g/devel/message/70296 Mute This Topic: https://groups.io/mt/79679234/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 Mon Nov 25 10:42:56 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+70297+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+70297+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642198; cv=none; d=zohomail.com; s=zohoarc; b=ArJznWcvVPZegqUjiIEVNHdD0cQHdmcmgLYobUsIplW77Bm8LDj5bYBWlGpzP+L3Ud+IZZ4KmfQej/pUgyLip42LBbmSceExcmeh+S4XfST825CpfLCxhACzp8VjgcQtQpfya3GpY84p+8sqm+5rf1DYpSZebtXG5L/4NyEi+38= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642198; 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=s1M+k6903FqpVETQNpIWaKXrJiJaURVzftKaOYVNjHU=; b=jYjxB4arNaTTqGGX7AfZZ3IONyX2TLSNYQHyBINkFETPyRzZoL3eeCFyVG9pOhbfXZIckIXDRMNsg5snWPfUN6+Ufgb+nIXelMY3X4pAzLwqZdmX3xDUdZYSJu9rKN6dWnCtcd6gSkdBPoNGRaYkm7HY/d1fSVdRqmofm72GyUQ= 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+70297+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642198240881.0148985204931; Thu, 14 Jan 2021 08:36:38 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id mKpBYY1788612xAVsOZSLjYT; Thu, 14 Jan 2021 08:36:37 -0800 X-Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) by mx.groups.io with SMTP id smtpd.web08.4273.1610642197267482731 for ; Thu, 14 Jan 2021 08:36:37 -0800 X-Received: by mail-io1-f49.google.com with SMTP id y19so12417057iov.2 for ; Thu, 14 Jan 2021 08:36:37 -0800 (PST) X-Gm-Message-State: RcRS36kI8qcZfFtk1N4ws7zax1787277AA= X-Google-Smtp-Source: ABdhPJzle77Sr/qmH8dlfvpIxe9960Yza4H6qHlib/ud+gzSpcXkA8Xuvcu9RwQzbpJALVqyolB0FA== X-Received: by 2002:a6b:dd0a:: with SMTP id f10mr5800653ioc.6.1610642196344; Thu, 14 Jan 2021 08:36:36 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:35 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu , Sami Mujawar Subject: [edk2-devel] [PATCH v6 02/22] ArmPkg: Add ARM SMC Architecture functions to ArmStdSmc.h Date: Thu, 14 Jan 2021 09:36:08 -0700 Message-Id: <20210114163628.31952-3-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642197; bh=72ohzOFabgzmlwFKy+J/JNH3+LipvO9rp6XQWNh33DY=; h=Cc:Date:From:Reply-To:Subject:To; b=jIor/v/C8jxcyJ9s7Ce+zbVskskUrVKaUXUVKOJ/ff0cih3ZEXqY596F9Bw+IOxPV1w Ba2cJocl1OIBIuyCwK8XFqetACl8M3ys2b62t/65s07SOE9Y+eYJP3yQw6JmV7kryxeg0 4qLs+emVU5elOWOT34ESMLaWKMR0CT+bwYk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The ARM SMC Architecture functions were missing from ArmStdSmc.h. Add them, based on the SMC Calling Convention version 1.2 specification. Signed-off-by: Rebecca Cran Reviewed-by: Leif Lindholm Reviewed-by: Sami Mujawar Reviewed-by: Samer El-Haj-Mahmoud --- ArmPkg/Include/IndustryStandard/ArmStdSmc.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h b/ArmPkg/Include/I= ndustryStandard/ArmStdSmc.h index 3509eb680f18..9e0a3a3960d5 100644 --- a/ArmPkg/Include/IndustryStandard/ArmStdSmc.h +++ b/ArmPkg/Include/IndustryStandard/ArmStdSmc.h @@ -1,9 +1,13 @@ /** @file * +* Copyright (c) 2020, NUVIA Inc. All rights reserved.
* Copyright (c) 2012-2017, ARM Limited. All rights reserved. * * SPDX-License-Identifier: BSD-2-Clause-Patent * +* @par Revision Reference: +* - SMC Calling Convention version 1.2 +* (https://developer.arm.com/documentation/den0028/c/?lang=3Den) **/ =20 #ifndef __ARM_STD_SMC_H__ @@ -52,6 +56,18 @@ #define ARM_SMC_MM_RET_DENIED -3 #define ARM_SMC_MM_RET_NO_MEMORY -4 =20 +// ARM Architecture Calls +#define SMCCC_VERSION 0x80000000 +#define SMCCC_ARCH_FEATURES 0x80000001 +#define SMCCC_ARCH_SOC_ID 0x80000002 +#define SMCCC_ARCH_WORKAROUND_1 0x80008000 +#define SMCCC_ARCH_WORKAROUND_2 0x80007FFF + +#define SMC_ARCH_CALL_SUCCESS 0 +#define SMC_ARCH_CALL_NOT_SUPPORTED -1 +#define SMC_ARCH_CALL_NOT_REQUIRED -2 +#define SMC_ARCH_CALL_INVALID_PARAMETER -3 + /* * Power State Coordination Interface (PSCI) calls cover a subset of the * Standard Service Call range. --=20 2.26.2 -=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 (#70297): https://edk2.groups.io/g/devel/message/70297 Mute This Topic: https://groups.io/mt/79679237/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 Mon Nov 25 10:42:56 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+70298+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+70298+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642204; cv=none; d=zohomail.com; s=zohoarc; b=BvEv0umGWkjK2V3K/k3h93Iu+AdTvfQsAL1Gn/bXd4Ujuwo0x1tdDtpdh5GQzWfRjxcxI5wjKf1VgyIKOsU73fy25QNOX5CttuYY66ZA7yUA62an2ZefClPdkWlbbwQoy0OBLA3UQIJQInP5AlxBcXMHj4lvcY+isNs7BLbAgmo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642204; 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=/O8K8FZYNjykbLwoGe/Rq+jzem6PIwdp9Rf64N6pIVM=; b=Lkc9Z8IQzA1LMIM7WMB56JrESfJUsi0Cg7hFDIn6RqA9Ik9QF3PDQMeQ2cGTyX+jTYXgo/U1I6rdCBeyMQTWxQsaSCYyp3qqF+nEsYy7iifCMvWBZujcvV/X7ZhLXxq2IiIDO9Z9PECI/aSAcTql0xIZcDtFRzYC7m2pJY/96NU= 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+70298+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642204913727.7298857954979; Thu, 14 Jan 2021 08:36:44 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 6sWiYY1788612x0nvdq8nbGQ; Thu, 14 Jan 2021 08:36:44 -0800 X-Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) by mx.groups.io with SMTP id smtpd.web10.4041.1610642198606479117 for ; Thu, 14 Jan 2021 08:36:38 -0800 X-Received: by mail-io1-f43.google.com with SMTP id o6so12315870iob.10 for ; Thu, 14 Jan 2021 08:36:38 -0800 (PST) X-Gm-Message-State: zllFf9joZC1E13t2BzDKDx7qx1787277AA= X-Google-Smtp-Source: ABdhPJxso7z3zRmk7kkAeWf87dfEjofcA7ZFzJznFa+ddRCeHIOV9B2oPT5qKi/hOEMmf5vBUIlwQA== X-Received: by 2002:a5d:824b:: with SMTP id n11mr5705191ioo.27.1610642197811; Thu, 14 Jan 2021 08:36:37 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:37 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu , Sami Mujawar Subject: [edk2-devel] [PATCH v6 03/22] MdePkg: Update IndustryStandard/SmBios.h with processor status data Date: Thu, 14 Jan 2021 09:36:09 -0700 Message-Id: <20210114163628.31952-4-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642204; bh=Cg+9pe3Q5Z5W8r7ElVSHNKM7rafiofpjrz7CYA8CPXY=; h=Cc:Date:From:Reply-To:Subject:To; b=ul22Yy0oglKt3S9T3jBTVufLMcN0rkZ9mqc9B8M5iphOwxUNQLcvRGui0ST7IZ/tqvb rn+myRPEYyCokS8mpvJ3TujzHafgGPuQANjHhOaRAK3092XuSPRhBOx81YIwCNStCpvI4 rGFA90Vm9geA5CUjwFc/le3m4wTcm7yVXQM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add a bitfield that describes the structure of the byte in the Status field of the SMBIOS Type 4 Processor Information table. Signed-off-by: Rebecca Cran Reviewed-by: Leif Lindholm Acked-by: Sami Mujawar Acked-by: Samer El-Haj-Mahmoud Reviewed-by: Liming Gao --- MdePkg/Include/IndustryStandard/SmBios.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/MdePkg/Include/IndustryStandard/SmBios.h b/MdePkg/Include/Indu= stryStandard/SmBios.h index 3bc8732eef99..cc023b73692a 100644 --- a/MdePkg/Include/IndustryStandard/SmBios.h +++ b/MdePkg/Include/IndustryStandard/SmBios.h @@ -875,6 +875,19 @@ typedef struct { UINT16 ProcessorReserved2 :6; } PROCESSOR_CHARACTERISTIC_FLAGS; =20 +/// +/// Processor Information - Status +/// +typedef union { + struct { + UINT8 CpuStatus :3; ///< Indicates the status of the processor. + UINT8 Reserved1 :3; ///< Reserved for future use. Must be set to= zero. + UINT8 SocketPopulated :1; ///< Indicates if the processor socket is po= pulated or not. + UINT8 Reserved2 :1; ///< Reserved for future use. Must be set to= zero. + } Bits; + UINT8 Data; +} PROCESSOR_STATUS_DATA; + typedef struct { PROCESSOR_SIGNATURE Signature; PROCESSOR_FEATURE_FLAGS FeatureFlags; --=20 2.26.2 -=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 (#70298): https://edk2.groups.io/g/devel/message/70298 Mute This Topic: https://groups.io/mt/79679238/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 Mon Nov 25 10:42:56 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+70299+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+70299+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642201; cv=none; d=zohomail.com; s=zohoarc; b=mv9cBaWs8q7zU4+fkXzNSbtmn69X7BOJUbKfm01y4vDQ3FmqQdBxUDTrQzhyEVbHDkBtnGm4ckzrwO1bfv2J5ae6obIutz79PNNaLxxl1JDh+4lwQC4ttU5v8x92NAa+Tz/zxCuH3zLS+LgDcp3U2UMz3vdO3mPs2WXEqeIz+lA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642201; 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=FJsSNeqVYYxsGIihwPUQZIv61BStvn5FhLO+O+1vuv4=; b=QstE60qWIbyoajAAHHvIj300/ModGzn0emuTqBfA4waE6WugYZ3iZemsMcRPceJwc/RNOrCPUo18kVTTpsA+g2om7OD/ILtdM/k2FgbMQjHMMbqIaGYej5DXfefojLk0CwLd0d4Cewmjy3ncItY+8RrS/OxB1HcNfLYhLvL8xOw= 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+70299+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642201286946.3765733923691; Thu, 14 Jan 2021 08:36:41 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id UgFoYY1788612x9OpgTWl27P; Thu, 14 Jan 2021 08:36:40 -0800 X-Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) by mx.groups.io with SMTP id smtpd.web09.4092.1610642200405137485 for ; Thu, 14 Jan 2021 08:36:40 -0800 X-Received: by mail-io1-f45.google.com with SMTP id z5so12310770iob.11 for ; Thu, 14 Jan 2021 08:36:40 -0800 (PST) X-Gm-Message-State: R6657F981wuwpoklAZAnVSO3x1787277AA= X-Google-Smtp-Source: ABdhPJzsXQxsMS91jABErXNpL2fKmbOcw6THFnome6FRtZQkdfE1Ipx1DZAb4dal6wgGwK5Jrdd7rA== X-Received: by 2002:a6b:fe19:: with SMTP id x25mr5771038ioh.78.1610642199544; Thu, 14 Jan 2021 08:36:39 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:39 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu , Sami Mujawar Subject: [edk2-devel] [PATCH v6 04/22] ArmPkg: Add register encoding definition for MMFR2 Date: Thu, 14 Jan 2021 09:36:10 -0700 Message-Id: <20210114163628.31952-5-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642200; bh=iDS7/9cS8uOTDPcb02Gs7Du2xDBRyhUCKMRklYyfgdo=; h=Cc:Date:From:Reply-To:Subject:To; b=qtuOiHfi+6gwmwlTMcB3/B2N9h7ogWEhaRxM9XI2cVP2YDmuHE014f2v2SjQsu/o7eU jln7NCsYVHHP2fLFXkiNQknr1oUD4BLLgB9hwjvVBfFgNkTAAmKDzoV1sNLo56y7DsdJb DX5HqjYjq0CaV0WVRDCRZJN9f9izuYVcn/0= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add register encoding definition for Memory Model Feature Register 2. We need to define it here because we build for ARMv8.0, which doesn't have it. Signed-off-by: Rebecca Cran Reviewed-by: Leif Lindholm Reviewed-by: Sami Mujawar --- ArmPkg/Include/Chipset/AArch64.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ArmPkg/Include/Chipset/AArch64.h b/ArmPkg/Include/Chipset/AArc= h64.h index 0ade5cce91c3..7c2b592f92ee 100644 --- a/ArmPkg/Include/Chipset/AArch64.h +++ b/ArmPkg/Include/Chipset/AArch64.h @@ -112,6 +112,10 @@ #define ARM_VECTOR_LOW_A32_FIQ 0x700 #define ARM_VECTOR_LOW_A32_SERR 0x780 =20 +// The ID_AA64MMFR2_EL1 register was added in ARMv8.2. Since we +// build for ARMv8.0, we need to define the register here. +#define ID_AA64MMFR2_EL1 S3_0_C0_C7_2 + #define VECTOR_BASE(tbl) \ .section .text.##tbl##,"ax"; \ .align 11; \ --=20 2.26.2 -=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 (#70299): https://edk2.groups.io/g/devel/message/70299 Mute This Topic: https://groups.io/mt/79679240/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 Mon Nov 25 10:42:56 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+70300+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+70300+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642208; cv=none; d=zohomail.com; s=zohoarc; b=J2fmiXnTA/IWQ0rwedva/J3GgwZV5Q/kf/z6hL4ArXCej9vMb60st1DIoYioJK1+4Rf9KA09P2kctYUcATDN64NHc7lp0manwbzI4YVY9HkHrdKfN9vIPR9QlejC5leCSdPe6Yq9B/eKstz2fKIlcCwKJJ6PoWmmOzbv7EigIJ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642208; 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=/gcp7uN5wgz5pQiSsasgBV0jIw4k5swbQDIQeWqh7LA=; b=Z5/AafpaTWDzuwf/SFtHCy+Hlyids3sW8Bvig89ayqQNjivCwzCx07K9LvNLYcwhz7fZ0wBdjlhTuKa0QBr2pWYsmkq63iIRqk+kxqDFO99Ino88S6jAw5b5VhGdt9SZzlOtPFqGB7t2G0sGgLomtf2rN9Vfbgo6mdycub3Tqk0= 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+70300+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642208580130.8778327764694; Thu, 14 Jan 2021 08:36:48 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 7WAdYY1788612x1pp6XL91qc; Thu, 14 Jan 2021 08:36:47 -0800 X-Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) by mx.groups.io with SMTP id smtpd.web09.4093.1610642201872365330 for ; Thu, 14 Jan 2021 08:36:41 -0800 X-Received: by mail-io1-f50.google.com with SMTP id d9so12367802iob.6 for ; Thu, 14 Jan 2021 08:36:41 -0800 (PST) X-Gm-Message-State: n2OeN4wfXwfnVlDF5kmuk7gQx1787277AA= X-Google-Smtp-Source: ABdhPJwPrcKE5lbbthMKrsO/WkHKG+wwhkjuqdn0jpovSGN4CDpasLtbwwMvB+ERUskuPzhr8m/JAg== X-Received: by 2002:a6b:7d42:: with SMTP id d2mr5728199ioq.176.1610642200990; Thu, 14 Jan 2021 08:36:40 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:40 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu , Sami Mujawar Subject: [edk2-devel] [PATCH v6 05/22] ArmPkg: Add helper to read the Memory Model Features Register 2 Date: Thu, 14 Jan 2021 09:36:11 -0700 Message-Id: <20210114163628.31952-6-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642207; bh=EI10WW5bU8jxLxC+3g8h6N0nfm0CywsmkdPmsHzD9z8=; h=Cc:Date:From:Reply-To:Subject:To; b=IM/thpVrDkMlGqIyyJIVeOYlWM+IgioDUQlPEVqakUDWHA+Ew+SGoJg9p1DuBXBFC0k 7Aa+Jul5Bx89BEMXL8+F10PULEPDJwpCXW8MQqSXlMi1WOw3bFjpR4U6QhgE9a6H6DQln iLqrg9UrQJgjOT9pTy53LwlJQamrlwOjArA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add helper function to read the MMFR2 register. We will need this to determine CCIDX support. Signed-off-by: Rebecca Cran Reviewed-by: Leif Lindholm Reviewed-by: Sami Mujawar Reviewed-by: Philippe Mathieu-Daude --- ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h | 11 +++++++++++ ArmPkg/Library/ArmLib/AArch64/AArch64Support.S | 3 +++ 2 files changed, 14 insertions(+) diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h b/ArmPkg/Library/Ar= mLib/AArch64/AArch64Lib.h index 85bcecda730f..cfc0c878a415 100644 --- a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h +++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.h @@ -41,5 +41,16 @@ EFIAPI ArmReadIdAA64Pfr0 ( VOID ); + +/** Reads the ID_AA64MMFR2_EL1 register. + + @return The contents of the ID_AA64MMFR2_EL1 register. +**/ +UINTN +EFIAPI +ArmReadIdAA64Mmfr2 ( + VOID + ); + #endif // __AARCH64_LIB_H__ =20 diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S b/ArmPkg/Librar= y/ArmLib/AArch64/AArch64Support.S index 129205d2ac27..d3cc1e86716b 100644 --- a/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S +++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Support.S @@ -425,6 +425,9 @@ ASM_FUNC(ArmCallWFI) wfi ret =20 +ASM_FUNC(ArmReadIdAA64Mmfr2) + mrs x0, ID_AA64MMFR2_EL1 // read EL1 MMFR2 + ret =20 ASM_FUNC(ArmReadMpidr) mrs x0, mpidr_el1 // read EL1 MPIDR --=20 2.26.2 -=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 (#70300): https://edk2.groups.io/g/devel/message/70300 Mute This Topic: https://groups.io/mt/79679241/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 Mon Nov 25 10:42:56 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+70301+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+70301+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642209; cv=none; d=zohomail.com; s=zohoarc; b=ThUZUEv1mSJKNyllPOe6bjTbmM0ARRXf2K3pm3i1A5f+KqfdLSjrO5K1SyYXAVI4DJ1sGHwFuJHDwsa8xvWfVuhEMWiDXBlVtF07KWwuj46wXWtyNLsUm0EGqdCD+Obo8IvzOAEv20HvlxRCBjmZA4lTyiNWf/nMe3i0bHw4Udo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642209; 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=dlWnhBfG3gxGyOXRX4v+pzKnH9QyjeXIdkJvNwZt85g=; b=J42MZW2J7Rr1XR9Ccd7MigE/ea7nx0NU2w4JajI+Htse21VgaURrmfXj+9GtQxrFoz0ZG5gUffmbtrxpksEp0+7rBUvl+QW5BiGEMLNAuBpw+bcbotYfX2BLmTKvm9LJizKjZ9UJoC08C9xpdjFV+arAaNpe3HVtczNJxkMZGt0= 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+70301+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642209114490.24025644709593; Thu, 14 Jan 2021 08:36:49 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id LrQgYY1788612xWxW0GbaO6G; Thu, 14 Jan 2021 08:36:48 -0800 X-Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) by mx.groups.io with SMTP id smtpd.web12.4172.1610642203292489994 for ; Thu, 14 Jan 2021 08:36:43 -0800 X-Received: by mail-io1-f51.google.com with SMTP id e22so12357744iom.5 for ; Thu, 14 Jan 2021 08:36:43 -0800 (PST) X-Gm-Message-State: pm9aLZqIxyG6fwHvKOwee5z8x1787277AA= X-Google-Smtp-Source: ABdhPJx59FjwIGlOWvsVRCI8OZho7d6RQrccFh0I9lW6hewaZlmBxuIkNJCZhi10EdZfwgHQMQ0QxQ== X-Received: by 2002:a6b:dc17:: with SMTP id s23mr1166723ioc.170.1610642202439; Thu, 14 Jan 2021 08:36:42 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:41 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu , Sami Mujawar Subject: [edk2-devel] [PATCH v6 06/22] ArmPkg: Add helper function to read the Memory Model Feature Register 4 Date: Thu, 14 Jan 2021 09:36:12 -0700 Message-Id: <20210114163628.31952-7-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642208; bh=hr+kcr1PPIS9hwa7SR+Tl7h88plII1EigwqlVT6ENuE=; h=Cc:Date:From:Reply-To:Subject:To; b=LgUyYbDm4ojGf6l1fvkrtJ9gTNTQMLbma3LDT8c1wr4rJwgSA2mbe3mdws5ZsoOSkKc xFWawzvax8Ig6vS4gDTcanYE78KUpnwygCweHh5EbCCmIioG8IxruJR/cLup6Ctg9VDrb rftGa+gs9J4osHWGqOF0SvSSEuegeeyfL6s= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" In AARCH32, CCIDX support is indicated in the MMFR4 register - unlike under AARCH64 where it's in MMFR2. Add a helper function to read it. Signed-off-by: Rebecca Cran Reviewed-by: Sami Mujawar Reviewed-by: Leif Lindholm --- ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h | 8 ++++++-- ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S | 4 ++++ ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm | 4 ++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h b/ArmPkg/Library/ArmLib/A= rm/ArmV7Lib.h index bb7bda0a3aeb..dcf6723b803b 100644 --- a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h +++ b/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.h @@ -48,9 +48,13 @@ ArmCleanInvalidateDataCacheEntryBySetWay ( IN UINTN SetWayFormat ); =20 -UINTN +/** Reads the ID_MMFR4 register. + + @return The contents of the ID_MMFR4 register. +**/ +UINT32 EFIAPI -ArmReadIdPfr0 ( +ArmReadIdMmfr4 ( VOID ); =20 diff --git a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S b/ArmPkg/Library/A= rmLib/Arm/ArmLibSupportV7.S index 01c91b10fcb7..a60a2f634132 100644 --- a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S +++ b/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S @@ -60,6 +60,10 @@ ASM_FUNC(ArmDisableInterrupts) isb bx LR =20 +ASM_FUNC(ArmReadIdMmfr4) + mrc p15,0,r0,c0,c2,6 @ Read ID_MMFR4 Register + bx lr + // UINT32 // ReadCCSIDR ( // IN UINT32 CSSELR diff --git a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm b/ArmPkg/Library= /ArmLib/Arm/ArmLibSupportV7.asm index 26ffa331b929..1679b09b797a 100644 --- a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm +++ b/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm @@ -64,6 +64,10 @@ isb bx LR =20 + RVCT_ASM_EXPORT ArmReadIdMmfr4 + mrc p15,0,r0,c0,c2,6 ; Read ID_MMFR4 Register + bx LR + // UINT32 // ReadCCSIDR ( // IN UINT32 CSSELR --=20 2.26.2 -=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 (#70301): https://edk2.groups.io/g/devel/message/70301 Mute This Topic: https://groups.io/mt/79679242/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 Mon Nov 25 10:42:56 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+70302+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+70302+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642210; cv=none; d=zohomail.com; s=zohoarc; b=Lbv/jXTijeNm2wCnsS7j3svJryeBeHAYNf97uYMrJjgSwqMqEk+aClYurN6lW8wW0C/+P8MTJ7Cga/C+Cg5GYo5b2jwEKQckVRs7p8dAHYhI1XyTYBh8KlcYg3HzIoORGiYaPBEEaMyeorJ/CQd0Sb+/hSXtTxPsZKgycoJPqhc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642210; 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=5XQmMrPbgZh8pa4U7RCzV6KR/LxhtCZIEMRtyS/myOo=; b=A19HOveTQkLHk7G1i8/f3Uv3WAIWRbZ9wHrIU9MDyfEh8ERHARB7V5pWRplPJJGuJVu4v8bXku+Nbtyz2CMqZJaOGb8b0Dxj/x4rTVsQSnZxg98oFRW8A3hOX908WMAyqeDxBvCjVx3oOGpbRc2qQJ1ZW/htaTctQh2FPCT/G6w= 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+70302+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642210610338.9720144245049; Thu, 14 Jan 2021 08:36:50 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id clArYY1788612xpGxQdNmI6t; Thu, 14 Jan 2021 08:36:50 -0800 X-Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) by mx.groups.io with SMTP id smtpd.web10.4046.1610642204701234235 for ; Thu, 14 Jan 2021 08:36:44 -0800 X-Received: by mail-io1-f41.google.com with SMTP id b19so9848572ioa.9 for ; Thu, 14 Jan 2021 08:36:44 -0800 (PST) X-Gm-Message-State: jTFJCw4xmYbS7jpJf9IDYZxIx1787277AA= X-Google-Smtp-Source: ABdhPJxDk3D5gJf4tauDsA542GhmKtBNSKPWOp48uA8qg7XOLlvUY9p0HSUsuR55QTzYYfNkZkdz6g== X-Received: by 2002:a92:cb44:: with SMTP id f4mr7210242ilq.131.1610642203897; Thu, 14 Jan 2021 08:36:43 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:43 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu , Sami Mujawar Subject: [edk2-devel] [PATCH v6 07/22] ArmPkg: Fix the return type of the ReadCCSIDR function Date: Thu, 14 Jan 2021 09:36:13 -0700 Message-Id: <20210114163628.31952-8-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642210; bh=+cH5ZHOWHufBLaR1xU52241mxPeFPTInbGTF/5H7Oy8=; h=Cc:Date:From:Reply-To:Subject:To; b=LxATvZf14IA12MS2K+L3fPEtVG6bJaqksRixvxapfDRWz75Jjot/KBMGp7NMlsuvziH 4PQw5hEURS4W/QAUr6i0+RLST30TNl7u/Vl/sucY6zTQ8NWizxTretk0aKeSfo6HNcM5V 2KSOnIfOSXxP8gFx1Jx08KdrII1+WG8ex6s= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" When CCIDX is supported, the Current Cache Size ID Register contains data above 32 bits: namely the number of sets. Avoid truncating this by returning a UINTN instead of UINT32. On AARCH32, the expanded number of sets data can be read via the CCSIDR2 register. Also, add Doxygen comments for the function. Signed-off-by: Rebecca Cran Reviewed-by: Sami Mujawar Reviewed-by: Leif Lindholm --- ArmPkg/Library/ArmLib/ArmLibPrivate.h | 9 ++++++++- ArmPkg/Library/ArmLib/AArch64/ArmLibSupportV8.S | 2 +- ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S | 2 +- ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ArmPkg/Library/ArmLib/ArmLibPrivate.h b/ArmPkg/Library/ArmLib/= ArmLibPrivate.h index 2e90739eb858..8959bdd9d73c 100644 --- a/ArmPkg/Library/ArmLib/ArmLibPrivate.h +++ b/ArmPkg/Library/ArmLib/ArmLibPrivate.h @@ -61,7 +61,14 @@ CPSRRead ( VOID ); =20 -UINT32 +/** Reads the CCSIDR register for the specified cache. + + @param CSSELR The CSSELR cache selection register value. + + @return The contents of the CCSIDR_EL1 register for the specified cache,= when in AARCH64 mode. + Returns the contents of the CCSIDR register in AARCH32 mode. +**/ +UINTN ReadCCSIDR ( IN UINT32 CSSELR ); diff --git a/ArmPkg/Library/ArmLib/AArch64/ArmLibSupportV8.S b/ArmPkg/Libra= ry/ArmLib/AArch64/ArmLibSupportV8.S index 0e8d21e2264f..0ae75e4cb9f9 100644 --- a/ArmPkg/Library/ArmLib/AArch64/ArmLibSupportV8.S +++ b/ArmPkg/Library/ArmLib/AArch64/ArmLibSupportV8.S @@ -84,7 +84,7 @@ ASM_FUNC(ArmDisableAllExceptions) ret =20 =20 -// UINT32 +// UINTN // ReadCCSIDR ( // IN UINT32 CSSELR // ) diff --git a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S b/ArmPkg/Library/A= rmLib/Arm/ArmLibSupportV7.S index a60a2f634132..af61dbee5261 100644 --- a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S +++ b/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S @@ -64,7 +64,7 @@ ASM_FUNC(ArmReadIdMmfr4) mrc p15,0,r0,c0,c2,6 @ Read ID_MMFR4 Register bx lr =20 -// UINT32 +// UINTN // ReadCCSIDR ( // IN UINT32 CSSELR // ) diff --git a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm b/ArmPkg/Library= /ArmLib/Arm/ArmLibSupportV7.asm index 1679b09b797a..81f3cb79994c 100644 --- a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm +++ b/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm @@ -68,7 +68,7 @@ mrc p15,0,r0,c0,c2,6 ; Read ID_MMFR4 Register bx LR =20 -// UINT32 +// UINTN // ReadCCSIDR ( // IN UINT32 CSSELR // ) --=20 2.26.2 -=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 (#70302): https://edk2.groups.io/g/devel/message/70302 Mute This Topic: https://groups.io/mt/79679243/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 Mon Nov 25 10:42:56 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+70303+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+70303+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642212; cv=none; d=zohomail.com; s=zohoarc; b=inCQVE0elgmOycXwaJJQxJnKparQc6rvJWxB45UBdTrsJDIp2OtBOHw7pC0sNCzg74sqWCBDMNqEJFfVaKDkQqdMr8cRKpW898+BgS2Mn47vHwNqdc+EVL7vju7fKx/iV/SNZBYw2dvtRnT83ZTLgQ42rJIV6TcZJVdwa7hvW5I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642212; 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=cdtmu6FCcMXem789lASVpZfcT6Tn5F861CVmFjMA3d8=; b=Ygdjr+KSqsKPecFZISBAggx4lECBCCnMt1chIBPRwwE2VbDa4aCJoryD8ECZcyJY7hllkyxZOHYXW2M2ZccEUHGST8fjWeKOGS21wL/QLMCoIeBe5a1V4wD9IaDccJODEzgvrkwPTBz12Kq0SakJReYp65EyGV2o5Ym9+g7dC58= 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+70303+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642212969489.1216595396528; Thu, 14 Jan 2021 08:36:52 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id E764YY1788612xyvagkGgj6F; Thu, 14 Jan 2021 08:36:52 -0800 X-Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) by mx.groups.io with SMTP id smtpd.web09.4095.1610642206514332856 for ; Thu, 14 Jan 2021 08:36:46 -0800 X-Received: by mail-io1-f52.google.com with SMTP id y19so12418026iov.2 for ; Thu, 14 Jan 2021 08:36:46 -0800 (PST) X-Gm-Message-State: JvufQG3MLTQhSKkD2n7JwfK9x1787277AA= X-Google-Smtp-Source: ABdhPJxEkIacTvdmelIvahxQ9PBhvL+xMnQ8QafeH/fJPhnzJ4hUZYHp8SMAotc2QxBP3svKua7Fzw== X-Received: by 2002:a05:6638:2686:: with SMTP id o6mr7137358jat.68.1610642205627; Thu, 14 Jan 2021 08:36:45 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:44 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu , Sami Mujawar Subject: [edk2-devel] [PATCH v6 08/22] ArmPkg: Update ArmLibPrivate.h with cache register definitions Date: Thu, 14 Jan 2021 09:36:14 -0700 Message-Id: <20210114163628.31952-9-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642212; bh=ymh4xDXy/2J4tR40uD2WaisQCpzqZ2DcBu2h46wGKSQ=; h=Cc:Date:From:Reply-To:Subject:To; b=pi3kTxaeNhPWNb64I1pe6awAXZQVgRL0DOkxISvYlgSoUwtpn2lxfPHlTTxe/tjc4i9 mA2/VzqaRVXFU1fRuCE2t/UGERFHyq5eJg50QeUy7L3ikTiSXJ57F83/k0l48yo0+649S J2b4knEp//jDXR7r+tckzzn7KUQxLOAhu/8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Update the cache definitions in ArmLibPrivate.h based on current ARMv8 documentation. Signed-off-by: Rebecca Cran Reviewed-by: Leif Lindholm Reviewed-by: Sami Mujawar --- ArmPkg/Library/ArmLib/ArmLibPrivate.h | 97 ++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/ArmPkg/Library/ArmLib/ArmLibPrivate.h b/ArmPkg/Library/ArmLib/= ArmLibPrivate.h index 8959bdd9d73c..77e592a99def 100644 --- a/ArmPkg/Library/ArmLib/ArmLibPrivate.h +++ b/ArmPkg/Library/ArmLib/ArmLibPrivate.h @@ -1,5 +1,7 @@ /** @file + ArmLibPrivate.h =20 + Copyright (c) 2020, NUVIA Inc. All rights reserved.
Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent @@ -50,6 +52,101 @@ #define CACHE_ARCHITECTURE_UNIFIED (0UL) #define CACHE_ARCHITECTURE_SEPARATE (1UL) =20 + +/// Defines the structure of the CSSELR (Cache Size Selection) register +typedef union { + struct { + UINT32 InD :1; ///< Instruction not Data bit + UINT32 Level :3; ///< Cache level (zero based) + UINT32 TnD :1; ///< Allocation not Data bit + UINT32 Reserved :27; ///< Reserved, RES0 + } Bits; ///< Bitfield definition of the register + UINT32 Data; ///< The entire 32-bit value +} CSSELR_DATA; + +/// The cache type values for the InD field of the CSSELR register +typedef enum +{ + /// Select the data or unified cache + CsselrCacheTypeDataOrUnified =3D 0, + /// Select the instruction cache + CsselrCacheTypeInstruction, + CsselrCacheTypeMax +} CSSELR_CACHE_TYPE; + +/// Defines the structure of the CCSIDR (Current Cache Size ID) register +typedef union { + struct { + UINT64 LineSize :3; ///< Line size (Log2(Num bytes in ca= che) - 4) + UINT64 Associativity :10; ///< Associativity - 1 + UINT64 NumSets :15; ///< Number of sets in the cache -1 + UINT64 Unknown :4; ///< Reserved, UNKNOWN + UINT64 Reserved :32; ///< Reserved, RES0 + } BitsNonCcidx; ///< Bitfield definition of the register when FEAT_CCIDX= is not supported. + struct { + UINT64 LineSize :3; ///< Line size (Log2(Num bytes in ca= che) - 4) + UINT64 Associativity :21; ///< Associativity - 1 + UINT64 Reserved1 :8; ///< Reserved, RES0 + UINT64 NumSets :24; ///< Number of sets in the cache -1 + UINT64 Reserved2 :8; ///< Reserved, RES0 + } BitsCcidxAA64; ///< Bitfield definition of the register when FEAT_IDX = is supported. + struct { + UINT64 LineSize : 3; + UINT64 Associativity : 21; + UINT64 Reserved : 8; + UINT64 Unallocated : 32; + } BitsCcidxAA32; + UINT64 Data; ///< The entire 64-bit value +} CCSIDR_DATA; + +/// Defines the structure of the AARCH32 CCSIDR2 register. +typedef union { + struct { + UINT32 NumSets :24; ///< Number of sets in the cache - 1 + UINT32 Reserved :8; ///< Reserved, RES0 + } Bits; ///< Bitfield definition of the register + UINT32 Data; ///< The entire 32-bit value +} CSSIDR2_DATA; + +/** Defines the structure of the CLIDR (Cache Level ID) register. + * + * The lower 32 bits are the same for both AARCH32 and AARCH64 + * so we can use the same structure for both. +**/ +typedef union { + struct { + UINT32 Ctype1 : 3; ///< Level 1 cache type + UINT32 Ctype2 : 3; ///< Level 2 cache type + UINT32 Ctype3 : 3; ///< Level 3 cache type + UINT32 Ctype4 : 3; ///< Level 4 cache type + UINT32 Ctype5 : 3; ///< Level 5 cache type + UINT32 Ctype6 : 3; ///< Level 6 cache type + UINT32 Ctype7 : 3; ///< Level 7 cache type + UINT32 LoUIS : 3; ///< Level of Unification Inner Shareable + UINT32 LoC : 3; ///< Level of Coherency + UINT32 LoUU : 3; ///< Level of Unification Uniprocessor + UINT32 Icb : 3; ///< Inner Cache Boundary + } Bits; ///< Bitfield definition of the register + UINT32 Data; ///< The entire 32-bit value +} CLIDR_DATA; + +/// The cache types reported in the CLIDR register. +typedef enum { + /// No cache is present + ClidrCacheTypeNone =3D 0, + /// There is only an instruction cache + ClidrCacheTypeInstructionOnly, + /// There is only a data cache + ClidrCacheTypeDataOnly, + /// There are separate data and instruction caches + ClidrCacheTypeSeparate, + /// There is a unified cache + ClidrCacheTypeUnified, + ClidrCacheTypeMax +} CLIDR_CACHE_TYPE; + +#define CLIDR_GET_CACHE_TYPE(x, level) ((x >> (3 * level)) & 0b111) + VOID CPSRMaskInsert ( IN UINT32 Mask, --=20 2.26.2 -=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 (#70303): https://edk2.groups.io/g/devel/message/70303 Mute This Topic: https://groups.io/mt/79679245/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 Mon Nov 25 10:42:56 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+70304+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+70304+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642214; cv=none; d=zohomail.com; s=zohoarc; b=byjwd5Gs+k1CD1EecWnuiSp8TFTnprVDMCeHZqNxo+Ht9oGvdUkM8nJQHTd61ZZQ6/icMw0497mX9IVpCo/D4Ey7+jxbXD2C6MNAJ6p+saVCmJkzXiUetjunZpmi3IhCok3Nrm7TO9HFkX0bIuNRgfymc6ftfq8+b80GdsOE8zo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642214; 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=QqMaIUFC5fzw6KLNSUNI9ADncbiA/AWFXy+M/dR6pBw=; b=fgSJa1XZ3GEWbzIZev2IR7PPlqgjFnuSHTMYu+oyxS4+bf99/4dkzTWt1D58rcePCqRT4L4DnBUpnZijg8jFCCxmVvZg22GTteKrKOBfHDw59r0e7fI05rndeowoB4j0t2uTsEev43RmmE/Ft4+T3cEj41/ehNa8Z8ZMCGk0TBY= 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+70304+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642214562164.44364351024547; Thu, 14 Jan 2021 08:36:54 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 6YGIYY1788612xqzXzGdsE9Y; Thu, 14 Jan 2021 08:36:53 -0800 X-Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) by mx.groups.io with SMTP id smtpd.web11.4156.1610642207856569334 for ; Thu, 14 Jan 2021 08:36:47 -0800 X-Received: by mail-io1-f43.google.com with SMTP id n4so12297913iow.12 for ; Thu, 14 Jan 2021 08:36:47 -0800 (PST) X-Gm-Message-State: LFM0t3AUJCQQ4dHP8e4kYEtqx1787277AA= X-Google-Smtp-Source: ABdhPJxiQpbk1CejPJoCGXGjDUYsRJmzfWy1/r9XaNYa2gMoxfA/cGpPh6Cm0H5609riy6C+2RTzpw== X-Received: by 2002:a02:5148:: with SMTP id s69mr7215039jaa.8.1610642207077; Thu, 14 Jan 2021 08:36:47 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:46 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu , Sami Mujawar Subject: [edk2-devel] [PATCH v6 09/22] ArmPkg: Add definition of the maximum cache level in ARMv8-A Date: Thu, 14 Jan 2021 09:36:15 -0700 Message-Id: <20210114163628.31952-10-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642213; bh=aXg0K3CLWYEll/9opWfX4zF3JcASVORt/QVOu8WtWHk=; h=Cc:Date:From:Reply-To:Subject:To; b=c/fjGk6KqbkYMKNhrkDTaC/jAcTIdXYp3caRR9pGiRSeDXpe4fvjSb7RgGNlE6D7G3b /G02IXyoRSvQCKPjOnZzcIuUv51or7gSGfLw1GnX6dzQ+hFeS7PfCKOVDVkhj2aubggRR L4SI80MQbaQwG6ocMXBcF/oyom0a8RXiInk= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" The ARM Architecture Reference Manual for ARMv8-A defines up to seven levels of cache, L1 through L7. Define MAX_ARM_CACHE_LEVEL to be 7. Signed-off-by: Rebecca Cran Reviewed-by: Leif Lindholm Reviewed-by: Sami Mujawar --- ArmPkg/Include/Library/ArmLib.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLi= b.h index 26cb05def0a2..fd4f06d24274 100644 --- a/ArmPkg/Include/Library/ArmLib.h +++ b/ArmPkg/Include/Library/ArmLib.h @@ -109,6 +109,10 @@ typedef enum { #define GET_MPID(ClusterId, CoreId) (((ClusterId) << 8) | (CoreId)) #define PRIMARY_CORE_ID (PcdGet32(PcdArmPrimaryCore) & ARM_CORE_MASK) =20 +// The ARM Architecture Reference Manual for ARMv8-A defines up +// to 7 levels of cache, L1 through L7. +#define MAX_ARM_CACHE_LEVEL 7 + UINTN EFIAPI ArmDataCacheLineLength ( --=20 2.26.2 -=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 (#70304): https://edk2.groups.io/g/devel/message/70304 Mute This Topic: https://groups.io/mt/79679249/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 Mon Nov 25 10:42:56 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+70305+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+70305+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642218; cv=none; d=zohomail.com; s=zohoarc; b=W8uoPnXtBsKlKDE/ahDvmd6eM+Wq0CaI1le8HHs0UgcjnY1kH+KPsMOS940NL3//JEemPa7FqvY55cXqdEMVEHHzm8jccSckd2BC4XtGw1+O0oNUOtv6lsvtO7cUUe4dSuZYVMljHpow4U4KQGrupqIRSz452wkqoOv9ZeY2tcg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642218; 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=pzDJ8Ez3cWk6fPPk1vF/c9XVh0J2J5SBP2dMTRZBlq0=; b=EjdfLxflWVKy/wEIPJJ8P1q2crf4EvS84Y4XyAZ0IrOmmR415IL+No6NGRtQNGUfzOi7j+brNp0PzYgRgVfw6kQqeEeGeVpxITWAnogPkFYdkFH+i870EyQmqWmsBs2k7mPP9j/i/yP6KSyuVe9m8MKY9s3eayPNI2sLkzNNb5w= 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+70305+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642218821110.23345681503724; Thu, 14 Jan 2021 08:36:58 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id AJhPYY1788612xOkLNoatalp; Thu, 14 Jan 2021 08:36:58 -0800 X-Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) by mx.groups.io with SMTP id smtpd.web12.4175.1610642209348055249 for ; Thu, 14 Jan 2021 08:36:49 -0800 X-Received: by mail-io1-f51.google.com with SMTP id z5so12311744iob.11 for ; Thu, 14 Jan 2021 08:36:49 -0800 (PST) X-Gm-Message-State: XKzuDxkDBWYaE547GXGeFigIx1787277AA= X-Google-Smtp-Source: ABdhPJx98a8ealXcN0JQxJBHYp2TzmPeyeInmB130z41r7xV5JrVNZmy6s7u31bWPNZDgzg4HP1yCw== X-Received: by 2002:a02:6a53:: with SMTP id m19mr6631590jaf.24.1610642208459; Thu, 14 Jan 2021 08:36:48 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:47 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu , Sami Mujawar Subject: [edk2-devel] [PATCH v6 10/22] ArmPkg: Add helper to read CCIDX status Date: Thu, 14 Jan 2021 09:36:16 -0700 Message-Id: <20210114163628.31952-11-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642218; bh=sy6X4dVkUwe8lX06A9teMFuYwfGRT7oOq36IuP4poyg=; h=Cc:Date:From:Reply-To:Subject:To; b=ii9aykQA2emRljQXcCFsLyNVTVM1OTV0Ng8Fl0JeLEox2VLYG1C+MJ2fKYxa8lwS+kv a3r6abyo/uftUehVpjbIwpCz/HkKlzn9xS7nIatVXHsvi6R7QCuc4j0y9knTGLYBEZr1h Ra7PlV+FiB4LFxN6tnAj1ABL25B5dk/DHq8= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add a helper function to determine CCIDX support. Signed-off-by: Rebecca Cran Reviewed-by: Sami Mujawar Reviewed-by: Leif Lindholm --- ArmPkg/Include/Library/ArmLib.h | 11 +++++++++++ ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c | 19 ++++++++++++++++++- ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c | 19 ++++++++++++++++++- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/ArmLi= b.h index fd4f06d24274..70b9d816b74c 100644 --- a/ArmPkg/Include/Library/ArmLib.h +++ b/ArmPkg/Include/Library/ArmLib.h @@ -725,6 +725,17 @@ ArmHasGicSystemRegisters ( VOID ); =20 +/** Checks if CCIDX is implemented. + + @retval TRUE CCIDX is implemented. + @retval FALSE CCIDX is not implemented. +**/ +BOOLEAN +EFIAPI +ArmHasCcidx ( + VOID + ); + #ifdef MDE_CPU_ARM /// /// AArch32-only ID Register Helper functions diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c b/ArmPkg/Library/Ar= mLib/AArch64/AArch64Lib.c index 53e593bc994b..191a5fea31a1 100644 --- a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c +++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c @@ -2,7 +2,7 @@ =20 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
Portions copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
- Copyright (c) 2020, NUVIA Inc. All rights reserved.
+ Copyright (c) 2021, NUVIA Inc. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -87,3 +87,20 @@ ArmHasGicSystemRegisters ( { return ((ArmReadIdAA64Pfr0 () & AARCH64_PFR0_GIC) !=3D 0); } + +/** Checks if CCIDX is implemented. + + @retval TRUE CCIDX is implemented. + @retval FALSE CCIDX is not implemented. +**/ +BOOLEAN +EFIAPI +ArmHasCcidx ( + VOID + ) +{ + UINTN Mmfr2; + + Mmfr2 =3D ArmReadIdAA64Mmfr2 (); + return (((Mmfr2 >> 20) & 0xF) =3D=3D 1) ? TRUE : FALSE; +} diff --git a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c b/ArmPkg/Library/ArmLib/A= rm/ArmV7Lib.c index 9f81a7223732..c5dd3f8b2f1c 100644 --- a/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c +++ b/ArmPkg/Library/ArmLib/Arm/ArmV7Lib.c @@ -2,7 +2,7 @@ =20 Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
Copyright (c) 2011 - 2014, ARM Limited. All rights reserved. - Copyright (c) 2020, NUVIA Inc. All rights reserved.
+ Copyright (c) 2021, NUVIA Inc. All rights reserved.
=20 SPDX-License-Identifier: BSD-2-Clause-Patent =20 @@ -102,3 +102,20 @@ ArmHasSecurityExtensions ( { return ((ArmReadIdPfr1 () & ARM_PFR1_SEC) !=3D 0); } + +/** Checks if CCIDX is implemented. + + @retval TRUE CCIDX is implemented. + @retval FALSE CCIDX is not implemented. +**/ +BOOLEAN +EFIAPI +ArmHasCcidx ( + VOID + ) +{ + UINTN Mmfr4; + + Mmfr4 =3D ArmReadIdMmfr4 (); + return (((Mmfr4 >> 24) & 0xF) =3D=3D 1) ? TRUE : FALSE; +} --=20 2.26.2 -=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 (#70305): https://edk2.groups.io/g/devel/message/70305 Mute This Topic: https://groups.io/mt/79679252/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 Mon Nov 25 10:42:56 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+70306+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+70306+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642220; cv=none; d=zohomail.com; s=zohoarc; b=IVZqLc85pZTXtFAu4xAuSlQVETqnuNaXRVp2QmvuA9dIzFTsJJQghNt9bc66j9D0hRc1DgYOdqwiqzkQX3Wz0z/lNptPuuSqieXBq9bfCAvL9oN/eZCnuZVsLd/n6EMlqdUFsuLnYc34btvnOSTmAguo5sor7Oo2s+l5x+krLTk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642220; 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=H8r3jIJU7ISa+eU2boPQydlTXHQtnbloE+a64BNRmEk=; b=cneVKoRcNCRLpPPUVqlD9jesD8mispWLm73QhnVhMlwZ42w3bBqJDntWeDfVb+XmsKUFBEDoqa4K7Osm5cxcWFtuRINauJuXlPaj6FjdEkZAl0GL5v/2sVqxL3vKgna9X9RlI0KWDpSLRnn+ah3eq2IvLnq57lvCAFMQPOYAvso= 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+70306+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642220270265.1181969067235; Thu, 14 Jan 2021 08:37:00 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id tZwdYY1788612x0P1frQyAvr; Thu, 14 Jan 2021 08:36:59 -0800 X-Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) by mx.groups.io with SMTP id smtpd.web12.4176.1610642210633745884 for ; Thu, 14 Jan 2021 08:36:50 -0800 X-Received: by mail-io1-f46.google.com with SMTP id d9so12368766iob.6 for ; Thu, 14 Jan 2021 08:36:50 -0800 (PST) X-Gm-Message-State: cbT2UAN5oDHFK6TBZyFJkdtvx1787277AA= X-Google-Smtp-Source: ABdhPJzSAVhgxqrvOFTBoFinAViAmsK1O6+lkBvFZE5ema7ZXgEb+gWAhZu2GrWZy8wBNppMaJ+5bA== X-Received: by 2002:a02:b709:: with SMTP id g9mr7252504jam.90.1610642209797; Thu, 14 Jan 2021 08:36:49 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:49 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu Subject: [edk2-devel] [PATCH v6 11/22] ArmPkg: Add helper to read the CCSIDR2 register Date: Thu, 14 Jan 2021 09:36:17 -0700 Message-Id: <20210114163628.31952-12-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642219; bh=c3kSqJoEaG03dUj9AZvTW1vSBfH8DOafMwnjue5qRuY=; h=Cc:Date:From:Reply-To:Subject:To; b=nEdVX4OaTj6SJiQEg9HACLBKCQTKidssv7QqoGw5vUX6Hf2YxhT2ubR1UcZ033NECAt 5h/i6HiwT6n4azS+d169HIGGt3SNDYz3IjTN2jIMuVP7ZPmsw4kl16IdHylEUiuw2fHii rIvs6Zc8U8b+ROx2NINaVS3cTDQpxJBVT7I= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add helper function to read the CCSIDR2 register. This is used when CCIDX is supported in AARCH32 mode. Signed-off-by: Rebecca Cran Reviewed-by: Leif Lindholm Reviewed-by: Sami Mujawar --- ArmPkg/Library/ArmLib/ArmLibPrivate.h | 11 +++++++++++ ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S | 10 ++++++++++ ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm | 10 ++++++++++ 3 files changed, 31 insertions(+) diff --git a/ArmPkg/Library/ArmLib/ArmLibPrivate.h b/ArmPkg/Library/ArmLib/= ArmLibPrivate.h index 77e592a99def..4b72827a6522 100644 --- a/ArmPkg/Library/ArmLib/ArmLibPrivate.h +++ b/ArmPkg/Library/ArmLib/ArmLibPrivate.h @@ -170,6 +170,17 @@ ReadCCSIDR ( IN UINT32 CSSELR ); =20 +/** Reads the CCSIDR2 for the specified cache. + + @param CSSELR The CSSELR cache selection register value + + @return The contents of the CCSIDR2 register for the specified cache. +**/ +UINT32 +ReadCCSIDR2 ( + IN UINT32 CSSELR + ); + UINT32 ReadCLIDR ( VOID diff --git a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S b/ArmPkg/Library/A= rmLib/Arm/ArmLibSupportV7.S index af61dbee5261..d843f91dfca8 100644 --- a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S +++ b/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.S @@ -74,6 +74,16 @@ ASM_FUNC(ReadCCSIDR) mrc p15,1,r0,c0,c0,0 @ Read current CP15 Cache Size ID Register (CCSID= R) bx lr =20 +// UINT32 +// ReadCCSIDR2 ( +// IN UINT32 CSSELR +// ) +ASM_FUNC(ReadCCSIDR2) + mcr p15,2,r0,c0,c0,0 @ Write Cache Size Selection Register (CSSELR) + isb + mrc p15,1,r0,c0,c0,2 @ Read current CP15 Cache Size ID Register (CCSID= R2) + bx lr + // UINT32 // ReadCLIDR ( // IN UINT32 CSSELR diff --git a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm b/ArmPkg/Library= /ArmLib/Arm/ArmLibSupportV7.asm index 81f3cb79994c..e14f1566258c 100644 --- a/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm +++ b/ArmPkg/Library/ArmLib/Arm/ArmLibSupportV7.asm @@ -78,6 +78,16 @@ mrc p15,1,r0,c0,c0,0 ; Read current CP15 Cache Size ID Register (CCSIDR) bx lr =20 +// UINT32 +// ReadCCSIDR2 ( +// IN UINT32 CSSELR +// ) + RVCT_ASM_EXPORT ReadCCSIDR2 + mcr p15,2,r0,c0,c0,0 ; Write Cache Size Selection Register (CSSELR) + isb + mrc p15,1,r0,c0,c0,2 ; Read current CP15 Cache Size ID Register (CCSIDR2) + bx lr + // UINT32 // ReadCLIDR ( // IN UINT32 CSSELR --=20 2.26.2 -=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 (#70306): https://edk2.groups.io/g/devel/message/70306 Mute This Topic: https://groups.io/mt/79679253/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 Mon Nov 25 10:42:56 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+70307+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+70307+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642216; cv=none; d=zohomail.com; s=zohoarc; b=JqmXrEA+SSBzyrPz9bR4hZyOYr9IbBUqgswNitlbLQPWhSRZTCJyTe4R1rOQtYggmvCDa6eh56TyjQb0Rb4hvRWgtBQqiv0no7D4ASl45Awn1Wdn+gh39lTSQXmUjt4BGOjdKxT4Dv3ofiZxV1BA4ldeUwFnceEu4mPTiP53QlY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642216; 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=EbOIO6ebo5wdM6PJLqCmfwWE3340AFerPEzZ4wphsA8=; b=a6W8YXiqxj50IKaAO9Mz6sF2UDbYX3wjKSbUqF+Xyr0phy5dM3ENDcxlXHW78isK2JqZusoP6RYVzU//hEpdZ2R1v5V9cTi/Fxu7BApoVgGcQ54P4rY0u8+li0ekTRtehQm8+F1NjLok19r1uDSh+Jdq9LgrtttICTQj5GI9Ab0= 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+70307+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642216643980.5855439126051; Thu, 14 Jan 2021 08:36:56 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id CJSzYY1788612xxw8cAwjLuH; Thu, 14 Jan 2021 08:36:55 -0800 X-Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) by mx.groups.io with SMTP id smtpd.web09.4099.1610642212776205288 for ; Thu, 14 Jan 2021 08:36:52 -0800 X-Received: by mail-io1-f50.google.com with SMTP id z5so12312139iob.11 for ; Thu, 14 Jan 2021 08:36:52 -0800 (PST) X-Gm-Message-State: GSYPr1taFoeiFfm9zg0jJjmGx1787277AA= X-Google-Smtp-Source: ABdhPJxsChYySrX6GNCA40Pc2rzosH7Y62THDQ/sOmDfrgUsONEfW6jwxVUFN2pKuL01kX5+zG8/+A== X-Received: by 2002:a02:bb99:: with SMTP id g25mr7047278jan.11.1610642211282; Thu, 14 Jan 2021 08:36:51 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:50 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu Subject: [edk2-devel] [PATCH v6 12/22] ArmPkg: Add Library/OemMiscLib.h Date: Thu, 14 Jan 2021 09:36:18 -0700 Message-Id: <20210114163628.31952-13-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642215; bh=GEDi7M5HM+CnhgkCB+5f8ebOdjlgnix83nxBThYvWIE=; h=Cc:Date:From:Reply-To:Subject:To; b=GCbNrHBK7wcM7nuftnU5LnwDRlfBO5MHcFhjwsl6dy++kFeM7cdERMJvH0YO2x5SCoo 5pcWxni6aIVE16+Byf0PQ6qZWYOlJCG6trHLgQPjlXeIb7Xh0Ez9MG0qBckr1Q4Nap7/S 8fXgXufqwEUXzfPihlToo3SjhYW3XjP4WIg= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" OemMiscLib.h provides the interface which platforms should implement to interact with the SmbiosMiscDxe and ProcessorSubClassDxe drivers to update SMBIOS tables. Signed-off-by: Rebecca Cran Acked-by: Leif Lindholm Reviewed-by: Samer El-Haj-Mahmoud --- ArmPkg/Include/Library/OemMiscLib.h | 166 ++++++++++++++++++++ 1 file changed, 166 insertions(+) diff --git a/ArmPkg/Include/Library/OemMiscLib.h b/ArmPkg/Include/Library/O= emMiscLib.h new file mode 100644 index 000000000000..a14eb36a60e3 --- /dev/null +++ b/ArmPkg/Include/Library/OemMiscLib.h @@ -0,0 +1,166 @@ +/** @file +* +* Copyright (c) 2021, NUVIA Inc. All rights reserved. +* Copyright (c) 2015, Hisilicon Limited. All rights reserved. +* Copyright (c) 2015, Linaro Limited. All rights reserved. +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + + +#ifndef OEM_MISC_LIB_H_ +#define OEM_MISC_LIB_H_ + +#include +#include + +typedef enum +{ + CpuCacheL1 =3D 0, + CpuCacheL2, + CpuCacheL3, + CpuCacheL4, + CpuCacheL5, + CpuCacheL6, + CpuCacheL7, + CpuCacheLevelMax +} OEM_MISC_CPU_CACHE_LEVEL; + +typedef struct +{ + UINT8 Voltage; ///< Processor voltage + UINT16 CurrentSpeed; ///< Current clock speed in MHz + UINT16 MaxSpeed; ///< Maximum clock speed in MHz + UINT16 ExternalClock; ///< External clock speed in MHz + UINT16 CoreCount; ///< Number of cores available + UINT16 CoresEnabled; ///< Number of cores enabled + UINT16 ThreadCount; ///< Number of threads per processor +} OEM_MISC_PROCESSOR_DATA; + +typedef enum +{ + ProductNameType01, + SerialNumType01, + UuidType01, + SystemManufacturerType01, + SkuNumberType01, + FamilyType01, + AssertTagType02, + SerialNumberType02, + BoardManufacturerType02, + SkuNumberType02, + ChassisLocationType02, + AssetTagType03, + SerialNumberType03, + VersionType03, + ChassisTypeType03, + ManufacturerType03, + SkuNumberType03, + SmbiosHiiStringFieldMax +} OEM_MISC_SMBIOS_HII_STRING_FIELD; + +/* + * The following are functions that the each platform needs to + * implement in its OemMiscLib library. + */ + +/** Gets the CPU frequency of the specified processor. + + @param ProcessorIndex Index of the processor to get the frequency for. + + @return CPU frequency in Hz +**/ +EFIAPI +UINTN +OemGetCpuFreq ( + IN UINT8 ProcessorIndex + ); + +/** Gets information about the specified processor and stores it in + the structures provided. + + @param ProcessorIndex Index of the processor to get the information for. + @param ProcessorStatus Processor status. + @param ProcessorCharacteristics Processor characteritics. + @param MiscProcessorData Miscellaneous processor information. + + @return TRUE on success, FALSE on failure. +**/ +EFIAPI +BOOLEAN +OemGetProcessorInformation ( + IN UINTN ProcessorIndex, + IN OUT PROCESSOR_STATUS_DATA *ProcessorStatus, + IN OUT PROCESSOR_CHARACTERISTIC_FLAGS *ProcessorCharacteristics, + IN OUT OEM_MISC_PROCESSOR_DATA *MiscProcessorData + ); + +/** Gets information about the cache at the specified cache level. + + @param ProcessorIndex The processor to get information for. + @param CacheLevel The cache level to get information for. + @param InstructionOrUnifiedCache Whether the cache is instruction or + unified, not data. + @param SmbiosCacheTable The SMBIOS Type7 cache information structure. + + @return TRUE on success, FALSE on failure. +**/ +EFIAPI +BOOLEAN +OemGetCacheInformation ( + IN UINT8 ProcessorIndex, + IN UINT8 CacheLevel, + IN BOOLEAN InstructionOrUnifiedCache, + IN OUT SMBIOS_TABLE_TYPE7 *SmbiosCacheTable + ); + +/** Gets the maximum number of sockets supported by the platform. + + @return The maximum number of sockets. +**/ +EFIAPI +UINT8 +OemGetProcessorMaxSockets ( + VOID + ); + +/** Gets the type of chassis for the system. + + @param ChassisType The type of the chassis. + + @retval EFI_SUCCESS The chassis type was fetched successfully. +**/ +EFIAPI +EFI_STATUS +OemGetChassisType ( + OUT UINT8 *ChassisType + ); + +/** Returns whether the specified processor is present or not. + + @param ProcessIndex The processor index to check. + + @return TRUE is the processor is present, FALSE otherwise. +**/ +EFIAPI +BOOLEAN +OemIsSocketPresent ( + IN UINTN ProcessorIndex + ); + +/** Updates the HII string for the specified field. + + @param mHiiHandle The HII handle. + @param TokenToUpdate The string to update. + @param Offset The field to get information about. +**/ +EFIAPI +VOID +OemUpdateSmbiosInfo ( + IN EFI_HII_HANDLE HiiHandle, + IN EFI_STRING_ID TokenToUpdate, + IN OEM_MISC_SMBIOS_HII_STRING_FIELD Offset + ); + +#endif // OEM_MISC_LIB_H_ --=20 2.26.2 -=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 (#70307): https://edk2.groups.io/g/devel/message/70307 Mute This Topic: https://groups.io/mt/79679254/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 Mon Nov 25 10:42:56 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+70308+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+70308+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642217; cv=none; d=zohomail.com; s=zohoarc; b=lpBGcSy01H2ucPUOKqmhwzUUVU8BavDyK+1bElbEomzNU5uvwh3A9xRzGMmX1p5m4PLf0qOXT3+TKp0g1KJ5ll3IELjNkDuRVWNi+LmJVFiM2UPN7JshZ142x5pkqjsRocGQTTJlggBN9pcTYNAGJmOqbHBSWopEsf0MSP+9c8M= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642217; 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=T+CZahsZhMMbvPxPYWYkE15aMDnYoogo8PrjVA0TNeo=; b=W+3S17VEk8BOEue7VbDRNBnv75zvE0AitHWZnhUOyQN05CbU/LdFEtnZDJptgP6goCA42pOkROm0bj/paZx6J6q2LGqfDJXNsxBUWGLLGR+KN8CzN0ugQ8xSO1oE47rhcwZLKS4J6cdS9dc/pB/28uL1vthdyoA1Pd1rbj7CSJI= 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+70308+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642217356443.3969545109245; Thu, 14 Jan 2021 08:36:57 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id C4kCYY1788612xRJyrpQ76f3; Thu, 14 Jan 2021 08:36:55 -0800 X-Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) by mx.groups.io with SMTP id smtpd.web09.4100.1610642214315221044 for ; Thu, 14 Jan 2021 08:36:54 -0800 X-Received: by mail-io1-f49.google.com with SMTP id d9so12369179iob.6 for ; Thu, 14 Jan 2021 08:36:54 -0800 (PST) X-Gm-Message-State: CKK63GRlbkIHa57c7dnu723Vx1787277AA= X-Google-Smtp-Source: ABdhPJypWBiyNO5JIJ29S9UiRQXZNCzeO9omBiekZSeGIEvDCcCWr1q5LOX66+3h9QjID+iSnORmNw== X-Received: by 2002:a05:6638:ecd:: with SMTP id q13mr7178738jas.62.1610642213248; Thu, 14 Jan 2021 08:36:53 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:52 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu Subject: [edk2-devel] [PATCH v6 13/22] ArmPkg: Add Universal/Smbios/OemMiscLibNull Date: Thu, 14 Jan 2021 09:36:19 -0700 Message-Id: <20210114163628.31952-14-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642215; bh=h2RMXez43GQHcKsDIgCChvAJzxM8uoVzjujz6eTrTJM=; h=Cc:Date:From:Reply-To:Subject:To; b=t5k6wBJ1SYGP+YtpfcuCN7dNf2WlILdOs7+i/Bnk1sIWg14Azmh/sQlRTBy5aeRhTHq QClK7swks4SJGq1jRpOO5MT6hA/JhTjWdmObiBqldzO7o46cjXMQkbzk+jPL8721RT2dA 8asryIq4abl/gn4C4KFN7vKWEwMf/mdLcu0= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add a Null implementation of OemMiscLib. OemMiscLib provides functions that platforms implement to fill in SMBIOS information for the SmbiosMiscDxe and ProcessSubClassDxe drivers. Signed-off-by: Rebecca Cran Acked-by: Leif Lindholm Reviewed-by: Samer El-Haj-Mahmoud --- ArmPkg/ArmPkg.dsc | 2 + ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLibNull.inf | 31 +++++ ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLib.c | 143 ++++++++++= ++++++++++ 3 files changed, 176 insertions(+) diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc index 48059cf38ed3..0f77a6da4483 100644 --- a/ArmPkg/ArmPkg.dsc +++ b/ArmPkg/ArmPkg.dsc @@ -84,6 +84,8 @@ [LibraryClasses.common] =20 ArmMtlLib|ArmPkg/Library/ArmMtlNullLib/ArmMtlNullLib.inf =20 + OemMiscLib|ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLibNull.inf + [LibraryClasses.common.PEIM] HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf diff --git a/ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLibNull.inf b/Ar= mPkg/Universal/Smbios/OemMiscLibNull/OemMiscLibNull.inf new file mode 100644 index 000000000000..b21eeade64b5 --- /dev/null +++ b/ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLibNull.inf @@ -0,0 +1,31 @@ +#/** @file +# OemMiscLib.inf +# +# Copyright (c) 2021, NUVIA Inc. All rights reserved. +# Copyright (c) 2018, Hisilicon Limited. All rights reserved. +# Copyright (c) 2018, Linaro Limited. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION =3D 1.29 + BASE_NAME =3D OemMiscLibNull + FILE_GUID =3D e80b8e6b-fffb-4c39-b433-41de67c9d7b8 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D OemMiscLib + +[Sources.common] + OemMiscLib.c + +[Packages] + ArmPkg/ArmPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + BaseMemoryLib + diff --git a/ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLib.c b/ArmPkg/U= niversal/Smbios/OemMiscLibNull/OemMiscLib.c new file mode 100644 index 000000000000..8233904647e5 --- /dev/null +++ b/ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLib.c @@ -0,0 +1,143 @@ +/** @file +* OemMiscLib.c +* +* Copyright (c) 2021, NUVIA Inc. All rights reserved. +* Copyright (c) 2018, Hisilicon Limited. All rights reserved. +* Copyright (c) 2018, Linaro Limited. All rights reserved. +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +#include +#include +#include + +#include + + +/** Gets the CPU frequency of the specified processor. + + @param ProcessorIndex Index of the processor to get the frequency for. + + @return CPU frequency in Hz +**/ +EFIAPI +UINTN +OemGetCpuFreq ( + IN UINT8 ProcessorIndex + ) +{ + ASSERT (FALSE); + return 0; +} + +/** Gets information about the specified processor and stores it in + the structures provided. + + @param ProcessorIndex Index of the processor to get the information for. + @param ProcessorStatus Processor status. + @param ProcessorCharacteristics Processor characteritics. + @param MiscProcessorData Miscellaneous processor information. + + @return TRUE on success, FALSE on failure. +**/ +EFIAPI +BOOLEAN +OemGetProcessorInformation ( + IN UINTN ProcessorIndex, + IN OUT PROCESSOR_STATUS_DATA *ProcessorStatus, + IN OUT PROCESSOR_CHARACTERISTIC_FLAGS *ProcessorCharacteristics, + IN OUT OEM_MISC_PROCESSOR_DATA *MiscProcessorData + ) +{ + ASSERT (FALSE); + return TRUE; +} + +/** Gets information about the cache at the specified cache level. + + @param ProcessorIndex The processor to get information for. + @param CacheLevel The cache level to get information for. + @param InstructionOrUnifiedCache Whether the cache is instruction or + unified, not data. + @param SmbiosCacheTable The SMBIOS Type7 cache information structure. + + @return TRUE on success, FALSE on failure. +**/ +EFIAPI +BOOLEAN +OemGetCacheInformation ( + IN UINT8 ProcessorIndex, + IN UINT8 CacheLevel, + IN BOOLEAN InstructionOrUnifiedCache, + IN OUT SMBIOS_TABLE_TYPE7 *SmbiosCacheTable + ) +{ + ASSERT (FALSE); + return TRUE; +} + +/** Gets the maximum number of sockets supported by the platform. + + @return The maximum number of sockets. +**/ +EFIAPI +UINT8 +OemGetProcessorMaxSockets ( + VOID + ) +{ + ASSERT (FALSE); + return 1; +} + +/** Gets the type of chassis for the system. + + @param ChassisType The type of the chassis. + + @retval EFI_SUCCESS The chassis type was fetched successfully. +**/ +EFI_STATUS +EFIAPI +OemGetChassisType ( + UINT8 *ChassisType + ) +{ + ASSERT (FALSE); + *ChassisType =3D MiscChassisTypeUnknown; + return EFI_SUCCESS; +} + +/** Returns whether the specified processor is present or not. + + @param ProcessIndex The processor index to check. + + @return TRUE is the processor is present, FALSE otherwise. +**/ +EFIAPI +BOOLEAN +OemIsSocketPresent ( + IN UINTN ProcessorIndex + ) +{ + ASSERT (FALSE); + return FALSE; +} + +/** Updates the HII string for the specified field. + + @param mHiiHandle The HII handle. + @param TokenToUpdate The string to update. + @param Offset The field to get information about. +**/ +EFIAPI +VOID +OemUpdateSmbiosInfo ( + IN EFI_HII_HANDLE mHiiHandle, + IN EFI_STRING_ID TokenToUpdate, + IN OEM_MISC_SMBIOS_HII_STRING_FIELD Offset + ) +{ + ASSERT (FALSE); +} --=20 2.26.2 -=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 (#70308): https://edk2.groups.io/g/devel/message/70308 Mute This Topic: https://groups.io/mt/79679255/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 Mon Nov 25 10:42:56 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+70309+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+70309+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642220; cv=none; d=zohomail.com; s=zohoarc; b=OEvWfj5x0uL4SgFKJzO3KZbEZd8K8tYaRbxZ1QAu7BUR+pexApfECMF8YOPebZ0R5mVRyjt3ABMgB53CoDktRj2ZAAvie3Aau6WcrJeMu8+MOyZppldx/ruSQq4gYQxBUwvrkIa07Zj9IrPEcp5BS+Tpkq8OdnyCTM5jY/4Ekh4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642220; 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=kjN8kJo5QrbS55JQ6BikuUm1CKRVnkFeopEobg/u+SM=; b=bWfDCti/9/Rs7OoQJrq4X7oSPW5bd+HqAmFM45Qm3s8fzPoo6rax2va944J88PnzCw3x0SlQ2bgHkjOz2rW4OCZ5K8qDq15918UhCG3v2CRsaflNP52xBDM90ut217EQv48cADYRs5SPb/S3I2dLZXneCyQygk+jIMpiSWIR0ts= 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+70309+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642219994502.8664717930242; Thu, 14 Jan 2021 08:36:59 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id yXFSYY1788612x94Tgl4Sv01; Thu, 14 Jan 2021 08:36:59 -0800 X-Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) by mx.groups.io with SMTP id smtpd.web11.4159.1610642216282718489 for ; Thu, 14 Jan 2021 08:36:56 -0800 X-Received: by mail-io1-f54.google.com with SMTP id y19so12419103iov.2 for ; Thu, 14 Jan 2021 08:36:56 -0800 (PST) X-Gm-Message-State: r3nYpf6B7wEuMMdHulIWbXePx1787277AA= X-Google-Smtp-Source: ABdhPJxJO/iHM2okw3A4qDTxjsdInvsKDs2qnDeF4d8DgA6v7TF8YsQsC6fOr6nTzute988yHzzEBw== X-Received: by 2002:a92:77c9:: with SMTP id s192mr7159547ilc.75.1610642214917; Thu, 14 Jan 2021 08:36:54 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:54 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu , Samer El-Haj-Mahmoud Subject: [edk2-devel] [PATCH v6 14/22] ArmPkg: Add Universal/Smbios/ProcessorSubClassDxe Date: Thu, 14 Jan 2021 09:36:20 -0700 Message-Id: <20210114163628.31952-15-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642219; bh=5FbOyRC4r7JVBOp5EtdM4xznPuoiaDxk/YMO40OoYqo=; h=Cc:Date:From:Reply-To:Subject:To; b=IA/Bz23FGERrwE+p4Cm7ViKbat90BzgcqWWqS3iCCAonJQ7//NsXiH6EdXVK6pCw8M1 I1EtYHdipFzwaDNqxo4uz8Zz35I3wc9q0fY2MHcFNNpNxqJDPqLH4TGNq+x5/Q9TkiczL 1c+CY5MCKSreXXkAvXUb+pScyIAUVewp+YY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" ProcessorSubClassDxe provides SMBIOS CPU information using generic methods combined with calls into OemMiscLib. Signed-off-by: Rebecca Cran Reviewed-by: Samer El-Haj-Mahmoud --- ArmPkg/ArmPkg.dsc = | 2 + ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf = | 58 ++ ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c = | 863 ++++++++++++++++++++ ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassStrings.uni = | 24 + 4 files changed, 947 insertions(+) diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc index 0f77a6da4483..fce86cb6d710 100644 --- a/ArmPkg/ArmPkg.dsc +++ b/ArmPkg/ArmPkg.dsc @@ -148,6 +148,8 @@ [Components.common] ArmPkg/Drivers/ArmCrashDumpDxe/ArmCrashDumpDxe.inf ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf =20 + ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf + [Components.AARCH64] ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf ArmPkg/Library/ArmMmuLib/ArmMmuPeiLib.inf diff --git a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass= Dxe.inf b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe= .inf new file mode 100644 index 000000000000..c8ef3ee56b72 --- /dev/null +++ b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf @@ -0,0 +1,58 @@ +#/** @file +# ProcessorSubClassDxe.inf +# +# Copyright (c) 2021, NUVIA Inc. All rights reserved. +# Copyright (c) 2015, Hisilicon Limited. All rights reserved. +# Copyright (c) 2015, Linaro Limited. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + + +[Defines] + INF_VERSION =3D 1.29 + BASE_NAME =3D ProcessorSubClass + FILE_GUID =3D f3fe0e33-ea38-4069-9fb5-be23407207c7 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D ProcessorSubClassEntryPoint + +[Sources] + ProcessorSubClass.c + ProcessorSubClassStrings.uni + +[Packages] + ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + ArmLib + ArmSmcLib + BaseLib + BaseMemoryLib + DebugLib + HiiLib + IoLib + MemoryAllocationLib + OemMiscLib + PcdLib + PrintLib + UefiDriverEntryPoint + +[Protocols] + gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED + +[Pcd] + gArmTokenSpaceGuid.PcdProcessorManufacturer + gArmTokenSpaceGuid.PcdProcessorVersion + gArmTokenSpaceGuid.PcdProcessorSerialNumber + gArmTokenSpaceGuid.PcdProcessorAssetTag + gArmTokenSpaceGuid.PcdProcessorPartNumber + +[Guids] + + +[Depex] + gEfiSmbiosProtocolGuid diff --git a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass= .c b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c new file mode 100644 index 000000000000..85cbe2a67f37 --- /dev/null +++ b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c @@ -0,0 +1,863 @@ +/** @file + ProcessorSubClass.c + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved. + Copyright (c) 2015, Linaro Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +extern UINT8 ProcessorSubClassStrings[]; + +#define CACHE_SOCKETED_SHIFT 3 +#define CACHE_LOCATION_SHIFT 5 +#define CACHE_ENABLED_SHIFT 7 +#define CACHE_OPERATION_MODE_SHIFT 8 + +// Sets the HII variable `x` if `pcd` isn't empty +#define SET_HII_STRING_IF_PCD_NOT_EMPTY(pcd, x) \ + x##Str =3D (CHAR16 *)PcdGetPtr (pcd); \ + if (StrLen (x##Str) > 0) { \ + HiiSetString (mHiiHandle, x, x##Str, NULL); \ + } \ + +typedef enum { + CacheModeWriteThrough =3D 0, ///< Cache is write-through + CacheModeWriteBack, ///< Cache is write-back + CacheModeVariesWithAddress, ///< Cache mode varies by address + CacheModeUnknown, ///< Cache mode is unknown + CacheModeMax +} CACHE_OPERATION_MODE; + +typedef enum { + CacheLocationInternal =3D 0, ///< Cache is internal to the processor + CacheLocationExternal, ///< Cache is external to the processor + CacheLocationReserved, ///< Reserved + CacheLocationUnknown, ///< Cache location is unknown + CacheLocationMax +} CACHE_LOCATION; + +EFI_HII_HANDLE mHiiHandle; + +EFI_SMBIOS_PROTOCOL *mSmbios; + +SMBIOS_TABLE_TYPE4 mSmbiosProcessorTableTemplate =3D { + { // Hdr + EFI_SMBIOS_TYPE_PROCESSOR_INFORMATION, // Type + sizeof (SMBIOS_TABLE_TYPE4), // Length + 0 // Handle + }, + 1, // Socket + CentralProcessor, // ProcessorType + ProcessorFamilyIndicatorFamily2, // ProcessorFamily + 2, // ProcessorManufacture + { // ProcessorId + { // Signature + 0 + }, + { // FeatureFlags + 0 + } + }, + 3, // ProcessorVersion + { // Voltage + 0 + }, + 0, // ExternalClock + 0, // MaxSpeed + 0, // CurrentSpeed + 0, // Status + ProcessorUpgradeUnknown, // ProcessorUpgrade + 0xFFFF, // L1CacheHandle + 0xFFFF, // L2CacheHandle + 0xFFFF, // L3CacheHandle + 4, // SerialNumber + 5, // AssetTag + 6, // PartNumber + 0, // CoreCount + 0, //EnabledCoreCount + 0, // ThreadCount + 0, // ProcessorCharacteristics + ProcessorFamilyARM, // ProcessorFamily2 + 0, // CoreCount2 + 0, // EnabledCoreCount2 + 0 // ThreadCount2 +}; + + +/** Fetches the specified processor's frequency in Hz. + + @param ProcessorNumber The processor number + + @return The clock frequency in MHz + +**/ +UINT16 +GetCpuFrequency ( + IN UINT8 ProcessorNumber + ) +{ + return (UINT16)(OemGetCpuFreq (ProcessorNumber) / 1000 / 1000); +} + +/** Gets a description of the specified cache. + + @param[in] CacheLevel Zero-based cache level (e.g. L1 c= ache is 0) + @param[in] InstructionOrUnifiedCache Whether this is an instruction or= unified + cache, or a data cache + @param[out] CacheSocketStr The description of the specified = cache + + @return The number of Unicode characters in CacheSocketStr not including= the + terminating NUL +**/ +UINTN +GetCacheSocketStr ( + IN UINT8 CacheLevel, + IN BOOLEAN InstructionOrUnifiedCache, + OUT CHAR16 *CacheSocketStr + ) +{ + UINTN CacheSocketStrLen; + + if (CacheLevel =3D=3D CpuCacheL1 + && InstructionOrUnifiedCache) { + CacheSocketStrLen =3D UnicodeSPrint ( + CacheSocketStr, + SMBIOS_STRING_MAX_LENGTH - 1, + L"L%x Instruction Cache", + CacheLevel + 1); + } else if (CacheLevel =3D=3D CpuCacheL1 && !InstructionOrUnifiedCache) { + CacheSocketStrLen =3D UnicodeSPrint (CacheSocketStr, + SMBIOS_STRING_MAX_LENGTH - 1, + L"L%x Data Cache", + CacheLevel + 1); + } else { + CacheSocketStrLen =3D UnicodeSPrint (CacheSocketStr, + SMBIOS_STRING_MAX_LENGTH - 1, + L"L%x Cache", + CacheLevel + 1); + } + + return CacheSocketStrLen; +} + +/** Fills in the Type 7 record with the cache architecture information + read from the CPU registers. + + @param[in] CacheLevel Cache level (e.g. L1) + @param[in] InstructionOrUnifiedCache Cache type is instruction or + unified, not data cache + @param[in] CcidxSupported Whether CCIDX is supported + @param[in] CacheType The type of cache supported at this cache = level + @param[out] Type7Record The Type 7 record to fill in + +**/ +VOID +SetCacheArchitectureInformation ( + IN UINT8 CacheLevel, + IN BOOLEAN InstructionOrUnifiedCache, + IN BOOLEAN CcidxSupported, + IN CLIDR_CACHE_TYPE CacheType, + OUT SMBIOS_TABLE_TYPE7 *Type7Record + ) +{ + CSSELR_DATA Csselr; + CCSIDR_DATA Ccsidr; +#if defined(MDE_CPU_ARM) + CSSIDR2_DATA Ccsidr2; +#endif + UINT8 Associativity; + UINT32 CacheSize32; + UINT16 CacheSize16; + UINT64 CacheSize64; + + Csselr.Data =3D 0; + Csselr.Bits.Level =3D CacheLevel; + + if (InstructionOrUnifiedCache) { + if (CacheType =3D=3D ClidrCacheTypeInstructionOnly || + CacheType =3D=3D ClidrCacheTypeSeparate) { + + Csselr.Bits.InD =3D CsselrCacheTypeInstruction; + Type7Record->SystemCacheType =3D CacheTypeInstruction; + } else { + Csselr.Bits.InD =3D CsselrCacheTypeDataOrUnified; + if (CacheType =3D=3D ClidrCacheTypeDataOnly) { + Type7Record->SystemCacheType =3D CacheTypeData; + } else { + Type7Record->SystemCacheType =3D CacheTypeUnified; + } + } + } else { + Type7Record->SystemCacheType =3D CacheTypeData; + Csselr.Bits.InD =3D CsselrCacheTypeDataOrUnified; + } + + // Read the CCSIDR register to get the cache architecture + Ccsidr.Data =3D ReadCCSIDR (Csselr.Data); + + if (CcidxSupported) { +#if defined(MDE_CPU_ARM) + Ccsidr2.Data =3D ReadCCSIDR2 (Csselr.Data); + CacheSize64 =3D (UINT64)(1 << (Ccsidr.BitsCcidxAA32.LineSize + 4)) * + (Ccsidr.BitsCcidxAA32.Associativity + 1) * + (Ccsidr2.Bits.NumSets + 1); + Associativity =3D Ccsidr.BitsCcidxAA32.Associativity; +#else + CacheSize64 =3D (UINT64)(1 << (Ccsidr.BitsCcidxAA64.LineSize + 4)) * + (Ccsidr.BitsCcidxAA64.Associativity + 1) * + (Ccsidr.BitsCcidxAA64.NumSets + 1); + Associativity =3D Ccsidr.BitsCcidxAA64.Associativity; +#endif + } else { + CacheSize64 =3D (1 << (Ccsidr.BitsNonCcidx.LineSize + 4)) * + (Ccsidr.BitsNonCcidx.Associativity + 1) * + (Ccsidr.BitsNonCcidx.NumSets + 1); + Associativity =3D Ccsidr.BitsNonCcidx.Associativity; + } + + CacheSize64 /=3D 1024; // Minimum granularity is 1K + + // Encode the cache size into the format SMBIOS wants + if (CacheSize64 < MAX_INT16) { + CacheSize16 =3D CacheSize64; + CacheSize32 =3D CacheSize16; + } else if ((CacheSize64 / 64) < MAX_INT16) { + CacheSize16 =3D (1 << 15) | (CacheSize64 / 64); + CacheSize32 =3D CacheSize16; + } else { + if ((CacheSize64 / 1024) <=3D 2047) { + CacheSize32 =3D CacheSize64; + } else { + CacheSize32 =3D (1 << 31) | (CacheSize64 / 64); + } + + CacheSize16 =3D -1; + } + + Type7Record->Associativity =3D Associativity + 1; + Type7Record->MaximumCacheSize =3D CacheSize16; + Type7Record->InstalledSize =3D CacheSize16; + Type7Record->MaximumCacheSize2 =3D CacheSize32; + Type7Record->InstalledSize2 =3D CacheSize32; + + switch (Associativity + 1) { + case 2: + Type7Record->Associativity =3D CacheAssociativity2Way; + break; + case 4: + Type7Record->Associativity =3D CacheAssociativity4Way; + break; + case 8: + Type7Record->Associativity =3D CacheAssociativity8Way; + break; + case 16: + Type7Record->Associativity =3D CacheAssociativity16Way; + break; + case 12: + Type7Record->Associativity =3D CacheAssociativity12Way; + break; + case 24: + Type7Record->Associativity =3D CacheAssociativity24Way; + break; + case 32: + Type7Record->Associativity =3D CacheAssociativity32Way; + break; + case 48: + Type7Record->Associativity =3D CacheAssociativity48Way; + break; + case 64: + Type7Record->Associativity =3D CacheAssociativity64Way; + break; + case 20: + Type7Record->Associativity =3D CacheAssociativity20Way; + break; + default: + Type7Record->Associativity =3D CacheAssociativityOther; + break; + } + + Type7Record->CacheConfiguration =3D (CacheModeUnknown << CACHE_OPERATION= _MODE_SHIFT) | + (1 << CACHE_ENABLED_SHIFT) | + (CacheLocationUnknown << CACHE_LOCATIO= N_SHIFT) | + (0 << CACHE_SOCKETED_SHIFT) | + CacheLevel; +} + + +/** Allocates and initializes an SMBIOS_TABLE_TYPE7 structure + + @param[in] CacheLevel The cache level (L1-L7) + @param[in] InstructionOrUnifiedCache The cache type is instruction or + unified, not a data cache. + + @return A pointer to the Type 7 structure. Returns NULL on failure. + +**/ +SMBIOS_TABLE_TYPE7 * +AllocateAndInitCacheInformation ( + IN UINT8 CacheLevel, + IN BOOLEAN InstructionOrUnifiedCache + ) +{ + SMBIOS_TABLE_TYPE7 *Type7Record; + EFI_STRING CacheSocketStr; + UINTN CacheSocketStrLen; + UINTN StringBufferSize; + CHAR8 *OptionalStrStart; + UINTN TableSize; + + // Allocate and fetch the cache description + StringBufferSize =3D sizeof (CHAR16) * SMBIOS_STRING_MAX_LENGTH; + CacheSocketStr =3D AllocateZeroPool (StringBufferSize); + if (CacheSocketStr =3D=3D NULL) { + return NULL; + } + + CacheSocketStrLen =3D GetCacheSocketStr (CacheLevel, + InstructionOrUnifiedCache, + CacheSocketStr); + + TableSize =3D sizeof (SMBIOS_TABLE_TYPE7) + CacheSocketStrLen + 1 + 1; + Type7Record =3D AllocateZeroPool (TableSize); + if (Type7Record =3D=3D NULL) { + FreePool(CacheSocketStr); + return NULL; + } + + Type7Record->Hdr.Type =3D EFI_SMBIOS_TYPE_CACHE_INFORMATION; + Type7Record->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE7); + Type7Record->Hdr.Handle =3D SMBIOS_HANDLE_PI_RESERVED; + + Type7Record->SocketDesignation =3D 1; + + Type7Record->SupportedSRAMType.Unknown =3D 1; + Type7Record->CurrentSRAMType.Unknown =3D 1; + Type7Record->CacheSpeed =3D 0; + Type7Record->ErrorCorrectionType =3D CacheErrorUnknown; + + OptionalStrStart =3D (CHAR8 *)(Type7Record + 1); + UnicodeStrToAsciiStrS (CacheSocketStr, OptionalStrStart, CacheSocketStrL= en + 1); + FreePool (CacheSocketStr); + + return Type7Record; +} + + +/** + Add Type 7 SMBIOS Record for Cache Information. + + @param[in] ProcessorIndex Processor number of specified processo= r. + @param[out] L1CacheHandle Pointer to the handle of the L1 Cache = SMBIOS record. + @param[out] L2CacheHandle Pointer to the handle of the L2 Cache = SMBIOS record. + @param[out] L3CacheHandle Pointer to the handle of the L3 Cache = SMBIOS record. + +**/ +VOID +AddSmbiosCacheTypeTable ( + IN UINTN ProcessorIndex, + OUT EFI_SMBIOS_HANDLE *L1CacheHandle, + OUT EFI_SMBIOS_HANDLE *L2CacheHandle, + OUT EFI_SMBIOS_HANDLE *L3CacheHandle + ) +{ + EFI_STATUS Status; + SMBIOS_TABLE_TYPE7 *Type7Record; + EFI_SMBIOS_HANDLE SmbiosHandle; + UINT8 CacheLevel; + UINT8 CacheSubLevel; + CLIDR_DATA Clidr; + BOOLEAN CcidxSupported; + UINT8 MaxCacheLevel; + CLIDR_CACHE_TYPE CacheType; + + Status =3D EFI_SUCCESS; + + MaxCacheLevel =3D 0; + + // Read the CLIDR register to find out what caches are present. + Clidr.Data =3D ReadCLIDR (); + + // Get the cache type for the L1 cache. If it's 0, there are no caches. + if (CLIDR_GET_CACHE_TYPE (Clidr.Data, 0) =3D=3D ClidrCacheTypeNone) { + return; + } + + for (CacheLevel =3D 1; CacheLevel < MAX_ARM_CACHE_LEVEL; CacheLevel++) { + if (CLIDR_GET_CACHE_TYPE (Clidr.Data, CacheLevel) =3D=3D ClidrCacheTyp= eNone) { + MaxCacheLevel =3D CacheLevel; + break; + } + } + + CcidxSupported =3D ArmHasCcidx (); + + for (CacheLevel =3D 0; CacheLevel < MaxCacheLevel; CacheLevel++) { + Type7Record =3D NULL; + + CacheType =3D CLIDR_GET_CACHE_TYPE (Clidr.Data, CacheLevel); + + // At each level of cache, we can have a single type (unified, instruc= tion or data), + // or two types - separate data and instruction caches. If we have sep= arate + // instruction and data caches, then on the first iteration (CacheSubL= evel =3D 0) + // process the instruction cache. + for (CacheSubLevel =3D 0; CacheSubLevel <=3D 1; CacheSubLevel++) { + // If there's no separate data/instruction cache, skip the second it= eration + if (CacheSubLevel > 0 && CacheType !=3D ClidrCacheTypeSeparate) { + continue; + } + + Type7Record =3D AllocateAndInitCacheInformation (CacheLevel, + (CacheSubLevel =3D=3D= 0)); + if (Type7Record =3D=3D NULL) { + continue; + } + + SetCacheArchitectureInformation(CacheLevel, + (CacheSubLevel =3D=3D 0), + CcidxSupported, + CacheType, + Type7Record); + + // Allow the platform to fill in other information such as speed, SR= AM type etc. + if (!OemGetCacheInformation (ProcessorIndex, CacheLevel, + (CacheSubLevel =3D=3D 0), Type7Record)) { + continue; + } + + SmbiosHandle =3D SMBIOS_HANDLE_PI_RESERVED; + // Finally, install the table + Status =3D mSmbios->Add (mSmbios, NULL, &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)Type7Record); + if (EFI_ERROR (Status)) { + continue; + } + + // Config L1/L2/L3 Cache Handle + switch (CacheLevel) { + case CpuCacheL1: + *L1CacheHandle =3D SmbiosHandle; + break; + case CpuCacheL2: + *L2CacheHandle =3D SmbiosHandle; + break; + case CpuCacheL3: + *L3CacheHandle =3D SmbiosHandle; + break; + default: + break; + } + } + } +} + +/** Fills in the Type 4 CPU processor ID field. + + @param[out] Type4Record The SMBIOS Type 4 record to fill in + +**/ +VOID +SetProcessorIdField ( + OUT SMBIOS_TABLE_TYPE4 *Type4Record +) +{ + ARM_SMC_ARGS Args; + INT32 SmcCallStatus; + INT32 Jep106Code; + INT32 SocRevision; + BOOLEAN Arm64SocIdSupported; + UINT64 *ProcessorId; + PROCESSOR_CHARACTERISTIC_FLAGS *ProcessorCharacteristicFlags; + + Arm64SocIdSupported =3D FALSE; + + Args.Arg0 =3D SMCCC_VERSION; + ArmCallSmc (&Args); + SmcCallStatus =3D (INT32)Args.Arg0; + + if (SmcCallStatus < 0 || (SmcCallStatus >> 16) >=3D 1) { + Args.Arg0 =3D SMCCC_ARCH_FEATURES; + Args.Arg1 =3D SMCCC_ARCH_SOC_ID; + ArmCallSmc (&Args); + + if (Args.Arg0 >=3D 0) { + ProcessorCharacteristicFlags =3D + (PROCESSOR_CHARACTERISTIC_FLAGS*)&Type4Record->ProcessorCharacteri= stics; + Args.Arg0 =3D SMCCC_ARCH_SOC_ID; + Args.Arg1 =3D 0; + ArmCallSmc (&Args); + SmcCallStatus =3D (int)Args.Arg0; + + if (SmcCallStatus >=3D 0) { + Arm64SocIdSupported =3D TRUE; + ProcessorCharacteristicFlags->ProcessorArm64SocId =3D 1; + Jep106Code =3D (int)Args.Arg0; + } else { + ProcessorCharacteristicFlags->ProcessorArm64SocId =3D 0; + } + Args.Arg0 =3D SMCCC_ARCH_SOC_ID; + Args.Arg1 =3D 1; + ArmCallSmc (&Args); + SmcCallStatus =3D (int)Args.Arg0; + + if (SmcCallStatus >=3D 0) { + SocRevision =3D (int)Args.Arg0; + } + } + } + + ProcessorId =3D (UINT64 *)&Type4Record->ProcessorId; + + if (Arm64SocIdSupported) { + *ProcessorId =3D ((UINT64)Jep106Code << 32) | SocRevision; + } else { + *ProcessorId =3D ArmReadMidr (); + } +} + + +/** Allocates a Type 4 Processor Information structure and sets the + strings following the data fields. + + @param[out] Type4Record The Type 4 structure to allocate and initiali= ze + @param[in] ProcessorIndex The index of the processor socket + @param[in] Populated Whether the specified processor socket is + populated. + + @retval EFI_SUCCESS The Type 4 structure was successfully + allocated and the strings initialized. + @retval EFI_OUT_OF_RESOURCES Could not allocate memory needed. +**/ +EFI_STATUS +AllocateType4AndSetProcessorInformationStrings ( + SMBIOS_TABLE_TYPE4 **Type4Record, + UINT8 ProcessorIndex, + BOOLEAN Populated + ) +{ + EFI_STATUS Status; + EFI_STRING_ID ProcessorManu; + EFI_STRING_ID ProcessorVersion; + EFI_STRING_ID SerialNumber; + EFI_STRING_ID AssetTag; + EFI_STRING_ID PartNumber; + EFI_STRING ProcessorSocketStr; + EFI_STRING ProcessorManuStr; + EFI_STRING ProcessorVersionStr; + EFI_STRING SerialNumberStr; + EFI_STRING AssetTagStr; + EFI_STRING PartNumberStr; + CHAR8 *OptionalStrStart; + CHAR8 *StrStart; + UINTN ProcessorSocketStrLen; + UINTN ProcessorManuStrLen; + UINTN ProcessorVersionStrLen; + UINTN SerialNumberStrLen; + UINTN AssetTagStrLen; + UINTN PartNumberStrLen; + UINTN TotalSize; + UINTN StringBufferSize; + + Status =3D EFI_SUCCESS; + + ProcessorManuStr =3D NULL; + ProcessorVersionStr =3D NULL; + SerialNumberStr =3D NULL; + AssetTagStr =3D NULL; + PartNumberStr =3D NULL; + + if (Populated) { + ProcessorManu =3D STRING_TOKEN (STR_PROCESSOR_MANUFACTURE); + ProcessorVersion =3D STRING_TOKEN (STR_PROCESSOR_VERSION); + SerialNumber =3D STRING_TOKEN (STR_PROCESSOR_SERIAL_NUMBER); + AssetTag =3D STRING_TOKEN (STR_PROCESSOR_ASSET_TAG); + PartNumber =3D STRING_TOKEN (STR_PROCESSOR_PART_NUMBER); + + SET_HII_STRING_IF_PCD_NOT_EMPTY(PcdProcessorManufacturer, ProcessorMan= u); + SET_HII_STRING_IF_PCD_NOT_EMPTY(PcdProcessorVersion, ProcessorVersion); + SET_HII_STRING_IF_PCD_NOT_EMPTY(PcdProcessorSerialNumber, SerialNumber= ); + SET_HII_STRING_IF_PCD_NOT_EMPTY(PcdProcessorAssetTag, AssetTag); + SET_HII_STRING_IF_PCD_NOT_EMPTY(PcdProcessorPartNumber, PartNumber); + } else { + ProcessorManu =3D STRING_TOKEN (STR_PROCESSOR_UNKNOWN); + ProcessorVersion =3D STRING_TOKEN (STR_PROCESSOR_UNKNOWN); + SerialNumber =3D STRING_TOKEN (STR_PROCESSOR_UNKNOWN); + AssetTag =3D STRING_TOKEN (STR_PROCESSOR_UNKNOWN); + PartNumber =3D STRING_TOKEN (STR_PROCESSOR_UNKNOWN); + } + + // Processor Socket Designation + StringBufferSize =3D sizeof (CHAR16) * SMBIOS_STRING_MAX_LENGTH; + ProcessorSocketStr =3D AllocateZeroPool (StringBufferSize); + if (ProcessorSocketStr =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + ProcessorSocketStrLen =3D UnicodeSPrint (ProcessorSocketStr, StringBuffe= rSize, + L"CPU%02d", ProcessorIndex + 1); + + // Processor Manufacture + ProcessorManuStr =3D HiiGetPackageString (&gEfiCallerIdGuid, ProcessorMa= nu, NULL); + ProcessorManuStrLen =3D StrLen (ProcessorManuStr); + + // Processor Version + ProcessorVersionStr =3D HiiGetPackageString (&gEfiCallerIdGuid, Processo= rVersion, NULL); + ProcessorVersionStrLen =3D StrLen (ProcessorVersionStr); + + // Serial Number + SerialNumberStr =3D HiiGetPackageString (&gEfiCallerIdGuid, SerialNumber= , NULL); + SerialNumberStrLen =3D StrLen (SerialNumberStr); + + // Asset Tag + AssetTagStr =3D HiiGetPackageString (&gEfiCallerIdGuid, AssetTag, NULL); + AssetTagStrLen =3D StrLen (AssetTagStr); + + // Part Number + PartNumberStr =3D HiiGetPackageString (&gEfiCallerIdGuid, PartNumber, NU= LL); + PartNumberStrLen =3D StrLen (PartNumberStr); + + TotalSize =3D sizeof (SMBIOS_TABLE_TYPE4) + + ProcessorSocketStrLen + 1 + + ProcessorManuStrLen + 1 + + ProcessorVersionStrLen + 1 + + SerialNumberStrLen + 1 + + AssetTagStrLen + 1 + + PartNumberStrLen + 1 + 1; + + *Type4Record =3D AllocateZeroPool (TotalSize); + if (*Type4Record =3D=3D NULL) { + Status =3D EFI_OUT_OF_RESOURCES; + goto Exit; + } + + CopyMem (*Type4Record, &mSmbiosProcessorTableTemplate, sizeof (SMBIOS_TA= BLE_TYPE4)); + + OptionalStrStart =3D (CHAR8 *)(*Type4Record + 1); + UnicodeStrToAsciiStrS ( + ProcessorSocketStr, + OptionalStrStart, + ProcessorSocketStrLen + 1 + ); + + StrStart =3D OptionalStrStart + ProcessorSocketStrLen + 1; + UnicodeStrToAsciiStrS ( + ProcessorManuStr, + StrStart, + ProcessorManuStrLen + 1 + ); + + StrStart +=3D ProcessorManuStrLen + 1; + UnicodeStrToAsciiStrS ( + ProcessorVersionStr, + StrStart, + ProcessorVersionStrLen + 1 + ); + + StrStart +=3D ProcessorVersionStrLen + 1; + UnicodeStrToAsciiStrS ( + SerialNumberStr, + StrStart, + SerialNumberStrLen + 1 + ); + + StrStart +=3D SerialNumberStrLen + 1; + UnicodeStrToAsciiStrS ( + AssetTagStr, + StrStart, + AssetTagStrLen + 1 + ); + + StrStart +=3D AssetTagStrLen + 1; + UnicodeStrToAsciiStrS ( + PartNumberStr, + StrStart, + PartNumberStrLen + 1 + ); + +Exit: + FreePool (ProcessorSocketStr); + FreePool (ProcessorManuStr); + FreePool (ProcessorVersionStr); + FreePool (SerialNumberStr); + FreePool (AssetTagStr); + FreePool (PartNumberStr); + + return Status; +} + +/** + Add Type 4 SMBIOS Record for Processor Information. + + @param[in] ProcessorIndex Processor index of specified processor. + +**/ +EFI_STATUS +AddSmbiosProcessorTypeTable ( + IN UINTN ProcessorIndex + ) +{ + EFI_STATUS Status; + SMBIOS_TABLE_TYPE4 *Type4Record; + EFI_SMBIOS_HANDLE SmbiosHandle; + EFI_SMBIOS_HANDLE L1CacheHandle; + EFI_SMBIOS_HANDLE L2CacheHandle; + EFI_SMBIOS_HANDLE L3CacheHandle; + UINT8 *LegacyVoltage; + PROCESSOR_STATUS_DATA ProcessorStatus; + OEM_MISC_PROCESSOR_DATA MiscProcessorData; + BOOLEAN SocketPopulated; + UINTN MainIdRegister; + + Type4Record =3D NULL; + + MiscProcessorData.Voltage =3D 0; + MiscProcessorData.CurrentSpeed =3D 0; + MiscProcessorData.CoreCount =3D 0; + MiscProcessorData.CoresEnabled =3D 0; + MiscProcessorData.ThreadCount =3D 0; + MiscProcessorData.MaxSpeed =3D 0; + L1CacheHandle =3D 0xFFFF; + L2CacheHandle =3D 0xFFFF; + L3CacheHandle =3D 0xFFFF; + + SocketPopulated =3D OemIsSocketPresent(ProcessorIndex); + + Status =3D AllocateType4AndSetProcessorInformationStrings ( + &Type4Record, + ProcessorIndex, + SocketPopulated + ); + if (EFI_ERROR (Status)) { + return Status; + } + + OemGetProcessorInformation (ProcessorIndex, + &ProcessorStatus, + (PROCESSOR_CHARACTERISTIC_FLAGS*) + &Type4Record->ProcessorCharacteristics, + &MiscProcessorData); + + if (SocketPopulated) { + AddSmbiosCacheTypeTable (ProcessorIndex, &L1CacheHandle, + &L2CacheHandle, &L3CacheHandle); + } + + LegacyVoltage =3D (UINT8*)&Type4Record->Voltage; + + *LegacyVoltage =3D MiscProcessorData.Voltage; + Type4Record->CurrentSpeed =3D MiscProcessorData.CurrentSpeed; + Type4Record->MaxSpeed =3D MiscProcessorData.MaxSpeed; + Type4Record->Status =3D ProcessorStatus.Data; + Type4Record->L1CacheHandle =3D L1CacheHandle; + Type4Record->L2CacheHandle =3D L2CacheHandle; + Type4Record->L3CacheHandle =3D L3CacheHandle; + Type4Record->CoreCount =3D MiscProcessorData.CoreCount; + Type4Record->CoreCount2 =3D MiscProcessorData.CoreCount; + Type4Record->EnabledCoreCount =3D MiscProcessorData.CoresEnabled; + Type4Record->EnabledCoreCount2 =3D MiscProcessorData.CoresEnabled; + Type4Record->ThreadCount =3D MiscProcessorData.ThreadCount; + Type4Record->ThreadCount2 =3D MiscProcessorData.ThreadCount; + + Type4Record->CurrentSpeed =3D GetCpuFrequency (ProcessorIndex); + Type4Record->ExternalClock =3D (UINT16)(ArmReadCntFrq () / 1000 /= 1000); + + SetProcessorIdField (Type4Record); + + MainIdRegister =3D ArmReadMidr (); + if (((MainIdRegister >> 16) & 0xF) < 8) { + Type4Record->ProcessorFamily2 =3D ProcessorFamilyARM; + } else { + if (sizeof (VOID*) =3D=3D 4) { + Type4Record->ProcessorFamily2 =3D ProcessorFamilyARMv7; + } else { + Type4Record->ProcessorFamily2 =3D ProcessorFamilyARMv8; + } + } + + SmbiosHandle =3D SMBIOS_HANDLE_PI_RESERVED; + Status =3D mSmbios->Add (mSmbios, NULL, &SmbiosHandle, + (EFI_SMBIOS_TABLE_HEADER *)Type4Record); + + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type04 Table Log Failed! %r \n= ", + __FUNCTION__, __LINE__, Status)); + } + FreePool (Type4Record); + + return Status; +} + +/** + Standard EFI driver point. + + @param ImageHandle Handle for the image of this driver + @param SystemTable Pointer to the EFI System Table + + @retval EFI_SUCCESS The data was successfully stored. + +**/ +EFI_STATUS +EFIAPI +ProcessorSubClassEntryPoint( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + UINT32 SocketIndex; + + // + // Locate dependent protocols + // + Status =3D gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, (VOID**)&= mSmbios); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Could not locate SMBIOS protocol. %r\n", Status= )); + return Status; + } + + // + // Add our default strings to the HII database. They will be modified la= ter. + // + mHiiHandle =3D HiiAddPackages (&gEfiCallerIdGuid, + NULL, + ProcessorSubClassStrings, + NULL, + NULL + ); + if (mHiiHandle =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + // + // Add SMBIOS tables for populated sockets. + // + for (SocketIndex =3D 0; SocketIndex < OemGetProcessorMaxSockets(); Socke= tIndex++) { + Status =3D AddSmbiosProcessorTypeTable (SocketIndex); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Add Processor Type Table Failed! %r.\n", Stat= us)); + return Status; + } + } + + return Status; +} diff --git a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass= Strings.uni b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClas= sStrings.uni new file mode 100644 index 000000000000..22b3c64d9fe2 --- /dev/null +++ b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassStrings= .uni @@ -0,0 +1,24 @@ +/** @file + SMBIOS Type 4 strings + + Copyright (c) 2021, NUVIA Inc. All rights reserved. + Copyright (c) 2015, Hisilicon Limited. All rights reserved. + Copyright (c) 2015, Linaro Limited. All rights reserved. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +/=3D# + +#langdef en-US "English" + +// +// Processor Information +// +#string STR_PROCESSOR_SOCKET_DESIGNATION #language en-US "Not Specifie= d" +#string STR_PROCESSOR_MANUFACTURE #language en-US "Not Specifie= d" +#string STR_PROCESSOR_VERSION #language en-US "Not Specifie= d" +#string STR_PROCESSOR_SERIAL_NUMBER #language en-US "Not Specifie= d" +#string STR_PROCESSOR_ASSET_TAG #language en-US "Not Specifie= d" +#string STR_PROCESSOR_PART_NUMBER #language en-US "Not Specifie= d" +#string STR_PROCESSOR_UNKNOWN #language en-US "Unknown" --=20 2.26.2 -=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 (#70309): https://edk2.groups.io/g/devel/message/70309 Mute This Topic: https://groups.io/mt/79679256/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 Mon Nov 25 10:42:56 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+70310+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+70310+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642223; cv=none; d=zohomail.com; s=zohoarc; b=DTO3TMU03iVNnRWRyySDuJx0mr8llYxmYZHqO6x/P33l1OdlWZzC6cT/gTvXKlEyzwguVOsZUF8f+EQ9fLXgLRXeyAox2PKVgwLTV8Tbb3eDiGy9dODn5a+ymJkwNCVglHKEcJyYa2qcMx8QXkcKCm14HOTqhUoooZWyU1gS5DA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642223; 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=KFelStcv8cTPmOoet9c5zvWqbbUU2Qk9eeQ38XMR3Ug=; b=bRbuVwMgk7mVpTn4OrjqUnCRaz94zpFe72Gjk8bBZsF2Eacm6epWjRnmo420OI0k3q2jfVuQlFLXq3tDwbDGgJ29hX/L/MF6tA3HhZkeGL2RYUkBqMV6LzbIXsGBVrnkY7B4NOfxwKSvsWX2DskW+U4C05arBMH2fjQTSLzhp3M= 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+70310+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642223736274.65487642151174; Thu, 14 Jan 2021 08:37:03 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id wCkhYY1788612xiYPvNj9evG; Thu, 14 Jan 2021 08:37:03 -0800 X-Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) by mx.groups.io with SMTP id smtpd.web11.4160.1610642217851414217 for ; Thu, 14 Jan 2021 08:36:57 -0800 X-Received: by mail-io1-f49.google.com with SMTP id e22so12359462iom.5 for ; Thu, 14 Jan 2021 08:36:57 -0800 (PST) X-Gm-Message-State: dRf1BrfvfeAGgh97qMD0Oa5qx1787277AA= X-Google-Smtp-Source: ABdhPJwVCYbV/jcSyT8sGZSo40WZFK7H6oDeqTLRTHsnogFvJaO8q+XJZ1uzXLFRF/Fgwevz6XRtjQ== X-Received: by 2002:a5d:96c5:: with SMTP id r5mr5710739iol.62.1610642216794; Thu, 14 Jan 2021 08:36:56 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:56 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu Subject: [edk2-devel] [PATCH v6 15/22] ArmPkg: Add Universal/Smbios/SmbiosMiscDxe/Type00 Date: Thu, 14 Jan 2021 09:36:21 -0700 Message-Id: <20210114163628.31952-16-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642223; bh=srzdvu2eAftjKdQMkRwrkhze1dFlbkfN4AGDBhpixKs=; h=Cc:Date:From:Reply-To:Subject:To; b=SAjZISEqnznsoBRBK/LVsuqR2ACYT/VnnRiomMEWQY+Me8S4jx1+npe/BtjZN5e335m AoowYMRkA9VPSqG9xgMlazVtXhQEyMvj/01tOzS00PO88lx34ZEaWELgz6RUEjDolfOIf C1Y6W6+7O3SpGRhgkPwOdTHERHFqr9U7yvE= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This code provides information for the SMBIOS Type 0 table. Signed-off-by: Rebecca Cran Reviewed-by: Leif Lindholm Reviewed-by: Samer El-Haj-Mahmoud --- ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorData.c | 9= 3 ++++++ ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c | 29= 7 ++++++++++++++++++++ ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendor.uni | 1= 8 ++ 3 files changed, 408 insertions(+) diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorDat= a.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorData.c new file mode 100644 index 000000000000..edf0186aeae8 --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorData.c @@ -0,0 +1,93 @@ +/** @file + This file provides Smbios Type0 Data + + Based on the files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + +#include "SmbiosMisc.h" + + +// +// Static (possibly build generated) Bios Vendor data. +// +SMBIOS_MISC_TABLE_DATA(SMBIOS_TABLE_TYPE0, MiscBiosVendor) =3D { + { // Hdr + EFI_SMBIOS_TYPE_BIOS_INFORMATION, // Type, + 0, // Length, + 0 // Handle + }, + 1, // Vendor + 2, // BiosVersion + 0xE000, // BiosSegment + 3, // BiosReleaseDate + 0, // BiosSize + { // BiosCharacteristics + 0, // Reserved = :2 + 0, // Unknown = :1 + 0, // BiosCharacteristicsNotSu= pported :1 + 0, // IsaIsSupported = :1 + 0, // McaIsSupported = :1 + 0, // EisaIsSupported = :1 + 1, // PciIsSupported = :1 + 0, // PcmciaIsSupported = :1 + 1, // PlugAndPlayIsSupported = :1 + 0, // ApmIsSupported = :1 + 1, // BiosIsUpgradable = :1 + 1, // BiosShadowingAllowed = :1 + 0, // VlVesaIsSupported = :1 + 0, // EscdSupportIsAvailable = :1 + 1, // BootFromCdIsSupported = :1 + 1, // SelectableBootIsSupporte= d :1 + 0, // RomBiosIsSocketed = :1 + 0, // BootFromPcmciaIsSupporte= d :1 + 0, // EDDSpecificationIsSuppor= ted :1 + 0, // JapaneseNecFloppyIsSuppo= rted :1 + 0, // JapaneseToshibaFloppyIsS= upported :1 + 0, // Floppy525_360IsSupported= :1 + 0, // Floppy525_12IsSupported = :1 + 0, // Floppy35_720IsSupported = :1 + 0, // Floppy35_288IsSupported = :1 + 0, // PrintScreenIsSupported = :1 + 0, // Keyboard8042IsSupported = :1 + 0, // SerialIsSupported = :1 + 0, // PrinterIsSupported = :1 + 0, // CgaMonoIsSupported = :1 + 0, // NecPc98 = :1 + 0 // ReservedForVendor = :32 + }, + + { + 0x01, // BIOSCharacteristicsExt= ensionBytes[0] + // { // BiosReserved + // 1, // AcpiIsSupported = :1 + // 0, // UsbLegacyIsSupport= ed :1 + // 0, // AgpIsSupported = :1 + // 0, // I20BootIsSupported= :1 + // 0, // Ls120BootIsSupport= ed :1 + // 0, // AtapiZipDriveBootI= sSupported :1 + // 0, // Boot1394IsSupporte= d :1 + // 0 // SmartBatteryIsSupp= orted :1 + // }, + 0x0C //BIOSCharacteristicsExte= nsionBytes[1] + // { //SystemReserved + // 0, //BiosBootSpecIsSuppo= rted :1 + // 0, //FunctionKeyNetworkB= ootIsSupported :1 + // 1, //TargetContentDistri= butionEnabled :1 + // 1, //UefiSpecificationSu= pported :1 + // 0, //VirtualMachineSuppo= rted :1 + // 0 //ExtensionByte2Reser= ved :3 + // }, + }, + 0xFF, // SystemBiosMajorRelease; + 0xFF, // SystemBiosMinorRelease; + 0xFF, // EmbeddedControllerFirmwareM= ajorRelease; + 0xFF // EmbeddedControllerFirmwareM= inorRelease; +}; diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFun= ction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFuncti= on.c new file mode 100644 index 000000000000..dd8d062d4903 --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c @@ -0,0 +1,297 @@ +/** @file + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include + +#include "SmbiosMisc.h" + + +typedef struct { + CONST CHAR8* MonthStr; + UINT32 MonthInt; +} MONTH_DESCRIPTION; + +STATIC CONST +MONTH_DESCRIPTION mMonthDescription[] =3D { + { "Jan", 1 }, + { "Feb", 2 }, + { "Mar", 3 }, + { "Apr", 4 }, + { "May", 5 }, + { "Jun", 6 }, + { "Jul", 7 }, + { "Aug", 8 }, + { "Sep", 9 }, + { "Oct", 10 }, + { "Nov", 11 }, + { "Dec", 12 }, + { "???", 1 }, // Use 1 as default month +}; + +/** + Field Filling Function. Transform an EFI_EXP_BASE2_DATA to a byte, with = '64k' + as the unit. + + @param Value Pointer to Base2_Data + + @retval + +**/ +UINT8 +Base2ToByteWith64KUnit ( + IN UINTN Value + ) +{ + UINT8 Size; + + Size =3D ((Value + (SIZE_64KB - 1)) >> 16); + + return Size; +} + +/** + Returns the date and time this file (and firmware) was built. + + @param[out] *Time Pointer to the EFI_TIME structure to fill in. +**/ +VOID +GetReleaseTime ( + OUT EFI_TIME *Time + ) +{ + CONST CHAR8 *ReleaseDate =3D __DATE__; + CONST CHAR8 *ReleaseTime =3D __TIME__; + UINTN i; + + for (i =3D 0; i < 12; i++) { + if (AsciiStrnCmp (ReleaseDate, mMonthDescription[i].MonthStr, 3) =3D= =3D 0) { + break; + } + } + + Time->Month =3D mMonthDescription[i].MonthInt; + Time->Day =3D AsciiStrDecimalToUintn (ReleaseDate + 4); + Time->Year =3D AsciiStrDecimalToUintn (ReleaseDate + 7); + Time->Hour =3D AsciiStrDecimalToUintn (ReleaseTime); + Time->Minute =3D AsciiStrDecimalToUintn (ReleaseTime + 3); + Time->Second =3D AsciiStrDecimalToUintn (ReleaseTime + 6); +} + +/** + Fetches the firmware ('BIOS') release date from the + FirmwareVersionInfo HOB. + + @return The release date as a UTF-16 string +**/ +CHAR16 * +GetBiosReleaseDate ( + VOID + ) +{ + CHAR16 *ReleaseDate; + EFI_TIME BuildTime; + + ReleaseDate =3D AllocateZeroPool ((sizeof (CHAR16)) * SMBIOS_STRING_MAX_= LENGTH); + if (ReleaseDate =3D=3D NULL) { + return NULL; + } + + GetReleaseTime (&BuildTime); + + (VOID)UnicodeSPrintAsciiFormat (ReleaseDate, + (sizeof (CHAR16)) * SMBIOS_STRING_MAX_LENGTH, + "%02d/%02d/%4d", + BuildTime.Month, + BuildTime.Day, + BuildTime.Year + ); + + return ReleaseDate; +} + +/** + Fetches the firmware ('BIOS') version from the + FirmwareVersionInfo HOB. + + @return The version as a UTF-16 string +**/ +CHAR16 * +GetBiosVersion ( + VOID + ) +{ + CHAR16 *ReleaseString; + + ReleaseString =3D + (CHAR16 *)FixedPcdGetPtr (PcdFirmwareVersionString); + + return ReleaseString; +} + + +/** + This function makes boot time changes to the contents of the + MiscBiosVendor (Type 0) record. + + @param RecordData Pointer to SMBIOS table with default = values. + @param Smbios SMBIOS protocol. + + @retval EFI_SUCCESS The SMBIOS table was successfully add= ed. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + @retval EFI_OUT_OF_RESOURCES Failed to allocate required memory. + +**/ +SMBIOS_MISC_TABLE_FUNCTION (MiscBiosVendor) +{ + CHAR8 *OptionalStrStart; + CHAR8 *StrStart; + UINTN VendorStrLen; + UINTN VerStrLen; + UINTN DateStrLen; + UINTN BiosPhysicalSize; + CHAR16 *Vendor; + CHAR16 *Version; + CHAR16 *ReleaseDate; + CHAR16 *Char16String; + EFI_STATUS Status; + EFI_STRING_ID TokenToUpdate; + EFI_STRING_ID TokenToGet; + SMBIOS_TABLE_TYPE0 *SmbiosRecord; + SMBIOS_TABLE_TYPE0 *InputData; + + // + // First check for invalid parameters. + // + if (RecordData =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + InputData =3D (SMBIOS_TABLE_TYPE0 *)RecordData; + + Vendor =3D (CHAR16 *) PcdGetPtr (PcdFirmwareVendor); + + if (StrLen (Vendor) > 0) { + TokenToUpdate =3D STRING_TOKEN (STR_MISC_BIOS_VENDOR); + HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Vendor, NULL); + } + + Version =3D GetBiosVersion(); + + if (StrLen (Version) > 0) { + TokenToUpdate =3D STRING_TOKEN (STR_MISC_BIOS_VERSION); + HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Version, NULL); + } else { + Version =3D (CHAR16 *) PcdGetPtr (PcdFirmwareVersionString); + if (StrLen (Version) > 0) { + TokenToUpdate =3D STRING_TOKEN (STR_MISC_BIOS_VERSION); + HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Version, NULL); + } + } + + Char16String =3D GetBiosReleaseDate (); + if (StrLen(Char16String) > 0) { + TokenToUpdate =3D STRING_TOKEN (STR_MISC_BIOS_RELEASE_DATE); + HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Char16String, NULL); + } + + TokenToGet =3D STRING_TOKEN (STR_MISC_BIOS_VENDOR); + Vendor =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet, NULL); + VendorStrLen =3D StrLen (Vendor); + + TokenToGet =3D STRING_TOKEN (STR_MISC_BIOS_VERSION); + Version =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet, NULL); + VerStrLen =3D StrLen (Version); + + TokenToGet =3D STRING_TOKEN (STR_MISC_BIOS_RELEASE_DATE); + ReleaseDate =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet, NULL= ); + DateStrLen =3D StrLen (ReleaseDate); + + // + // Now update the BiosPhysicalSize + // + BiosPhysicalSize =3D FixedPcdGet32 (PcdFdSize); + + // + // Two zeros following the last string. + // + SmbiosRecord =3D AllocateZeroPool (sizeof (SMBIOS_TABLE_TYPE0) + VendorS= trLen + 1 + + VerStrLen + 1 + + DateStrLen + 1 + 1); + if (SmbiosRecord =3D=3D NULL) { + Status =3D EFI_OUT_OF_RESOURCES; + goto Exit; + } + + (VOID)CopyMem (SmbiosRecord, InputData, sizeof (SMBIOS_TABLE_TYPE0)); + + SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE0); + SmbiosRecord->BiosSegment =3D (UINT16)(FixedPcdGet32 (PcdFdBaseAddress) = / SIZE_64KB); + if (BiosPhysicalSize < SIZE_16MB) { + SmbiosRecord->BiosSize =3D Base2ToByteWith64KUnit (BiosPhysicalSize) -= 1; + SmbiosRecord->ExtendedBiosSize.Size =3D BiosPhysicalSize / SIZE_1MB; + SmbiosRecord->ExtendedBiosSize.Unit =3D 0; // Size is in MB + } else { + SmbiosRecord->BiosSize =3D 0xFF; + if (BiosPhysicalSize > 0x3FFF) { + SmbiosRecord->ExtendedBiosSize.Size =3D BiosPhysicalSize / SIZE_1GB; + SmbiosRecord->ExtendedBiosSize.Unit =3D 1; // Size is in GB + } + } + + SmbiosRecord->SystemBiosMajorRelease =3D (UINT8) (PcdGet16 (PcdSystemBio= sRelease) >> 8); + SmbiosRecord->SystemBiosMinorRelease =3D (UINT8) (PcdGet16 (PcdSystemBio= sRelease) & 0xFF); + + SmbiosRecord->EmbeddedControllerFirmwareMajorRelease =3D (UINT16) + (PcdGet16 (PcdEmbeddedControllerFirmwareRelease) >> 8); + SmbiosRecord->EmbeddedControllerFirmwareMinorRelease =3D (UINT16) + (PcdGet16 (PcdEmbeddedControllerFirmwareRelease) & 0xFF); + + OptionalStrStart =3D (CHAR8 *)(SmbiosRecord + 1); + UnicodeStrToAsciiStrS (Vendor, OptionalStrStart, VendorStrLen + 1); + StrStart =3D OptionalStrStart + VendorStrLen + 1; + UnicodeStrToAsciiStrS (Version, StrStart, VerStrLen + 1); + StrStart +=3D VerStrLen + 1; + UnicodeStrToAsciiStrS (ReleaseDate, StrStart, DateStrLen + 1); + // + // Now we have got the full smbios record, call smbios protocol to add t= his record. + // + Status =3D SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type00 Table Log Failed! %r = \n", + __FUNCTION__, __LINE__, Status)); + } + + FreePool (SmbiosRecord); + +Exit: + if (Vendor !=3D NULL) { + FreePool (Vendor); + } + + if (Version !=3D NULL) { + FreePool (Version); + } + + if (ReleaseDate !=3D NULL) { + FreePool (ReleaseDate); + } + + if (Char16String !=3D NULL) { + FreePool (Char16String); + } + + return Status; +} diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendor.un= i b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendor.uni new file mode 100644 index 000000000000..a3f068cdcca2 --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendor.uni @@ -0,0 +1,18 @@ +/** @file + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +/=3D# + +#string STR_MISC_BIOS_VENDOR #language en-US "Not Specified" +#string STR_MISC_BIOS_VERSION #language en-US "Not Specified" +#string STR_MISC_BIOS_RELEASE_DATE #language en-US "Not Specified" +#string STR_MISC_BIOS_VENDOR #language en-US "Not Specified" +#string STR_MISC_BIOS_RELEASE_DATE #language en-US "12/02/2020" --=20 2.26.2 -=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 (#70310): https://edk2.groups.io/g/devel/message/70310 Mute This Topic: https://groups.io/mt/79679257/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 Mon Nov 25 10:42:56 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+70311+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+70311+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642222; cv=none; d=zohomail.com; s=zohoarc; b=Nlxrgg6O54z+gfgItVSrOi+HP6sFkppLQHIXhkrNkCZM8y0GOGCDT7BROIAtvjAKnoltr89+ybU/CjN3CNsQZZWGx5WzNhBDoTmmz0ZBtrQoOm6PgUx2cIopoMYS9aZbY1POL2rqCh6Qjss2AH57ehkN5tPpZAUKb8v8eA1HmlM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642222; 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=lmKrvMGn0+RIGWIOrRvQs+7KSrKSDwO3zAmKVAy6ebY=; b=idYmmL4CiqiRCP6ZFeoqhEhp8QsnTKgQkcpWZbmb03WZGdiQ94DkLhMcPvc38MustGbhOw+QCPeUq7DRPAX6avg4CaxEMUMXnzWE8x2iqMXfaKBvrtHXeDpHIv6iuNwI5ALZnyAUhWQL5ff1Q39pdYUhxMwB5gKtVHdDe4vCKpI= 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+70311+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642222619230.7159912651025; Thu, 14 Jan 2021 08:37:02 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id zFmNYY1788612xQ7CsFaz7hp; Thu, 14 Jan 2021 08:37:01 -0800 X-Received: from mail-io1-f49.google.com (mail-io1-f49.google.com [209.85.166.49]) by mx.groups.io with SMTP id smtpd.web11.4163.1610642219427306169 for ; Thu, 14 Jan 2021 08:36:59 -0800 X-Received: by mail-io1-f49.google.com with SMTP id b19so9850115ioa.9 for ; Thu, 14 Jan 2021 08:36:59 -0800 (PST) X-Gm-Message-State: 1xuFLGEp9dOIz4icI9R38vlWx1787277AA= X-Google-Smtp-Source: ABdhPJyb/HMmsWuWRvEc2ytWiVuet5fVO/jeW+Gv58J0kXWsj0SLSXV47H6/v3WX4O3ksIy7N/nIQQ== X-Received: by 2002:a6b:7e02:: with SMTP id i2mr1747272iom.185.1610642218405; Thu, 14 Jan 2021 08:36:58 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:57 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu Subject: [edk2-devel] [PATCH v6 16/22] ArmPkg: Add Universal/Smbios/SmbiosMiscDxe/Type01 Date: Thu, 14 Jan 2021 09:36:22 -0700 Message-Id: <20210114163628.31952-17-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642221; bh=BpYCW+2gn2KpuUnsN+bwlQqdYRZj+Qlnlz5tZS3zrsQ=; h=Cc:Date:From:Reply-To:Subject:To; b=uAEx5eVybMV3OpyfAXwBSR+MxHzpqbORU7Hlu5kdABBJqY02SWJsg9n6Jg5l+eb7pC2 XMMby1jjVCWCogLYCGYriqVOIeRvNDIDMc/8pkFB3XnT3woXr+ekNt66gP1FFQDezUzvJ p14XNcp7g5mqO56dJYs/Mpxi/TCjz/fqAQ0= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This code provides information for the SMBIOS Type 1 table. Signed-off-by: Rebecca Cran Reviewed-by: Leif Lindholm Reviewed-by: Samer El-Haj-Mahmoud --- ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type01/MiscSystemManufacturerData.c = | 36 ++++ ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type01/MiscSystemManufacturerFunctio= n.c | 196 ++++++++++++++++++++ ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type01/MiscSystemManufacturer.uni = | 20 ++ 3 files changed, 252 insertions(+) diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type01/MiscSystemManufac= turerData.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type01/MiscSystemManufa= cturerData.c new file mode 100644 index 000000000000..c03b133690ce --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type01/MiscSystemManufacturerDa= ta.c @@ -0,0 +1,36 @@ +/** @file + This file provides Smbios Type1 Data + + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "SmbiosMisc.h" + + +// +// Static (possibly build generated) System Manufacturer data. +// +SMBIOS_MISC_TABLE_DATA(SMBIOS_TABLE_TYPE1, MiscSystemManufacturer) =3D { + { // Hdr + EFI_SMBIOS_TYPE_SYSTEM_INFORMATION, // Type, + 0, // Length, + 0 // Handle + }, + 1, // Manufacturer + 2, // ProductName + 3, // Version + 4, // SerialNumber + { // Uuid + 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,= 0x00} + }, + SystemWakeupTypePowerSwitch, // SystemWakeupType + 5, // SKUNumber, + 6 // Family +}; diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type01/MiscSystemManufac= turerFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type01/MiscSystemMa= nufacturerFunction.c new file mode 100644 index 000000000000..2c69c2593f5d --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type01/MiscSystemManufacturerFu= nction.c @@ -0,0 +1,196 @@ +/** @file + This driver parses the mMiscSubclassDataTable structure and reports + any generated data to smbios. + + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "SmbiosMisc.h" + +/** + This function makes boot time changes to the contents of the + MiscSystemManufacturer (Type 1) record. + + @param RecordData Pointer to SMBIOS table with default = values. + @param Smbios SMBIOS protocol. + + @retval EFI_SUCCESS The SMBIOS table was successfully add= ed. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + @retval EFI_OUT_OF_RESOURCES Failed to allocate required memory. + +**/ +SMBIOS_MISC_TABLE_FUNCTION(MiscSystemManufacturer) +{ + CHAR8 *OptionalStrStart; + CHAR8 *StrStart; + UINTN ManuStrLen; + UINTN VerStrLen; + UINTN PdNameStrLen; + UINTN SerialNumStrLen; + UINTN SKUNumStrLen; + UINTN FamilyStrLen; + UINTN RecordLength; + EFI_STRING Manufacturer; + EFI_STRING ProductName; + EFI_STRING Version; + EFI_STRING SerialNumber; + EFI_STRING SKUNumber; + EFI_STRING Family; + EFI_STRING_ID TokenToGet; + SMBIOS_TABLE_TYPE1 *SmbiosRecord; + SMBIOS_TABLE_TYPE1 *InputData; + EFI_STATUS Status; + EFI_STRING_ID TokenToUpdate; + CHAR16 *Product; + CHAR16 *pVersion; + + Status =3D EFI_SUCCESS; + + // + // First check for invalid parameters. + // + if (RecordData =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + InputData =3D (SMBIOS_TABLE_TYPE1 *)RecordData; + + Product =3D (CHAR16 *) PcdGetPtr (PcdSystemProductName); + if (StrLen (Product) > 0) { + TokenToUpdate =3D STRING_TOKEN (STR_MISC_SYSTEM_PRODUCT_NAME); + HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Product, NULL); + } + + pVersion =3D (CHAR16 *) PcdGetPtr (PcdSystemVersion); + if (StrLen (pVersion) > 0) { + TokenToUpdate =3D STRING_TOKEN (STR_MISC_SYSTEM_VERSION); + HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, pVersion, NULL); + } + + OemUpdateSmbiosInfo (mSmbiosMiscHiiHandle, + STRING_TOKEN (STR_MISC_SYSTEM_SERIAL_NUMBER), + SerialNumType01); + OemUpdateSmbiosInfo (mSmbiosMiscHiiHandle, + STRING_TOKEN (STR_MISC_SYSTEM_MANUFACTURER), + SystemManufacturerType01); + OemUpdateSmbiosInfo (mSmbiosMiscHiiHandle, + STRING_TOKEN (STR_MISC_SYSTEM_SKU_NUMBER), + SkuNumberType01); + OemUpdateSmbiosInfo (mSmbiosMiscHiiHandle, + STRING_TOKEN (STR_MISC_SYSTEM_FAMILY), + FamilyType01); + + TokenToGet =3D STRING_TOKEN (STR_MISC_SYSTEM_MANUFACTURER); + Manufacturer =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet, NUL= L); + ManuStrLen =3D StrLen (Manufacturer); + + TokenToGet =3D STRING_TOKEN (STR_MISC_SYSTEM_PRODUCT_NAME); + ProductName =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet, NUL= L); + PdNameStrLen =3D StrLen (ProductName); + + TokenToGet =3D STRING_TOKEN (STR_MISC_SYSTEM_VERSION); + Version =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet, NULL); + VerStrLen =3D StrLen (Version); + + TokenToGet =3D STRING_TOKEN (STR_MISC_SYSTEM_SERIAL_NUMBER); + SerialNumber =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet, = NULL); + SerialNumStrLen =3D StrLen (SerialNumber); + + TokenToGet =3D STRING_TOKEN (STR_MISC_SYSTEM_SKU_NUMBER); + SKUNumber =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet, NUL= L); + SKUNumStrLen =3D StrLen (SKUNumber); + + TokenToGet =3D STRING_TOKEN (STR_MISC_SYSTEM_FAMILY); + Family =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet, NUL= L); + FamilyStrLen =3D StrLen (Family); + + // + // Two zeros following the last string. + // + RecordLength =3D sizeof (SMBIOS_TABLE_TYPE1) + + ManuStrLen + 1 + + PdNameStrLen + 1 + + VerStrLen + 1 + + SerialNumStrLen + 1 + + SKUNumStrLen + 1 + + FamilyStrLen + 1 + 1; + SmbiosRecord =3D AllocateZeroPool (RecordLength); + + if (SmbiosRecord =3D=3D NULL) { + Status =3D EFI_OUT_OF_RESOURCES; + goto Exit; + } + + (VOID)CopyMem (SmbiosRecord, InputData, sizeof (SMBIOS_TABLE_TYPE1)); + + SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE1); + + CopyGuid(&SmbiosRecord->Uuid, &InputData->Uuid); + + OptionalStrStart =3D (CHAR8 *)(SmbiosRecord + 1); + UnicodeStrToAsciiStrS (Manufacturer, OptionalStrStart, ManuStrLen + 1); + StrStart =3D OptionalStrStart + ManuStrLen + 1; + UnicodeStrToAsciiStrS (ProductName, StrStart, PdNameStrLen + 1); + StrStart +=3D PdNameStrLen + 1; + UnicodeStrToAsciiStrS (Version, StrStart, VerStrLen + 1); + StrStart +=3D VerStrLen + 1; + UnicodeStrToAsciiStrS (SerialNumber, StrStart, SerialNumStrLen + 1); + StrStart +=3D SerialNumStrLen + 1; + UnicodeStrToAsciiStrS (SKUNumber, StrStart, SKUNumStrLen + 1); + StrStart +=3D SKUNumStrLen + 1; + UnicodeStrToAsciiStrS (Family, StrStart, FamilyStrLen + 1); + + // + // Now we have got the full smbios record, call smbios protocol to add t= his record. + // + Status =3D SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type01 Table Log Failed! %r \n= ", + __FUNCTION__, __LINE__, Status)); + } + + FreePool (SmbiosRecord); + +Exit: + if (Manufacturer !=3D NULL) { + FreePool (Manufacturer); + } + + if (ProductName !=3D NULL) { + FreePool (ProductName); + } + + if (Version !=3D NULL) { + FreePool (Version); + } + + if (SerialNumber !=3D NULL) { + FreePool (SerialNumber); + } + + if (SKUNumber !=3D NULL) { + FreePool (SKUNumber); + } + + if (Family !=3D NULL) { + FreePool (Family); + } + + return Status; +} diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type01/MiscSystemManufac= turer.uni b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type01/MiscSystemManufact= urer.uni new file mode 100644 index 000000000000..8038f0e4b0bf --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type01/MiscSystemManufacturer.u= ni @@ -0,0 +1,20 @@ +/** @file + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +/=3D# + +#string STR_MISC_SYSTEM_MANUFACTURER #language en-US "Not Specified" +#string STR_MISC_SYSTEM_PRODUCT_NAME #language en-US "Not Specified" +#string STR_MISC_SYSTEM_PRODUCT_NAME #language en-US "Not Specified" +#string STR_MISC_SYSTEM_VERSION #language en-US "Not Specified" +#string STR_MISC_SYSTEM_SERIAL_NUMBER #language en-US "Not Specified" +#string STR_MISC_SYSTEM_SKU_NUMBER #language en-US "Not Specified" +#string STR_MISC_SYSTEM_FAMILY #language en-US "Not Specified" --=20 2.26.2 -=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 (#70311): https://edk2.groups.io/g/devel/message/70311 Mute This Topic: https://groups.io/mt/79679261/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 Mon Nov 25 10:42:56 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+70312+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+70312+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642225; cv=none; d=zohomail.com; s=zohoarc; b=J/1sc/R6TUTM4Gt49igR6LSukmLVTv87iSKXgdMbLdiVNxC1p+NsD7ufpvdfjRRt1Odc33WZODfBXdDnJ3jKEE38mHGsqGbJIbrkMbOwf/9LIyD36ZqzbNh6uhqAEn1GGO4gAIQoo25J9Mvuk93wFGH9BfH+N0u5ayG6KPpBmNE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642225; 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=H7598TcowWj0ZydrmQaazUjVifsA+oiMKYsg7EOHYSg=; b=GYSZnVko07VCSzajcHgJN1fZt8DfObDTdhe6UnMoC5Ouaf8Rg1whKQwtHnUfNkxfUA9WTkprphgVKCFTD1bvS17GKnqbAA9mLm53pNK2k7vh+jjtbmxyewhdbEHyNOVG50cgbEmph5p9cWu0vUacFhxLEYGZ7KpzJXVIIfL9eYE= 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+70312+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642225434422.06756468852404; Thu, 14 Jan 2021 08:37:05 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id Kf1WYY1788612xnOOGXNeKyj; Thu, 14 Jan 2021 08:37:04 -0800 X-Received: from mail-io1-f54.google.com (mail-io1-f54.google.com [209.85.166.54]) by mx.groups.io with SMTP id smtpd.web12.4181.1610642220837674537 for ; Thu, 14 Jan 2021 08:37:00 -0800 X-Received: by mail-io1-f54.google.com with SMTP id r9so12347988ioo.7 for ; Thu, 14 Jan 2021 08:37:00 -0800 (PST) X-Gm-Message-State: AbEw55qCY9bqtM981vU7TokDx1787277AA= X-Google-Smtp-Source: ABdhPJxK1Tw5KW4rXHyvx0O/AYpFJ+SQ5LYyLYLvzaGdm1RlI/yo1L+zjYlePqhSwrCYtgFinBidlA== X-Received: by 2002:a05:6638:2192:: with SMTP id s18mr1673002jaj.18.1610642219886; Thu, 14 Jan 2021 08:36:59 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:36:59 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu Subject: [edk2-devel] [PATCH v6 17/22] ArmPkg: Add Universal/Smbios/SmbiosMiscDxe/Type02 Date: Thu, 14 Jan 2021 09:36:23 -0700 Message-Id: <20210114163628.31952-18-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642224; bh=sdgkWZcz9x9pzcFOfaTm4PXG1Swv8majG64Ca0UtK6Y=; h=Cc:Date:From:Reply-To:Subject:To; b=eO11d14JDhY5whBEzyT0UPGXYPus/fH2nrEvxnvWVIrbW64PADEF7w3NXYVaVQM1IZm GY7mkleUI6ANcRs+42TyCEgzuAYpF3kpY5ve1M166c+JL41n2xYY2euJXRAk6elWw596z SzwW6WfwHCinNkrLXdR4YexWeuO1iODj7sA= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This code provides information for the SMBIOS Type 2 table. Signed-off-by: Rebecca Cran Reviewed-by: Leif Lindholm Reviewed-by: Samer El-Haj-Mahmoud --- ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type02/MiscBaseBoardManufacturerData= .c | 46 ++++ ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type02/MiscBaseBoardManufacturerFunc= tion.c | 230 ++++++++++++++++++++ ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type02/MiscBaseBoardManufacturer.uni= | 20 ++ 3 files changed, 296 insertions(+) diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type02/MiscBaseBoardManu= facturerData.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type02/MiscBaseBoard= ManufacturerData.c new file mode 100644 index 000000000000..dfe1f2d45b92 --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type02/MiscBaseBoardManufacture= rData.c @@ -0,0 +1,46 @@ +/** @file + + This file provide OEM to define Smbios Type2 Data + + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "SmbiosMisc.h" + +// +// Static (possibly build generated) Chassis Manufacturer data. +// +SMBIOS_MISC_TABLE_DATA(SMBIOS_TABLE_TYPE2, MiscBaseBoardManufacturer) =3D { + { // Hdr + EFI_SMBIOS_TYPE_BASEBOARD_INFORMATION, // Type, + 0, // Length, + 0 // Handle + }, + 1, // BaseBoardManu= facturer + 2, // BaseBoardProd= uctName + 3, // BaseBoardVers= ion + 4, // BaseBoardSeri= alNumber + 5, // BaseBoardAsse= tTag + { // FeatureFlag + 1, // Motherboard = :1 + 0, // RequiresDaugh= terCard :1 + 0, // Removable = :1 + 1, // Replaceable = :1 + 0, // HotSwappable = :1 + 0 // Reserved = :3 + }, + 6, // BaseBoardChas= sisLocation + 0, // ChassisHandle; + BaseBoardTypeMotherBoard, // BoardType; + 0, // NumberOfConta= inedObjectHandles; + { + 0 + } // ContainedObje= ctHandles[1]; +}; diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type02/MiscBaseBoardManu= facturerFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type02/MiscBaseB= oardManufacturerFunction.c new file mode 100644 index 000000000000..097777a23904 --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type02/MiscBaseBoardManufacture= rFunction.c @@ -0,0 +1,230 @@ +/** @file + This driver parses the mSmbiosMiscDataTable structure and reports + any generated data using SMBIOS protocol. + + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "SmbiosMisc.h" + + +/** + This function makes boot time changes to the contents of the + MiscBaseBoardManufacturer (Type 2) record. + + @param RecordData Pointer to SMBIOS table with default = values. + @param Smbios SMBIOS protocol. + + @retval EFI_SUCCESS The SMBIOS table was successfully add= ed. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + @retval EFI_OUT_OF_RESOURCES Failed to allocate required memory. + +**/ +SMBIOS_MISC_TABLE_FUNCTION(MiscBaseBoardManufacturer) +{ + CHAR8 *OptionalStrStart; + CHAR8 *StrStart; + UINTN RecordLength; + UINTN ManuStrLen; + UINTN ProductNameStrLen; + UINTN VerStrLen; + UINTN SerialNumStrLen; + UINTN AssetTagStrLen; + UINTN ChassisLocaStrLen; + UINTN HandleCount; + UINT16 *HandleArray; + CHAR16 *BaseBoardManufacturer; + CHAR16 *BaseBoardProductName; + CHAR16 *Version; + EFI_STRING SerialNumber; + EFI_STRING AssetTag; + EFI_STRING ChassisLocation; + EFI_STRING_ID TokenToGet; + SMBIOS_TABLE_TYPE2 *SmbiosRecord; + SMBIOS_TABLE_TYPE2 *InputData; + EFI_STATUS Status; + + EFI_STRING_ID TokenToUpdate; + + HandleCount =3D 0; + HandleArray =3D NULL; + InputData =3D NULL; + + // + // First check for invalid parameters. + // + if (RecordData =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + InputData =3D (SMBIOS_TABLE_TYPE2*)RecordData; + + BaseBoardManufacturer =3D (CHAR16 *) PcdGetPtr (PcdBaseBoardManufacturer= ); + if (StrLen (BaseBoardManufacturer) > 0) { + TokenToUpdate =3D STRING_TOKEN (STR_MISC_BASE_BOARD_MANUFACTURER); + HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, BaseBoardManufactur= er, NULL); + } + + BaseBoardProductName =3D (CHAR16 *) PcdGetPtr (PcdBaseBoardProductName); + if (StrLen (BaseBoardProductName) > 0) { + TokenToUpdate =3D STRING_TOKEN (STR_MISC_BASE_BOARD_PRODUCT_NAME); + HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, BaseBoardProductNam= e, NULL); + } + + Version =3D (CHAR16 *) PcdGetPtr (PcdBaseBoardVersion); + if (StrLen (Version) > 0) { + TokenToUpdate =3D STRING_TOKEN (STR_MISC_BASE_BOARD_VERSION); + HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Version, NULL); + } + + OemUpdateSmbiosInfo (mSmbiosMiscHiiHandle, + STRING_TOKEN (STR_MISC_BASE_BOARD_ASSET_TAG), + AssertTagType02 + ); + OemUpdateSmbiosInfo (mSmbiosMiscHiiHandle, + STRING_TOKEN (STR_MISC_BASE_BOARD_SERIAL_NUMBER), + SerialNumberType02 + ); + OemUpdateSmbiosInfo (mSmbiosMiscHiiHandle, + STRING_TOKEN (STR_MISC_BASE_BOARD_MANUFACTURER), + BoardManufacturerType02 + ); + OemUpdateSmbiosInfo (mSmbiosMiscHiiHandle, + STRING_TOKEN (STR_MISC_BASE_BOARD_SERIAL_NUMBER), + SerialNumberType02 + ); + OemUpdateSmbiosInfo (mSmbiosMiscHiiHandle, + STRING_TOKEN (STR_MISC_BASE_BOARD_SKU_NUMBER), + SerialNumberType02 + ); + OemUpdateSmbiosInfo (mSmbiosMiscHiiHandle, + STRING_TOKEN (STR_MISC_BASE_BOARD_CHASSIS_LOCATION), + ChassisLocationType02 + ); + + TokenToGet =3D STRING_TOKEN (STR_MISC_BASE_BOARD_MANUFACTURER); + BaseBoardManufacturer =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenT= oGet, NULL); + ManuStrLen =3D StrLen (BaseBoardManufacturer); + + TokenToGet =3D STRING_TOKEN (STR_MISC_BASE_BOARD_PRODUCT_NAME); + BaseBoardProductName =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenTo= Get, NULL); + ProductNameStrLen =3D StrLen (BaseBoardProductName); + + TokenToGet =3D STRING_TOKEN (STR_MISC_BASE_BOARD_VERSION); + Version =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet, NULL); + VerStrLen =3D StrLen (Version); + + TokenToGet =3D STRING_TOKEN (STR_MISC_BASE_BOARD_SERIAL_NUMBER); + SerialNumber =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet, NUL= L); + SerialNumStrLen =3D StrLen (SerialNumber); + + TokenToGet =3D STRING_TOKEN (STR_MISC_BASE_BOARD_ASSET_TAG); + AssetTag =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet, NULL); + AssetTagStrLen =3D StrLen (AssetTag); + + TokenToGet =3D STRING_TOKEN (STR_MISC_BASE_BOARD_CHASSIS_LOCATION); + ChassisLocation =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet, = NULL); + ChassisLocaStrLen =3D StrLen (ChassisLocation); + + // + // Two zeros following the last string. + // + RecordLength =3D sizeof (SMBIOS_TABLE_TYPE2) + + ManuStrLen + 1 + + ProductNameStrLen + 1 + + VerStrLen + 1 + + SerialNumStrLen + 1 + + AssetTagStrLen + 1 + + ChassisLocaStrLen + 1 + 1; + SmbiosRecord =3D AllocateZeroPool (RecordLength); + if (SmbiosRecord =3D=3D NULL) { + Status =3D EFI_OUT_OF_RESOURCES; + goto Exit; + } + + (VOID)CopyMem (SmbiosRecord, InputData, sizeof (SMBIOS_TABLE_TYPE2)); + SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE2); + + // + // Update Contained objects Handle + // + SmbiosRecord->NumberOfContainedObjectHandles =3D 0; + SmbiosMiscGetLinkTypeHandle (EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE, &HandleAr= ray, + &HandleCount); + // It's assumed there's at most a single chassis + ASSERT (HandleCount < 2); + if (HandleCount > 0) { + SmbiosRecord->ChassisHandle =3D HandleArray[0]; + } + + FreePool (HandleArray); + + OptionalStrStart =3D (CHAR8 *)(SmbiosRecord + 1); + UnicodeStrToAsciiStrS (BaseBoardManufacturer, OptionalStrStart, ManuStrL= en + 1); + + StrStart =3D OptionalStrStart + ManuStrLen + 1; + UnicodeStrToAsciiStrS (BaseBoardProductName, StrStart, ProductNameStrLen= + 1); + + StrStart +=3D ProductNameStrLen + 1; + UnicodeStrToAsciiStrS (Version, StrStart, VerStrLen + 1); + + StrStart +=3D VerStrLen + 1; + UnicodeStrToAsciiStrS (SerialNumber, StrStart, SerialNumStrLen + 1); + + StrStart +=3D SerialNumStrLen + 1; + UnicodeStrToAsciiStrS (AssetTag, StrStart, AssetTagStrLen + 1); + + StrStart +=3D AssetTagStrLen + 1; + UnicodeStrToAsciiStrS (ChassisLocation, StrStart, ChassisLocaStrLen + 1); + + Status =3D SmbiosMiscAddRecord ((UINT8 *)SmbiosRecord, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type02 Table Log Failed! %r \n= ", + __FUNCTION__, __LINE__, Status)); + } + + FreePool (SmbiosRecord); + +Exit: + if (BaseBoardManufacturer !=3D NULL) { + FreePool (BaseBoardManufacturer); + } + + if (BaseBoardProductName !=3D NULL) { + FreePool (BaseBoardProductName); + } + + if (Version !=3D NULL) { + FreePool (Version); + } + + if (SerialNumber !=3D NULL) { + FreePool (SerialNumber); + } + + if (AssetTag !=3D NULL) { + FreePool (AssetTag); + } + + if (ChassisLocation !=3D NULL) { + FreePool (ChassisLocation); + } + + return 0; +} diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type02/MiscBaseBoardManu= facturer.uni b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type02/MiscBaseBoardMa= nufacturer.uni new file mode 100644 index 000000000000..0f0fb1f93bbb --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type02/MiscBaseBoardManufacture= r.uni @@ -0,0 +1,20 @@ +/** @file + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +/=3D# + +#string STR_MISC_BASE_BOARD_MANUFACTURER #language en-US "Not Specifi= ed" +#string STR_MISC_BASE_BOARD_PRODUCT_NAME #language en-US "Not Specifi= ed" +#string STR_MISC_BASE_BOARD_VERSION #language en-US "Not Specifi= ed" +#string STR_MISC_BASE_BOARD_SERIAL_NUMBER #language en-US "Not Specifi= ed" +#string STR_MISC_BASE_BOARD_ASSET_TAG #language en-US "Not Specifi= ed" +#string STR_MISC_BASE_BOARD_CHASSIS_LOCATION #language en-US "Not Specifi= ed" +#string STR_MISC_BASE_BOARD_SKU_NUMBER #language en-US "Not Specifi= ed" --=20 2.26.2 -=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 (#70312): https://edk2.groups.io/g/devel/message/70312 Mute This Topic: https://groups.io/mt/79679262/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 Mon Nov 25 10:42:56 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+70313+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+70313+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642224; cv=none; d=zohomail.com; s=zohoarc; b=UJSe62866vjP+a1VO1N3jjO0ccogf6eJ6FMLnUIdTKAGRRiulaZfU0NrUvZ0XGAPclFbwehSZBDfL+9ZFtW+FbsVNyCU/VdZ/8Uh2Xdy9+1+gslYIlwKK5y9HXbpLAZtgV1T5ucqbXDk7ufQr39740Yx9RO9IOEhdWULS0+/L9A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642224; 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=gzQoPvCsmTpq8f3Fa455L8ryN2x5k/DJYQ93T4gSTlg=; b=Hi1GjliK5NWSRehpmgNyhRwdq9IaaZTk+VqQXf5od5ys0DW4DJr15LeyUnlqC6zXZrSOI5PjsOBXoflPtR6wCPjRWNrr/Nx2iwNaCoCrJO4l/ThSdtxFUqvi1vaVcDpaWD62rLTK8drlXyQSif8KRrcqhgr/fJmkfq0/JM0BKHs= 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+70313+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642224523645.2559972198554; Thu, 14 Jan 2021 08:37:04 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id CV3iYY1788612xbvnxA9trph; Thu, 14 Jan 2021 08:37:04 -0800 X-Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) by mx.groups.io with SMTP id smtpd.web11.4166.1610642222598056779 for ; Thu, 14 Jan 2021 08:37:02 -0800 X-Received: by mail-io1-f52.google.com with SMTP id n4so12299476iow.12 for ; Thu, 14 Jan 2021 08:37:02 -0800 (PST) X-Gm-Message-State: 0RICBqBo755UT4UP9yowyfAjx1787277AA= X-Google-Smtp-Source: ABdhPJxpLksE38oxHLvLkQkjljHYfHqKE8iS4GODNXzgJ7R1Li1e2PQANM+I7fH+OtXh8fHONpdAuQ== X-Received: by 2002:a05:6602:20ca:: with SMTP id 10mr5742631ioz.51.1610642221549; Thu, 14 Jan 2021 08:37:01 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.36.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:37:00 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu Subject: [edk2-devel] [PATCH v6 18/22] ArmPkg: Add Universal/Smbios/SmbiosMiscDxe/Type03 Date: Thu, 14 Jan 2021 09:36:24 -0700 Message-Id: <20210114163628.31952-19-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642224; bh=MQhdEpYMWEjzd0weLY7vzVFa4p4+2DAg7jAslGmHnOI=; h=Cc:Date:From:Reply-To:Subject:To; b=ksJIZ0KXQp0SxARM7DYxmuVGBU1bAjTFXNSwHIgpyOH36FgBnLKGHtnZhD+RcbO/28j 6a/uvE5HMV+joYUkXBSjo4AjVYDjs+c4X1lmAtpriB+Pe1cypU14NbypP3GhVB6pOwKQd rj45LNNHcIN3ZC8N0PkpTKZKwj9maXEaIMY= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This code provides information for the SMBIOS Type 3 table. Signed-off-by: Rebecca Cran Reviewed-by: Leif Lindholm Reviewed-by: Samer El-Haj-Mahmoud --- ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManufacturerData.c= | 52 +++++ ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManufacturerFuncti= on.c | 224 ++++++++++++++++++++ ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManufacturer.uni = | 18 ++ 3 files changed, 294 insertions(+) diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManufa= cturerData.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManu= facturerData.c new file mode 100644 index 000000000000..137bd941d0b1 --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManufacturerD= ata.c @@ -0,0 +1,52 @@ +/** @file + This file provides Smbios Type3 Data + + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "SmbiosMisc.h" + + +// +// Static (possibly build generated) Chassis Manufacturer data. +// +SMBIOS_MISC_TABLE_DATA(SMBIOS_TABLE_TYPE3, MiscChassisManufacturer) =3D { + { // Hdr + EFI_SMBIOS_TYPE_SYSTEM_ENCLOSURE, // Type, + 0, // Length, + 0 // Handle + }, + 1, // Manufactrurer + MiscChassisTypeMainServerChassis, // Type + 2, // Version + 3, // SerialNumber + 4, // AssetTag + ChassisStateSafe, // BootupState + ChassisStateSafe, // PowerSupplySt= ate + ChassisStateSafe, // ThermalState + ChassisSecurityStatusNone, // SecurityState + { + 0, // OemDefined[0] + 0, // OemDefined[1] + 0, // OemDefined[2] + 0 // OemDefined[3] + }, + 2, // Height + 1, // NumberofPower= Cords + 0, // ContainedElem= entCount + 0, // ContainedElem= entRecordLength + { // ContainedElem= ents[0] + { + 0, // ContainedEl= ementType + 0, // ContainedEl= ementMinimum + 0 // ContainedEl= ementMaximum + } + } +}; diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManufa= cturerFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassis= ManufacturerFunction.c new file mode 100644 index 000000000000..e6adbceba2d5 --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManufacturerF= unction.c @@ -0,0 +1,224 @@ +/** @file + This driver parses the mMiscSubclassDataTable structure and reports + any generated data to smbios. + + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "SmbiosMisc.h" + +/** + * Returns the chassis type in SMBIOS format. + * + * @return Chassis type +**/ +UINT8 +GetChassisType ( + VOID + ) +{ + EFI_STATUS Status; + UINT8 ChassisType; + + Status =3D OemGetChassisType (&ChassisType); + if (EFI_ERROR (Status)) { + return 0; + } + + return ChassisType; +} + +/** + This function makes boot time changes to the contents of the + MiscChassisManufacturer (Type 3) record. + + @param RecordData Pointer to SMBIOS table with default = values. + @param Smbios SMBIOS protocol. + + @retval EFI_SUCCESS The SMBIOS table was successfully add= ed. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + @retval EFI_OUT_OF_RESOURCES Failed to allocate required memory. + +**/ +SMBIOS_MISC_TABLE_FUNCTION(MiscChassisManufacturer) +{ + CHAR8 *OptionalStrStart; + CHAR8 *StrStart; + UINTN RecordLength; + UINTN ManuStrLen; + UINTN VerStrLen; + UINTN AssertTagStrLen; + UINTN SerialNumStrLen; + UINTN ChaNumStrLen; + EFI_STRING Manufacturer; + EFI_STRING Version; + EFI_STRING SerialNumber; + EFI_STRING AssertTag; + EFI_STRING ChassisSkuNumber; + EFI_STRING_ID TokenToGet; + SMBIOS_TABLE_TYPE3 *SmbiosRecord; + SMBIOS_TABLE_TYPE3 *InputData; + EFI_STATUS Status; + + UINT8 ContainedElementCount; + CONTAINED_ELEMENT ContainedElements; + UINT8 ExtendLength; + + UINT8 ChassisType; + + ExtendLength =3D 0; + + // + // First check for invalid parameters. + // + if (RecordData =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + InputData =3D (SMBIOS_TABLE_TYPE3 *)RecordData; + + OemUpdateSmbiosInfo ( + mSmbiosMiscHiiHandle, + STRING_TOKEN (STR_MISC_CHASSIS_ASSET_TAG), + AssetTagType03 + ); + OemUpdateSmbiosInfo ( + mSmbiosMiscHiiHandle, + STRING_TOKEN (STR_MISC_CHASSIS_SERIAL_NUMBER), + SerialNumberType03 + ); + OemUpdateSmbiosInfo ( + mSmbiosMiscHiiHandle, + STRING_TOKEN (STR_MISC_CHASSIS_VERSION), + VersionType03 + ); + OemUpdateSmbiosInfo ( + mSmbiosMiscHiiHandle, + STRING_TOKEN (STR_MISC_CHASSIS_MANUFACTURER), + ManufacturerType03 + ); + OemUpdateSmbiosInfo ( + mSmbiosMiscHiiHandle, + STRING_TOKEN (STR_MISC_CHASSIS_SKU_NUMBER), + SkuNumberType03 + ); + + TokenToGet =3D STRING_TOKEN (STR_MISC_CHASSIS_MANUFACTURER); + Manufacturer =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet, NUL= L); + ManuStrLen =3D StrLen (Manufacturer); + + TokenToGet =3D STRING_TOKEN (STR_MISC_CHASSIS_VERSION); + Version =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet, NULL); + VerStrLen =3D StrLen (Version); + + TokenToGet =3D STRING_TOKEN (STR_MISC_CHASSIS_SERIAL_NUMBER); + SerialNumber =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet, NUL= L); + SerialNumStrLen =3D StrLen (SerialNumber); + + TokenToGet =3D STRING_TOKEN (STR_MISC_CHASSIS_ASSET_TAG); + AssertTag =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet, NULL); + AssertTagStrLen =3D StrLen (AssertTag); + + TokenToGet =3D STRING_TOKEN (STR_MISC_CHASSIS_SKU_NUMBER); + ChassisSkuNumber =3D HiiGetPackageString (&gEfiCallerIdGuid, TokenToGet,= NULL); + ChaNumStrLen =3D StrLen (ChassisSkuNumber); + + ContainedElementCount =3D InputData->ContainedElementCount; + + if (ContainedElementCount > 1) { + ExtendLength =3D (ContainedElementCount - 1) * sizeof (CONTAINED_ELEME= NT); + } + + // + // Two zeros following the last string. + // + RecordLength =3D sizeof (SMBIOS_TABLE_TYPE3) + + ExtendLength + 1 + + ManuStrLen + 1 + + VerStrLen + 1 + + SerialNumStrLen + 1 + + AssertTagStrLen + 1 + + ChaNumStrLen + 1 + 1; + SmbiosRecord =3D AllocateZeroPool (RecordLength); + if (SmbiosRecord =3D=3D NULL) { + Status =3D EFI_OUT_OF_RESOURCES; + goto Exit; + } + + (VOID)CopyMem (SmbiosRecord, InputData, sizeof (SMBIOS_TABLE_TYPE3)); + + SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE3) + ExtendLength = + 1; + + ChassisType =3D GetChassisType (); + if (ChassisType !=3D 0) { + SmbiosRecord->Type =3D ChassisType; + } + + //ContainedElements + ASSERT (ContainedElementCount < 2); + (VOID)CopyMem (SmbiosRecord + 1, &ContainedElements, ExtendLength); + + //ChassisSkuNumber + *((UINT8 *)SmbiosRecord + sizeof (SMBIOS_TABLE_TYPE3) + ExtendLength) = =3D 5; + + OptionalStrStart =3D (CHAR8 *)((UINT8 *)SmbiosRecord + sizeof (SMBIOS_TA= BLE_TYPE3) + + ExtendLength + 1); + UnicodeStrToAsciiStrS (Manufacturer, OptionalStrStart, ManuStrLen + 1); + StrStart =3D OptionalStrStart + ManuStrLen + 1; + UnicodeStrToAsciiStrS (Version, StrStart, VerStrLen + 1); + StrStart +=3D VerStrLen + 1; + UnicodeStrToAsciiStrS (SerialNumber, StrStart, SerialNumStrLen + 1); + StrStart +=3D SerialNumStrLen + 1; + UnicodeStrToAsciiStrS (AssertTag, StrStart, AssertTagStrLen + 1); + StrStart +=3D AssertTagStrLen + 1; + UnicodeStrToAsciiStrS (ChassisSkuNumber, StrStart, ChaNumStrLen + 1); + // + // Now we have got the full smbios record, call smbios protocol to add t= his record. + // + Status =3D SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type03 Table Log Failed! %r \n= ", + __FUNCTION__, __LINE__, Status)); + } + + FreePool (SmbiosRecord); + +Exit: + if (Manufacturer !=3D NULL) { + FreePool (Manufacturer); + } + + if (Version !=3D NULL) { + FreePool (Version); + } + + if (SerialNumber !=3D NULL) { + FreePool (SerialNumber); + } + + if (AssertTag !=3D NULL) { + FreePool (AssertTag); + } + + if (ChassisSkuNumber !=3D NULL) { + FreePool (ChassisSkuNumber); + } + + return 0; +} diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManufa= cturer.uni b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManufa= cturer.uni new file mode 100644 index 000000000000..9512b354fe9a --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type03/MiscChassisManufacturer.= uni @@ -0,0 +1,18 @@ +/** @file + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +/=3D# + +#string STR_MISC_CHASSIS_MANUFACTURER #language en-US "Not Specified" +#string STR_MISC_CHASSIS_VERSION #language en-US "Not Specified" +#string STR_MISC_CHASSIS_SERIAL_NUMBER #language en-US "Not Specified" +#string STR_MISC_CHASSIS_ASSET_TAG #language en-US "Not Specified" +#string STR_MISC_CHASSIS_SKU_NUMBER #language en-US "Not Specified" --=20 2.26.2 -=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 (#70313): https://edk2.groups.io/g/devel/message/70313 Mute This Topic: https://groups.io/mt/79679263/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 Mon Nov 25 10:42:56 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+70314+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+70314+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642230; cv=none; d=zohomail.com; s=zohoarc; b=IgiRL6xWyR2JjQ0ESnIvnlxIkHvkY8czZyWQRdv5P6BRoHM/EconFbfYhry1IvHu8XFfQgU9j22B/42cZDPZOrg4t54RaDSM1IKwsedyIQhqBm/OuYLeOJIZb9ov/j8pIOjXRIYeQYckQwjsdOGOFxoSV/WGxPD1/jqnxrd2aSc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642230; 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=JIHZ4VMtq1MGKFvOfjAOZxSfNq39ARyb/3cKeuLu2Ok=; b=T0KMtezOl/KdsnGd6m8gk40SXOtkAuyjnh4w80WE/7DaFJEGSLPz5IK1BlP82wQMtnam+1YiIfCuTYs98UnGB951Njub4hVUNZlFIMJDvosZxwZrZu2tYC63ewc1QDHZmh04oPbPGWqIxM3q5xE9Z1HLyJNuvFs4sTD9xbigebM= 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+70314+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642230614855.9886685323221; Thu, 14 Jan 2021 08:37:10 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 4RrTYY1788612x1ZRkkPutjt; Thu, 14 Jan 2021 08:37:10 -0800 X-Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) by mx.groups.io with SMTP id smtpd.web09.4103.1610642223917209768 for ; Thu, 14 Jan 2021 08:37:04 -0800 X-Received: by mail-io1-f52.google.com with SMTP id n4so12299614iow.12 for ; Thu, 14 Jan 2021 08:37:03 -0800 (PST) X-Gm-Message-State: X0KPRon4OadbJFcqFgVCzJOlx1787277AA= X-Google-Smtp-Source: ABdhPJxHzcAGRcxRF8K/Akgkbpq6EihnstZUlw8l6B8CgbkOWJEQcZ8kAhgRvMqLIw/ZZw1l6uhpYQ== X-Received: by 2002:a02:7428:: with SMTP id o40mr7051349jac.130.1610642222912; Thu, 14 Jan 2021 08:37:02 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.37.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:37:02 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu Subject: [edk2-devel] [PATCH v6 19/22] ArmPkg: Add Universal/Smbios/SmbiosMiscDxe/Type13 Date: Thu, 14 Jan 2021 09:36:25 -0700 Message-Id: <20210114163628.31952-20-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642230; bh=taQP979svRK0qLBr0IHk0Wmg3W31ZbxCbpla6Bo017s=; h=Cc:Date:From:Reply-To:Subject:To; b=boAYBmm4pjPBtgZiT7jryZDNbMfBzQ9MDPNVwB2mLDYyunppPh3PZQ6/qU1buopW0Gr YE3TKz+ZA/TBLgbs7rkEZVwKKhcrbHCnLjVMyneNxdufid93lfWX4ItYKsUYysSRgQW16 3j2S9Mqxbf0NbRY2isezrIQkh7Yi82M3Ep0= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This code provides information for the SMBIOS Type 13 table. Signed-off-by: Rebecca Cran Reviewed-by: Leif Lindholm --- ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNumberOfInstallableLangua= gesData.c | 33 ++++ ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNumberOfInstallableLangua= gesFunction.c | 166 ++++++++++++++++++++ ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNumberOfInstallableLangua= ges.uni | 43 +++++ 3 files changed, 242 insertions(+) diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNumberOfInsta= llableLanguagesData.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNu= mberOfInstallableLanguagesData.c new file mode 100644 index 000000000000..97d7303d1a33 --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNumberOfInstallableL= anguagesData.c @@ -0,0 +1,33 @@ +/** @file + This file provides Smbios Type13 Data + + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "SmbiosMisc.h" + +// +// Static (possibly build generated) Bios Vendor data. +// + +SMBIOS_MISC_TABLE_DATA(SMBIOS_TABLE_TYPE13, MiscNumberOfInstallableLanguag= es) =3D +{ + { // Hdr + EFI_SMBIOS_TYPE_BIOS_LANGUAGE_INFORMATION, // Type, + 0, // Length, + 0 // Handle + }, + 0, // InstallableLang= uages + 0, // Flags + { + 0 // Reserved[15] + }, + 1 // CurrentLanguage +}; diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNumberOfInsta= llableLanguagesFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/Mi= scNumberOfInstallableLanguagesFunction.c new file mode 100644 index 000000000000..19b60ed71f8c --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNumberOfInstallableL= anguagesFunction.c @@ -0,0 +1,166 @@ +/** @file + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "SmbiosMisc.h" + +/** + Get next language from language code list (with separator ';'). + + @param LangCode Input: point to first language in the list. On + Otput: point to next language in the list, or + NULL if no more language in the list. + @param Lang The first language in the list. + +**/ +VOID +EFIAPI +GetNextLanguage ( + IN OUT CHAR8 **LangCode, + OUT CHAR8 *Lang + ) +{ + UINTN Index; + CHAR8 *StringPtr; + + if (LangCode =3D=3D NULL || *LangCode =3D=3D NULL || Lang =3D=3D NULL) { + return; + } + + Index =3D 0; + StringPtr =3D *LangCode; + while (StringPtr[Index] !=3D 0 && StringPtr[Index] !=3D ';') { + Index++; + } + + (VOID)CopyMem (Lang, StringPtr, Index); + Lang[Index] =3D 0; + + if (StringPtr[Index] =3D=3D ';') { + Index++; + } + *LangCode =3D StringPtr + Index; +} + +/** + This function returns the number of supported languages on HiiHandle. + + @param HiiHandle The HII package list handle. + + @retval The number of supported languages. + +**/ +UINT16 +EFIAPI +GetSupportedLanguageNumber ( + IN EFI_HII_HANDLE HiiHandle + ) +{ + CHAR8 *Lang; + CHAR8 *Languages; + CHAR8 *LanguageString; + UINT16 LangNumber; + + Languages =3D HiiGetSupportedLanguages (HiiHandle); + if (Languages =3D=3D NULL) { + return 0; + } + + LangNumber =3D 0; + Lang =3D AllocatePool (AsciiStrSize (Languages)); + if (Lang !=3D NULL) { + LanguageString =3D Languages; + while (*LanguageString !=3D 0) { + GetNextLanguage (&LanguageString, Lang); + LangNumber++; + } + FreePool (Lang); + } + FreePool (Languages); + return LangNumber; +} + + +/** + This function makes boot time changes to the contents of the + MiscNumberOfInstallableLanguages (Type 13) record. + + @param RecordData Pointer to SMBIOS table with default = values. + @param Smbios SMBIOS protocol. + + @retval EFI_SUCCESS The SMBIOS table was successfully add= ed. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + @retval EFI_OUT_OF_RESOURCES Failed to allocate required memory. + +**/ +SMBIOS_MISC_TABLE_FUNCTION(MiscNumberOfInstallableLanguages) +{ + UINTN LangStrLen; + CHAR8 CurrentLang[SMBIOS_STRING_MAX_= LENGTH + 1]; + CHAR8 *OptionalStrStart; + EFI_STATUS Status; + SMBIOS_TABLE_TYPE13 *SmbiosRecord; + SMBIOS_TABLE_TYPE13 *InputData; + + InputData =3D NULL; + + // + // First check for invalid parameters. + // + if (RecordData =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + InputData =3D (SMBIOS_TABLE_TYPE13 *)RecordData; + + InputData->InstallableLanguages =3D GetSupportedLanguageNumber (mSmbiosM= iscHiiHandle); + + // + // Try to check if current langcode matches with the langcodes in instal= led languages + // + ZeroMem (CurrentLang, SMBIOS_STRING_MAX_LENGTH - 1); + (VOID)AsciiStrCpyS (CurrentLang, SMBIOS_STRING_MAX_LENGTH - 1, "en|US|is= o8859-1"); + LangStrLen =3D AsciiStrLen (CurrentLang); + + // + // Two zeros following the last string. + // + SmbiosRecord =3D AllocateZeroPool (sizeof (SMBIOS_TABLE_TYPE13) + LangSt= rLen + 1 + 1); + if (SmbiosRecord =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + (VOID)CopyMem (SmbiosRecord, InputData, sizeof (SMBIOS_TABLE_TYPE13)); + + SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE13); + + OptionalStrStart =3D (CHAR8 *)(SmbiosRecord + 1); + (VOID)AsciiStrCpyS (OptionalStrStart, SMBIOS_STRING_MAX_LENGTH - 1, Curr= entLang); + // + // Now we have got the full smbios record, call smbios protocol to add t= his record. + // + Status =3D SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type13 Table Log Failed! %r \n= ", + __FUNCTION__, __LINE__, Status)); + } + + FreePool (SmbiosRecord); + return Status; +} diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNumberOfInsta= llableLanguages.uni b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNumb= erOfInstallableLanguages.uni new file mode 100644 index 000000000000..3af7a01653d8 --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type13/MiscNumberOfInstallableL= anguages.uni @@ -0,0 +1,43 @@ +/** @file + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +/=3D# + +/=3D# +// +// Language String (Long Format) +// +#string STR_MISC_BIOS_LANGUAGES_ENG_LONG #language en-US "en|US|is= o8859-1" +#string STR_MISC_BIOS_LANGUAGES_FRA_LONG #language en-US "fr|CA|is= o8859-1" +#string STR_MISC_BIOS_LANGUAGES_CHN_LONG #language en-US "zh|TW|un= icode" +#string STR_MISC_BIOS_LANGUAGES_JPN_LONG #language en-US "ja|JP|un= icode" +#string STR_MISC_BIOS_LANGUAGES_ITA_LONG #language en-US "it|IT|is= o8859-1" +#string STR_MISC_BIOS_LANGUAGES_SPA_LONG #language en-US "es|ES|is= o8859-1" +#string STR_MISC_BIOS_LANGUAGES_GER_LONG #language en-US "de|DE|is= o8859-1" +#string STR_MISC_BIOS_LANGUAGES_POR_LONG #language en-US "pt|PT|is= o8859-1" + + +// +// Language String (Abbreviated Format) +// +#string STR_MISC_BIOS_LANGUAGES_ENG_ABBREVIATE #language en-US "enUS" +#string STR_MISC_BIOS_LANGUAGES_FRA_ABBREVIATE #language en-US "frCA" +#string STR_MISC_BIOS_LANGUAGES_CHN_ABBREVIATE #language en-US "zhTW" +#string STR_MISC_BIOS_LANGUAGES_JPN_ABBREVIATE #language en-US "jaJP" +#string STR_MISC_BIOS_LANGUAGES_ITA_ABBREVIATE #language en-US "itIT" +#string STR_MISC_BIOS_LANGUAGES_SPA_ABBREVIATE #language en-US "esES" +#string STR_MISC_BIOS_LANGUAGES_GER_ABBREVIATE #language en-US "deDE" +#string STR_MISC_BIOS_LANGUAGES_POR_ABBREVIATE #language en-US "ptPT" + +#string STR_MISC_BIOS_LANGUAGES_SIMPLECH_ABBREVIATE #language en-US "zhC= N" +#string STR_MISC_BIOS_LANGUAGES_SIMPLECH_LONG #language en-US "zh|= CN|unicode" + + --=20 2.26.2 -=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 (#70314): https://edk2.groups.io/g/devel/message/70314 Mute This Topic: https://groups.io/mt/79679264/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 Mon Nov 25 10:42:56 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+70315+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+70315+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642227; cv=none; d=zohomail.com; s=zohoarc; b=g2bufBcO0pObXjvmMV76wQ3hiuGl6xeIQR9mz13n6MkZf+L2wF/MlpeXTAIK3nx0zK94dJT3a91DpB/ah6bhDtaETq7+Lfd5tay9b79vAFxIpNNy3PaFbKALevbVvQGdWrunpLJPtBh1HroZZYb0+MpKR5tK8Zn+xvQcKlK9XFg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642227; 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=NHw5mA8z/gRb0wFkEdy4YvwEgpwFs1Vbo449cYWKnbc=; b=PlbVaAjEufJdZZ4jFVmUimFayaXPz+/PhFU5ZKfrA3qeuB7b1sY2/yBAk2Dz3u4DRS0ORnMsaqdyj6nkJ5Wn/N1dJ3Ri1J+n36LUq4jC95ruMDk6/7z7Rviu+/5Lc/4C0OtVeOenQUU7l7UbfwR7jJtHRWFPu9jBdDuX92nvG5k= 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+70315+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642227115221.08831572800477; Thu, 14 Jan 2021 08:37:07 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id p8QtYY1788612xdIvq0m82Ox; Thu, 14 Jan 2021 08:37:06 -0800 X-Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) by mx.groups.io with SMTP id smtpd.web11.4168.1610642225297175001 for ; Thu, 14 Jan 2021 08:37:05 -0800 X-Received: by mail-io1-f43.google.com with SMTP id e22so12360329iom.5 for ; Thu, 14 Jan 2021 08:37:05 -0800 (PST) X-Gm-Message-State: v3NaPn1mWp4f8K0UVao9VJxVx1787277AA= X-Google-Smtp-Source: ABdhPJzvNfFkC6WMfNoiHyBNRobaJR9nOzJtWWxFDaH0uZ6ZghVptwOGCgaIhY66k17+uxA7EtbboQ== X-Received: by 2002:a92:bbcb:: with SMTP id x72mr7324644ilk.104.1610642224343; Thu, 14 Jan 2021 08:37:04 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.37.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:37:03 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu Subject: [edk2-devel] [PATCH v6 20/22] ArmPkg: Add Universal/Smbios/SmbiosMiscDxe/Type32 Date: Thu, 14 Jan 2021 09:36:26 -0700 Message-Id: <20210114163628.31952-21-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642226; bh=rhmUg8WYsncIjoWS18xgSpPlJy2TYK0EeMSJqxD+rrE=; h=Cc:Date:From:Reply-To:Subject:To; b=oYoP0xjp9qGjMcLD2iT6WCvGNobxis0kGCakREX8GbD6Br7CyOr7L6V5mHTADk2iq2a GoEt8EgNCPXT0P9rnXKG6fPtG2msEmIoeugfioAWfxvlHoDBvmIvDMaUK+iXy98IsiHqb hgeMwChrtKUkOv/bbjVxmWBbQL4iEjgMBCM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This code provides information for the SMBIOS Type 32 table. Signed-off-by: Rebecca Cran Reviewed-by: Leif Lindholm Reviewed-by: Samer El-Haj-Mahmoud --- ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInformationData.c = | 32 +++++++++ ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInformationFunction.c= | 73 ++++++++++++++++++++ 2 files changed, 105 insertions(+) diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInformati= onData.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInformation= Data.c new file mode 100644 index 000000000000..ebe4ad941c5f --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInformationData.c @@ -0,0 +1,32 @@ +/** @file + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "SmbiosMisc.h" + +// +// Static (possibly build generated) Bios Vendor data. +// +SMBIOS_MISC_TABLE_DATA(SMBIOS_TABLE_TYPE32, MiscBootInformation) =3D { + { // Hdr + EFI_SMBIOS_TYPE_SYSTEM_BOOT_INFORMATION, // Type, + 0, // Length, + 0 // Handle + }, + { // Reserved[6] + 0, + 0, + 0, + 0, + 0, + 0 + }, + BootInformationStatusNoError // BootInformation= Status +}; diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInformati= onFunction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInforma= tionFunction.c new file mode 100644 index 000000000000..733615bbcf1a --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type32/MiscBootInformationFunct= ion.c @@ -0,0 +1,73 @@ +/** @file + boot information boot time changes. + SMBIOS type 32. + + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include + +#include "SmbiosMisc.h" + +/** + This function makes boot time changes to the contents of the + MiscBootInformation (Type 32) record. + + @param RecordData Pointer to SMBIOS table with default = values. + @param Smbios SMBIOS protocol. + + @retval EFI_SUCCESS The SMBIOS table was successfully add= ed. + @retval EFI_INVALID_PARAMETER Invalid parameter was found. + @retval EFI_OUT_OF_RESOURCES Failed to allocate required memory. + +**/ +SMBIOS_MISC_TABLE_FUNCTION(MiscBootInformation) +{ + EFI_STATUS Status; + SMBIOS_TABLE_TYPE32 *SmbiosRecord; + SMBIOS_TABLE_TYPE32 *InputData; + + // + // First check for invalid parameters. + // + if (RecordData =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + InputData =3D (SMBIOS_TABLE_TYPE32 *)RecordData; + + // + // Two zeros following the last string. + // + SmbiosRecord =3D AllocateZeroPool (sizeof (SMBIOS_TABLE_TYPE32) + 1 + 1); + if (SmbiosRecord =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + (VOID)CopyMem (SmbiosRecord, InputData, sizeof (SMBIOS_TABLE_TYPE32)); + + SmbiosRecord->Hdr.Length =3D sizeof (SMBIOS_TABLE_TYPE32); + + // + // Now we have got the full smbios record, call smbios protocol to add t= his record. + // + Status =3D SmbiosMiscAddRecord ((UINT8*)SmbiosRecord, NULL); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "[%a]:[%dL] Smbios Type32 Table Log Failed! %r \n= ", + __FUNCTION__, __LINE__, Status)); + } + + FreePool (SmbiosRecord); + return Status; +} --=20 2.26.2 -=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 (#70315): https://edk2.groups.io/g/devel/message/70315 Mute This Topic: https://groups.io/mt/79679267/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 Mon Nov 25 10:42:56 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+70316+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+70316+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642227; cv=none; d=zohomail.com; s=zohoarc; b=Nmhha6dKuos9knTajz3hMhgQWW3SbyHOqO/qgnSYkBYU8BjllSnEE0XxlmQtmUH0BjcxEmycbE0N37qHBvtvvkZiuU4PHmar92aZSIRgrkjXcMKAErg+BXtmdgHQClZAysybGgC5vwIfQKZk5h9STypNITwJbMurcl+yXmD3TJQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642227; 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=gaRy+B4+DXI+fc9J4h1vZrFrQoqoSel0j9JnUDXEte0=; b=Q5zTp608MutndjypaLzZcf7nss9N57fojZulhTdzaCvII/O/WPIAZx/KHvaS1+wIObsfx6evI+TmTlJGupnWGMejz2Y/N9MoIAfeEdR/9r3Lxrs5y3z0AiR7NaqfNdgQU6oYA2t1+kTt6JR0Kt2R7YecRkTk1aPwPL/rMaCT5fc= 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+70316+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642227961954.0841751601781; Thu, 14 Jan 2021 08:37:07 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id jdTuYY1788612x2zVeY7rFnm; Thu, 14 Jan 2021 08:37:07 -0800 X-Received: from mail-io1-f53.google.com (mail-io1-f53.google.com [209.85.166.53]) by mx.groups.io with SMTP id smtpd.web12.4186.1610642226710933327 for ; Thu, 14 Jan 2021 08:37:06 -0800 X-Received: by mail-io1-f53.google.com with SMTP id n4so12299880iow.12 for ; Thu, 14 Jan 2021 08:37:06 -0800 (PST) X-Gm-Message-State: N204fyfCBAffVGtqqaFAuc9Zx1787277AA= X-Google-Smtp-Source: ABdhPJyWDeo4dmPKwUOp1h8zVUzdMgY02Qabq4cWQqLu7LENC6OwFksnecZH/0vWHo4qjmnorI31dA== X-Received: by 2002:a6b:8d0f:: with SMTP id p15mr5661567iod.56.1610642225947; Thu, 14 Jan 2021 08:37:05 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.37.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:37:05 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu Subject: [edk2-devel] [PATCH v6 21/22] ArmPkg: Add SMBIOS PCDs to ArmPkg.dec Date: Thu, 14 Jan 2021 09:36:27 -0700 Message-Id: <20210114163628.31952-22-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642227; bh=dsBBlzXcEDAL+KSufdzAlzDTY/86NxBJO/hd8wc5CHg=; h=Cc:Date:From:Reply-To:Subject:To; b=qfrwJ6HqJ5g6KznbMznA4XPOaZ3m9MNKD5Gcmj4otAsT+nYczI0PwCf2UoE9xrulMom A/d1/gxCdzE9cZSkUC/q8GawfUXrheWX2z1zGxto1IMgCX86cfov0OXH5dh7KCU3zCK9g ssaw04NnXZzLfsj5qOy8kmuGfcaL9OzahRM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Platforms are expected to override these PCDs to provide relevant information to SMBIOS. Signed-off-by: Rebecca Cran Reviewed-by: Leif Lindholm --- ArmPkg/ArmPkg.dec | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec index eaf1072d9ef3..f0b136a57af0 100644 --- a/ArmPkg/ArmPkg.dec +++ b/ArmPkg/ArmPkg.dec @@ -115,6 +115,20 @@ [PcdsFixedAtBuild.common] # The Primary Core is ClusterId[0] & CoreId[0] gArmTokenSpaceGuid.PcdArmPrimaryCore|0|UINT32|0x00000037 =20 + # + # SMBIOS PCDs + # + gArmTokenSpaceGuid.PcdSystemProductName|L""|VOID*|0x30000053 + gArmTokenSpaceGuid.PcdSystemVersion|L""|VOID*|0x30000054 + gArmTokenSpaceGuid.PcdBaseBoardManufacturer|L""|VOID*|0x30000055 + gArmTokenSpaceGuid.PcdBaseBoardProductName|L""|VOID*|0x30000056 + gArmTokenSpaceGuid.PcdBaseBoardVersion|L""|VOID*|0x30000057 + gArmTokenSpaceGuid.PcdProcessorManufacturer|L""|VOID*|0x30000071 + gArmTokenSpaceGuid.PcdProcessorVersion|L""|VOID*|0x30000072 + gArmTokenSpaceGuid.PcdProcessorSerialNumber|L""|VOID*|0x30000073 + gArmTokenSpaceGuid.PcdProcessorAssetTag|L""|VOID*|0x30000074 + gArmTokenSpaceGuid.PcdProcessorPartNumber|L""|VOID*|0x30000075 + # # ARM L2x0 PCDs # @@ -215,6 +229,9 @@ [PcdsFixedAtBuild.common, PcdsDynamic.common, PcdsPatch= ableInModule.common] gArmTokenSpaceGuid.PcdMmBufferBase|0|UINT64|0x00000045 gArmTokenSpaceGuid.PcdMmBufferSize|0|UINT64|0x00000046 =20 + gArmTokenSpaceGuid.PcdSystemBiosRelease|0xFFFF|UINT16|0x30000058 + gArmTokenSpaceGuid.PcdEmbeddedControllerFirmwareRelease|0xFFFF|UINT16|0x= 30000059 + [PcdsFixedAtBuild.common, PcdsDynamic.common] # # ARM Architectural Timer --=20 2.26.2 -=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 (#70316): https://edk2.groups.io/g/devel/message/70316 Mute This Topic: https://groups.io/mt/79679268/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 Mon Nov 25 10:42:56 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+70317+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+70317+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1610642231; cv=none; d=zohomail.com; s=zohoarc; b=RFuWInA4CbO89kGmrMnqVm2EBrqJeZuhKMnZj7hFsUm4ShYaJswWcCQdIIwain19F0soENWsmYq8St6r9DoLQ5gTuaE24cmsuFQttPN4QUkSRmjZ3mdtxgDj/nPVqx+XYKa65zYaBGkChjXiZuOOkUBjZ2F0zoQZgFBr3QQQXck= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610642231; 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=ftuCnRip+/IjvkOIDABYfglZBG/UXRfcinEA1gx6Tz4=; b=Nm1RTsaBJGARGjaMHFeA0KK/u1wpDvtZcOn6tvzmVB1zwkhrWXljeVw2x6ISPub7CvQWc2OkX3TysKmR0M7XLEY1dYZ0+7ygCRtxPXcNw29XEm6TPz3+Bw+/a+jGShLhpTD1l3H+315R+fuEz9k3/8xPdhpZf5yulM84iUi1Tq0= 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+70317+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1610642231602188.65798886187576; Thu, 14 Jan 2021 08:37:11 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id QcPsYY1788612xl7fvKsE8fY; Thu, 14 Jan 2021 08:37:10 -0800 X-Received: from mail-io1-f45.google.com (mail-io1-f45.google.com [209.85.166.45]) by mx.groups.io with SMTP id smtpd.web11.4169.1610642228421533284 for ; Thu, 14 Jan 2021 08:37:08 -0800 X-Received: by mail-io1-f45.google.com with SMTP id u26so12393328iof.3 for ; Thu, 14 Jan 2021 08:37:08 -0800 (PST) X-Gm-Message-State: of1TwwiPtt3u6mgRJbv06MaYx1787277AA= X-Google-Smtp-Source: ABdhPJyS71/9Uv/0dMQlWLAJRolM62useYL43PaCgLUBprenHgcYPV4Ks7FqDZYzUGk55ZmOL7hOPg== X-Received: by 2002:a92:de05:: with SMTP id x5mr7440239ilm.184.1610642227359; Thu, 14 Jan 2021 08:37:07 -0800 (PST) X-Received: from cube.nuviainc.com (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id y5sm3711920ilj.35.2021.01.14.08.37.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 08:37:06 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Leif Lindholm , Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu Subject: [edk2-devel] [PATCH v6 22/22] ArmPkg: Add Universal/Smbios/SmbiosMiscDxe Date: Thu, 14 Jan 2021 09:36:28 -0700 Message-Id: <20210114163628.31952-23-rebecca@nuviainc.com> In-Reply-To: <20210114163628.31952-1-rebecca@nuviainc.com> References: <20210114163628.31952-1-rebecca@nuviainc.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,rebecca@nuviainc.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1610642230; bh=VBwGuX8DtTwhSZ1NBF7AmTRF33eCJLjKJG4rUFipTQk=; h=Cc:Date:From:Reply-To:Subject:To; b=NtyGWiq8ZTtSpqLYfhw9KNvfTjyXvf9vMAEp5VrtxE9Rv7uDHNGkx+e61XUqzmYoEb6 s4GumxyVOd+Byd+ZbO8p0GItHYCu+b3YWpupBnUt/uhmnTZSEF506XtWHYoIQ1mxq9FCq PQkxUYfOA8/J5MnamaIRHCK9rOu28anEJNQ= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" SmbiosMiscDxe provides SMBIOS tables 0, 1, 2, 3, 13, and 32. Signed-off-by: Rebecca Cran Reviewed-by: Leif Lindholm Reviewed-by: Samer El-Haj-Mahmoud --- ArmPkg/ArmPkg.dsc | 1 + ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf | 89 +++++= +++ ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMisc.h | 134 +++++= +++++++ ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDataTable.c | 62 ++++++ ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscEntryPoint.c | 227 +++++= +++++++++++++++ ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxeStrings.uni | 22 ++ 6 files changed, 535 insertions(+) diff --git a/ArmPkg/ArmPkg.dsc b/ArmPkg/ArmPkg.dsc index fce86cb6d710..7194eb2d3c44 100644 --- a/ArmPkg/ArmPkg.dsc +++ b/ArmPkg/ArmPkg.dsc @@ -149,6 +149,7 @@ [Components.common] ArmPkg/Drivers/ArmScmiDxe/ArmScmiDxe.inf =20 ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClassDxe.inf + ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf =20 [Components.AARCH64] ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf b/ArmP= kg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf new file mode 100644 index 000000000000..60d8fe31c219 --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxe.inf @@ -0,0 +1,89 @@ +#/** @file +# Component description file for SmbiosMisc instance. +# +# Parses the MiscSubclassDataTable and reports any generated data to the D= ataHub. +# All .uni file who tagged with "ToolCode=3D"DUMMY"" in following file li= st is included by +# MiscSubclassDriver.uni file, the StrGather tool will expand MiscSubclas= sDriver.uni file +# and parse all .uni file. +# +# Copyright (c) 2021, NUVIA Inc. All rights reserved.
+# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+# Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+# Copyright (c) 2015, Linaro Limited. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +# Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ +#**/ + + +[Defines] + INF_VERSION =3D 1.29 + BASE_NAME =3D SmbiosMiscDxe + FILE_GUID =3D 7e5e26d4-0be9-401f-b5e1-1c2bda7ca777 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D SmbiosMiscEntryPoint + +[Sources] + SmbiosMisc.h + SmbiosMiscDataTable.c + SmbiosMiscEntryPoint.c + SmbiosMiscDxeStrings.uni + Type00/MiscBiosVendorData.c + Type00/MiscBiosVendorFunction.c + Type01/MiscSystemManufacturerData.c + Type01/MiscSystemManufacturerFunction.c + Type02/MiscBaseBoardManufacturerData.c + Type02/MiscBaseBoardManufacturerFunction.c + Type03/MiscChassisManufacturerData.c + Type03/MiscChassisManufacturerFunction.c + Type13/MiscNumberOfInstallableLanguagesData.c + Type13/MiscNumberOfInstallableLanguagesFunction.c + Type32/MiscBootInformationData.c + Type32/MiscBootInformationFunction.c + +[Packages] + ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + DevicePathLib + PcdLib + HiiLib + HobLib + MemoryAllocationLib + OemMiscLib + UefiBootServicesTableLib + UefiDriverEntryPoint + UefiLib + UefiRuntimeServicesTableLib + +[Protocols] + gEfiSmbiosProtocolGuid # PROTOCOL ALWAYS_CONSUMED + +[Pcd] + gArmTokenSpaceGuid.PcdFdSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVendor + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString + gArmTokenSpaceGuid.PcdSystemBiosRelease + gArmTokenSpaceGuid.PcdEmbeddedControllerFirmwareRelease + gArmTokenSpaceGuid.PcdSystemProductName + gArmTokenSpaceGuid.PcdSystemVersion + gArmTokenSpaceGuid.PcdBaseBoardManufacturer + gArmTokenSpaceGuid.PcdBaseBoardProductName + gArmTokenSpaceGuid.PcdBaseBoardVersion + gArmTokenSpaceGuid.PcdFdBaseAddress + +[Guids] + gEfiGenericVariableGuid + +[Depex] + gEfiSmbiosProtocolGuid + + diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMisc.h b/ArmPkg/Un= iversal/Smbios/SmbiosMiscDxe/SmbiosMisc.h new file mode 100644 index 000000000000..4fd37c4cdc0b --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMisc.h @@ -0,0 +1,134 @@ +/** @file + Header file for the SmbiosMisc Driver. + + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#ifndef SMBIOS_MISC_H_ +#define SMBIOS_MISC_H_ + +#include +#include + +// +// Data table entry update function. +// +typedef EFI_STATUS (EFIAPI SMBIOS_MISC_DATA_FUNCTION) ( + IN VOID *RecordData, + IN EFI_SMBIOS_PROTOCOL *Smbios + ); + + +// +// Data table entry definition. +// +typedef struct { + // + // intermediate input data for SMBIOS record + // + VOID *RecordData; + SMBIOS_MISC_DATA_FUNCTION *Function; +} SMBIOS_MISC_DATA_TABLE; + + +// +// SMBIOS table extern definitions +// +#define SMBIOS_MISC_TABLE_EXTERNS(NAME1, NAME2, NAME3) \ +extern NAME1 NAME2 ## Data; \ +extern SMBIOS_MISC_DATA_FUNCTION NAME3 ## Function; + + +// +// SMBIOS data table entries +// +// This is used to define a pair of table structure pointer and functions +// in order to iterate through the list of tables, populate them and add +// them into the system. +#define SMBIOS_MISC_TABLE_ENTRY_DATA_AND_FUNCTION(NAME1, NAME2) \ +{ \ + & NAME1 ## Data, \ + NAME2 ## Function \ +} + +// +// Global definition macros. +// +#define SMBIOS_MISC_TABLE_DATA(NAME1, NAME2) \ + NAME1 NAME2 ## Data + +#define SMBIOS_MISC_TABLE_FUNCTION(NAME2) \ + EFI_STATUS EFIAPI NAME2 ## Function( \ + IN VOID *RecordData, \ + IN EFI_SMBIOS_PROTOCOL *Smbios \ + ) + +// +// Data Table Array Entries +// +extern EFI_HII_HANDLE mSmbiosMiscHiiHandle; + +typedef struct _SMBIOS_TYPE13_BIOS_LANGUAGE_INFORMATION_STRING{ + UINT8 *LanguageSignature; + EFI_STRING_ID InstallableLanguageLongString; + EFI_STRING_ID InstallableLanguageAbbreviateString; +} SMBIOS_TYPE13_BIOS_LANGUAGE_INFORMATION_STRING; + + +/** + Adds an SMBIOS record. + + @param Buffer The data for the SMBIOS record. + The format of the record is determined by + EFI_SMBIOS_TABLE_HEADER.Type. The size of the + formatted area is defined by EFI_SMBIOS_TABLE_HEAD= ER.Length + and either followed by a double-null (0x0000) or a= set + of null terminated strings and a null. + @param SmbiosHandle A unique handle will be assigned to the SMBIOS rec= ord + if not NULL. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system= resources. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed in was already in = use. + +**/ +EFI_STATUS +SmbiosMiscAddRecord ( + IN UINT8 *Buffer, + IN OUT EFI_SMBIOS_HANDLE *SmbiosHandle OPTIONAL + ); + +/** + Get Link Type Handle. + + @param [in] SmbiosType Get this Type from SMBIOS table + @param [out] HandleArray Pointer to handle array which will be freed = by caller + @param [out] HandleCount Pointer to handle count + +**/ +VOID +SmbiosMiscGetLinkTypeHandle( + IN UINT8 SmbiosType, + OUT UINT16 **HandleArray, + OUT UINTN *HandleCount + ); + +// +// Data Table Array +// +extern SMBIOS_MISC_DATA_TABLE mSmbiosMiscDataTable[]; + +// +// Data Table Array Entries +// +extern UINTN mSmbiosMiscDataTableEntries; +extern UINT8 mSmbiosMiscDxeStrings[]; + +#endif // SMBIOS_MISC_H_ diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDataTable.c b/= ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDataTable.c new file mode 100644 index 000000000000..ac16c3a2688e --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDataTable.c @@ -0,0 +1,62 @@ +/** @file + This file provides SMBIOS Misc Type. + + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent\ + +**/ + +#include "SmbiosMisc.h" + +SMBIOS_MISC_TABLE_EXTERNS (SMBIOS_TABLE_TYPE0, + MiscBiosVendor, + MiscBiosVendor) +SMBIOS_MISC_TABLE_EXTERNS (SMBIOS_TABLE_TYPE1, + MiscSystemManufacturer, + MiscSystemManufacturer) +SMBIOS_MISC_TABLE_EXTERNS (SMBIOS_TABLE_TYPE3, + MiscChassisManufacturer, + MiscChassisManufacturer) +SMBIOS_MISC_TABLE_EXTERNS (SMBIOS_TABLE_TYPE2, + MiscBaseBoardManufacturer, + MiscBaseBoardManufacturer) +SMBIOS_MISC_TABLE_EXTERNS (SMBIOS_TABLE_TYPE13, + MiscNumberOfInstallableLanguages, + MiscNumberOfInstallableLanguages) +SMBIOS_MISC_TABLE_EXTERNS (SMBIOS_TABLE_TYPE32, + MiscBootInformation, + MiscBootInformation) + + +SMBIOS_MISC_DATA_TABLE mSmbiosMiscDataTable[] =3D { + // Type0 + SMBIOS_MISC_TABLE_ENTRY_DATA_AND_FUNCTION (MiscBiosVendor, + MiscBiosVendor), + // Type1 + SMBIOS_MISC_TABLE_ENTRY_DATA_AND_FUNCTION (MiscSystemManufacturer, + MiscSystemManufacturer), + // Type3 + SMBIOS_MISC_TABLE_ENTRY_DATA_AND_FUNCTION (MiscChassisManufacturer, + MiscChassisManufacturer), + // Type2 + SMBIOS_MISC_TABLE_ENTRY_DATA_AND_FUNCTION (MiscBaseBoardManufacturer, + MiscBaseBoardManufacturer), + // Type13 + SMBIOS_MISC_TABLE_ENTRY_DATA_AND_FUNCTION (MiscNumberOfInstallableLangua= ges, + MiscNumberOfInstallableLangua= ges), + // Type32 + SMBIOS_MISC_TABLE_ENTRY_DATA_AND_FUNCTION (MiscBootInformation, + MiscBootInformation), +}; + + +// +// Number of Data Table entries. +// +UINTN mSmbiosMiscDataTableEntries =3D + (sizeof (mSmbiosMiscDataTable)) / sizeof (SMBIOS_MISC_DATA_TABLE); diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscEntryPoint.c b= /ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscEntryPoint.c new file mode 100644 index 000000000000..37e79d285e57 --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscEntryPoint.c @@ -0,0 +1,227 @@ +/** @file + This driver parses the mSmbiosMiscDataTable structure and reports + any generated data using SMBIOS protocol. + + Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + + Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+ Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ Copyright (c) 2015, Linaro Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include +#include +#include +#include +#include +#include + +#include "SmbiosMisc.h" + + +STATIC EFI_HANDLE mSmbiosMiscImageHandle; +STATIC EFI_SMBIOS_PROTOCOL *mSmbiosMiscSmbios =3D NULL; + +EFI_HII_HANDLE mSmbiosMiscHiiHandle; + +/** + Standard EFI driver point. This driver parses the mSmbiosMiscDataTable + structure and reports any generated data using SMBIOS protocol. + + @param ImageHandle Handle for the image of this driver + @param SystemTable Pointer to the EFI System Table + + @retval EFI_SUCCESS The data was successfully stored. + +**/ +EFI_STATUS +EFIAPI +SmbiosMiscEntryPoint( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + UINTN Index; + EFI_STATUS EfiStatus; + + mSmbiosMiscImageHandle =3D ImageHandle; + + EfiStatus =3D gBS->LocateProtocol (&gEfiSmbiosProtocolGuid, NULL, + (VOID**)&mSmbiosMiscSmbios); + if (EFI_ERROR (EfiStatus)) { + DEBUG ((DEBUG_ERROR, "Could not locate SMBIOS protocol. %r\n", EfiSta= tus)); + return EfiStatus; + } + + mSmbiosMiscHiiHandle =3D HiiAddPackages ( + &gEfiCallerIdGuid, + mSmbiosMiscImageHandle, + SmbiosMiscDxeStrings, + NULL + ); + if (mSmbiosMiscHiiHandle =3D=3D NULL) { + return EFI_OUT_OF_RESOURCES; + } + + for (Index =3D 0; Index < mSmbiosMiscDataTableEntries; ++Index) { + // + // If the entry have a function pointer, just log the data. + // + if (mSmbiosMiscDataTable[Index].Function !=3D NULL) { + EfiStatus =3D (*mSmbiosMiscDataTable[Index].Function)( + mSmbiosMiscDataTable[Index].RecordData, + mSmbiosMiscSmbios + ); + + if (EFI_ERROR(EfiStatus)) { + DEBUG ((DEBUG_ERROR, "Misc smbios store error. Index=3D%d," + "ReturnStatus=3D%r\n", Index, EfiStatus)); + return EfiStatus; + } + } + } + + return EfiStatus; +} + + +/** + Adds an SMBIOS record. + + @param Buffer The data for the SMBIOS record. + The format of the record is determined by + EFI_SMBIOS_TABLE_HEADER.Type. The size of the + formatted area is defined by EFI_SMBIOS_TABLE_HEAD= ER.Length + and either followed by a double-null (0x0000) or a= set + of null terminated strings and a null. + @param SmbiosHandle A unique handle will be assigned to the SMBIOS rec= ord + if not NULL. + + @retval EFI_SUCCESS Record was added. + @retval EFI_OUT_OF_RESOURCES Record was not added due to lack of system= resources. + @retval EFI_ALREADY_STARTED The SmbiosHandle passed in was already in = use. + +**/ +EFI_STATUS +SmbiosMiscAddRecord ( + IN UINT8 *Buffer, + IN OUT EFI_SMBIOS_HANDLE *SmbiosHandle OPTIONAL + ) +{ + EFI_STATUS Status; + EFI_SMBIOS_HANDLE Handle; + + Handle =3D SMBIOS_HANDLE_PI_RESERVED; + + if (SmbiosHandle !=3D NULL) { + Handle =3D *SmbiosHandle; + } + + Status =3D mSmbiosMiscSmbios->Add ( + mSmbiosMiscSmbios, + NULL, + &Handle, + (EFI_SMBIOS_TABLE_HEADER *)Buffer + ); + + if (SmbiosHandle !=3D NULL) { + *SmbiosHandle =3D Handle; + } + + return Status; +} + + +/** Fetches the number of handles of the specified SMBIOS type + * + * @param SmbiosType The type of SMBIOS record to look for + * + * @return The number of handles + * +**/ +STATIC +UINTN +GetHandleCount ( + IN UINT8 SmbiosType + ) +{ + UINTN HandleCount; + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + EFI_SMBIOS_TABLE_HEADER *Record; + + HandleCount =3D 0; + + // Iterate through entries to get the number + do { + Status =3D mSmbiosMiscSmbios->GetNext ( + mSmbiosMiscSmbios, + &SmbiosHandle, + &SmbiosType, + &Record, + NULL + ); + + if (Status =3D=3D EFI_SUCCESS) { + HandleCount++; + } + } while (!EFI_ERROR (Status)); + + return HandleCount; +} + +/** + Fetches a list of the specified SMBIOS table types. + + @param[in] SmbiosType The type of table to fetch + @param[out] **HandleArray The array of handles + @param[out] *HandleCount Number of handles in the array +**/ +VOID +SmbiosMiscGetLinkTypeHandle( + IN UINT8 SmbiosType, + OUT SMBIOS_HANDLE **HandleArray, + OUT UINTN *HandleCount + ) +{ + UINTN Index; + EFI_STATUS Status; + EFI_SMBIOS_HANDLE SmbiosHandle; + EFI_SMBIOS_TABLE_HEADER *Record; + + if (mSmbiosMiscSmbios =3D=3D NULL) { + return; + } + + SmbiosHandle =3D SMBIOS_HANDLE_PI_RESERVED; + *HandleCount =3D GetHandleCount (SmbiosType); + + *HandleArray =3D AllocateZeroPool (sizeof (SMBIOS_HANDLE) * (*HandleCoun= t)); + if (*HandleArray =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "HandleArray allocate memory resource failed.\n")= ); + *HandleCount =3D 0; + return; + } + + SmbiosHandle =3D SMBIOS_HANDLE_PI_RESERVED; + + for (Index =3D 0; Index < (*HandleCount); Index++) { + Status =3D mSmbiosMiscSmbios->GetNext ( + mSmbiosMiscSmbios, + &SmbiosHandle, + &SmbiosType, + &Record, + NULL + ); + + if (!EFI_ERROR (Status)) { + (*HandleArray)[Index] =3D Record->Handle; + } else { + break; + } + } +} + diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxeStrings.uni= b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxeStrings.uni new file mode 100644 index 000000000000..6f877e706922 --- /dev/null +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/SmbiosMiscDxeStrings.uni @@ -0,0 +1,22 @@ +/** @file + * Based on files under Nt32Pkg/MiscSubClassPlatformDxe/ + * + * Copyright (c) 2021, NUVIA Inc. All rights reserved.
+ * Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.
+ * Copyright (c) 2015, Hisilicon Limited. All rights reserved.
+ * Copyright (c) 2015, Linaro Limited. All rights reserved.
+ * SPDX-License-Identifier: BSD-2-Clause-Patent + * + * +**/ + + +/=3D# + +#langdef en-US "English" + +#include "Type00/MiscBiosVendor.uni" +#include "Type01/MiscSystemManufacturer.uni" +#include "Type02/MiscBaseBoardManufacturer.uni" +#include "Type03/MiscChassisManufacturer.uni" +#include "Type13/MiscNumberOfInstallableLanguages.uni" --=20 2.26.2 -=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 (#70317): https://edk2.groups.io/g/devel/message/70317 Mute This Topic: https://groups.io/mt/79679270/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-