From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.123]) by mx.groups.io with SMTP id smtpd.web11.16535.1679855882426762199 for ; Sun, 26 Mar 2023 11:38:02 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@os.amperecomputing.com header.s=selector2 header.b=Ono3c70Y; spf=pass (domain: os.amperecomputing.com, ip: 40.107.244.123, mailfrom: tinhnguyen@os.amperecomputing.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cQ3MrT7RL8W6Ra/KERqpv4YOyKfgnCCld8TINR9/98Ja9eJ+c4TAI55Jof3fX78gFNSUh7aLzRLjXSn3zS0r4kE8hxhMqm9PbDtDEaOeKJ/vxrFC3AXNjUtPSLlZJrKGsHVt7jjvnmb9c4ZDd8+DA7ZnJKCeoGncevlFkKoI7mX8uykhZ84yKs6Nkp/A811WDJJdSvPRjxr93hkI33gV4EQ1PwpSaP2eaxeF+V/jKq2hA34T8PWn0vxpYgw4NT9IUgN/BPxPU1eD7v7Vl2bAksiSjfdqfmm35B0NYGcr4HfifKefdxQ7G2xVtMJO04Nz05YlGw/T7R98tHKUAcN6dg== 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=aE+RwGzX0GdpKvw3lWqmapV4rnX9KAN5sB+MOP9fzHI=; b=nKqC0R9Y0R2XJLMUx0+sYgdW+FPHWZQcAHJ07GncacabkJLFL61S8IOw4X1ZP3uqF8RKRgeIdmwgZxCGqh0w3BsJ6S+aec5zsY9oUlcA0Q4XnLWKZEN8Ix8JzjdndUQ4hkYqAokDAiAYR+g7WDh8n/iS9/LYfZS3FvePChB8G843FfPJzZJVUcZzQpTENnxbqmc7RzDZU6GnlKCgp0GTbvIIWPP86LfwYTbWJW4QMYx/EUIGjJemxtab3XxbrERRoQRJRn6AmUQpm5rlPI+TmlL2McM0uqkBdxV98s3Wc7AeHkCl4OINZeSIWyvo2nWkqTGid4YeEtTODXKgus2Kew== 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=aE+RwGzX0GdpKvw3lWqmapV4rnX9KAN5sB+MOP9fzHI=; b=Ono3c70YnjpBpQtzvJfqA34TV1PeQplciXR0gZTMc2AWo03IPVBTHYnz35AHeEUyeTZQiA7JFVm9GokKzl3r7/GE9iQE18k9P4t7x7DTwv9bkS8N1VGKDzjnvbkdghdzNr4dpuzdwFEFtERkAUjYhiqF/TYn05Ivdme6YMkp4MY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=os.amperecomputing.com; Received: from MWHPR0101MB2942.prod.exchangelabs.com (2603:10b6:301:2e::14) by BN6PR01MB2227.prod.exchangelabs.com (2603:10b6:404:44::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6254.15; Sun, 26 Mar 2023 18:37:55 +0000 Received: from MWHPR0101MB2942.prod.exchangelabs.com ([fe80::1d06:a51a:ca3d:c2f6]) by MWHPR0101MB2942.prod.exchangelabs.com ([fe80::1d06:a51a:ca3d:c2f6%4]) with mapi id 15.20.6178.041; Sun, 26 Mar 2023 18:37:55 +0000 From: "Tinh Nguyen" To: devel@edk2.groups.io Cc: patches@amperecomputing.com, quic_llindhol@quicinc.com, ardb+tianocore@kernel.org, nhi@os.amperecomputing.com, rebecca@bsdio.com, osd@smith-denny.com, Tinh Nguyen Subject: [PATCH v4 1/1] ArmPkg/SmbiosMiscDxe: Adjust the priority of getting firmware version Date: Mon, 27 Mar 2023 01:35:43 +0700 Message-Id: <20230326183543.1980914-1-tinhnguyen@os.amperecomputing.com> X-Mailer: git-send-email 2.39.2 X-ClientProxiedBy: SI2PR01CA0048.apcprd01.prod.exchangelabs.com (2603:1096:4:193::17) To MWHPR0101MB2942.prod.exchangelabs.com (2603:10b6:301:2e::14) Return-Path: tinhnguyen@os.amperecomputing.com MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR0101MB2942:EE_|BN6PR01MB2227:EE_ X-MS-Office365-Filtering-Correlation-Id: f139297d-757d-4eec-0348-08db2e29366b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NxWZehjxmZgjnXn9Jurnl3xe5SuEM872C8mBVJKfW8wX57fWHFvL+fSanwHa9MGubLIvRCI5zIfeDfvSd2ihAmOO4GqtAL+ajqXs67IGNHhIJudQ8GbH1Pid7dWlsp0/e8H5GH39X8KHaDs6Ji7IrdUZFk7dayoZRey+rqgOTsSFSZwhi7nWc7OZ4shxgPw1o0uUlE6oLm+fL8+WJ838vFsFwHQPCrhUZZYyN7FOg4kfiPzSaB1U++LoPdaqN2OM/W2RokoCHKJL8avf2wcHpRn67TpdlMR/9uDeU8HmtILR6BQJTH5kfylje1s0XHKjdu7diJma02zftYDMhK7A8CwEimNo8hhEACl6/SSyw64sNuqrbEH1tXRDXFwtCh2eIgJhPoMUgAAwbRo7iprjwUQUDk418n0SRuVjNhE1GqxEKPniDC9LvALNgiABFlWkcMd6fKiXqhsH6DWfTBOX3njEOiVsvZf6TtsTzA7eTsK5QPlyY0nif5CLTtpCzAQ0sMCqv/7pLuIyzl9BXvktw5v4ADqp3rkLRzPc8Koif7h4QWq1byutTC2XSvPhln0KcnBh93TonY9P/xzJj+wyRd5tMRx3KOy/WMBZJbuxAb1weRX3mdRBOknjJFoktXW8 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR0101MB2942.prod.exchangelabs.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(136003)(366004)(39840400004)(396003)(451199021)(38100700002)(38350700002)(86362001)(8936002)(5660300002)(6666004)(107886003)(6512007)(6506007)(1076003)(26005)(186003)(66946007)(316002)(478600001)(41300700001)(6486002)(52116002)(8676002)(6916009)(4326008)(66556008)(66476007)(83380400001)(2906002)(2616005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?hgoF/lTch8I6dXztgZWY+rCfPVGU86P4b6gn0qaLp3NLH8oH/9U1MTxPfXnN?= =?us-ascii?Q?xcYxoJGs19VZd+1Gvy9POFMsxYbXTA2QQ32MV+M/wY63u43b1BosXzz9YLO5?= =?us-ascii?Q?d8CtZy0hcvJmAhYiZGD5ROJD9NHt2qNqivW5IxsYFrnSJV/9s9MKg3sJuHyq?= =?us-ascii?Q?7hf4D2Cgjw5GS8PHJ5QZnPUgib9+8FdlnLeobu0l7zAj82phlISFb+dXb5Qf?= =?us-ascii?Q?3OXEbRt/J6cCy8qXLt9dFpbsxM4Y+MMRHwsDg8OGAw3RSwjGGZF1r6KvL3Bz?= =?us-ascii?Q?NarRchQ7xtACNKwCrZmIg01EvAadrfPIKN15F6D8DDZ6XzlpHa/6Zdv90+jI?= =?us-ascii?Q?F4l4nxmZkYhrnGuEBnV/Pb8OaNJtdptmb/kiJcMzzeSgVB/LTndCYm7Bkj0k?= =?us-ascii?Q?Ja6tUbgw7yfB6a0uLuffKClVbFQNMJs9WgLLdrQA/duzSvippUBRoXxxLaXF?= =?us-ascii?Q?hOtJHg81EMUsXhUj1EnwSRx7/5l7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wZm34oW26FMVcLK7NKj9Q/226/7YTO8zKMgKO+i2VyS5U6A2nIeROviPI0lB?= =?us-ascii?Q?p6Y6l59SgMiCzqa8nXZse8R0nb+zLt1pYTzou5aCjKbxyjT8HLedM0DlC78p?= =?us-ascii?Q?pq6gJwc07StTayUlUUvbYuWHuCPcS8Yjb5TaF5cKhQBnyuf8TKwLk5GK0SnS?= =?us-ascii?Q?dtzBNPyY4V5NOqWEWlFJlClG5Wd0Z5Dje3ZQOaFi63ERcEkdq7H3NIu3v/Fq?= =?us-ascii?Q?xgz3mGElr27eRFksREB+vu7eXOjSt140vQJs9CDjobhL?= X-OriginatorOrg: os.amperecomputing.com X-MS-Exchange-CrossTenant-Network-Message-Id: f139297d-757d-4eec-0348-08db2e29366b X-MS-Exchange-CrossTenant-AuthSource: MWHPR0101MB2942.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Mar 2023 18:37:55.3326 (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: Dr5fXWj3b4uTjfH1/T+yxUhXkBhHdx16OZk+FqlhHTdBM78rdBvRMxtFeOjLn32TlqJWhg2aVNrwNqJaAdjPX3TiFnd1NarahV8kN+tLbMObKISsBdYoWCGmyUHCWce1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR01MB2227 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain The BIOS Firmware Version in the SMBIOS Type 0 can be fetched from the fixed PcdFirmwareVersionString or platform specific OemMiscLib. In fact, the support from OemMiscLib comes into play when the firmware version may be modified at boot time for extended information. Therefore, the priority of getting the version from OemMiscLib should be higher. In case there is no modification in the OemMiscLib, we have to keep HII string STR_MISC_BIOS_VERSION empty or 'Not Specified' to indicate that the firmware version should be fetched from the PcdFirmwareVersionString. Signed-off-by: Tinh Nguyen Reviewed-by: Rebecca Cran Reviewed-by: Oliver Smith-Denny Reviewed-by: Leif Lindholm --- Changes since v1: + Change GetBiosVersion () to SetBiosVersion () and move the selection l= ogic fully into SetBiosVersion (). Changes since v2: + Add R-B by Rebecca and remove @retval VOID Changes since v3: + Change the function's comment. Add R-B by Leif and Oliver. ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c | 58= ++++++++++++-------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFun= ction.c b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFuncti= on.c index 66ead22a6e2c..c9f25b750254 100644 --- a/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c +++ b/ArmPkg/Universal/Smbios/SmbiosMiscDxe/Type00/MiscBiosVendorFunction.c @@ -1,6 +1,6 @@ /** @file=0D =0D - Copyright (c) 2022, Ampere Computing LLC. All rights reserved.
=0D + Copyright (c) 2022 - 2023, 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 @@ -124,22 +124,47 @@ GetBiosReleaseDate ( return ReleaseDate;=0D }=0D =0D -/**=0D - Fetches the firmware ('BIOS') version from the=0D - FirmwareVersionInfo HOB.=0D +/** Fetches the Firmware version string for SMBIOS type 0=0D +=0D + This function first acquires the firmware version string from OemMiscLib= ;=0D + if it is invalid, PcdFirmwareVersionString is used as a fallback,=0D + and then sets it in SMBIOS type 0.=0D =0D - @return The version as a UTF-16 string=0D **/=0D -CHAR16 *=0D -GetBiosVersion (=0D +VOID=0D +SetBiosVersion (=0D VOID=0D )=0D {=0D - CHAR16 *ReleaseString;=0D + CHAR16 *DefaultVersionString;=0D + CHAR16 *Version;=0D + EFI_STRING_ID TokenToUpdate;=0D =0D - ReleaseString =3D (CHAR16 *)FixedPcdGetPtr (PcdFirmwareVersionString);=0D + DefaultVersionString =3D HiiGetString (=0D + mSmbiosMiscHiiHandle,=0D + STRING_TOKEN (STR_MISC_BIOS_VERSION),=0D + NULL=0D + );=0D =0D - return ReleaseString;=0D + OemUpdateSmbiosInfo (=0D + mSmbiosMiscHiiHandle,=0D + STRING_TOKEN (STR_MISC_BIOS_VERSION),=0D + BiosVersionType00=0D + );=0D +=0D + Version =3D HiiGetString (=0D + mSmbiosMiscHiiHandle,=0D + STRING_TOKEN (STR_MISC_BIOS_VERSION),=0D + NULL=0D + );=0D +=0D + if (((StrCmp (Version, DefaultVersionString) =3D=3D 0) || (StrLen (Versi= on) =3D=3D 0))) {=0D + Version =3D (CHAR16 *)FixedPcdGetPtr (PcdFirmwareVersionString);=0D + if (StrLen (Version) > 0) {=0D + TokenToUpdate =3D STRING_TOKEN (STR_MISC_BIOS_VERSION);=0D + HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Version, NULL);=0D + }=0D + }=0D }=0D =0D /**=0D @@ -187,18 +212,7 @@ SMBIOS_MISC_TABLE_FUNCTION (MiscBiosVendor) { HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Vendor, NULL);=0D }=0D =0D - Version =3D GetBiosVersion ();=0D -=0D - if (StrLen (Version) > 0) {=0D - TokenToUpdate =3D STRING_TOKEN (STR_MISC_BIOS_VERSION);=0D - HiiSetString (mSmbiosMiscHiiHandle, TokenToUpdate, Version, NULL);=0D - } else {=0D - OemUpdateSmbiosInfo (=0D - mSmbiosMiscHiiHandle,=0D - STRING_TOKEN (STR_MISC_BIOS_VERSION),=0D - BiosVersionType00=0D - );=0D - }=0D + SetBiosVersion ();=0D =0D Char16String =3D GetBiosReleaseDate ();=0D if (StrLen (Char16String) > 0) {=0D -- 2.39.2