From 121f9aea1d8660859be99816fc2bef91d77c6d26 Mon Sep 17 00:00:00 2001 From: Abdul Lateef Attar Date: Fri, 29 Nov 2024 13:03:26 +0000 Subject: [PATCH] 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 --- .../Include/ArchCommonNameSpaceObjects.h | 10 +++++++ .../Include/X64NameSpaceObjects.h | 5 ++++ .../X64/X64SsdtCpuTopologyGenerator.c | 29 +++++++++++++++++++ .../ConfigurationManagerObjectParser.c | 10 ++++++- DynamicTablesPkg/Readme.md | 1 + 5 files changed, 54 insertions(+), 1 deletion(-) diff --git a/DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h b/DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h index 8b9b87164210b..6f21c29884ac7 100755 --- a/DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h +++ b/DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h @@ -56,6 +56,7 @@ typedef enum ArchCommonObjectID { EArchCommonObjCstInfo, ///< 29 - C-State Info EArchCommonObjCsdInfo, ///< 30 - C-State Dependency (CSD) Info EArchCommonObjPstateInfo, ///< 31 - Processor P-State Info + EArchCommonObjStaInfo, ///< 32 - _STA (Device Status) Info EArchCommonObjMax } EARCH_COMMON_OBJECT_ID; @@ -776,6 +777,15 @@ typedef struct CmArchCommonPstateInfo { UINT32 Ppc; } CM_ARCH_COMMON_PSTATE_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_ diff --git a/DynamicTablesPkg/Include/X64NameSpaceObjects.h b/DynamicTablesPkg/Include/X64NameSpaceObjects.h index fa14c8e5da0c8..251de2babb4dd 100644 --- a/DynamicTablesPkg/Include/X64NameSpaceObjects.h +++ b/DynamicTablesPkg/Include/X64NameSpaceObjects.h @@ -252,6 +252,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; /** diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/X64/X64SsdtCpuTopologyGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/X64/X64SsdtCpuTopologyGenerator.c index 8cdf55bca5b4b..ed420b9df94d8 100644 --- a/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/X64/X64SsdtCpuTopologyGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/X64/X64SsdtCpuTopologyGenerator.c @@ -58,6 +58,15 @@ GET_OBJECT_LIST ( CM_ARCH_COMMON_PSTATE_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 + ); + /** Create the processor hierarchy AML tree from arch specific CM objects. @@ -85,6 +94,7 @@ CreateTopologyFromIntC ( CM_ARCH_COMMON_CSD_INFO *CsdInfo; UINT32 CsdNumEntries; CM_ARCH_COMMON_PSTATE_INFO *PstateInfo; + CM_ARCH_COMMON_STA_INFO *StaInfo; ASSERT (Generator != NULL); ASSERT (CfgMgrProtocol != NULL); @@ -223,6 +233,25 @@ CreateTopologyFromIntC ( return Status; } } + + 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; + } + + Status = AmlCodeGenMethodRetInteger ("_STA", StaInfo->DeviceStatus, 0, FALSE, 0, CpuNode, NULL); + if (EFI_ERROR (Status)) { + ASSERT_EFI_ERROR (Status); + return Status; + } + } } return Status; diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c index e8ae978c15693..2943b3dcabed7 100755 --- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c +++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c @@ -749,6 +749,12 @@ STATIC CONST CM_OBJ_PARSER CmArchCommonPstateInfoParser[] = { { "Ppc", 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[] = { @@ -784,6 +790,7 @@ STATIC CONST CM_OBJ_PARSER_ARRAY ArchCommonNamespaceObjectParser[] = { CM_PARSER_ADD_OBJECT (EArchCommonObjCstInfo, CmArchCommonCstInfoParser), CM_PARSER_ADD_OBJECT (EArchCommonObjCsdInfo, CmArchCommonCsdInfoParser), CM_PARSER_ADD_OBJECT (EArchCommonObjPstateInfo, CmArchCommonPstateInfoParser), + CM_PARSER_ADD_OBJECT (EArchCommonObjStaInfo, CmArchCommonStaInfoParser), CM_PARSER_ADD_OBJECT_RESERVED (EArchCommonObjMax) }; @@ -959,7 +966,8 @@ STATIC CONST CM_OBJ_PARSER CmX64ObjLocalApicX2ApicInfoParser[] = { { "CsdToken", sizeof (CM_OBJECT_TOKEN), "0x%p", NULL }, { "PstateToken", 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. diff --git a/DynamicTablesPkg/Readme.md b/DynamicTablesPkg/Readme.md index 07c4a47f0d9f8..1378083275fee 100644 --- a/DynamicTablesPkg/Readme.md +++ b/DynamicTablesPkg/Readme.md @@ -503,6 +503,7 @@ The CM_OBJECT_ID type is used to identify the Configuration Manager | 29 | Processor C-State Control Info | | | 30 | Processor C-State Dependency Info | | | 31 | Processor P-State Info | | +| 32 | _STA Device Status Info | | | `*` | All other values are reserved. | | #### Object ID's in the X64 Namespace: