From nobody Mon Feb 9 23:18:26 2026 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+68104+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+68104+1787277+3901457@groups.io ARC-Seal: i=1; a=rsa-sha256; t=1606782903; cv=none; d=zohomail.com; s=zohoarc; b=FmxOMMSVy3KqRWLbg4m6teSLgLzM+fBo6+lfY+Y2LO69vP+PYdJMwSCvc2L9r1uKSEDY9SJsoGMa5Ytvu+adYBG2um//QrQxyromb50KOtdj43bDFHp2wVp5MsKQamy6axx5v8i5UNV4PdLV/hCnN77eh8bBVBKq+MCJEHNMpxY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606782903; 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=29ekC2ZADcnXUOQiKMHcAS8C5QsnLN9rPZWSbUEwJDQ=; b=DY+T4rdty/oXt03+PjGyOnuAR7aS5vv8B+ri3Gg7YvORT0/EBympCXmRYNole5XyJl1ph1y4t6YPlU4z+Evq1p373/mlCh6tujKn1Uhho1gXR5PWWLdQgpFZWOKYwNy+4z16jxuhk01UCmV6H652EKASTRM+1fMTaYzOQ3Fgjao= 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+68104+1787277+3901457@groups.io Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1606782903470948.5638234454046; Mon, 30 Nov 2020 16:35:03 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id JNTnYY1788612x9XKN8S8ISh; Mon, 30 Nov 2020 16:35:02 -0800 X-Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by mx.groups.io with SMTP id smtpd.web11.3045.1606782902422577646 for ; Mon, 30 Nov 2020 16:35:02 -0800 X-Received: by mail-pl1-f177.google.com with SMTP id x4so96613pln.8 for ; Mon, 30 Nov 2020 16:35:02 -0800 (PST) X-Gm-Message-State: X02pRfHJrvm5FZt3lZBuBwxUx1787277AA= X-Google-Smtp-Source: ABdhPJw8EcICTlgcmcIC1AHRX3MDVs4wKevW4jRmcD8+OwYIp7UbUZWBn0Ij+KUl6QOmHLUcKZT0VQ== X-Received: by 2002:a17:902:a9c7:b029:d6:da66:253c with SMTP id b7-20020a170902a9c7b02900d6da66253cmr187254plr.19.1606782901502; Mon, 30 Nov 2020 16:35: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 22sm57899pjb.40.2020.11.30.16.34.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2020 16:35:00 -0800 (PST) From: "Rebecca Cran" To: devel@edk2.groups.io Cc: Rebecca Cran , Michael D Kinney , Liming Gao , Zhiguang Liu , Leif Lindholm , Ard Biesheuvel , Sami Mujawar Subject: [edk2-devel] [PATCH v4 09/11] ArmPkg: Add FirmwareVersionInfoPeim Date: Mon, 30 Nov 2020 17:33:56 -0700 Message-Id: <20201201003358.8780-10-rebecca@nuviainc.com> In-Reply-To: <20201201003358.8780-1-rebecca@nuviainc.com> References: <20201201003358.8780-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=1606782902; bh=AxcCOEFre+yqmKXBx0svOV5PtWo+ze2N/rcovRtXVEo=; h=Cc:Date:From:Reply-To:Subject:To; b=bCzp42v/Qt2iATOSCoCY57vvgzNIE4NwQjnlrcpUXZzdIXCGdwTdEhiQb/GMhhPYXIN ODnzHnRmbBFxJiv5FDBD6XjY81SKBN105sxTYvINcuD5m0ewxS7/LCEB6yYos4Aj8iZk1 Z8IRV53FQ58Cv4l37qbyYcsI1EDXxVQynvc= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add the FirmwareVersionInfoPeim driver, which provides the firmware release date to the SMBIOS code. Signed-off-by: Rebecca Cran --- ArmPkg/ArmPkg.dec | 3 + ArmPkg/Drivers/FirmwareVersionInfoPeim/FirmwareVersionInfoPeim.inf | 47 ++= ++++++++ ArmPkg/Include/Guid/FirmwareVersionInfoHobGuid.h | 29 ++= +++++ ArmPkg/Drivers/FirmwareVersionInfoPeim/FirmwareVersionInfoPeim.c | 91 ++= ++++++++++++++++++ 4 files changed, 170 insertions(+) diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec index eaf1072d9ef3..840f6c7c34e1 100644 --- a/ArmPkg/ArmPkg.dec +++ b/ArmPkg/ArmPkg.dec @@ -45,6 +45,9 @@ [Guids.common] # Include/Guid/ArmMpCoreInfo.h gArmMpCoreInfoGuid =3D { 0xa4ee0728, 0xe5d7, 0x4ac5, {0xb2, 0x1e, 0x65,= 0x8e, 0xd8, 0x57, 0xe8, 0x34} } =20 + gFirmwareInfoHobGuid =3D { 0x78ba5a73, 0x04d0, 0x4adf, {0xb6, 0x14, 0x04= , 0xa6, 0xa3, 0xd8, 0xa2, 0x57} } + + [Protocols.common] ## Arm System Control and Management Interface(SCMI) Base protocol ## ArmPkg/Include/Protocol/ArmScmiBaseProtocol.h diff --git a/ArmPkg/Drivers/FirmwareVersionInfoPeim/FirmwareVersionInfoPeim= .inf b/ArmPkg/Drivers/FirmwareVersionInfoPeim/FirmwareVersionInfoPeim.inf new file mode 100644 index 000000000000..5b61fcfa2ebf --- /dev/null +++ b/ArmPkg/Drivers/FirmwareVersionInfoPeim/FirmwareVersionInfoPeim.inf @@ -0,0 +1,47 @@ +#/** @file +# +# Copyright (c) 2020, NUVIA Inc. All rights reserved. +# Copyright (c) 2016, Hisilicon Limited. All rights reserved. +# Copyright (c) 2016, Linaro Limited. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION =3D 1.29 + BASE_NAME =3D FirmwareVersionInfoPeim + FILE_GUID =3D 3d45d0a0-4ded-4c01-b16f-2b3007c1fbe2 + MODULE_TYPE =3D PEIM + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D FirmwareVersionInfoEntry + +[Sources.common] + FirmwareVersionInfoPeim.c + +[Packages] + ArmPkg/ArmPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + BaseLib + BaseMemoryLib + DebugLib + HobLib + PcdLib + PeimEntryPoint + PrintLib + SerialPortLib + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString + +[Guids] + gFirmwareVersionInfoHobGuid + +[Depex] + TRUE + +[BuildOptions] + diff --git a/ArmPkg/Include/Guid/FirmwareVersionInfoHobGuid.h b/ArmPkg/Incl= ude/Guid/FirmwareVersionInfoHobGuid.h new file mode 100644 index 000000000000..af4fa6fec823 --- /dev/null +++ b/ArmPkg/Include/Guid/FirmwareVersionInfoHobGuid.h @@ -0,0 +1,29 @@ +/** @file +* +* Copyright (c) 2020, NUVIA Inc. All rights reserved. +* Copyright (c) 2016, Hisilicon Limited. All rights reserved. +* Copyright (c) 2016, Linaro Limited. All rights reserved. +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +#ifndef FIRMWARE_VERSION_INFO_HOB_GUID_H_ +#define FIRMWARE_VERSION_INFO_HOB_GUID_H_ + +// {78ba5a73-04d0-4adf-b614-04a6a3d8a257} +#define FIRMWARE_VERSION_INFO_HOB_GUID \ + {0x78ba5a73, 0x04d0, 0x4adf, {0xb6, 0x14, 0x04, 0xa6, 0xa3, 0xd8, 0xa2, = 0x57}} + +extern GUID gFirmwareVersionInfoHobGuid; + +#pragma pack(1) + +typedef struct { + EFI_TIME BuildTime; + CHAR16 String[1]; +} FIRMWARE_VERSION_INFO; + +#pragma pack() + +#endif /* FIRMWARE_VERSION_INFO_HOB_GUID_H_ */ diff --git a/ArmPkg/Drivers/FirmwareVersionInfoPeim/FirmwareVersionInfoPeim= .c b/ArmPkg/Drivers/FirmwareVersionInfoPeim/FirmwareVersionInfoPeim.c new file mode 100644 index 000000000000..48dcf4602a95 --- /dev/null +++ b/ArmPkg/Drivers/FirmwareVersionInfoPeim/FirmwareVersionInfoPeim.c @@ -0,0 +1,91 @@ +/** @file +* +* Copyright (c) 2020, NUVIA Inc. All rights reserved. +* Copyright (c) 2016, Hisilicon Limited. All rights reserved. +* Copyright (c) 2016, Linaro Limited. All rights reserved. +* +* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +struct MonthDescription { + CONST CHAR8* MonthStr; + UINT32 MonthInt; +} 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 +}; + +VOID GetReleaseTime (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); + + return; +} + +EFI_STATUS +EFIAPI +FirmwareVersionInfoEntry ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + FIRMWARE_VERSION_INFO *VersionInfo; + EFI_TIME Time =3D {0}; + CONST CHAR16 *ReleaseString =3D + (CHAR16 *)FixedPcdGetPtr (PcdFirmwareVersionString); + + GetReleaseTime (&Time); + + VersionInfo =3D BuildGuidHob (&gFirmwareVersionInfoHobGuid, + sizeof (FIRMWARE_VERSION_INFO) - + sizeof (VersionInfo->String) + + StrSize (ReleaseString)); + if (VersionInfo =3D=3D NULL) { + DEBUG ((DEBUG_ERROR, "[%a]:[%d] Build HOB failed!\n", __FILE__, __LINE= __)); + return EFI_OUT_OF_RESOURCES; + } + + CopyMem (&VersionInfo->BuildTime, &Time, sizeof (EFI_TIME)); + CopyMem (VersionInfo->String, ReleaseString, StrSize (ReleaseString)); + + return EFI_SUCCESS; +} --=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 (#68104): https://edk2.groups.io/g/devel/message/68104 Mute This Topic: https://groups.io/mt/78622928/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-