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