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