3 Copyright (c) 2017, 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:
59 Standard SMBIOS Table IDs:
109 typedef UINT32 TABLE_GENERATOR_ID
;
111 /** This enum lists the Table Generator Types.
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
;
120 /** This enum lists the namespaces for the Table Generators.
122 typedef enum TableGeneratorNameSpace
{
123 ETableGeneratorNameSpaceStd
= 0, ///< Standard Namespace.
124 ETableGeneratorNameSpaceOem
///< OEM Namespace.
125 } ETABLE_GENERATOR_NAMESPACE
;
127 /** A mask for the Table ID bits of TABLE_GENERATOR_ID.
129 #define TABLE_ID_MASK 0xFF
131 /** A mask for the Namespace ID bits of TABLE_GENERATOR_ID.
133 #define TABLE_NAMESPACEID_MASK (BIT31)
135 /** A mask for the Table Type bits of TABLE_GENERATOR_ID.
137 #define TABLE_TYPE_MASK (BIT29 | BIT28)
139 /** Starting bit position for the Table Type bits
141 #define TABLE_TYPE_BIT_SHIFT 28
143 /** Starting bit position for the Table Namespace ID bit
145 #define TABLE_NAMESPACE_ID_BIT_SHIFT 31
147 /** This macro returns the Table ID from the TableGeneratorId.
149 @param [in] TableGeneratorId The table generator ID.
151 @return the Table ID described by the TableGeneratorId.
153 #define GET_TABLE_ID(TableGeneratorId) \
154 ((TableGeneratorId) & TABLE_ID_MASK)
156 /** This macro returns the Table type from the TableGeneratorId.
158 @param [in] TableGeneratorId The table generator ID.
160 @return the Table type described by the TableGeneratorId.
162 #define GET_TABLE_TYPE(TableGeneratorId) \
163 (((TableGeneratorId) & TABLE_TYPE_MASK) >> TABLE_TYPE_BIT_SHIFT)
165 /** This macro returns the Namespace ID from the TableGeneratorId.
167 @param [in] TableGeneratorId The table generator ID.
169 @return the Namespace described by the TableGeneratorId.
171 #define GET_TABLE_NAMESPACEID(TableGeneratorId) \
172 (((TableGeneratorId) & TABLE_NAMESPACEID_MASK) >> \
173 TABLE_NAMESPACE_ID_BIT_SHIFT)
175 /** This macro checks if the TableGeneratorId is in the Standard Namespace.
177 @param [in] TableGeneratorId The table generator ID.
179 @return TRUE if the TableGeneratorId is in the Standard Namespace.
181 #define IS_GENERATOR_NAMESPACE_STD(TableGeneratorId) \
183 GET_TABLE_NAMESPACEID(TableGeneratorId) == \
184 ETableGeneratorNameSpaceStd \
187 /** This macro creates a TableGeneratorId
189 @param [in] TableType The table type.
190 @param [in] TableNameSpaceId The namespace ID for the table.
191 @param [in] TableId The table ID.
193 @return a TableGeneratorId calculated from the inputs.
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))
200 /** Starting bit position for MAJOR revision
202 #define MAJOR_REVISION_BIT_SHIFT 16
204 /** A mask for Major revision.
206 #define MAJOR_REVISION_MASK 0xFFFF
208 /** A mask for Minor revision.
210 #define MINOR_REVISION_MASK 0xFFFF
212 /** This macro generates a Major.Minor version
213 where the Major and Minor fields are 16 bit.
215 @param [in] Major The Major revision.
216 @param [in] Minor The Minor revision.
218 @return a 32 bit representation of the type Major.Minor.
220 #define CREATE_REVISION(Major, Minor) \
221 ((((Major) & MAJOR_REVISION_MASK) << MAJOR_REVISION_BIT_SHIFT) | \
222 ((Minor) & MINOR_REVISION_MASK))
224 /** This macro returns the Major revision
226 Extracts Major from the 32 bit representation of the type Major.Minor
228 @param [in] Revision The Revision value which is 32 bit.
230 @return the Major part of the revision.
232 #define GET_MAJOR_REVISION(Revision) \
233 (((Revision) >> MAJOR_REVISION_BIT_SHIFT) & MAJOR_REVISION_MASK)
235 /** This macro returns the Minor revision
237 Extracts Minor from the 32 bit representation of the type Major.Minor
239 @param [in] Revision The Revision value which is 32 bit.
241 @return the Minor part of the revision.
243 #define GET_MINOR_REVISION(Revision) ((Revision) & MINOR_REVISION_MASK)
245 #endif // TABLE_GENERATOR_H_