TianoCore EDK2 master
Loading...
Searching...
No Matches
PpttGenerator.c File Reference

Go to the source code of this file.

Macros

#define PPTT_GENERATOR_REVISION   CREATE_REVISION (1, 0)
 

Functions

 GET_OBJECT_LIST (EObjNameSpaceArchCommon, EArchCommonObjProcHierarchyInfo, CM_ARCH_COMMON_PROC_HIERARCHY_INFO)
 
 GET_OBJECT_LIST (EObjNameSpaceArchCommon, EArchCommonObjCacheInfo, CM_ARCH_COMMON_CACHE_INFO)
 
 GET_OBJECT_LIST (EObjNameSpaceArchCommon, EArchCommonObjCmRef, CM_ARCH_COMMON_OBJ_REF)
 
 GET_OBJECT_LIST (EObjNameSpaceArm, EArmObjGicCInfo, CM_ARM_GICC_INFO)
 
STATIC UINT32 GetProcHierarchyNodeSize (IN CONST CM_ARCH_COMMON_PROC_HIERARCHY_INFO *Node)
 
 GET_SIZE_OF_PPTT_STRUCTS (ProcHierarchyNodes, GetProcHierarchyNodeSize(NodesToIndex), CM_ARCH_COMMON_PROC_HIERARCHY_INFO)
 
 GET_SIZE_OF_PPTT_STRUCTS (CacheTypeStructs, sizeof(EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE), CM_ARCH_COMMON_CACHE_INFO)
 
STATIC EFI_STATUS GetPpttNodeReferencedByToken (IN PPTT_NODE_INDEXER *NodeIndexer, IN UINT32 NodeCount, IN CONST CM_OBJECT_TOKEN SearchToken, OUT PPTT_NODE_INDEXER **IndexedNodeFound)
 
STATIC EFI_STATUS DetectCyclesInTopology (IN CONST ACPI_PPTT_GENERATOR *CONST Generator)
 
STATIC EFI_STATUS AddPrivateResources (IN CONST ACPI_PPTT_GENERATOR *CONST Generator, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN UINT32 *PrivResArray, IN UINT32 PrivResCount, IN CONST CM_OBJECT_TOKEN PrivResArrayToken)
 
BOOLEAN EFIAPI IsAcpiIdObjectTokenEqual (IN CONST VOID *Object1, IN CONST VOID *Object2, IN UINTN Index1, IN UINTN Index2)
 
STATIC EFI_STATUS AddProcHierarchyNodes (IN CONST ACPI_PPTT_GENERATOR *CONST Generator, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN CONST EFI_ACPI_6_4_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER *Pptt, IN CONST UINT32 NodesStartOffset)
 
STATIC BOOLEAN IsCacheIdUnique (IN CONST UINT32 CacheId, IN CONST UINT32 *CacheIdList, IN CONST UINT32 CacheIdListSize)
 
STATIC EFI_STATUS AddCacheTypeStructures (IN CONST ACPI_PPTT_GENERATOR *CONST Generator, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN CONST EFI_ACPI_6_4_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER *Pptt, IN CONST UINT32 NodesStartOffset, IN CONST UINT32 Revision)
 
