[edk2-devel] [PATCH v4 1/6] ArmPkg/ProcessorSubClassDxe: Get processor version from OemMiscLib

Nhi Pham via groups.io posted 6 patches 2 years, 2 months ago
[edk2-devel] [PATCH v4 1/6] ArmPkg/ProcessorSubClassDxe: Get processor version from OemMiscLib
Posted by Nhi Pham via groups.io 2 years, 2 months ago
From: Minh Nguyen <minhn@amperecomputing.com>

In some scenarios, the processor version may be updated dynamically
from pre-UEFI firmware during booting. But the processor version is
fixed with PCD (PcdProcessorVersion), so it can not be updated it
dynamically. This patch will support setting that value both
statically and dynamically.

Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
Reviewed-by: Rebecca Cran <rebecca@quicinc.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
---
 ArmPkg/Include/Library/OemMiscLib.h                              | 2 ++
 ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c | 8 +++++++-
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/ArmPkg/Include/Library/OemMiscLib.h b/ArmPkg/Include/Library/OemMiscLib.h
index 47cb30d84a62..330bb4b014de 100644
--- a/ArmPkg/Include/Library/OemMiscLib.h
+++ b/ArmPkg/Include/Library/OemMiscLib.h
@@ -1,5 +1,6 @@
 /** @file

 *

+*  Copyright (c) 2022, Ampere Computing LLC. All rights reserved.

 *  Copyright (c) 2021, NUVIA Inc. All rights reserved.

 *  Copyright (c) 2015, Hisilicon Limited. All rights reserved.

 *  Copyright (c) 2015, Linaro Limited. All rights reserved.

@@ -58,6 +59,7 @@ typedef enum {
   SkuNumberType03,

   ProcessorPartNumType04,

   ProcessorSerialNumType04,

+  ProcessorVersionType04,

   SmbiosHiiStringFieldMax

 } OEM_MISC_SMBIOS_HII_STRING_FIELD;

 

diff --git a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c
index 0b9af9bd7e1c..3b12e26abf6e 100644
--- a/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c
+++ b/ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c
@@ -1,6 +1,7 @@
 /** @file

   ProcessorSubClass.c

 

+  Copyright (c) 2022, Ampere Computing LLC. All rights reserved.

   Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>

   Copyright (c) 2015, Hisilicon Limited. All rights reserved.

   Copyright (c) 2015, Linaro Limited. All rights reserved.

@@ -512,7 +513,6 @@ AllocateType4AndSetProcessorInformationStrings (
   PartNumber       = STRING_TOKEN (STR_PROCESSOR_PART_NUMBER);

 

   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 (PcdProcessorAssetTag, AssetTag);

 

   if (StrLen ((CHAR16 *)FixedPcdGetPtr (PcdProcessorSerialNumber)) > 0) {

@@ -527,6 +527,12 @@ AllocateType4AndSetProcessorInformationStrings (
     OemUpdateSmbiosInfo (mHiiHandle, PartNumber, ProcessorPartNumType04);

   }

 

+  if (StrLen ((CHAR16 *)FixedPcdGetPtr (PcdProcessorVersion)) > 0) {

+    HiiSetString (mHiiHandle, ProcessorVersion, (CHAR16 *)FixedPcdGetPtr (PcdProcessorVersion), NULL);

+  } else {

+    OemUpdateSmbiosInfo (mHiiHandle, ProcessorVersion, ProcessorVersionType04);

+  }

+

   // Processor Designation

   StringBufferSize = sizeof (CHAR16) * SMBIOS_STRING_MAX_LENGTH;

   ProcessorStr     = AllocateZeroPool (StringBufferSize);

-- 
2.25.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#93927): https://edk2.groups.io/g/devel/message/93927
Mute This Topic: https://groups.io/mt/93773958/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-