3 Copyright (c) 2017, ARM Limited. All rights reserved.
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
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.
14 - ACPI - Advanced Configuration and Power Interface
15 - SMBIOS - System Management BIOS
19 #ifndef TABLE_GENERATOR_H_
20 #define TABLE_GENERATOR_H_
22 /** The TABLE_GENERATOR_ID type describes the Table Generator ID
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 -------------------------------------------------------------------------------
35 _______________________________________________________________________________
37 Bit [31] - Table NameSpace ID (TNSID)
41 Bit [30] - Reserved, Must be Zero
43 Bit [29:28] - Table Type (TT)
46 2 - DT (Device Tree) Table
47 3 - Reserved (INVALID)
49 Bit [27:16] - Reserved, Must Be Zero
53 Standard ACPI Table IDs:
65 Standard SMBIOS Table IDs:
115 typedef UINT32 TABLE_GENERATOR_ID
;
117 /** This enum lists the Table Generator Types.
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
;
126 /** This enum lists the namespaces for the Table Generators.
128 typedef enum TableGeneratorNameSpace
{
129 ETableGeneratorNameSpaceStd
= 0, ///< Standard Namespace.
130 ETableGeneratorNameSpaceOem
///< OEM Namespace.
131 } ETABLE_GENERATOR_NAMESPACE
;
133 /** A mask for the Table ID bits of TABLE_GENERATOR_ID.
135 #define TABLE_ID_MASK 0xFF
137 /** A mask for the Namespace ID bits of TABLE_GENERATOR_ID.
139 #define TABLE_NAMESPACEID_MASK (BIT31)
141 /** A mask for the Table Type bits of TABLE_GENERATOR_ID.
143 #define TABLE_TYPE_MASK (BIT29 | BIT28)
145 /** Starting bit position for the Table Type bits
147 #define TABLE_TYPE_BIT_SHIFT 28
149 /** Starting bit position for the Table Namespace ID bit
151 #define TABLE_NAMESPACE_ID_BIT_SHIFT 31
153 /** This macro returns the Table ID from the TableGeneratorId.
155 @param [in] TableGeneratorId The table generator ID.
157 @return the Table ID described by the TableGeneratorId.
159 #define GET_TABLE_ID(TableGeneratorId) \
160 ((TableGeneratorId) & TABLE_ID_MASK)
162 /** This macro returns the Table type from the TableGeneratorId.
164 @param [in] TableGeneratorId The table generator ID.
166 @return the Table type described by the TableGeneratorId.
168 #define GET_TABLE_TYPE(TableGeneratorId) \
169 (((TableGeneratorId) & TABLE_TYPE_MASK) >> TABLE_TYPE_BIT_SHIFT)
171 /** This macro returns the Namespace ID from the TableGeneratorId.
173 @param [in] TableGeneratorId The table generator ID.
175 @return the Namespace described by the TableGeneratorId.
177 #define GET_TABLE_NAMESPACEID(TableGeneratorId) \
178 (((TableGeneratorId) & TABLE_NAMESPACEID_MASK) >> \
179 TABLE_NAMESPACE_ID_BIT_SHIFT)
181 /** This macro checks if the TableGeneratorId is in the Standard Namespace.
183 @param [in] TableGeneratorId The table generator ID.
185 @return TRUE if the TableGeneratorId is in the Standard Namespace.
187 #define IS_GENERATOR_NAMESPACE_STD(TableGeneratorId) \
189 GET_TABLE_NAMESPACEID(TableGeneratorId) == \
190 ETableGeneratorNameSpaceStd \
193 /** This macro creates a TableGeneratorId
195 @param [in] TableType The table type.
196 @param [in] TableNameSpaceId The namespace ID for the table.
197 @param [in] TableId The table ID.
199 @return a TableGeneratorId calculated from the inputs.
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))
206 /** Starting bit position for MAJOR revision
208 #define MAJOR_REVISION_BIT_SHIFT 16
210 /** A mask for Major revision.
212 #define MAJOR_REVISION_MASK 0xFFFF
214 /** A mask for Minor revision.
216 #define MINOR_REVISION_MASK 0xFFFF
218 /** This macro generates a Major.Minor version
219 where the Major and Minor fields are 16 bit.
221 @param [in] Major The Major revision.
222 @param [in] Minor The Minor revision.
224 @return a 32 bit representation of the type Major.Minor.
226 #define CREATE_REVISION(Major, Minor) \
227 ((((Major) & MAJOR_REVISION_MASK) << MAJOR_REVISION_BIT_SHIFT) | \
228 ((Minor) & MINOR_REVISION_MASK))
230 /** This macro returns the Major revision
232 Extracts Major from the 32 bit representation of the type Major.Minor
234 @param [in] Revision The Revision value which is 32 bit.
236 @return the Major part of the revision.
238 #define GET_MAJOR_REVISION(Revision) \
239 (((Revision) >> MAJOR_REVISION_BIT_SHIFT) & MAJOR_REVISION_MASK)
241 /** This macro returns the Minor revision
243 Extracts Minor from the 32 bit representation of the type Major.Minor
245 @param [in] Revision The Revision value which is 32 bit.
247 @return the Minor part of the revision.
249 #define GET_MINOR_REVISION(Revision) ((Revision) & MINOR_REVISION_MASK)
251 #endif // TABLE_GENERATOR_H_