From nobody Mon Nov 25 12:48:45 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-