STATIC EFI_STATUS EFIAPI BuildPpttTable (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 FreePpttTableResources (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)
 
EFI_STATUS EFIAPI AcpiPpttLibConstructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 
EFI_STATUS EFIAPI AcpiPpttLibDestructor (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

STATIC ACPI_PPTT_GENERATOR PpttGenerator
 

Detailed Description

PPTT Table Generator

Copyright (c) 2021, ARM Limited. All rights reserved. SPDX-License-Identifier: BSD-2-Clause-Patent

Reference(s):
  • ACPI 6.4 Specification, January 2021
Glossary:
  • Cm or CM - Configuration Manager
  • Obj or OBJ - Object

Definition in file PpttGenerator.c.

Macro Definition Documentation

◆ PPTT_GENERATOR_REVISION

#define PPTT_GENERATOR_REVISION   CREATE_REVISION (1, 0)

The PPTT Table Generator revision.

Definition at line 1387 of file PpttGenerator.c.

Function Documentation

◆ AcpiPpttLibConstructor()

EFI_STATUS EFIAPI AcpiPpttLibConstructor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Register the Generator with the ACPI Table Factory.

Parameters
[in]ImageHandleThe handle to the image.
[in]SystemTablePointer to the System Table.
Return values
EFI_SUCCESSThe Generator is registered.
EFI_INVALID_PARAMETERA parameter is invalid.
EFI_ALREADY_STARTEDThe Generator for the Table ID is already registered.

Definition at line 1445 of file PpttGenerator.c.

◆ AcpiPpttLibDestructor()

EFI_STATUS EFIAPI AcpiPpttLibDestructor ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Deregister the Generator from the ACPI Table Factory.

Parameters
[in]ImageHandleThe handle to the image.
[in]SystemTablePointer to the System Table.
Return values
EFI_SUCCESSThe Generator is deregistered.
EFI_INVALID_PARAMETERA parameter is invalid.
EFI_NOT_FOUNDThe Generator is not registered.

Definition at line 1470 of file PpttGenerator.c.

◆ AddCacheTypeStructures()

STATIC EFI_STATUS AddCacheTypeStructures ( IN CONST ACPI_PPTT_GENERATOR *CONST  Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST  CfgMgrProtocol,
IN CONST EFI_ACPI_6_4_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER Pptt,
IN CONST UINT32  NodesStartOffset,
IN CONST UINT32  Revision 
)

Update the Cache Type Structure (Type 1) information.

This function populates the Cache Type Structures with information from the Configuration Manager and adds this information to the PPTT table.

Parameters
[in]GeneratorPointer to the PPTT Generator.
[in]CfgMgrProtocolPointer to the Configuration Manager Protocol Interface.
[in]PpttPointer to PPTT table structure.
[in]NodesStartOffsetOffset from the start of PPTT table to the start of Cache Type Structures.
[in]RevisionRevision of the PPTT table being requested.
Return values
EFI_SUCCESSStructures updated successfully.
EFI_INVALID_PARAMETERA parameter is invalid.
EFI_NOT_FOUNDA required object was not found.
EFI_OUT_OF_RESOURCESOut of resources.

Definition at line 780 of file PpttGenerator.c.

◆ AddPrivateResources()

STATIC EFI_STATUS AddPrivateResources ( IN CONST ACPI_PPTT_GENERATOR *CONST  Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST  CfgMgrProtocol,
IN UINT32 *  PrivResArray,
IN UINT32  PrivResCount,
IN CONST CM_OBJECT_TOKEN  PrivResArrayToken 
)

Update the array of private resources for a given Processor Hierarchy Node.

Parameters
[in]GeneratorPointer to the PPTT Generator.
[in]CfgMgrProtocolPointer to the Configuration Manager Protocol Interface.
[in]PrivResArrayPointer to the array of private resources.
[in]PrivResCountNumber of private resources.
[in]PrivResArrayTokenReference Token for the CM_ARCH_COMMON_OBJ_REF array describing node's private resources.
Return values
EFI_SUCCESSArray updated successfully.
EFI_INVALID_PARAMETERA parameter is invalid.
EFI_NOT_FOUNDA private resource was not found.

Definition at line 276 of file PpttGenerator.c.

◆ AddProcHierarchyNodes()

STATIC EFI_STATUS AddProcHierarchyNodes ( IN CONST ACPI_PPTT_GENERATOR *CONST  Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST  CfgMgrProtocol,
IN CONST EFI_ACPI_6_4_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_HEADER Pptt,
IN CONST UINT32  NodesStartOffset 
)

Update the Processor Hierarchy Node (Type 0) information.

This function populates the Processor Hierarchy Nodes with information from the Configuration Manager and adds this information to the PPTT table.

Parameters
[in]GeneratorPointer to the PPTT Generator.
[in]CfgMgrProtocolPointer to the Configuration Manager Protocol Interface.
[in]PpttPointer to PPTT table structure.
[in]NodesStartOffsetOffset from the start of PPTT table to the start of Processor Hierarchy Nodes.
Return values
EFI_SUCCESSNode updated successfully.
EFI_INVALID_PARAMETERA parameter is invalid.
EFI_NOT_FOUNDThe required object was not found.

Definition at line 469 of file PpttGenerator.c.

◆ BuildPpttTable()

Construct the PPTT ACPI table.

This function invokes the Configuration Manager protocol interface to get the required hardware information for generating the ACPI table.

If this function allocates any resources then they must be freed in the FreeXXXXTableResources function.

Parameters
[in]ThisPointer to the table generator.
[in]AcpiTableInfoPointer to the ACPI table generator to be used.
[in]CfgMgrProtocolPointer to the Configuration Manager Protocol Interface.
[out]TablePointer to the constructed ACPI Table.
Return values
EFI_SUCCESSTable generated successfully.
EFI_INVALID_PARAMETERA parameter is invalid.
EFI_NOT_FOUNDThe required object was not found.
EFI_BAD_BUFFER_SIZEThe size returned by the Configuration Manager is less than the Object size for the requested object.

Definition at line 1061 of file PpttGenerator.c.

◆ DetectCyclesInTopology()

STATIC EFI_STATUS DetectCyclesInTopology ( IN CONST ACPI_PPTT_GENERATOR *CONST  Generator)

Detect cycles in the processor and cache topology graph represented in the PPTT table.

Parameters
[in]GeneratorPointer to the PPTT Generator.
Return values
EFI_SUCCESSThere are no cyclic references in the graph.
EFI_INVALID_PARAMETERProcessor or cache references form a cycle.

Definition at line 201 of file PpttGenerator.c.

◆ FreePpttTableResources()

Free any resources allocated for constructing the PPTT

Parameters
[in]ThisPointer to the table generator.
[in]AcpiTableInfoPointer to the ACPI Table Info.
[in]CfgMgrProtocolPointer to the Configuration Manager Protocol Interface.
[in,out]TablePointer to the ACPI Table.
Return values
EFI_SUCCESSThe resources were freed successfully.
EFI_INVALID_PARAMETERThe table pointer is NULL or invalid.

Definition at line 1346 of file PpttGenerator.c.

◆ GET_OBJECT_LIST() [1/4]

This macro expands to a function that retrieves the cache information from the Configuration Manager.

◆ GET_OBJECT_LIST() [2/4]

This macro expands to a function that retrieves the cross-CM-object- reference information from the Configuration Manager.

◆ GET_OBJECT_LIST() [3/4]

ARM standard PPTT Generator

Requirements: The following Configuration Manager Object(s) are used by this Generator:

  • EArchCommonObjProcHierarchyInfo (REQUIRED)
  • EArchCommonObjCacheInfo
  • EArchCommonObjCmRef
  • EArmObjGicCInfo (REQUIRED) This macro expands to a function that retrieves the Processor Hierarchy information from the Configuration Manager.

◆ GET_OBJECT_LIST() [4/4]

GET_OBJECT_LIST ( EObjNameSpaceArm  ,
EArmObjGicCInfo  ,
CM_ARM_GICC_INFO   
)

This macro expands to a function that retrieves the GIC CPU interface information from the Configuration Manager.

◆ GET_SIZE_OF_PPTT_STRUCTS() [1/2]

GET_SIZE_OF_PPTT_STRUCTS ( CacheTypeStructs  ,
sizeof(EFI_ACPI_6_4_PPTT_STRUCTURE_CACHE ,
CM_ARCH_COMMON_CACHE_INFO   
)

This macro expands to a function that retrieves the amount of memory required to store the Cache Type Structures (Type 1) and updates the Node Indexer.

◆ GET_SIZE_OF_PPTT_STRUCTS() [2/2]

GET_SIZE_OF_PPTT_STRUCTS ( ProcHierarchyNodes  ,
GetProcHierarchyNodeSize(NodesToIndex)  ,
CM_ARCH_COMMON_PROC_HIERARCHY_INFO   
)

This macro expands to a function that retrieves the amount of memory required to store the Processor Hierarchy Nodes (Type 0) and updates the Node Indexer.

◆ GetPpttNodeReferencedByToken()

STATIC EFI_STATUS GetPpttNodeReferencedByToken ( IN PPTT_NODE_INDEXER NodeIndexer,
IN UINT32  NodeCount,
IN CONST CM_OBJECT_TOKEN  SearchToken,
OUT PPTT_NODE_INDEXER **  IndexedNodeFound 
)

Search the Node Indexer and return the indexed PPTT node with the given Token.

Parameters
[in]NodeIndexerPointer to the Node Indexer array.
[in]NodeCountNumber of elements in Node Indexer.
[in]SearchTokenToken used for Node Indexer lookup.
[out]IndexedNodeFoundPointer to the Node Indexer array element with the given Token.
Return values
EFI_SUCCESSSuccess.
EFI_NOT_FOUNDNo element with a matching token was found in the Node Indexer array.

Definition at line 139 of file PpttGenerator.c.

◆ GetProcHierarchyNodeSize()

STATIC UINT32 GetProcHierarchyNodeSize ( IN CONST CM_ARCH_COMMON_PROC_HIERARCHY_INFO Node)

Returns the size of the PPTT Processor Hierarchy Node (Type 0) given a Processor Hierarchy Info CM object.

Parameters
[in]NodePointer to Processor Hierarchy Info CM object which represents the Processor Hierarchy Node to be generated.
Return values
Sizeof the Processor Hierarchy Node in bytes.

Definition at line 92 of file PpttGenerator.c.

◆ IsAcpiIdObjectTokenEqual()

BOOLEAN EFIAPI IsAcpiIdObjectTokenEqual ( IN CONST VOID *  Object1,
IN CONST VOID *  Object2,
IN UINTN  Index1,
IN UINTN  Index2 
)

Function to test if two indexed Processor Hierarchy Info objects map to the same GIC CPU Interface Info object.

This is a callback function that can be invoked by FindDuplicateValue ().

Parameters
[in]Object1Pointer to the first indexed Processor Hierarchy Info object.
[in]Object2Pointer to the second indexed Processor Hierarchy Info object.
[in]Index1Index of Object1 to be displayed for debugging purposes.
[in]Index2Index of Object2 to be displayed for debugging purposes.
Return values
TRUEObject1 and Object2 have the same AcpiIdObjectToken.
FALSEObject1 and Object2 have different AcpiIdObjectTokens.

Definition at line 407 of file PpttGenerator.c.

◆ IsCacheIdUnique()

STATIC BOOLEAN IsCacheIdUnique ( IN CONST UINT32  CacheId,
IN CONST UINT32 *  CacheIdList,
IN CONST UINT32  CacheIdListSize 
)

Test whether CacheId is unique among the CacheIdList.

Parameters
[in]CacheIdCache ID to check.
[in]CacheIdListList of already existing cache IDs.
[in]CacheIdListSizeSize of CacheIdList.
Return values
TRUECacheId does not exist in CacheIdList.
FALSECacheId already exists in CacheIdList.

Definition at line 742 of file PpttGenerator.c.

Variable Documentation

◆ PpttGenerator

STATIC ACPI_PPTT_GENERATOR PpttGenerator

The interface for the PPTT Table Generator.

Definition at line 1392 of file PpttGenerator.c.