]> git.proxmox.com Git - mirror_edk2.git/blob - DynamicTablesPkg/Library/Acpi/Arm/AcpiSsdtCpuTopologyLibArm/SsdtCpuTopologyGenerator.h
DynamicTablesPkg: Apply uncrustify changes
[mirror_edk2.git] / DynamicTablesPkg / Library / Acpi / Arm / AcpiSsdtCpuTopologyLibArm / SsdtCpuTopologyGenerator.h
1 /** @file
2 SSDT Cpu Topology Table Generator.
3
4 Copyright (c) 2021, Arm Limited. All rights reserved.<BR>
5 SPDX-License-Identifier: BSD-2-Clause-Patent
6
7 @par Reference(s):
8 - ACPI 6.3 Specification - January 2019 - s8.4 Declaring Processors
9 **/
10
11 #ifndef SSDT_CPU_TOPOLOGY_GENERATOR_H_
12 #define SSDT_CPU_TOPOLOGY_GENERATOR_H_
13
14 #pragma pack(1)
15
16 // Mask for the flags that need to be checked.
17 #define PPTT_PROCESSOR_MASK ( \
18 (EFI_ACPI_6_3_PPTT_PACKAGE_PHYSICAL) | \
19 (EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \
20 (EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))
21
22 // Mask for the cpu flags.
23 #define PPTT_CPU_PROCESSOR_MASK ( \
24 (EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL) | \
25 (EFI_ACPI_6_3_PPTT_PROCESSOR_ID_VALID << 1) | \
26 (EFI_ACPI_6_3_PPTT_NODE_IS_LEAF << 3))
27
28 // Mask for the cluster flags.
29 // Even though a _UID is generated for clusters, it is simpler to use
30 // EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID and to not match the cluster id of
31 // the PPTT table (not sure the PPTT table is generated).
32 #define PPTT_CLUSTER_PROCESSOR_MASK ( \
33 (EFI_ACPI_6_3_PPTT_PACKAGE_NOT_PHYSICAL) | \
34 (EFI_ACPI_6_3_PPTT_PROCESSOR_ID_INVALID << 1) | \
35 (EFI_ACPI_6_3_PPTT_NODE_IS_NOT_LEAF << 3))
36
37 /** LPI states are stored in the ASL namespace at '\_SB_.Lxxx',
38 with xxx being the node index of the LPI state.
39 */
40 #define SB_SCOPE "\\_SB_"
41 #define SB_SCOPE_PREFIX SB_SCOPE "."
42 /// Size of the SB_SCOPE_PREFIX string.
43 #define SB_SCOPE_PREFIX_SIZE sizeof (SB_SCOPE_PREFIX)
44
45 /// HID for a processor device.
46 #define ACPI_HID_PROCESSOR_DEVICE "ACPI0007"
47
48 /// HID for a processor container device.
49 #define ACPI_HID_PROCESSOR_CONTAINER_DEVICE "ACPI0010"
50
51 /** Node names of Cpus and Clusters are 'Cxxx', and 'Lxxx' for LPI states.
52 The 'xxx' is an index on 12 bits is given to node name,
53 thus the limitation in the number of nodes.
54 */
55 #define MAX_NODE_COUNT (1 << 12)
56
57 /** A structure used to handle the Lpi structures referencing.
58
59 A CM_ARM_PROC_HIERARCHY_INFO structure references a CM_ARM_OBJ_REF.
60 This CM_ARM_OBJ_REF references CM_ARM_LPI_INFO structures.
61
62 Example:
63 (Cpu0) (Cpu1)
64 CM_ARM_PROC_HIERARCHY_INFO CM_ARM_PROC_HIERARCHY_INFO
65 | |
66 +----------------------------------------
67 |
68 v
69 (List of references to Lpi states)
70 CM_ARM_OBJ_REF
71 |
72 +----------------------------------------
73 | |
74 v v
75 (A first Lpi state) (A second Lpi state)
76 CM_ARM_LPI_INFO[0] CM_ARM_LPI_INFO[1]
77
78 Here, Cpu0 and Cpu1 have the same Lpi states. Both CM_ARM_PROC_HIERARCHY_INFO
79 structures reference the same CM_ARM_OBJ_REF. An entry is created in the
80 TokenTable such as:
81 0 <-> CM_ARM_OBJ_REF
82
83 This will lead to the creation of this pseudo-ASL code where Cpu0 and Cpu1
84 return the same object at \_SB.L000:
85 Scope (\_SB) {
86 Device (C000) {
87 [...]
88 Method (_LPI) {
89 Return (\_SB.L000)
90 }
91 } // C000
92
93 Device (C001) {
94 [...]
95 Method (_LPI) {
96 Return (\_SB.L000)
97 }
98 } // C001
99
100 // Lpi states
101 Name (L000, Package (0x05) {
102 [...]
103 }
104 }
105 */
106 typedef struct TokenTable {
107 /// TokenTable, a table allowing to map:
108 /// Index <-> CM_OBJECT_TOKEN (to CM_ARM_LPI_INFO structures).
109 CM_OBJECT_TOKEN *Table;
110
111 /// Last used index of the TokenTable.
112 /// LastIndex is bound by ProcNodeCount.
113 UINT32 LastIndex;
114 } TOKEN_TABLE;
115
116 /** A structure holding the Cpu topology generator and additional private data.
117 */
118 typedef struct AcpiCpuTopologyGenerator {
119 /// ACPI Table generator header
120 ACPI_TABLE_GENERATOR Header;
121
122 // Private fields are defined from here.
123
124 /// Private object used to handle token referencing.
125 TOKEN_TABLE TokenTable;
126 /// List of CM_ARM_PROC_HIERARCHY_INFO CM objects.
127 CM_ARM_PROC_HIERARCHY_INFO *ProcNodeList;
128 /// Count of CM_ARM_PROC_HIERARCHY_INFO CM objects.
129 UINT32 ProcNodeCount;
130 } ACPI_CPU_TOPOLOGY_GENERATOR;
131
132 #pragma pack()
133
134 #endif // SSDT_CPU_TOPOLOGY_GENERATOR_H_