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