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