DynamicTablesPkg: Add _STA method to CPU object

Implement the _STA method for the CPU object based on
the value provided by the configuration manager.

Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
This commit is contained in:
Abdul Lateef Attar
2024-11-29 13:03:26 +00:00
committed by pierregondois
parent eb1beb6e95
commit 0f136602fd
5 changed files with 78 additions and 1 deletions

View File

@@ -58,6 +58,7 @@ typedef enum ArchCommonObjectID {
EArchCommonObjPctInfo, ///< 31 - P-State control (PCT) Info
EArchCommonObjPssInfo, ///< 32 - P-State status (PSS) Info
EArchCommonObjPpcInfo, ///< 33 - P-State control (PPC) Info
EArchCommonObjStaInfo, ///< 34 - _STA (Device Status) Info
EArchCommonObjMax
} EARCH_COMMON_OBJECT_ID;
@@ -801,6 +802,16 @@ typedef struct CmArchCommonObjPpcInfo {
/// The number of performance states supported by the processor.
UINT32 PstateCount;
} CM_ARCH_COMMON_PPC_INFO;
/** A structure that describes the _STA (Device Status) Info.
ID: EArchCommonObjStaInfo
*/
typedef struct CmArchCommonStaInfo {
/// Device Status
UINT32 DeviceStatus;
} CM_ARCH_COMMON_STA_INFO;
#pragma pack()
#endif // ARCH_COMMON_NAMESPACE_OBJECTS_H_

View File

@@ -269,6 +269,11 @@ typedef struct CmX64LocalApicX2ApicInfo {
i.e. a token referencing a CM_ARCH_COMMON_CPC_INFO object.
*/
CM_OBJECT_TOKEN CpcToken;
/** Optional field: Reference Token for _STA info of this processor.
i.e. a token referencing a CM_ARCH_COMMON_STA_INFO object.
*/
CM_OBJECT_TOKEN StaToken;
} CM_X64_LOCAL_APIC_X2APIC_INFO;
/**

View File

@@ -25,6 +25,19 @@
#include "SsdtCpuTopologyGenerator.h"
/** This macro defines the supported ACPI Processor Status bits.
The following bits are supported:
- ACPI_AML_STA_DEVICE_STATUS_PRESET
- ACPI_AML_STA_DEVICE_STATUS_ENABLED
- ACPI_AML_STA_DEVICE_STATUS_UI
- ACPI_AML_STA_DEVICE_STATUS_FUNCTIONING
*/
#define ACPI_AML_STA_PROC_SUPPORTED ( \
ACPI_AML_STA_DEVICE_STATUS_PRESET | \
ACPI_AML_STA_DEVICE_STATUS_ENABLED | \
ACPI_AML_STA_DEVICE_STATUS_UI | \
ACPI_AML_STA_DEVICE_STATUS_FUNCTIONING)
/** This macro expands to a function that retrieves the
Local APIC or X2APIC information from the Configuration Manager.
*/
@@ -79,6 +92,15 @@ GET_OBJECT_LIST (
CM_ARCH_COMMON_PPC_INFO
);
/** This macro expands to a function that retrieves the
_STA (Device Status) information from the Configuration Manager.
*/
GET_OBJECT_LIST (
EObjNameSpaceArchCommon,
EArchCommonObjStaInfo,
CM_ARCH_COMMON_STA_INFO
);
/**
This macro expands to a function that retrieves the cross-CM-object-
reference information from the Configuration Manager.
@@ -625,6 +647,7 @@ CreateTopologyFromIntC (
CM_ARCH_COMMON_PCT_INFO *PctInfo;
CM_ARCH_COMMON_PPC_INFO *PpcInfo;
CM_ARCH_COMMON_PSS_INFO *PssInfo;
CM_ARCH_COMMON_STA_INFO *StaInfo;
CM_X64_LOCAL_APIC_X2APIC_INFO *LocalApicX2ApicInfo;
EFI_STATUS Status;
TOKEN_TABLE CstTokenTable;
@@ -819,6 +842,35 @@ CreateTopologyFromIntC (
}
}
if (LocalApicX2ApicInfo[Index].StaToken != CM_NULL_TOKEN) {
Status = GetEArchCommonObjStaInfo (
CfgMgrProtocol,
LocalApicX2ApicInfo[Index].StaToken,
&StaInfo,
NULL
);
if (EFI_ERROR (Status)) {
ASSERT_EFI_ERROR (Status);
return Status;
}
/// check STA bits
if ((StaInfo->DeviceStatus & ~(ACPI_AML_STA_PROC_SUPPORTED)) != 0) {
DEBUG ((
DEBUG_ERROR,
"Unsupported STA bits set for processor %d\n",
LocalApicX2ApicInfo[Index].AcpiProcessorUid
));
return EFI_UNSUPPORTED;
}
Status = AmlCodeGenMethodRetInteger ("_STA", StaInfo->DeviceStatus, 0, FALSE, 0, CpuNode, NULL);
if (EFI_ERROR (Status)) {
ASSERT_EFI_ERROR (Status);
return Status;
}
}
return_handler:
TokenTableFree (&CstTokenTable);
return Status;

View File

@@ -751,6 +751,12 @@ STATIC CONST CM_OBJ_PARSER CmArchCommonPpcInfoParser[] = {
{ "PstateCount", 4, "0x%x", NULL }
};
/** A parser for EArchCommonObjStaInfo.
*/
STATIC CONST CM_OBJ_PARSER CmArchCommonStaInfoParser[] = {
{ "DeviceStatus", 4, "0x%x", NULL }
};
/** A parser for Arch Common namespace objects.
*/
STATIC CONST CM_OBJ_PARSER_ARRAY ArchCommonNamespaceObjectParser[] = {
@@ -788,6 +794,7 @@ STATIC CONST CM_OBJ_PARSER_ARRAY ArchCommonNamespaceObjectParser[] = {
CM_PARSER_ADD_OBJECT (EArchCommonObjPctInfo, CmArchCommonPctInfoParser),
CM_PARSER_ADD_OBJECT (EArchCommonObjPssInfo, CmArchCommonPssInfoParser),
CM_PARSER_ADD_OBJECT (EArchCommonObjPpcInfo, CmArchCommonPpcInfoParser),
CM_PARSER_ADD_OBJECT (EArchCommonObjStaInfo, CmArchCommonStaInfoParser),
CM_PARSER_ADD_OBJECT_RESERVED (EArchCommonObjMax)
};
@@ -965,7 +972,8 @@ STATIC CONST CM_OBJ_PARSER CmX64ObjLocalApicX2ApicInfoParser[] = {
{ "PssToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{ "PpcToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{ "PsdToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{ "CpcToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }
{ "CpcToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL },
{ "StaToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }
};
/** A parser for CmX64IoApicInfoParser.

View File

@@ -506,6 +506,7 @@ The CM_OBJECT_ID type is used to identify the Configuration Manager
| 31 | Processor P-State Control Info | |
| 32 | Processor P-State Status Info | |
| 33 | Processor P-State Capability Info | |
| 34 | _STA Device Status Info | |
| `*` | All other values are reserved. | |
#### Object ID's in the X64 Namespace: