public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Nhi Pham" <nhi@os.amperecomputing.com>
To: devel@edk2.groups.io
Cc: patches@amperecomputing.com,
	Nhi Pham <nhi@os.amperecomputing.com>,
	Leif Lindholm <leif@nuviainc.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Rebecca Cran <rebecca@nuviainc.com>,
	Sami Mujawar <sami.mujawar@arm.com>
Subject: [PATCH v2 3/3] ArmPkg/ProcessorSubClassDxe: Get serial and part number from OemMiscLib
Date: Thu, 16 Dec 2021 10:54:55 +0700	[thread overview]
Message-ID: <20211216035455.977400-4-nhi@os.amperecomputing.com> (raw)
In-Reply-To: <20211216035455.977400-1-nhi@os.amperecomputing.com>

Currently, the serial and part number of a processor are filled with
fixed PCDs. However, they may be updated dynamically according to the
information being passed from a the pre-UEFI firmware during booting.
So, this patch is to support updating these string fields from
OemMiscLib if the PCDs are empty.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Rebecca Cran <rebecca@nuviainc.com>
Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
---
 ArmPkg/Include/Library/OemMiscLib.h                              |  2 ++
 ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c | 14 ++++++++++++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/ArmPkg/Include/Library/OemMiscLib.h b/ArmPkg/Include/Library/OemMiscLib.h
index f25c8f3342a9..47cb30d84a62 100644
--- a/ArmPkg/Include/Library/OemMiscLib.h
+++ b/ArmPkg/Include/Library/OemMiscLib.h
@@ -56,6 +56,8 @@ typedef enum {
   ChassisTypeType03,
   ManufacturerType03,
   SkuNumberType03,
+  ProcessorPartNumType04,
+  ProcessorSerialNumType04,
   SmbiosHiiStringFieldMax
 } OEM_MISC_SMBIOS_HII_STRING_FIELD;
 
diff --git a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c
index a4f98e6a81d2..0b9af9bd7e1c 100644
--- a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c
+++ b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c
@@ -513,9 +513,19 @@ AllocateType4AndSetProcessorInformationStrings (
 
   SET_HII_STRING_IF_PCD_NOT_EMPTY (PcdProcessorManufacturer, ProcessorManu);
   SET_HII_STRING_IF_PCD_NOT_EMPTY (PcdProcessorVersion, ProcessorVersion);
-  SET_HII_STRING_IF_PCD_NOT_EMPTY (PcdProcessorSerialNumber, SerialNumber);
   SET_HII_STRING_IF_PCD_NOT_EMPTY (PcdProcessorAssetTag, AssetTag);
-  SET_HII_STRING_IF_PCD_NOT_EMPTY (PcdProcessorPartNumber, PartNumber);
+
+  if (StrLen ((CHAR16 *)FixedPcdGetPtr (PcdProcessorSerialNumber)) > 0) {
+    HiiSetString (mHiiHandle, SerialNumber, (CHAR16 *)FixedPcdGetPtr (PcdProcessorSerialNumber), NULL);
+  } else {
+    OemUpdateSmbiosInfo (mHiiHandle, SerialNumber, ProcessorSerialNumType04);
+  }
+
+  if (StrLen ((CHAR16 *)FixedPcdGetPtr (PcdProcessorPartNumber)) > 0) {
+    HiiSetString (mHiiHandle, PartNumber, (CHAR16 *)FixedPcdGetPtr (PcdProcessorPartNumber), NULL);
+  } else {
+    OemUpdateSmbiosInfo (mHiiHandle, PartNumber, ProcessorPartNumType04);
+  }
 
   // Processor Designation
   StringBufferSize = sizeof (CHAR16) * SMBIOS_STRING_MAX_LENGTH;
-- 
2.25.1


  parent reply	other threads:[~2021-12-16  3:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-16  3:54 [PATCH v2 0/3] ArmPkg/SMBIOS: Update HII string settings for SMBIOS Nhi Pham
2021-12-16  3:54 ` [PATCH v2 1/3] ArmPkg/SmbiosMiscDxe: Remove duplicate HII string definition Nhi Pham
2021-12-16  3:54 ` [PATCH v2 2/3] ArmPkg/SmbiosMiscDxe: Get full SMBIOS strings from OemMiscLib Nhi Pham
2021-12-16  3:54 ` Nhi Pham [this message]
2021-12-16 18:56 ` [PATCH v2 0/3] ArmPkg/SMBIOS: Update HII string settings for SMBIOS Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211216035455.977400-4-nhi@os.amperecomputing.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox