]> git.proxmox.com Git - mirror_edk2.git/blame - DynamicTablesPkg/Include/TableGenerator.h
UefiCpuPkg CpuCommFeaturesLib: Fix GP fault issue about ProcTrace
[mirror_edk2.git] / DynamicTablesPkg / Include / TableGenerator.h
CommitLineData
90c1ba92
SM
1/** @file\r
2\r
3 Copyright (c) 2017, ARM Limited. All rights reserved.\r
4\r
9cd9bdc6 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
90c1ba92
SM
6\r
7 @par Glossary:\r
8 - ACPI - Advanced Configuration and Power Interface\r
9 - SMBIOS - System Management BIOS\r
10 - DT - Device Tree\r
11**/\r
12\r
13#ifndef TABLE_GENERATOR_H_\r
14#define TABLE_GENERATOR_H_\r
15\r
16/** The TABLE_GENERATOR_ID type describes the Table Generator ID\r
17\r
18 Table Generator ID\r
19\r
20_______________________________________________________________________________\r
21| 31 | 30 |29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17| 16|\r
22-------------------------------------------------------------------------------\r
23|TNSID| 0 | TT | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0| 0|\r
24_______________________________________________________________________________\r
25_______________________________________________________________________________\r
26|15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0|\r
27-------------------------------------------------------------------------------\r
28| Table ID |\r
29_______________________________________________________________________________\r
30\r
31 Bit [31] - Table NameSpace ID (TNSID)\r
32 0 - Standard\r
33 1 - Custom/OEM\r
34\r
35 Bit [30] - Reserved, Must be Zero\r
36\r
37 Bit [29:28] - Table Type (TT)\r
38 0 - ACPI Table\r
39 1 - SMBIOS Table\r
40 2 - DT (Device Tree) Table\r
41 3 - Reserved (INVALID)\r
42\r
43 Bit [27:16] - Reserved, Must Be Zero\r
44\r
45 Bit [15:0] - Table ID\r
46\r
47 Standard ACPI Table IDs:\r
48 0 - Reserved\r
49 1 - RAW\r
50 2 - FADT\r
51 3 - DSDT\r
52 4 - SSDT\r
53 5 - MADT\r
54 6 - GTDT\r
55 7 - DBG2\r
56 8 - SPCR\r
57 9 - MCFG\r
58\r
59 Standard SMBIOS Table IDs:\r
60 0 - Reserved\r
61 1 - RAW\r
62 2 - Table Type00\r
63 3 - Table Type01\r
64 4 - Table Type02\r
65 5 - Table Type03\r
66 6 - Table Type04\r
67 7 - Table Type05\r
68 8 - Table Type06\r
69 9 - Table Type07\r
70 10 - Table Type08\r
71 11 - Table Type09\r
72 12 - Table Type10\r
73 13 - Table Type11\r
74 14 - Table Type12\r
75 15 - Table Type13\r
76 16 - Table Type14\r
77 17 - Table Type15\r
78 18 - Table Type16\r
79 19 - Table Type17\r
80 20 - Table Type18\r
81 21 - Table Type19\r
82 22 - Table Type20\r
83 23 - Table Type21\r
84 24 - Table Type22\r
85 25 - Table Type23\r
86 26 - Table Type24\r
87 27 - Table Type25\r
88 28 - Table Type26\r
89 29 - Table Type27\r
90 30 - Table Type28\r
91 31 - Table Type29\r
92 32 - Table Type30\r
93 33 - Table Type31\r
94 34 - Table Type32\r
95 35 - Table Type33\r
96 36 - Table Type34\r
97 37 - Table Type35\r
98 38 - Table Type36\r
99 39 - Table Type37\r
100 40 - Table Type38\r
101 41 - Table Type39\r
102 42 - Table Type40\r
103 43 - Table Type41\r
104 44 - Table Type42\r
105 45-127 - Reserved\r
106 128 - Table Type126\r
107 129 - Table Type127\r
108**/\r
109typedef UINT32 TABLE_GENERATOR_ID;\r
110\r
111/** This enum lists the Table Generator Types.\r
112*/\r
113typedef enum TableGeneratorType {\r
114 ETableGeneratorTypeAcpi = 0, ///< ACPI Table Generator Type.\r
115 ETableGeneratorTypeSmbios, ///< SMBIOS Table Generator Type.\r
116 ETableGeneratorTypeDt, ///< Device Tree Table Generator Type.\r
117 ETableGeneratorTypeReserved\r
118} ETABLE_GENERATOR_TYPE;\r
119\r
120/** This enum lists the namespaces for the Table Generators.\r
121*/\r
122typedef enum TableGeneratorNameSpace {\r
123 ETableGeneratorNameSpaceStd = 0, ///< Standard Namespace.\r
124 ETableGeneratorNameSpaceOem ///< OEM Namespace.\r
125} ETABLE_GENERATOR_NAMESPACE;\r
126\r
127/** A mask for the Table ID bits of TABLE_GENERATOR_ID.\r
128*/\r
129#define TABLE_ID_MASK 0xFF\r
130\r
131/** A mask for the Namespace ID bits of TABLE_GENERATOR_ID.\r
132*/\r
133#define TABLE_NAMESPACEID_MASK (BIT31)\r
134\r
135/** A mask for the Table Type bits of TABLE_GENERATOR_ID.\r
136*/\r
137#define TABLE_TYPE_MASK (BIT29 | BIT28)\r
138\r
139/** Starting bit position for the Table Type bits\r
140*/\r
141#define TABLE_TYPE_BIT_SHIFT 28\r
142\r
143/** Starting bit position for the Table Namespace ID bit\r
144*/\r
145#define TABLE_NAMESPACE_ID_BIT_SHIFT 31\r
146\r
147/** This macro returns the Table ID from the TableGeneratorId.\r
148\r
149 @param [in] TableGeneratorId The table generator ID.\r
150\r
151 @return the Table ID described by the TableGeneratorId.\r
152**/\r
153#define GET_TABLE_ID(TableGeneratorId) \\r
154 ((TableGeneratorId) & TABLE_ID_MASK)\r
155\r
156/** This macro returns the Table type from the TableGeneratorId.\r
157\r
158 @param [in] TableGeneratorId The table generator ID.\r
159\r
160 @return the Table type described by the TableGeneratorId.\r
161**/\r
162#define GET_TABLE_TYPE(TableGeneratorId) \\r
163 (((TableGeneratorId) & TABLE_TYPE_MASK) >> TABLE_TYPE_BIT_SHIFT)\r
164\r
165/** This macro returns the Namespace ID from the TableGeneratorId.\r
166\r
167 @param [in] TableGeneratorId The table generator ID.\r
168\r
169 @return the Namespace described by the TableGeneratorId.\r
170**/\r
171#define GET_TABLE_NAMESPACEID(TableGeneratorId) \\r
172 (((TableGeneratorId) & TABLE_NAMESPACEID_MASK) >> \\r
173 TABLE_NAMESPACE_ID_BIT_SHIFT)\r
174\r
175/** This macro checks if the TableGeneratorId is in the Standard Namespace.\r
176\r
177 @param [in] TableGeneratorId The table generator ID.\r
178\r
179 @return TRUE if the TableGeneratorId is in the Standard Namespace.\r
180**/\r
181#define IS_GENERATOR_NAMESPACE_STD(TableGeneratorId) \\r
182 ( \\r
183 GET_TABLE_NAMESPACEID(TableGeneratorId) == \\r
184 ETableGeneratorNameSpaceStd \\r
185 )\r
186\r
187/** This macro creates a TableGeneratorId\r
188\r
189 @param [in] TableType The table type.\r
190 @param [in] TableNameSpaceId The namespace ID for the table.\r
191 @param [in] TableId The table ID.\r
192\r
193 @return a TableGeneratorId calculated from the inputs.\r
194**/\r
195#define CREATE_TABLE_GEN_ID(TableType, TableNameSpaceId, TableId) \\r
196 ((((TableType) << TABLE_TYPE_BIT_SHIFT) & TABLE_TYPE_MASK) | \\r
197 (((TableNameSpaceId) << TABLE_NAMESPACE_ID_BIT_SHIFT) & \\r
198 TABLE_NAMESPACEID_MASK) | ((TableId) & TABLE_ID_MASK))\r
199\r
200/** Starting bit position for MAJOR revision\r
201*/\r
202#define MAJOR_REVISION_BIT_SHIFT 16\r
203\r
204/** A mask for Major revision.\r
205*/\r
206#define MAJOR_REVISION_MASK 0xFFFF\r
207\r
208/** A mask for Minor revision.\r
209*/\r
210#define MINOR_REVISION_MASK 0xFFFF\r
211\r
212/** This macro generates a Major.Minor version\r
213 where the Major and Minor fields are 16 bit.\r
214\r
215 @param [in] Major The Major revision.\r
216 @param [in] Minor The Minor revision.\r
217\r
218 @return a 32 bit representation of the type Major.Minor.\r
219**/\r
220#define CREATE_REVISION(Major, Minor) \\r
221 ((((Major) & MAJOR_REVISION_MASK) << MAJOR_REVISION_BIT_SHIFT) | \\r
222 ((Minor) & MINOR_REVISION_MASK))\r
223\r
224/** This macro returns the Major revision\r
225\r
226 Extracts Major from the 32 bit representation of the type Major.Minor\r
227\r
228 @param [in] Revision The Revision value which is 32 bit.\r
229\r
230 @return the Major part of the revision.\r
231**/\r
232#define GET_MAJOR_REVISION(Revision) \\r
233 (((Revision) >> MAJOR_REVISION_BIT_SHIFT) & MAJOR_REVISION_MASK)\r
234\r
235/** This macro returns the Minor revision\r
236\r
237 Extracts Minor from the 32 bit representation of the type Major.Minor\r
238\r
239 @param [in] Revision The Revision value which is 32 bit.\r
240\r
241 @return the Minor part of the revision.\r
242**/\r
243#define GET_MINOR_REVISION(Revision) ((Revision) & MINOR_REVISION_MASK)\r
244\r
245#endif // TABLE_GENERATOR_H_\r
246\r