From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (NAM04-BN8-obe.outbound.protection.outlook.com [40.107.100.117]) by mx.groups.io with SMTP id smtpd.web11.15634.1663554149503314356 for ; Sun, 18 Sep 2022 19:22:29 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=CSOGknKE; spf=pass (domain: os.amperecomputing.com, ip: 40.107.100.117, mailfrom: nhi@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hvcXoDSFYm1XCtIMyaJgOgF350Fpb8L7cLdH524Rvpmi7Tux4OKkmPwR8muuo5yR7S5IoU9apXLYgYa+R2qZk8pVudv8+xpoRr9UgKseMqANEmB5j0BJgxb3t1peg+QZIqarmlKhEn4D5fWYz1hVeD3ffx7PO/JQZH842V6OUG2fPfruvDzXmpTkzKVKle2lAZjv9ky8CXb961+KpPcjruX/5DfmbDRczOtxmLf+c7HH+XzZDb9lGDm4mTRzawhegg/Oz2kwvvt0Fnm4iyVuowi7BOkT8Kz57uK8Z4G6q7dqJo9EilUlq3YpL7UqkmjL9zMJXjSPr2vi4UG8iePG5A== 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=rxFp5F6wcddgQ77hT2EmOauK4rAynwNSUMyflRNyZas=; b=hcGjNpVUiw+IPLmWppRJ0d6KVccbPC/VOS0cC+MQP96Wv0+0DLtsmsFSK0WY9p9vHXl+9u0gWoNgJXHHvwvud8HV1MIq3G8Eo//Q6kmJ+2oL58FOf6Ll3WGk+a4GRKWugaHebzp8knVlzTeY0xo4688YZUAfwv6sjLxpZth3C0kQnToAOqmlDTddNVAiV8hZm9JNGmiJ98JcAHYCbj5QwyCB+yRhlF9PKvI3QC7AM7EoEm71bf4d9u+nJv/i0ULzx0MHrWbJ8ZxmOsTENVbZ/1LLV0DCTZ2pSYP/pWm7NY7UjS0N09Z3E4WiVo//VdGusUrDWp/F0KRx0qx8O7UroQ== 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=rxFp5F6wcddgQ77hT2EmOauK4rAynwNSUMyflRNyZas=; b=CSOGknKEM7feOeDQIYXrUFvT6Q8J4m83G73GH54NNyj30hcaoGWrRvUEEi57JsKstgPscGr7OHur79lxzExTlgsx34N3E4kUkxXVoh/Ng+Q4lQdWxCSxundiw23SwpQDMWW7DtzqbOq/WZ3vOHPmso4wqnH+TUqdrZG0vgQa8B8= 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 CO1PR01MB6791.prod.exchangelabs.com (2603:10b6:303:f7::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5632.16; Mon, 19 Sep 2022 02:22:27 +0000 Received: from PH0PR01MB7287.prod.exchangelabs.com ([fe80::441a:930:ac15:1ce9]) by PH0PR01MB7287.prod.exchangelabs.com ([fe80::441a:930:ac15:1ce9%4]) with mapi id 15.20.5632.019; Mon, 19 Sep 2022 02:22:27 +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 v4 6/6] ArmPkg/SmbiosMiscDxe: Get SMBIOS information from OemMiscLib Date: Mon, 19 Sep 2022 09:19:50 +0700 Message-Id: <20220919021950.2110333-7-nhi@os.amperecomputing.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220919021950.2110333-1-nhi@os.amperecomputing.com> References: <20220919021950.2110333-1-nhi@os.amperecomputing.com> X-ClientProxiedBy: SG2PR02CA0071.apcprd02.prod.outlook.com (2603:1096:4:54::35) 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_|CO1PR01MB6791:EE_ X-MS-Office365-Filtering-Correlation-Id: ebef48fb-ba08-411f-61aa-08da99e5cb9d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hjkHOZv+Ud7c+DqIXhLIYVbBGh+FnQ4WY78Th6JFK5M+cGBThXjVRFapmxARTkmbsgjIqV6LaZGZyio8iBE0cda4IdlF2nOFR7Ef/K/bLFyBOrCLmVH+c9aYHSZEYzwmpJvN51vxZxrKnjLNcpR1ceN09OQNLPsr2rhiraE2ncWxUOQgOsk61x2sZVXxasn5+icSNjQSzjsdC68kreYsXazZWUtX5LGvwK+UIHu6pRo8fZWBSKl7TtNqUEyl4nJJA80RYR/wzzhl6lPGmEy87MiAlNPXt+vZUibEpJla7qLu9ERoKV09DgSGJCbefYiznVIUZzNqxcCLpIEpw5r9XlNeGt1IfAgKdxH+L/ioQL3rw3kT4AbVN17BNToqNMkA9FK9e5C8SkXAGyQnaAt59seNrpLItkRGFdP5RHn8pjMGogtvcZtFLZKnlTm8+cz5mlZ/1dPVncjnfW6DUWJG8LsqqoUaExhFeegrcyxTqAvmn/Rfr8upkvP8ZTWdtvSbwwYgLSTOpvb/TNfSe6kFthU7pGepyctmGTbdxHxkN8cBacp+zadb/Svri/jPdhx6ECNHEHBKjEL5dLYXjgYODo9IyeTJPVtAuBQR5jJ34pDu6DuO4Ehy1UhKUKz+4f60Y+dZgT4lbJdKs0Pvrot8+QpnvfeFId4WY5NoBJ0AkRMFW2sSVYdXpXOZvsXkrDrcGfLmuyb3IiVwxKBFAXwJDwijiCZJjNinzNdkGx8UQkQT93qdMSfhbnmlW458IdLEHwTViEH5RKte17Z6yZsFBWgcuiIM5Feq8pT7aAGL8qo= 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)(366004)(136003)(346002)(39840400004)(376002)(396003)(451199015)(66946007)(5660300002)(8676002)(4326008)(66556008)(66476007)(8936002)(54906003)(86362001)(316002)(38100700002)(38350700002)(83380400001)(6666004)(41300700001)(52116002)(6486002)(6506007)(478600001)(2616005)(186003)(1076003)(6512007)(26005)(2906002)(44824005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?bTsXghUjAxOYgVW9zPP6lqljPO0rQ3M9hdqYwz+xYG012WXhtFubZVrAnANI?= =?us-ascii?Q?iUtcgFE5cHRkMhbrhBTS1vH02EN+YJhpmWS6TlYXbzbKXmJL+Cp+blTaROyC?= =?us-ascii?Q?yyMWM0e7+Qw5jlnkU3VA/D9VGjAJLcDRIW0CFh7sqOWXRivNpn/xxdRrqTMj?= =?us-ascii?Q?yI5ROeS34pK44RszzmFKXTnXdzJymgeL5fEPZjWd8kwrHea79iqpON8tozXZ?= =?us-ascii?Q?PKsHX4Pr3sI6KMhKuII/sUVqTJz+1cMWYKBpMB7M/q5bVsOp0Pse+igIah6d?= =?us-ascii?Q?+uKuc65MuAiJeJmk2ur2TIlz2SvT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ii?Q?wWw+Q8WjBOF9J47QUXoNebCELI7UqxynSbYoS+Hno4plKqvRq5tf0N5Fc/k4?= =?us-ascii?Q?+f8//o40K9fzlVAJu3PqAG1NLuVSNF1Xc8eKOZEZK1+fdUy8EUk3JVgP6KXF?= =?us-ascii?Q?0FhYDBCZNqrb+pcRDbBofTd0HzWu7NFyMwvavPXYaT4qxKseD4v7rvXU9j/J?= =?us-ascii?Q?m9UgCGYZzm2zD13Ln3vKG4ABdk2smimVzSRh1swNlESEtZjxJOd1DdO3B0Ir?= =?us-ascii?Q?wfRsTwANr+Otlss699Si99fZXYBN2f/tKEDKMGBbrXzA+Jr/DarwvDJ3y3Zl?= =?us-ascii?Q?gqBmX477tNSoxJR4wK5KLMO33Dw3j72/ZJy/5qNjfVV6tTc/s+r8Wrh7MSBu?= =?us-ascii?Q?4sqWIIqG1wZ1L1F5I1bRPYcEIBNudF+pFQMQElciP7p+g54aIX5f7IoZ6F5j?= =?us-ascii?Q?LCcSuK9FY6wEcyJ3/a+fStA=3D?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: ebef48fb-ba08-411f-61aa-08da99e5cb9d X-MS-Exchange-CrossTenant-AuthSource: PH0PR01MB7287.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2022 02:22:27.1339 (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: dYjU3B52+Vu8txboUNVI9qXk8vBA3fbtkfLbetVpn9pMRFi0SwznfSbbSUan/C7jKLdpDJALIY+1k0tOSPiJ8q1sUnsGBwj8BZ+8v6nH6rs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR01MB6791 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/Universal/Smbios/OemMiscLibNull/OemMiscLibNull.inf | 5= ++++ ArmPkg/Include/Library/OemMiscLib.h | 21= ++++++++++++++ ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLib.c | 29= ++++++++++++++++++++ ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c | 22= +++++++-------- 4 files changed, 66 insertions(+), 11 deletions(-) diff --git a/ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLibNull.inf b/Ar= mPkg/Universal/Smbios/OemMiscLibNull/OemMiscLibNull.inf index 8653f57720d1..7286ed61142a 100644 --- a/ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLibNull.inf +++ b/ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLibNull.inf @@ -30,6 +30,11 @@ [Packages] [LibraryClasses]=0D BaseMemoryLib=0D DebugLib=0D + PcdLib=0D =0D [Guids]=0D gZeroGuid=0D +=0D +[Pcd]=0D + gArmTokenSpaceGuid.PcdEmbeddedControllerFirmwareRelease=0D + gArmTokenSpaceGuid.PcdSystemBiosRelease=0D 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..a5d635da9e11 100644 --- a/ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLib.c +++ b/ArmPkg/Universal/Smbios/OemMiscLibNull/OemMiscLib.c @@ -16,6 +16,7 @@ #include =0D #include =0D #include =0D +#include =0D =0D /** Gets the CPU frequency of the specified processor.=0D =0D @@ -254,3 +255,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 PcdGet16 (PcdSystemBiosRelease);=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 PcdGet16 (PcdEmbeddedControllerFirmwareRelease);=0D +}=0D diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFun= ction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFuncti= on.c index b49c4b754cab..e1310f331009 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,11 @@ 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 + SmbiosRecord->SystemBiosMajorRelease =3D (UINT8)(OemGetBiosRelease () >>= 8);=0D + SmbiosRecord->SystemBiosMinorRelease =3D (UINT8)(OemGetBiosRelease () & = 0xFF);=0D =0D - SmbiosRecord->EmbeddedControllerFirmwareMajorRelease =3D (UINT16)=0D - (PcdGet16 (PcdEmb= eddedControllerFirmwareRelease) >> 8);=0D - SmbiosRecord->EmbeddedControllerFirmwareMinorRelease =3D (UINT16)=0D - (PcdGet16 (PcdEmb= eddedControllerFirmwareRelease) & 0xFF);=0D + SmbiosRecord->EmbeddedControllerFirmwareMajorRelease =3D (UINT16)(OemGet= EmbeddedControllerFirmwareRelease () >> 8);=0D + SmbiosRecord->EmbeddedControllerFirmwareMinorRelease =3D (UINT16)(OemGet= EmbeddedControllerFirmwareRelease () & 0xFF);=0D =0D OptionalStrStart =3D (CHAR8 *)(SmbiosRecord + 1);=0D UnicodeStrToAsciiStrS (Vendor, OptionalStrStart, VendorStrLen + 1);=0D --=20 2.25.1