DynamicTablesPkg: Use ArmSmcccSocIdLib for SoC ID

Update SmbiosSmcLib to use ArmSmcccSocIdLib for retrieving the JEP106
identification code and SoC revision.

Remove the duplicated SMCCC feature detection and SoC ID calls while
retaining the SMBIOS-specific formatting of the Type 4 Processor ID.

Signed-off-by: Varshit Pandya <Varshit.Pandya@arm.com>
This commit is contained in:
VarshitPandya 2026-07-22 16:07:24 +01:00 committed by mergify[bot]
parent 5c6e9d475f
commit 984b2fb3bd
4 changed files with 32 additions and 96 deletions

View file

@ -29,6 +29,7 @@
Tpm2DeviceTableLib|DynamicTablesPkg/Library/Common/Tpm2DeviceTableLib/Tpm2DeviceTableLib.inf
[LibraryClasses.AARCH64]
ArmSmcccSocIdLib|ArmPkg/Library/ArmSmcccSocIdLib/ArmSmcccSocIdLib.inf
DynamicTablesScmiInfoLib|DynamicTablesPkg/Library/DynamicTablesScmiInfoLib/DynamicTablesScmiInfoLib.inf
[Components.ARM, Components.AARCH64, Components.X64, Components.RISCV64, Components.LOONGARCH64]

View file

@ -1,6 +1,6 @@
/** @file
*
* Copyright (c) 2025, ARM Limited. All rights reserved.
* Copyright (c) 2025 - 2026, ARM Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*
@ -8,14 +8,17 @@
#pragma once
/** Returns the SOC ID, formatted for the SMBIOS Type 4 Processor ID field.
/**
Return the SoC ID formatted for the SMBIOS Type 4 Processor ID field.
@param Processor ID.
@param[out] ProcessorId Pointer to the SMBIOS Processor ID.
@return 0 on success
@return EFI_UNSUPPORTED if SMCCC_ARCH_SOC_ID is not implemented
@retval EFI_SUCCESS The Processor ID was returned successfully.
@retval EFI_INVALID_PARAMETER ProcessorId is NULL.
@retval EFI_UNSUPPORTED The SMCCC Architecture SoC ID interface is
unsupported or an SoC ID call failed.
**/
UINT64
EFI_STATUS
SmbiosSmcGetSocId (
UINT64 *ProcessorId
OUT UINT64 *ProcessorId
);

View file

@ -3,111 +3,42 @@
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>
Copyright (c) 2025 - 2026, 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/ArmSmcccSocIdLib.h>
#include <Library/SmbiosSmcLib.h>
/** Checks if the ARM64 SoC ID SMC call is supported
/**
Return the SoC ID formatted for the SMBIOS Type 4 Processor ID field.
@return Whether the ARM64 SoC ID call is supported.
@param[out] ProcessorId Pointer to the SMBIOS Processor ID.
@retval EFI_SUCCESS The Processor ID was returned successfully.
@retval EFI_INVALID_PARAMETER ProcessorId is NULL.
@retval EFI_UNSUPPORTED The SMCCC Architecture SoC ID interface is
unsupported or an SoC ID call failed.
**/
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
OUT 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;
if (ProcessorId == NULL) {
return EFI_INVALID_PARAMETER;
}
Status = ArmSmcccGetSocId (&Jep106Code, &SocRevision);
if (!EFI_ERROR (Status)) {
*ProcessorId = ((UINT64)SocRevision << 32) | Jep106Code;
}
return Status;

View file

@ -1,6 +1,6 @@
#/** @file
#
# Copyright (c) 2025, ARM Ltd. All rights reserved.<BR>
# Copyright (c) 2025 - 2026, ARM Ltd. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@ -18,9 +18,10 @@
SmbiosSmcLib.c
[Packages]
ArmPkg/ArmPkg.dec
DynamicTablesPkg/DynamicTablesPkg.dec
MdePkg/MdePkg.dec
[LibraryClasses]
ArmSmcLib
ArmSmcccSocIdLib