From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (NAM10-BN7-obe.outbound.protection.outlook.com [40.107.92.113]) by mx.groups.io with SMTP id smtpd.web09.1735.1663050183096629696 for ; Mon, 12 Sep 2022 23:23:03 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=sn5uoL1Z; spf=pass (domain: os.amperecomputing.com, ip: 40.107.92.113, mailfrom: nhi@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Tlu1yEzZXfgVmX427J/PIMuEs4/II49hMNZQDFvcZclE0uT/cPQ0ggPuc8zKa0yJvKNrYvenQL6sU6dZI88c+zhOmjBpytjEHhFUspq5wAxpdGWusjAw1ZEdhrOaXczP3zcrcv6F9uW38KR1C/O9VSi36YtNAV+lWiXI4LOsN3VO3vkz5GwaX7WO1319zxziM0q41mtX7CLnAOMzF38kPGUY4VLuBbL2DJLEgdHWv/+wPofKqI2HMQc/Z93rD25hUl1gz6XOaLwTfZ6hGoOEKzkI0FKo4bcK1dLtm2FggsDCHcEfeMpDj5pJFzveu8hPEAS9K0iS+CU+JDSqpwXdCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=HbwTL1K4CPdyTtqNke06ojccfOHEFT8WRODSzd0IA+o=; b=ayOeKMb1IB34S+rhNBfwBpHvaacPCu6epJCMiGqCvKbfktZuYjP5E1m/KdrsHoZvRTmwu8gUjh3wRQV0awX1d7Vn+w7UgmMa2gmC82Lzr1AQPYBegOpmF/XHj/UP8ewRvgiAkWj6Bt7FIGG4e1qhCw2Z2SOeuF1UR1oY1KYbKDrmqvu8yA7TtZok+tnMqbhngd80rrVmb6WaRLO4ZlQx57rJocsyz1VYoMOgUbEXrPyC2a0xeMWCya6GdRQskIIbnlsQaIbwxHbhdBY8aNDMJ8P/0gikgbUxgStrYT/GZL2+vMOp3UVYt8TPCdpX1PXnd6AENPb4H9YEHsnfIpp/1g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=os.amperecomputing.com; dmarc=pass action=none header.from=os.amperecomputing.com; dkim=pass header.d=os.amperecomputing.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=os.amperecomputing.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=HbwTL1K4CPdyTtqNke06ojccfOHEFT8WRODSzd0IA+o=; b=sn5uoL1Z8maNG+qy95jZNepz7MQBEuqDV2MdG/FquPeZCr3RPsEdZUJP/QwHlimXZmunQF904C7PD4nDrrszcxkbwMxcNIZ8uXBPDgd37QWsJ/9U/8cisbZor69VUgx5hJp8qhENu+p+1pGdcVaQg+3YCEwuI2rB3tKnO9KX5+c= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) by DM6PR01MB3644.prod.exchangelabs.com (2603:10b6:5:92::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.14; Tue, 13 Sep 2022 06:22:59 +0000 Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::fc6b:4f56:8f32:dfa5]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::fc6b:4f56:8f32:dfa5%4]) with mapi id 15.20.5612.022; Tue, 13 Sep 2022 06:22:59 +0000 From: "Nhi Pham" To: devel@edk2.groups.io, quic_llindhol@quicinc.com, ardb+tianocore@kernel.org, sami.mujawar@arm.com, quic_rcran@quicinc.com Cc: patches@amperecomputing.com, Minh Nguyen , Nhi Pham , Rebecca Cran , Ard Biesheuvel Subject: [PATCH v3 6/6] ArmPkg/SmbiosMiscDxe: Get SMBIOS information from OemMiscLib Date: Tue, 13 Sep 2022 13:19:47 +0700 Message-Id: <20220913061947.735951-7-nhi@os.amperecomputing.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220913061947.735951-1-nhi@os.amperecomputing.com> References: <20220913061947.735951-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: SG2PR06CA0194.apcprd06.prod.outlook.com (2603:1096:4:1::26) To PH0PR01MB7287.prod.exchangelabs.com (2603:10b6:510:10a::21) Return-Path: nhi@os.amperecomputing.com MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH0PR01MB7287:EE_|DM6PR01MB3644:EE_ X-MS-Office365-Filtering-Correlation-Id: 84bb68d3-727b-4b98-5539-08da95506752 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: pmZQ1axObUuTmMvSq3YYQVLwwR/0Bxt7X3qYiWR5+MkLrkeJGxe2/C605RekbMQRW+JMebqmeOBboQIwb7mthjcsdlbDn4r8cVSgKbqfZX1dY9LjWQl5Xk4uiatsfPIFCT6Uy0Pi6V/Sg+4UrCjHr36L8XzzLYtAEpxolsl5F/D2zYZU2Fs0QBn35RyZGeJe1vI7Z/thXVjDmlWg8sjW4OhZ5V6pe7No394HCqUNw0y9ISiww2TIqjiGkOO51itm5hsCm5R+F5fR3lQjazTKF+myLf5QTIzI/wSuBhYtaTFXmYCH/wS+7vpMHmcoWkLaHgPOx4E8p5YjaroSaN8deBLTA2tvOF64vOxt9BdcAatwF7UNvYtxUVpDeasHgdKDxGOsg8iBzriA4++SqB3OqxvDLMVfYZ5I3isMGXZxJtx6bwE8aPMkdrsKkg5W1Sh/7zHdpmpuBVpSsZW1rvRbmvXNNUnOZGwoEdGBK4VPPFUp0lUyYM7jryHaamGdlXmPEgU4PB3YRy7O/Qz0bOjE4t8AjOiwNXbVpG9GV66D/If3fD3AMLdRQ0eA56ySQoMNWrkPVo3xKGGm8efQRnCB++sD87MQpG3FiurjH1pK3qyOJTo+NxqADy9c9+hQf84rU6+aELzMOoPDtIDwe5T8onrTG+IEcEfAb42cUb54dt8jsXefTKj0d3SfH1G4gJS3QuuZba6JTZI1Xiod3ifLyxekgFMx8Jf+EN8449ED9lnM4dmrpfqlHOPMWjO+vKhG1hoEhkOqmC6bGfs0krc4CQTtjXyYM98oS8aWCA5uGmY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH0PR01MB7287.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(396003)(39850400004)(136003)(366004)(376002)(346002)(451199015)(66556008)(6666004)(8676002)(316002)(66946007)(478600001)(4326008)(66476007)(83380400001)(2616005)(6512007)(86362001)(41300700001)(6486002)(26005)(54906003)(2906002)(6506007)(186003)(5660300002)(1076003)(38100700002)(8936002)(38350700002)(52116002)(44824005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?u7iY2jrbzpHVyG3442rTeUz8bbCu7a9VJm6EhX/QgXl8Ftlh/fnXZOw+li/1?= =?us-ascii?Q?5JXGkVYV63hSEXOCIE0PAwOwXfOJmzoFKq9w0Ug+UMV2+7M6/b00DU3gqDeV?= =?us-ascii?Q?/5p7/3UfOULbKSQ2z39P0/fwMEB97ZtG57IxM5LKUZ+tKdO1/hDPCshfsJjb?= =?us-ascii?Q?uFc1t3xf1nOoLi+lZTapOBDqoGNTR/mxKDBHN1XPZmZiOMQe4UtSKlIYmCVO?= =?us-ascii?Q?QFZKTgaLFadLId1ojld7l5P+Dz19VTptxMGsVWtY1yxpKT6i4YL+mqJpqo4W?= =?us-ascii?Q?3893ll56QQHscMyvKh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us-ascii?Q?+KSolMLQnU7xdOqHKj00P/85teRwwOKiruL0Eo+qot7OA4zBUNA6IljUh7lB?= =?us-ascii?Q?MbsUQMW19XW/EI8Hn+6ZZ9ec++97+zMCEXR3v4r6mMHP8Uyw/oE1Du/PPDmp?= =?us-ascii?Q?9yRWB4OUth4rhp4n8aX2vXIYdmU1NEolmHv3ITQ1UBDI8TBXCYDsokPl3dOr?= =?us-ascii?Q?iLvlYJoTE4xpYzjIlBPaM5DIrgAl+h8Oig70Akin+4vToaZePvSAaoqhgR+k?= =?us-ascii?Q?MPjt44oakLR4C24dSCttSxt9nqG3fyqNxvgnZBZ9piwcPG/2vigGx3z3PE74?= =?us-ascii?Q?OPLQKD/zJ1ifgFhLEbuVIOTnduM80QPlnnSBPFa4ON9SMa3O4S+lpFOEdzNu?= =?us-ascii?Q?vlZkxT97D1ui4YMYEFo0om2GgOLF9WHcwIkDc1vUKrsSLEtU3n9YU+NzgH6R?= =?us-ascii?Q?V+sykTU1A1uhslgLrd5qTYM=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: 84bb68d3-727b-4b98-5539-08da95506752 X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Sep 2022 06:22:59.2060 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3bc2b170-fd94-476d-b0ce-4229bdc904a7 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: wViyTtiQehV9NZdw4LLMKFQM2z8/sHGPJQyCK4gLtsl48dx0f5vAzzb1S9oOuoZgj1akHmLha8oqVO1dyLJ/4Kd24AZ143DZv3wT5n4Zpoo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR01MB3644 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain From: Minh Nguyen In some scenarios, the information of Bios Version, Bios Release and Embedded Controller Firmware Release are fetched during UEFI booting. This patch supports updating those fields dynamically when the PCDs are empty. Signed-off-by: Nhi Pham Reviewed-by: Rebecca Cran Reviewed-by: Sami Mujawar Acked-by: Ard Biesheuvel --- ArmPkg/Include/Library/OemMiscLib.h | 21= +++++++++++++ ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLib.c | 28= +++++++++++++++++ ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c | 32= +++++++++++++------- 3 files changed, 70 insertions(+), 11 deletions(-) diff --git a/ArmPkg/Include/Library/OemMiscLib.h b/ArmPkg/Include/Library/O= emMiscLib.h index 1936619d9b5b..541274999e5c 100644 --- a/ArmPkg/Include/Library/OemMiscLib.h +++ b/ArmPkg/Include/Library/OemMiscLib.h @@ -37,6 +37,7 @@ typedef struct { } OEM_MISC_PROCESSOR_DATA;=0D =0D typedef enum {=0D + BiosVersionType00,=0D ProductNameType01,=0D SerialNumType01,=0D UuidType01,=0D @@ -247,4 +248,24 @@ OemGetSystemUuid ( OUT GUID *SystemUuid=0D );=0D =0D +/** Fetches the BIOS release.=0D +=0D + @return The BIOS release.=0D +**/=0D +UINT16=0D +EFIAPI=0D +OemGetBiosRelease (=0D + VOID=0D + );=0D +=0D +/** Fetches the embedded controller firmware release.=0D +=0D + @return The embedded controller firmware release.=0D +**/=0D +UINT16=0D +EFIAPI=0D +OemGetEmbeddedControllerFirmwareRelease (=0D + VOID=0D + );=0D +=0D #endif // OEM_MISC_LIB_H_=0D diff --git a/ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLib.c b/ArmPkg/U= niversal/Smbios/OemMiscLibNull/OemMiscLib.c index 32f6d55c1a9a..788ccab9e8c1 100644 --- a/ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLib.c +++ b/ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLib.c @@ -254,3 +254,31 @@ OemGetSystemUuid ( ASSERT (FALSE);=0D CopyGuid (SystemUuid, &gZeroGuid);=0D }=0D +=0D +/** Fetches the BIOS release.=0D +=0D + @return The BIOS release.=0D +**/=0D +UINT16=0D +EFIAPI=0D +OemGetBiosRelease (=0D + VOID=0D + )=0D +{=0D + ASSERT (FALSE);=0D + return 0xFFFF;=0D +}=0D +=0D +/** Fetches the embedded controller firmware release.=0D +=0D + @return The embedded controller firmware release.=0D +**/=0D +UINT16=0D +EFIAPI=0D +OemGetEmbeddedControllerFirmwareRelease (=0D + VOID=0D + )=0D +{=0D + ASSERT (FALSE);=0D + return 0xFFFF;=0D +}=0D diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFun= ction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFuncti= on.c index b49c4b754cab..e9106a8a2fec 100644 --- a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c @@ -1,5 +1,6 @@ /** @file=0D =0D + Copyright (c) 2022, Ampere Computing LLC. All rights reserved.
=0D Copyright (c) 2021, NUVIA Inc. All rights reserved.
=0D Copyright (c) 2009, Intel Corporation. All rights reserved.
=0D Copyright (c) 2015, Hisilicon Limited. All rights reserved.
=0D @@ -13,6 +14,7 @@ #include =0D #include =0D #include =0D +#include =0D #include =0D #include =0D =0D @@ -191,11 +193,11 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscBiosVendor) { TokenToUpdate =3D STRING_TOKEN (STR_MISC_BIOS_VERSION);=0D HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Version, NULL);=0D } else {=0D - Version =3D (CHAR16 *)PcdGetPtr (PcdFirmwareVersionString);=0D - if (StrLen (Version) > 0) {=0D - TokenToUpdate =3D STRING_TOKEN (STR_MISC_BIOS_VERSION);=0D - HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Version, NULL);=0D - }=0D + OemUpdateSmbiosInfo (=0D + mSmbiosMiscHiiHandle,=0D + STRING_TOKEN (STR_MISC_BIOS_VERSION),=0D + BiosVersionType00=0D + );=0D }=0D =0D Char16String =3D GetBiosReleaseDate ();=0D @@ -251,13 +253,21 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscBiosVendor) { }=0D }=0D =0D - SmbiosRecord->SystemBiosMajorRelease =3D (UINT8)(PcdGet16 (PcdSystemBios= Release) >> 8);=0D - SmbiosRecord->SystemBiosMinorRelease =3D (UINT8)(PcdGet16 (PcdSystemBios= Release) & 0xFF);=0D + if (PcdGet16 (PcdSystemBiosRelease) !=3D 0xFFFF) {=0D + SmbiosRecord->SystemBiosMajorRelease =3D (UINT8)(PcdGet16 (PcdSystemBi= osRelease) >> 8);=0D + SmbiosRecord->SystemBiosMinorRelease =3D (UINT8)(PcdGet16 (PcdSystemBi= osRelease) & 0xFF);=0D + } else {=0D + SmbiosRecord->SystemBiosMajorRelease =3D (UINT8)(OemGetBiosRelease () = >> 8);=0D + SmbiosRecord->SystemBiosMinorRelease =3D (UINT8)(OemGetBiosRelease () = & 0xFF);=0D + }=0D =0D - SmbiosRecord->EmbeddedControllerFirmwareMajorRelease =3D (UINT16)=0D - (PcdGet16 (PcdEmb= eddedControllerFirmwareRelease) >> 8);=0D - SmbiosRecord->EmbeddedControllerFirmwareMinorRelease =3D (UINT16)=0D - (PcdGet16 (PcdEmb= eddedControllerFirmwareRelease) & 0xFF);=0D + if (PcdGet16 (PcdEmbeddedControllerFirmwareRelease) !=3D 0xFFFF) {=0D + SmbiosRecord->EmbeddedControllerFirmwareMajorRelease =3D (UINT16)(PcdG= et16 (PcdEmbeddedControllerFirmwareRelease) >> 8);=0D + SmbiosRecord->EmbeddedControllerFirmwareMinorRelease =3D (UINT16)(PcdG= et16 (PcdEmbeddedControllerFirmwareRelease) & 0xFF);=0D + } else {=0D + SmbiosRecord->EmbeddedControllerFirmwareMajorRelease =3D (UINT16)(OemG= etEmbeddedControllerFirmwareRelease () >> 8);=0D + SmbiosRecord->EmbeddedControllerFirmwareMinorRelease =3D (UINT16)(OemG= etEmbeddedControllerFirmwareRelease () & 0xFF);=0D + }=0D =0D OptionalStrStart =3D (CHAR8 *)(SmbiosRecord + 1);=0D UnicodeStrToAsciiStrS (Vendor, OptionalStrStart, VendorStrLen + 1);=0D --=20 2.25.1