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