127 return EFI_INVALID_PARAMETER;
133 return EFI_OUT_OF_RESOURCES;
186 LastIndex =
Generator->TokenTable.LastIndex;
189 for (Index = 0; Index < LastIndex; Index++) {
190 if (Table[Index] == Token) {
196 ASSERT (LastIndex < Generator->ProcNodeCount);
199 Table[LastIndex] = Token;
201 return Generator->TokenTable.LastIndex++;
225 IN OUT CHAR8 *AslName
234 return EFI_INVALID_PARAMETER;
237 AslName[0] = LeadChar;
238 AslName[AML_NAME_SEG_SIZE] =
'\0';
240 for (Index = 0; Index < AML_NAME_SEG_SIZE - 1; Index++) {
241 AslName[AML_NAME_SEG_SIZE - Index - 1] =
296 Status = GetEArchCommonObjPsdInfo (
302 if (EFI_ERROR (Status)) {
382 Status = GetEArchCommonObjCpcInfo (
388 if (EFI_ERROR (Status)) {
447 ASSERT (ProcHierarchyNodeInfo !=
NULL);
449 ASSERT (Node !=
NULL);
460 if (EFI_ERROR (Status)) {
478 if (EFI_ERROR (Status)) {
536 UINT32 LpiRefInfoCount;
539 CHAR8 AslName[AML_NAME_SEG_SIZE + 1];
543 ASSERT (CfgMgrProtocol !=
NULL);
544 ASSERT (ScopeNode !=
NULL);
546 LastIndex =
Generator->TokenTable.LastIndex;
550 for (Index = 0; Index < LastIndex; Index++) {
552 if (EFI_ERROR (Status)) {
559 if (EFI_ERROR (Status)) {
565 Status = GetEArchCommonObjCmRef (
571 if (EFI_ERROR (Status)) {
576 for (LpiRefIndex = 0; LpiRefIndex < LpiRefInfoCount; LpiRefIndex++) {
579 Status = GetEArchCommonObjLpiInfo (
581 LpiRefInfo[LpiRefIndex].ReferenceToken,
585 if (EFI_ERROR (Status)) {
608 if (EFI_ERROR (Status)) {
642 IN UINT32 AcpiProcessorUid,
649 CHAR8 AslName[AML_NAME_SEG_SIZE + 1];
652 ASSERT (ParentNode !=
NULL);
655 if (EFI_ERROR (Status)) {
661 if (EFI_ERROR (Status)) {
672 if (EFI_ERROR (Status)) {
683 if (EFI_ERROR (Status)) {
689 if (CpuNodePtr !=
NULL) {
690 *CpuNodePtr = CpuNode;
724 UINT32 AcpiProcessorUid;
729 ASSERT (CfgMgrProtocol !=
NULL);
730 ASSERT (ParentNode !=
NULL);
731 ASSERT (ProcHierarchyNodeInfo !=
NULL);
732 ASSERT (ProcHierarchyNodeInfo->AcpiIdObjectToken !=
CM_NULL_TOKEN);
736 ProcHierarchyNodeInfo->AcpiIdObjectToken,
741 if (EFI_ERROR (Status)) {
747 if (EFI_ERROR (Status)) {
756 if (EFI_ERROR (Status)) {
764 if (EFI_ERROR (Status)) {
774 if (EFI_ERROR (Status)) {
784 ProcHierarchyNodeInfo->AcpiIdObjectToken,
788 if (EFI_ERROR (Status)) {
835 IN UINT16 ProcContainerName,
836 IN UINT32 ProcContainerUid,
842 CHAR8 AslNameProcContainer[AML_NAME_SEG_SIZE + 1];
845 ASSERT (CfgMgrProtocol !=
NULL);
846 ASSERT (ParentNode !=
NULL);
847 ASSERT (ProcHierarchyNodeInfo !=
NULL);
848 ASSERT (ProcContainerNodePtr !=
NULL);
850 Status =
WriteAslName (
'C', ProcContainerName, AslNameProcContainer);
851 if (EFI_ERROR (Status)) {
856 Status =
AmlCodeGenDevice (AslNameProcContainer, ParentNode, &ProcContainerNode);
857 if (EFI_ERROR (Status)) {
870 if (EFI_ERROR (Status)) {
881 if (EFI_ERROR (Status)) {
891 ProcHierarchyNodeInfo,
894 if (EFI_ERROR (Status)) {
900 *ProcContainerNodePtr = ProcContainerNode;
924 BOOLEAN PackageNodeSeen
927 BOOLEAN InvalidFlags;
928 BOOLEAN HasPhysicalPackageBit;
930 HasPhysicalPackageBit = (NodeFlags & EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL) ==
931 EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL;
934 InvalidFlags = HasPhysicalPackageBit && PackageNodeSeen;
938 InvalidFlags |= ((NodeFlags & PPTT_LEAF_MASK) != PPTT_LEAF_MASK);
940 InvalidFlags |= !(HasPhysicalPackageBit || PackageNodeSeen);
942 InvalidFlags |= ((NodeFlags & PPTT_LEAF_MASK) != 0);
948 "ERROR: SSDT-CPU-TOPOLOGY: Invalid flags for ProcNode: 0x%p.\n",
952 return EFI_INVALID_PARAMETER;
984 IN OUT UINT32 *ProcContainerIndex,
985 IN BOOLEAN PackageNodeSeen
991 UINT32 ProcContainerName;
995 BOOLEAN HasPhysicalPackageBit;
1000 ASSERT (CfgMgrProtocol !=
NULL);
1001 ASSERT (ParentNode !=
NULL);
1002 ASSERT (ProcContainerIndex !=
NULL);
1005 ProcContainerName = 0;
1007 for (Index = 0; Index <
Generator->ProcNodeCount; Index++) {
1010 if (
Generator->ProcNodeList[Index].ParentToken == NodeToken) {
1021 if (EFI_ERROR (Status)) {
1026 if (
Generator->ProcNodeList[Index].OverrideNameUidEnabled) {
1027 Name =
Generator->ProcNodeList[Index].OverrideName;
1029 ASSERT ((CpuIndex & ~MAX_UINT16) == 0);
1030 Name = (UINT16)CpuIndex;
1040 if (EFI_ERROR (Status)) {
1056 if (EFI_ERROR (Status)) {
1061 if (
Generator->ProcNodeList[Index].OverrideNameUidEnabled) {
1062 Name =
Generator->ProcNodeList[Index].OverrideName;
1063 Uid =
Generator->ProcNodeList[Index].OverrideUid;
1065 ASSERT ((ProcContainerName & ~MAX_UINT16) == 0);
1066 Name = (UINT16)ProcContainerName;
1067 Uid = *ProcContainerIndex;
1079 if (EFI_ERROR (Status)) {
1086 (*ProcContainerIndex)++;
1091 ProcContainerName = 0;
1093 ProcContainerName++;
1096 HasPhysicalPackageBit = (
Generator->ProcNodeList[Index].Flags & EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL) ==
1097 EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL;
1106 (PackageNodeSeen || HasPhysicalPackageBit)
1108 if (EFI_ERROR (Status)) {
1141 UINT32 ProcContainerIndex;
1146 ASSERT (CfgMgrProtocol !=
NULL);
1147 ASSERT (ScopeNode !=
NULL);
1149 ProcContainerIndex = 0;
1152 if (EFI_ERROR (Status)) {
1162 &ProcContainerIndex,
1165 if (EFI_ERROR (Status)) {
1171 if (EFI_ERROR (Status)) {
1217 UINT32 ProcHierarchyNodeCount;
1220 ASSERT (This !=
NULL);
1221 ASSERT (AcpiTableInfo !=
NULL);
1222 ASSERT (CfgMgrProtocol !=
NULL);
1223 ASSERT (Table !=
NULL);
1224 ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
1225 ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
1235 if (EFI_ERROR (Status)) {
1240 if (EFI_ERROR (Status)) {
1246 Status = GetEArchCommonObjProcHierarchyInfo (
1249 &ProcHierarchyNodeList,
1250 &ProcHierarchyNodeCount
1252 if (EFI_ERROR (Status) &&
1253 (Status != EFI_NOT_FOUND))
1258 if (Status == EFI_NOT_FOUND) {
1265 if (EFI_ERROR (Status)) {
1270 Generator->ProcNodeList = ProcHierarchyNodeList;
1271 Generator->ProcNodeCount = ProcHierarchyNodeCount;
1278 if (EFI_ERROR (Status)) {
1287 if (EFI_ERROR (Status)) {
1290 "ERROR: SSDT-CPU-TOPOLOGY: Failed to Serialize SSDT Table Data."
1324 ASSERT (This !=
NULL);
1325 ASSERT (AcpiTableInfo !=
NULL);
1326 ASSERT (CfgMgrProtocol !=
NULL);
1327 ASSERT (AcpiTableInfo->TableGeneratorId == This->GeneratorID);
1328 ASSERT (AcpiTableInfo->AcpiTableSignature == This->AcpiTableSignature);
1330 if ((Table ==
NULL) || (*Table ==
NULL)) {
1331 DEBUG ((DEBUG_ERROR,
"ERROR: SSDT-CPU-TOPOLOGY: Invalid Table Pointer\n"));
1332 ASSERT ((Table !=
NULL) && (*Table !=
NULL));
1333 return EFI_INVALID_PARAMETER;
1343#define SSDT_CPU_TOPOLOGY_GENERATOR_REVISION CREATE_REVISION (1, 0)
1354 L
"ACPI.STD.SSDT.CPU.TOPOLOGY.GENERATOR",
1413 "SSDT-CPU-TOPOLOGY: Register Generator. Status = %r\n",
1442 "SSDT-CPU-TOPOLOGY: Deregister Generator. Status = %r\n",
#define EFI_ACPI_6_3_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE
UINT8 EFIAPI AsciiFromHex(IN UINT8 Hex)
EFI_STATUS EFIAPI RegisterAcpiTableGenerator(IN CONST ACPI_TABLE_GENERATOR *CONST Generator)
EFI_STATUS EFIAPI DeregisterAcpiTableGenerator(IN CONST ACPI_TABLE_GENERATOR *CONST Generator)
#define CREATE_STD_ACPI_TABLE_GEN_ID(TableId)
#define TABLE_GENERATOR_CREATOR_ID
@ EStdAcpiTableIdSsdtCpuTopology
SSDT Cpu Topology.
void * AML_ROOT_NODE_HANDLE
EFI_STATUS EFIAPI AmlCreateCpcNode(IN AML_CPC_INFO *CpcInfo, IN AML_NODE_HANDLE ParentNode OPTIONAL, OUT AML_OBJECT_NODE_HANDLE *NewCpcNode OPTIONAL)
EFI_STATUS EFIAPI AmlAddLpiState(IN UINT32 MinResidency, IN UINT32 WorstCaseWakeLatency, IN UINT32 Flags, IN UINT32 ArchFlags, IN UINT32 ResCntFreq, IN UINT32 EnableParentState, IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *GenericRegisterDescriptor OPTIONAL, IN UINT64 Integer OPTIONAL, IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *ResidencyCounterRegister OPTIONAL, IN EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE *UsageCounterRegister OPTIONAL, IN CONST CHAR8 *StateName OPTIONAL, IN AML_OBJECT_NODE_HANDLE LpiNode)
EFI_STATUS EFIAPI AmlCreatePsdNode(IN AML_PSD_INFO *PsdInfo, IN AML_NODE_HANDLE ParentNode OPTIONAL, OUT AML_OBJECT_NODE_HANDLE *NewPsdNode OPTIONAL)
EFI_STATUS EFIAPI AmlCodeGenDevice(IN CONST CHAR8 *NameString, IN AML_NODE_HANDLE ParentNode OPTIONAL, OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL)
EFI_STATUS EFIAPI AmlCodeGenScope(IN CONST CHAR8 *NameString, IN AML_NODE_HANDLE ParentNode OPTIONAL, OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL)
EFI_STATUS EFIAPI AmlCodeGenNameString(IN CONST CHAR8 *NameString, IN CONST CHAR8 *String, IN AML_NODE_HANDLE ParentNode OPTIONAL, OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL)
EFI_STATUS EFIAPI AmlCreateLpiNode(IN CONST CHAR8 *LpiNameString, IN UINT16 Revision, IN UINT64 LevelId, IN AML_NODE_HANDLE ParentNode OPTIONAL, OUT AML_OBJECT_NODE_HANDLE *NewLpiNode OPTIONAL)
EFI_STATUS EFIAPI AmlCodeGenNameInteger(IN CONST CHAR8 *NameString, IN UINT64 Integer, IN AML_NODE_HANDLE ParentNode OPTIONAL, OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL)
void * AML_OBJECT_NODE_HANDLE
EFI_STATUS EFIAPI AmlCodeGenMethodRetNameString(IN CONST CHAR8 *MethodNameString, IN CONST CHAR8 *ReturnedNameString OPTIONAL, IN UINT8 NumArgs, IN BOOLEAN IsSerialized, IN UINT8 SyncLevel, IN AML_NODE_HANDLE ParentNode OPTIONAL, OUT AML_OBJECT_NODE_HANDLE *NewObjectNode OPTIONAL)
@ EArchCommonObjLpiInfo
15 - Lpi Info
@ EArchCommonObjCpcInfo
18 - Continuous Performance Control Info
@ EArchCommonObjPsdInfo
25 - P-State Dependency (PSD) Info
@ EArchCommonObjCmRef
7 - CM Object Reference
@ EArchCommonObjProcHierarchyInfo
16 - Processor Hierarchy Info
EFI_STATUS EFIAPI CreateTopologyFromIntC(IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN AML_OBJECT_NODE_HANDLE ScopeNode)
EFI_STATUS EFIAPI GetIntCInfo(IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN CM_OBJECT_TOKEN AcpiIdObjectToken, OUT UINT32 *AcpiProcessorUid, OUT CM_OBJECT_TOKEN *CpcToken, OUT CM_OBJECT_TOKEN *PsdToken)
EFI_STATUS EFIAPI AddArchAmlCpuInfo(IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN CM_OBJECT_TOKEN AcpiIdObjectToken, IN UINT32 CpuName, OUT AML_OBJECT_NODE_HANDLE *CpuNode)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
#define GET_OBJECT_LIST(CmObjectNameSpace, CmObjectId, Type)
@ EObjNameSpaceArchCommon
Arch Common Objects Namespace.
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define ASSERT_EFI_ERROR(StatusParameter)
#define DEBUG(Expression)
STATIC EFI_STATUS EFIAPI CreateAmlLpiMethod(IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, IN CM_ARCH_COMMON_PROC_HIERARCHY_INFO *ProcHierarchyNodeInfo, IN AML_OBJECT_NODE_HANDLE *Node)
EFI_STATUS EFIAPI AcpiSsdtCpuTopologyLibConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
STATIC EFI_STATUS EFIAPI CreateAmlPsdNode(IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN CM_OBJECT_TOKEN PsdToken, IN AML_OBJECT_NODE_HANDLE *Node)
STATIC EFI_STATUS EFIAPI TokenTableInitialize(IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, IN UINT32 Count)
STATIC UINT32 EFIAPI TokenTableAdd(IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, IN CM_OBJECT_TOKEN Token)
STATIC ACPI_CPU_TOPOLOGY_GENERATOR SsdtCpuTopologyGenerator
#define SSDT_CPU_TOPOLOGY_GENERATOR_REVISION
STATIC EFI_STATUS EFIAPI CreateAmlCpuFromProcHierarchy(IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN AML_NODE_HANDLE ParentNode, IN UINT32 CpuName, IN CM_ARCH_COMMON_PROC_HIERARCHY_INFO *ProcHierarchyNodeInfo)
STATIC EFI_STATUS EFIAPI BuildSsdtCpuTopologyTable(IN CONST ACPI_TABLE_GENERATOR *CONST This, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table)
STATIC EFI_STATUS EFIAPI FreeSsdtCpuTopologyTableResources(IN CONST ACPI_TABLE_GENERATOR *CONST This, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN OUT EFI_ACPI_DESCRIPTION_HEADER **CONST Table)
STATIC EFI_STATUS EFIAPI GenerateLpiStates(IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN AML_OBJECT_NODE_HANDLE ScopeNode)
EFI_STATUS EFIAPI AcpiSsdtCpuTopologyLibDestructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS EFIAPI CreateAmlCpu(IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, IN AML_NODE_HANDLE ParentNode, IN UINT32 AcpiProcessorUid, IN UINT32 CpuName, OUT AML_OBJECT_NODE_HANDLE *CpuNodePtr OPTIONAL)
EFI_STATUS EFIAPI WriteAslName(IN CHAR8 LeadChar, IN UINT32 Value, IN OUT CHAR8 *AslName)
STATIC EFI_STATUS EFIAPI CreateAmlProcessorContainer(IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN AML_NODE_HANDLE ParentNode, IN CM_ARCH_COMMON_PROC_HIERARCHY_INFO *ProcHierarchyNodeInfo, IN UINT16 ProcContainerName, IN UINT32 ProcContainerUid, OUT AML_OBJECT_NODE_HANDLE *ProcContainerNodePtr)
STATIC VOID EFIAPI TokenTableFree(IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator)
STATIC EFI_STATUS EFIAPI CheckProcNode(UINT32 NodeFlags, BOOLEAN IsLeaf, CM_OBJECT_TOKEN NodeToken, CM_OBJECT_TOKEN ParentNodeToken, BOOLEAN PackageNodeSeen)
EFI_STATUS EFIAPI CreateAmlCpcNode(IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN CM_OBJECT_TOKEN CpcToken, IN AML_OBJECT_NODE_HANDLE *Node)
STATIC EFI_STATUS EFIAPI CreateAmlCpuTopologyTree(IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN CM_OBJECT_TOKEN NodeToken, IN AML_NODE_HANDLE ParentNode, IN OUT UINT32 *ProcContainerIndex, IN BOOLEAN PackageNodeSeen)
STATIC EFI_STATUS EFIAPI CreateTopologyFromProcHierarchy(IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN AML_OBJECT_NODE_HANDLE ScopeNode)
#define SB_SCOPE_PREFIX_SIZE
Size of the SB_SCOPE_PREFIX string.
#define ACPI_HID_PROCESSOR_CONTAINER_DEVICE
HID for a processor container device.
#define ACPI_HID_PROCESSOR_DEVICE
HID for a processor device.
EFI_STATUS EFIAPI AddSsdtAcpiHeader(IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN CONST ACPI_TABLE_GENERATOR *CONST Generator, IN CONST CM_STD_OBJ_ACPI_TABLE_INFO *CONST AcpiTableInfo, OUT AML_ROOT_NODE_HANDLE *RootNode)
EFI_STATUS EFIAPI AmlDeleteTree(IN AML_NODE_HANDLE Node)
EFI_STATUS EFIAPI AmlSerializeDefinitionBlock(IN AML_ROOT_NODE_HANDLE RootNode, OUT EFI_ACPI_DESCRIPTION_HEADER **Table)
ACPI_TABLE_GENERATOR Header
ACPI Table generator header.
UINT32 WorstCaseWakeLatency
EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE UsageCounterRegister
EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE RegisterEntryMethod
EFI_ACPI_6_3_GENERIC_ADDRESS_STRUCTURE ResidencyCounterRegister
UINT64 IntegerEntryMethod