TianoCore EDK2 master
Loading...
Searching...
No Matches
SsdtCpuTopologyGenerator.h File Reference

Go to the source code of this file.

Data Structures

struct  TokenTable
 
struct  AcpiCpuTopologyGenerator
 

Macros

#define PPTT_PROCESSOR_MASK
 
#define PPTT_CPU_PROCESSOR_MASK
 
#define PPTT_CLUSTER_PROCESSOR_MASK
 
#define PPTT_LEAF_MASK
 
#define SB_SCOPE   "\\_SB_"
 
#define SB_SCOPE_PREFIX   SB_SCOPE "."
 
#define SB_SCOPE_PREFIX_SIZE   sizeof (SB_SCOPE_PREFIX)
 Size of the SB_SCOPE_PREFIX string.
 
#define ACPI_HID_PROCESSOR_DEVICE   "ACPI0007"
 HID for a processor device.
 
#define ACPI_HID_ET_DEVICE   "ARMHC500"
 HID for a ETM/ETE device.
 
#define ACPI_HID_PROCESSOR_CONTAINER_DEVICE   "ACPI0010"
 HID for a processor container device.
 
#define MAX_NODE_COUNT   (1 << 12)
 

Typedefs

typedef struct TokenTable TOKEN_TABLE
 
typedef struct AcpiCpuTopologyGenerator ACPI_CPU_TOPOLOGY_GENERATOR
 

Functions

EFI_STATUS EFIAPI WriteAslName (IN CHAR8 LeadChar, IN UINT32 Value, IN OUT CHAR8 *AslName)
 
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 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)
 
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 CreateTopologyFromIntC (IN ACPI_CPU_TOPOLOGY_GENERATOR *Generator, IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST CfgMgrProtocol, IN AML_OBJECT_NODE_HANDLE ScopeNode)
 
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)
 

Detailed Description

SSDT Cpu Topology Table Generator.

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

Reference(s):
Glossary:
  • ETE - Embedded Trace Extension.
  • ETM - Embedded Trace Macrocell.

Definition in file SsdtCpuTopologyGenerator.h.

Macro Definition Documentation

◆ ACPI_HID_ET_DEVICE

#define ACPI_HID_ET_DEVICE   "ARMHC500"

HID for a ETM/ETE device.

Definition at line 59 of file SsdtCpuTopologyGenerator.h.

◆ ACPI_HID_PROCESSOR_CONTAINER_DEVICE

#define ACPI_HID_PROCESSOR_CONTAINER_DEVICE   "ACPI0010"

HID for a processor container device.

Definition at line 62 of file SsdtCpuTopologyGenerator.h.

◆ ACPI_HID_PROCESSOR_DEVICE

#define ACPI_HID_PROCESSOR_DEVICE   "ACPI0007"

HID for a processor device.

Definition at line 56 of file SsdtCpuTopologyGenerator.h.

◆ MAX_NODE_COUNT

#define MAX_NODE_COUNT   (1 << 12)

Node names of Cpus and Clusters are 'Cxxx', and 'Lxxx' for LPI states. The 'xxx' is an index on 12 bits is given to node name, thus the limitation in the number of nodes.

Definition at line 68 of file SsdtCpuTopologyGenerator.h.

◆ PPTT_CLUSTER_PROCESSOR_MASK

#define PPTT_CLUSTER_PROCESSOR_MASK
Value:
( \
(EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID << 1) | \
(EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF << 3))
#define EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL
Definition: Acpi63.h:2553

Definition at line 38 of file SsdtCpuTopologyGenerator.h.

◆ PPTT_CPU_PROCESSOR_MASK

