diff --git a/DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h b/DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h index fcc0623361..300f591974 100755 --- a/DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h +++ b/DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h @@ -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_ diff --git a/DynamicTablesPkg/Include/X64NameSpaceObjects.h b/DynamicTablesPkg/Include/X64NameSpaceObjects.h index 3e7ad9ccbd..1e10e3f28d 100644 --- a/DynamicTablesPkg/Include/X64NameSpaceObjects.h +++ b/DynamicTablesPkg/Include/X64NameSpaceObjects.h @@ -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; /** diff --git a/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/X64/X64SsdtCpuTopologyGenerator.c b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/X64/X64SsdtCpuTopologyGenerator.c index 366809f674..6f21dfbaf8 100644 --- a/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/X64/X64SsdtCpuTopologyGenerator.c +++ b/DynamicTablesPkg/Library/Acpi/Common/AcpiSsdtCpuTopologyLib/X64/X64SsdtCpuTopologyGenerator.c @@ -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; diff --git a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c index f290a9fecb..e36de5e0c6 100755 --- a/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c +++ b/DynamicTablesPkg/Library/Common/TableHelperLib/ConfigurationManagerObjectParser.c @@ -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. diff --git a/DynamicTablesPkg/Readme.md b/DynamicTablesPkg/Readme.md index f885c45889..f52099c1c0 100644 --- a/DynamicTablesPkg/Readme.md +++ b/DynamicTablesPkg/Readme.md @@ -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: