Skip to content

Commit

Permalink
DynamicTablesPkg: Add _STA method to CPU object
Browse files Browse the repository at this point in the history
Implement the _STA method for the CPU object based on
the value provided by the configuration manager.

Signed-off-by: Abdul Lateef Attar <[email protected]>
  • Loading branch information
Abdul Lateef Attar authored and Abdul Lateef Attar committed Nov 29, 2024
1 parent 45f3fc2 commit 121f9ae
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 1 deletion.
10 changes: 10 additions & 0 deletions DynamicTablesPkg/Include/ArchCommonNameSpaceObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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_
5 changes: 5 additions & 0 deletions DynamicTablesPkg/Include/X64NameSpaceObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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[] = {
Expand Down Expand Up @@ -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)
};

Expand Down Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions DynamicTablesPkg/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 121f9ae

Please sign in to comment.