Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions ArmPkg/Universal/Smbios/ProcessorSubClassDxe/ProcessorSubClass.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,19 @@ SMBIOS_TABLE_TYPE4 mSmbiosProcessorTableTemplate = {
ProcessorFamilyIndicatorFamily2, // ProcessorFamily
2, // ProcessorManufacture
{ // ProcessorId
#ifdef MDE_CPU_AARCH64
0, // SocId
0, // SipId
0, // SipBankIndex
0 // SocRevision
#else
{ // Signature
0
},
{ // FeatureFlags
0
}
#endif
},
3, // ProcessorVersion
{ // Voltage
Expand Down Expand Up @@ -193,8 +200,8 @@ ConfigureCacheArchitectureInformation (
)
{
UINT8 Associativity;
UINT32 CacheSize32;
UINT16 CacheSize16;
CACHE_SIZE_2 CacheSize32;
CACHE_SIZE CacheSize16;
UINT64 CacheSize64;

if (!DataCache && !UnifiedCache) {
Expand Down Expand Up @@ -223,19 +230,26 @@ ConfigureCacheArchitectureInformation (

// Encode the cache size into the format SMBIOS wants
if (CacheSize64 < MAX_INT16) {
CacheSize16 = CacheSize64;
CacheSize32 = CacheSize16;
CacheSize16.Size = CacheSize64;
CacheSize16.Granularity64K = 0;
CacheSize32.Size = CacheSize64;
CacheSize32.Granularity64K = 0;
} else if ((CacheSize64 / 64) < MAX_INT16) {
CacheSize16 = (1 << 15) | (CacheSize64 / 64);
CacheSize32 = (1 << 31) | (CacheSize64 / 64);
CacheSize16.Size = CacheSize64 / 64;
CacheSize16.Granularity64K = 1;
CacheSize32.Size = CacheSize64 / 64;
CacheSize32.Granularity64K = 1;
} else {
if ((CacheSize64 / 1024) <= 2047) {
CacheSize32 = CacheSize64;
CacheSize32.Size = CacheSize64;
CacheSize32.Granularity64K = 0;
} else {
CacheSize32 = (1 << 31) | (CacheSize64 / 64);
CacheSize32.Size = CacheSize64 / 64;
CacheSize32.Granularity64K = 1;
}

CacheSize16 = -1;
CacheSize16.Size = 0x7fff;
CacheSize16.Granularity64K = 1;
}

Type7Record->MaximumCacheSize = CacheSize16;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ BuildAndInstallMultipleSmbiosTables (
Status = TableFactoryProtocol->AddSmbiosHandle (
SmbiosProtocol,
&TableHandle,
CmObjToken[Index],
CmObjToken ? CmObjToken[Index] : CM_NULL_TOKEN,
SmbiosTableInfo->TableGeneratorId
);
if (EFI_ERROR (Status)) {
Expand Down
6 changes: 6 additions & 0 deletions DynamicTablesPkg/DynamicTables.dsc.inc
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@
DynamicTablesPkg/Library/Acpi/Arm/AcpiIortLibArm/AcpiIortLibArm.inf
DynamicTablesPkg/Library/Acpi/Arm/AcpiMadtLibArm/AcpiMadtLibArm.inf

DynamicTablesPkg/Library/Smbios/SmbiosType4Lib/SmbiosType4Lib.inf
DynamicTablesPkg/Library/Smbios/SmbiosType7Lib/SmbiosType7Lib.inf

# AML Fixup (Arm specific)
DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCmn600LibArm/SsdtCmn600LibArm.inf

Expand Down Expand Up @@ -128,5 +131,8 @@
# Common
NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/SsdtCpuTopologyLib.inf
NULL|DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtPcieLib/SsdtPcieLib.inf

NULL|DynamicTablesPkg/Library/Smbios/SmbiosType4Lib/SmbiosType4Lib.inf
NULL|DynamicTablesPkg/Library/Smbios/SmbiosType7Lib/SmbiosType7Lib.inf
}

3 changes: 3 additions & 0 deletions DynamicTablesPkg/DynamicTablesPkg.dec
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
## @libraryclass Defines a set of SMBIOS string helper methods.
SmbiosStringTableLib|Include/Library/SmbiosStringTableLib.h

## @libraryclass Defines a set of SMBIOS releated SMC helper methods.
SmcbiosSmbLib|Include/Library/SmbiosSmcLib.h

[LibraryClasses.AARCH64]
## @libraryclass Defines a set of APIs to populate CmObj using SCMI.
DynamicTablesScmiInfoLib|Include/Library/DynamicTablesScmiInfoLib.h
Expand Down
1 change: 1 addition & 0 deletions DynamicTablesPkg/DynamicTablesPkg.dsc
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@

[Components.ARM, Components.AARCH64]
DynamicTablesPkg/Library/FdtHwInfoParserLib/FdtHwInfoParserLib.inf
DynamicTablesPkg/Library/Smbios/Arm/SmbiosSmcLib/SmbiosSmcLib.inf

[Components.AARCH64]
DynamicTablesPkg/Library/DynamicTablesScmiInfoLib/DynamicTablesScmiInfoLib.inf
Expand Down
25 changes: 25 additions & 0 deletions DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,8 @@ typedef struct CmArchCommonLpiInfo {
CHAR8 StateName[16];
} CM_ARCH_COMMON_LPI_INFO;

#define SMBIOS_MAX_STRING_SIZE (1024)

/** A structure that describes the Processor Hierarchy Node (Type 0) in PPTT

ID: EArchCommonObjProcHierarchyInfo
Expand Down Expand Up @@ -421,6 +423,24 @@ typedef struct CmArchCommonProcHierarchyInfo {
/// If OverrideNameUidEnabled is TRUE then this value will be used for
/// the UID of processor containers.
UINT32 OverrideUid;
/// SMBIOS: Processor ID. See SMBIOS "Processor ID field format" for format details.
UINT64 ProcessorId;
/// SMBIOS: Designation of this CM_ARCH_COMMON_PROC_HIERARCHY_INFO instance.
/// This string (and all that follow) are intended only for instances with
/// EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL set, ie describing physical sockets.
CHAR8 SocketDesignation[SMBIOS_MAX_STRING_SIZE];
/// SMBIOS: String stating processor manufacturer.
CHAR8 ProcessorManufacturer[SMBIOS_MAX_STRING_SIZE];
/// SMBIOS: String stating processor version / device name.
CHAR8 ProcessorVersion[SMBIOS_MAX_STRING_SIZE];
/// SMBIOS: String stating processor serial number.
CHAR8 SerialNumber[SMBIOS_MAX_STRING_SIZE];
/// SMBIOS: String stating processor asset tag.
CHAR8 AssetTag[SMBIOS_MAX_STRING_SIZE];
/// SMBIOS: String stating processor part number.
CHAR8 PartNumber[SMBIOS_MAX_STRING_SIZE];
/// SMBIOS: String stating processor socket type.
CHAR8 SocketType[SMBIOS_MAX_STRING_SIZE];
} CM_ARCH_COMMON_PROC_HIERARCHY_INFO;

/** A structure that describes the Cache Type Structure (Type 1) in PPTT
Expand Down Expand Up @@ -451,6 +471,11 @@ typedef struct CmArchCommonCacheInfo {
UINT16 LineSize;
/// Unique ID for the cache
UINT32 CacheId;
/// SMBIOS: Level of cache within the processor hierarchy
/// 0-2 = cache level 1-3
UINT32 Level;
/// SMBIOS: Designation of this cache on this socket
CHAR8 SocketDesignation[SMBIOS_MAX_STRING_SIZE];
} CM_ARCH_COMMON_CACHE_INFO;

/** A structure that describes the Cpc information.
Expand Down
24 changes: 24 additions & 0 deletions DynamicTablesPkg/Include/Library/SmbiosSmcLib.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/** @file
*
* Copyright (c) 2025, ARM Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*
**/

#ifndef SMBIOS_SMC_LIB_H_
#define SMBIOS_SMC_LIB_H_

/** Returns the SOC ID, formatted for the SMBIOS Type 4 Processor ID field.

@param Processor ID.

@return 0 on success
@return EFI_UNSUPPORTED if SMCCC_ARCH_SOC_ID is not implemented
**/
UINT64
SmbiosSmcGetSocId (
UINT64 *ProcessorId
);

#endif // SMBIOS_SMC_LIB_H_
53 changes: 50 additions & 3 deletions DynamicTablesPkg/Include/StandardNameSpaceObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,17 @@
to identify a Configuration Manager object.

This can be used to differentiate between instances of
objects of the same types. The identification scheme is
implementation defined and is defined by the Configuration
Manager.
objects of the same types. When bit 0 is clear, the
identification scheme is implementation defined and is
defined by the Configuration Manager.

Tokens are also used by table generators to look up
previously generated tables. To aid with this, the concept
of an abstract token exists, allowing generators to
define arbitary tokens to identify generated tables.
When bit 1 is set, the token is an abstract token and
refers to generated tables. The format of an abstract
token is shown below.

Typically the token is used to identify a specific instance
from a set of objects in a call to the GetObject()/SetObject(),
Expand All @@ -40,6 +48,45 @@
**/
typedef UINTN CM_OBJECT_TOKEN;

/** The EABSTRACT_TOKEN_ID enum describes the defined namespaces
for Abstract Tokens.
*/
typedef enum AbstractTokenID {
ETokenNameSpaceUnknown = 0,
ETokenNameSpaceSmbios,

ETokenNameSpaceMax
} EABSTRACT_TOKEN_ID;

/** Abstract token generated by table generators

Description of abstract token format
______________________________________________________________________________
|31 |30 |29 |28 || 27 | 26 | 25 | 24 || 23 | 22 | 21 | 20 | 19 | 18 | 17 | 16|
------------------------------------------------------------------------------
| 1 0 1 0 || Name Space ID || Object ID |
______________________________________________________________________________

Bits: [31:28] - Must be 1010 (0xa) for abstract token
Bits: [27:24] - Name Space ID
0000 - Unknown
0001 - SMBIOS
Bits: [23:16] - Object ID
_______________________________________________________________________________
|15 |14 |13 |12 || 11 | 10 | 9 | 8 || 7 | 6 | 5 | 4 || 3 | 2 | 1 | 0|
-------------------------------------------------------------------------------
| ID | 1 |
_______________________________________________________________________________

Bits: [15:1] - Token ID
Token ID is arbitary and is defined by the generator
Bit [0] - Must be 1 for abstract token

Object ID's in the SMBIOS Namespace:
See ESTD_SMBIOS_TABLE_ID.
*/
#define CM_ABSTRACT_TOKEN_MAKE(ns, obj_id, id) ((CM_OBJECT_TOKEN)((0xa << 28) | ((ns) << 24) | ((obj_id) << 16) | ((id) << 1) | 1))

/**
A type representing a SMBIOS structure/table type.

Expand Down
114 changes: 114 additions & 0 deletions DynamicTablesPkg/Library/Smbios/Arm/SmbiosSmcLib/SmbiosSmcLib.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
/** @file
SMBIOS SMC helper functions.

Copyright (c) 2021, NUVIA Inc. All rights reserved.<BR>
Copyright (c) 2021 - 2022, Ampere Computing LLC. All rights reserved.<BR>
Copyright (c) 2025, ARM Ltd. All rights reserved.<BR>

SPDX-License-Identifier: BSD-2-Clause-Patent

**/

#include <Uefi.h>
#include <IndustryStandard/ArmStdSmc.h>
#include <Library/ArmSmcLib.h>
#include <Library/SmbiosSmcLib.h>

/** Checks if the ARM64 SoC ID SMC call is supported

@return Whether the ARM64 SoC ID call is supported.
**/
STATIC
BOOLEAN
HasSmcArm64SocId (
VOID
)
{
INT32 SmcCallStatus;
BOOLEAN Arm64SocIdSupported;
UINTN SmcParam;

Arm64SocIdSupported = FALSE;

SmcCallStatus = ArmCallSmc0 (SMCCC_VERSION, NULL, NULL, NULL);

if ((SmcCallStatus < 0) || ((SmcCallStatus >> 16) >= 1)) {
SmcParam = SMCCC_ARCH_SOC_ID;
SmcCallStatus = ArmCallSmc1 (SMCCC_ARCH_FEATURES, &SmcParam, NULL, NULL);
if (SmcCallStatus >= 0) {
Arm64SocIdSupported = TRUE;
}
}

return Arm64SocIdSupported;
}

/** Fetches the JEP106 code and SoC Revision.

@param Jep106Code JEP 106 code.
@param SocRevision SoC revision.

@retval EFI_SUCCESS Succeeded.
@retval EFI_UNSUPPORTED Failed.
**/
STATIC
EFI_STATUS
SmbiosGetSmcArm64SocId (
OUT UINT32 *Jep106Code,
OUT UINT32 *SocRevision
)
{
INT32 SmcCallStatus;
EFI_STATUS Status;
UINTN SmcParam;

Status = EFI_SUCCESS;

SmcParam = 0;
SmcCallStatus = ArmCallSmc1 (SMCCC_ARCH_SOC_ID, &SmcParam, NULL, NULL);

if (SmcCallStatus >= 0) {
*Jep106Code = (UINT32)SmcCallStatus;
} else {
Status = EFI_UNSUPPORTED;
}

SmcParam = 1;
SmcCallStatus = ArmCallSmc1 (SMCCC_ARCH_SOC_ID, &SmcParam, NULL, NULL);

if (SmcCallStatus >= 0) {
*SocRevision = (UINT32)SmcCallStatus;
} else {
Status = EFI_UNSUPPORTED;
}

return Status;
}

/** Returns the SOC ID, formatted for the SMBIOS Type 4 Processor ID field.

@param Processor ID.

@return 0 on success
@return EFI_UNSUPPORTED if SMCCC_ARCH_SOC_ID is not implemented
**/
UINT64
SmbiosSmcGetSocId (
UINT64 *ProcessorId
)
{
EFI_STATUS Status;
UINT32 Jep106Code;
UINT32 SocRevision;

if (HasSmcArm64SocId ()) {
Status = SmbiosGetSmcArm64SocId (&Jep106Code, &SocRevision);
if (!EFI_ERROR (Status)) {
*ProcessorId = ((UINT64)SocRevision << 32) | Jep106Code;
}
} else {
Status = EFI_UNSUPPORTED;
}

return Status;
}
26 changes: 26 additions & 0 deletions DynamicTablesPkg/Library/Smbios/Arm/SmbiosSmcLib/SmbiosSmcLib.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#/** @file
#
# Copyright (c) 2025, ARM Ltd. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
#**/

[Defines]
INF_VERSION = 1.30
BASE_NAME = SmbiosSmcLib
FILE_GUID = 201d7312-46c8-42f4-a1cf-38897ddfe916
MODULE_TYPE = BASE
VERSION_STRING = 1.0
LIBRARY_CLASS = SmbiosSmcLib

[Sources]
SmbiosSmcLib.c

[Packages]
DynamicTablesPkg/DynamicTablesPkg.dec
MdePkg/MdePkg.dec

[LibraryClasses]
ArmSmcLib

Loading