#define PPTT_CPU_PROCESSOR_MASK
Value:
( \
(EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \
(EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))

Definition at line 29 of file SsdtCpuTopologyGenerator.h.

◆ PPTT_LEAF_MASK

#define PPTT_LEAF_MASK
Value:
((EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \
(EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))

Definition at line 44 of file SsdtCpuTopologyGenerator.h.

◆ PPTT_PROCESSOR_MASK

#define PPTT_PROCESSOR_MASK
Value:
( \
(EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL) | \
(EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \
(EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))

Definition at line 23 of file SsdtCpuTopologyGenerator.h.

◆ SB_SCOPE

#define SB_SCOPE   "\\_SB_"

LPI states are stored in the ASL namespace at '_SB_.Lxxx', with xxx being the node index of the LPI state.

Definition at line 50 of file SsdtCpuTopologyGenerator.h.

◆ SB_SCOPE_PREFIX

#define SB_SCOPE_PREFIX   SB_SCOPE "."

Definition at line 51 of file SsdtCpuTopologyGenerator.h.

◆ SB_SCOPE_PREFIX_SIZE

#define SB_SCOPE_PREFIX_SIZE   sizeof (SB_SCOPE_PREFIX)

Size of the SB_SCOPE_PREFIX string.

Definition at line 53 of file SsdtCpuTopologyGenerator.h.

Typedef Documentation

◆ ACPI_CPU_TOPOLOGY_GENERATOR

A structure holding the Cpu topology generator and additional private data.

◆ TOKEN_TABLE

typedef struct TokenTable TOKEN_TABLE

A structure used to handle the Lpi structures referencing.

A CM_ARCH_COMMON_PROC_HIERARCHY_INFO structure references a CM_ARCH_COMMON_OBJ_REF. This CM_ARCH_COMMON_OBJ_REF references CM_ARCH_COMMON_LPI_INFO structures.

Example: (Cpu0) (Cpu1) CM_ARCH_COMMON_PROC_HIERARCHY_INFO CM_ARCH_COMMON_PROC_HIERARCHY_INFO | | +-------------------------------------— | v (List of references to Lpi states) CM_ARCH_COMMON_OBJ_REF | +-------------------------------------— | | v v (A first Lpi state) (A second Lpi state) CM_ARCH_COMMON_LPI_INFO[0] CM_ARCH_COMMON_LPI_INFO[1]

Here, Cpu0 and Cpu1 have the same Lpi states. Both CM_ARCH_COMMON_PROC_HIERARCHY_INFO structures reference the same CM_ARCH_COMMON_OBJ_REF. An entry is created in the TokenTable such as: 0 <-> CM_ARCH_COMMON_OBJ_REF

This will lead to the creation of this pseudo-ASL code where Cpu0 and Cpu1 return the same object at _SB.L000: Scope (_SB) { Device (C000) { [...] Method (_LPI) { Return (_SB.L000) } } // C000

Device (C001) { [...] Method (_LPI) { Return (_SB.L000) } } // C001

Lpi states Name (L000, Package (0x05) { [...] } }

Function Documentation

◆ AddArchAmlCpuInfo()

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 
)

Add arch specific information to a CPU node in the asl description.

Parameters
[in]GeneratorThe SSDT Cpu Topology generator.
[in]CfgMgrProtocolPointer to the Configuration Manager Protocol Interface.
[in]AcpiIdObjectTokenAcpiIdObjectToken identifying the CPU to fetch the other fields from.
[in]CpuNameValue used to generate the CPU node name.
[out]CpuNodeCPU Node to which the ET device node is attached.
Return values
EFI_SUCCESSSuccess.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_NOT_FOUNDNot found.
EFI_UNSUPPORTEDFeature Unsupported.
EFI_OUT_OF_RESOURCESFailed to allocate memory.

Definition at line 370 of file ArmSsdtCpuTopologyGenerator.c.

◆ CreateAmlCpcNode()

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 
)

Create and add an _CPC Node to Cpu Node.

For instance, transform an AML node from: Device (C002) { Name (_UID, 2) Name (_HID, "ACPI0007") }

To: Device (C002) { Name (_UID, 2) Name (_HID, "ACPI0007") Name(_CPC, Package() { NumEntries, // Integer Revision, // Integer HighestPerformance, // Integer or Buffer (Resource Descriptor) NominalPerformance, // Integer or Buffer (Resource Descriptor) LowestNonlinearPerformance, // Integer or Buffer (Resource Descriptor) LowestPerformance, // Integer or Buffer (Resource Descriptor) GuaranteedPerformanceRegister, // Buffer (Resource Descriptor) DesiredPerformanceRegister , // Buffer (Resource Descriptor) MinimumPerformanceRegister , // Buffer (Resource Descriptor) MaximumPerformanceRegister , // Buffer (Resource Descriptor) PerformanceReductionToleranceRegister, // Buffer (Resource Descriptor) TimeWindowRegister, // Buffer (Resource Descriptor) CounterWraparoundTime, // Integer or Buffer (Resource Descriptor) ReferencePerformanceCounterRegister, // Buffer (Resource Descriptor) DeliveredPerformanceCounterRegister, // Buffer (Resource Descriptor) PerformanceLimitedRegister, // Buffer (Resource Descriptor) CPPCEnableRegister // Buffer (Resource Descriptor) AutonomousSelectionEnable, // Integer or Buffer (Resource Descriptor) AutonomousActivityWindowRegister, // Buffer (Resource Descriptor) EnergyPerformancePreferenceRegister, // Buffer (Resource Descriptor) ReferencePerformance // Integer or Buffer (Resource Descriptor) LowestFrequency, // Integer or Buffer (Resource Descriptor) NominalFrequency // Integer or Buffer (Resource Descriptor) }) }

Parameters
[in]GeneratorThe SSDT Cpu Topology generator.
[in]CfgMgrProtocolPointer to the Configuration Manager Protocol Interface.
[in]CpcTokenCPC token of the INTC info describing the Cpu.
[in]NodeCPU Node to which the _CPC node is attached.
Return values
EFI_SUCCESSThe function completed successfully.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESFailed to allocate memory.

Definition at line 372 of file SsdtCpuTopologyGenerator.c.

◆ CreateAmlCpu()

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 
)

Create a Cpu in the AML namespace.

This generates the following ASL code: Device (C002) { Name (_UID, 2) Name (_HID, "ACPI0007") }

Parameters
[in]GeneratorThe SSDT Cpu Topology generator.
[in]ParentNodeParent node to attach the Cpu node to.
[in]AcpiProcessorUidACPI processor UID of the CPU.
[in]CpuNameValue used to generate the node name.
[out]CpuNodePtrIf not NULL, return the created Cpu node.
Return values
EFI_SUCCESSSuccess.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESFailed to allocate memory.

Definition at line 639 of file SsdtCpuTopologyGenerator.c.

◆ CreateTopologyFromIntC()

EFI_STATUS EFIAPI CreateTopologyFromIntC ( IN ACPI_CPU_TOPOLOGY_GENERATOR Generator,
IN CONST EDKII_CONFIGURATION_MANAGER_PROTOCOL *CONST  CfgMgrProtocol,
IN AML_OBJECT_NODE_HANDLE  ScopeNode 
)

Create the processor hierarchy AML tree from arch specific CM objects.

The Arm architecture will use the CM_ARM_GICC_INFO CM objects for instance. A processor container is by extension any non-leave device in the cpu topology.

Parameters
[in]GeneratorThe SSDT Cpu Topology generator.
[in]CfgMgrProtocolPointer to the Configuration Manager Protocol Interface.
[in]ScopeNodeScope node handle ('_SB' scope).
Return values
EFI_SUCCESSSuccess.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_OUT_OF_RESOURCESFailed to allocate memory.

Definition at line 222 of file ArmSsdtCpuTopologyGenerator.c.

◆ GetIntCInfo()

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 
)

Get generic interrupt information from arch specific CM objects.

The AcpiProcessorUid, CpcToken, etc. are held in arch specific CM objects, in the CM_ARM_GICC_INFO CM object for Arm for instance. This wrapper allows to get this information from each arch object.

Parameters
[in]CfgMgrProtocolPointer to the Configuration Manager Protocol Interface.
[in]AcpiProcessorUidACPI processor Uid of the local intc (gicc, other) other fields from.
[out]AcpiProcessorUidAcpiProcessorUid of the CPU identified by the AcpiIdObjectToken.
[out]CpcTokenCpcToken of the CPU identified by the AcpiIdObjectToken.
[out]PsdTokenPsdToken of the CPU identified by the AcpiIdObjectToken.
Return values
EFI_SUCCESSSuccess.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_NOT_FOUNDNot found.

Get generic interrupt information from arch specific CM objects.

The AcpiProcessorUid, CpcToken, etc. are held in arch specific CM objects, in the CM_ARM_GICC_INFO CM object for Arm for instance. This wrapper allows to get this information from each arch object.

Parameters
[in]CfgMgrProtocolPointer to the Configuration Manager Protocol Interface.
[in]AcpiIdObjectTokenAcpiIdObjectToken identifying the CPU to fetch the other fields from.
[out]AcpiProcessorUidAcpiProcessorUid of the CPU identified by the AcpiIdObjectToken.
[out]CpcTokenCpcToken of the CPU identified by the AcpiIdObjectToken.
[out]PsdTokenPsdToken of the CPU identified by the AcpiIdObjectToken.
Return values
EFI_SUCCESSSuccess.
EFI_INVALID_PARAMETERInvalid parameter.
EFI_NOT_FOUNDNot found.

Definition at line 315 of file ArmSsdtCpuTopologyGenerator.c.

◆ WriteAslName()

EFI_STATUS EFIAPI WriteAslName ( IN CHAR8  LeadChar,
IN UINT32  Value,
IN OUT CHAR8 *  AslName 
)

Write a string 'Xxxx\0' in AslName (5 bytes long), with 'X' being the leading char of the name, and with 'xxx' being Value in hexadecimal.

As 'xxx' in hexadecimal represents a number on 12 bits, we have Value < (1 << 12).

Parameters
[in]LeadCharLeading char of the name.
[in]ValueHex value of the name. Must be lower than (2 << 12).
[in,out]AslNamePointer to write the 'Xxxx' string to. Must be at least 5 bytes long.
Return values
EFI_SUCCESSSuccess.
EFI_INVALID_PARAMETERInvalid parameter.

Definition at line 222 of file SsdtCpuTopologyGenerator.c.