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