3 Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
5 SPDX-License-Identifier: BSD-2-Clause-Patent
8 - ACPI - Advanced Configuration and Power Interface
9 - SMBIOS - System Management BIOS
13 #ifndef TABLE_GENERATOR_H_
14 #define TABLE_GENERATOR_H_
16 /** The TABLE_GENERATOR_ID type describes the Table Generator ID
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 -------------------------------------------------------------------------------
29 _______________________________________________________________________________
31 Bit [31] - Table NameSpace ID (TNSID)
35 Bit [30] - Reserved, Must be Zero
37 Bit [29:28] - Table Type (TT)
40 2 - DT (Device Tree) Table
41 3 - Reserved (INVALID)
43 Bit [27:16] - Reserved, Must Be Zero
47 Standard ACPI Table IDs:
60 Standard SMBIOS Table IDs:
110 typedef UINT32 TABLE_GENERATOR_ID
;
112 /** This enum lists the Table Generator Types.
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
;
121 /** This enum lists the namespaces for the Table Generators.
123 typedef enum TableGeneratorNameSpace
{
124 ETableGeneratorNameSpaceStd
= 0, ///< Standard Namespace.
125 ETableGeneratorNameSpaceOem
///< OEM Namespace.
126 } ETABLE_GENERATOR_NAMESPACE
;
128 /** A mask for the Table ID bits of TABLE_GENERATOR_ID.
130 #define TABLE_ID_MASK 0xFF
132 /** A mask for the Namespace ID bits of TABLE_GENERATOR_ID.
134 #define TABLE_NAMESPACEID_MASK (BIT31)
136 /** A mask for the Table Type bits of TABLE_GENERATOR_ID.
138 #define TABLE_TYPE_MASK (BIT29 | BIT28)
140 /** Starting bit position for the Table Type bits
142 #define TABLE_TYPE_BIT_SHIFT 28
144 /** Starting bit position for the Table Namespace ID bit
146 #define TABLE_NAMESPACE_ID_BIT_SHIFT 31
148 /** This macro returns the Table ID from the TableGeneratorId.
150 @param [in] TableGeneratorId The table generator ID.
152 @return the Table ID described by the TableGeneratorId.
154 #define GET_TABLE_ID(TableGeneratorId) \
155 ((TableGeneratorId) & TABLE_ID_MASK)
157 /** This macro returns the Table type from the TableGeneratorId.
159 @param [in] TableGeneratorId The table generator ID.
161 @return the Table type described by the TableGeneratorId.
163 #define GET_TABLE_TYPE(TableGeneratorId) \
164 (((TableGeneratorId) & TABLE_TYPE_MASK) >> TABLE_TYPE_BIT_SHIFT)
166 /** This macro returns the Namespace ID from the TableGeneratorId.
168 @param [in] TableGeneratorId The table generator ID.
170 @return the Namespace described by the TableGeneratorId.
172 #define GET_TABLE_NAMESPACEID(TableGeneratorId) \
173 (((TableGeneratorId) & TABLE_NAMESPACEID_MASK) >> \
174 TABLE_NAMESPACE_ID_BIT_SHIFT)
176 /** This macro checks if the TableGeneratorId is in the Standard Namespace.
178 @param [in] TableGeneratorId The table generator ID.
180 @return TRUE if the TableGeneratorId is in the Standard Namespace.
182 #define IS_GENERATOR_NAMESPACE_STD(TableGeneratorId) \
184 GET_TABLE_NAMESPACEID(TableGeneratorId) == \
185 ETableGeneratorNameSpaceStd \
188 /** This macro creates a TableGeneratorId
190 @param [in] TableType The table type.
191 @param [in] TableNameSpaceId The namespace ID for the table.
192 @param [in] TableId The table ID.
194 @return a TableGeneratorId calculated from the inputs.
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))
201 /** Starting bit position for MAJOR revision
203 #define MAJOR_REVISION_BIT_SHIFT 16
205 /** A mask for Major revision.
207 #define MAJOR_REVISION_MASK 0xFFFF
209 /** A mask for Minor revision.
211 #define MINOR_REVISION_MASK 0xFFFF
213 /** This macro generates a Major.Minor version
214 where the Major and Minor fields are 16 bit.
216 @param [in] Major The Major revision.
217 @param [in] Minor The Minor revision.
219 @return a 32 bit representation of the type Major.Minor.
221 #define CREATE_REVISION(Major, Minor) \
222 ((((Major) & MAJOR_REVISION_MASK) << MAJOR_REVISION_BIT_SHIFT) | \
223 ((Minor) & MINOR_REVISION_MASK))
225 /** This macro returns the Major revision
227 Extracts Major from the 32 bit representation of the type Major.Minor
229 @param [in] Revision The Revision value which is 32 bit.
231 @return the Major part of the revision.
233 #define GET_MAJOR_REVISION(Revision) \
234 (((Revision) >> MAJOR_REVISION_BIT_SHIFT) & MAJOR_REVISION_MASK)
236 /** This macro returns the Minor revision
238 Extracts Minor from the 32 bit representation of the type Major.Minor
240 @param [in] Revision The Revision value which is 32 bit.
242 @return the Minor part of the revision.
244 #define GET_MINOR_REVISION(Revision) ((Revision) & MINOR_REVISION_MASK)
246 #endif // TABLE_GENERATOR_H_