--- /dev/null
+/** @file\r
+\r
+ Copyright (c) 2017, ARM Limited. All rights reserved.\r
+\r
+ This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+\r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ @par Glossary:\r
+ - ACPI - Advanced Configuration and Power Interface\r
+ - SMBIOS - System Management BIOS\r
+ - DT - Device Tree\r
+**/\r
+\r
+#ifndef TABLE_GENERATOR_H_\r
+#define TABLE_GENERATOR_H_\r
+\r
+/** The TABLE_GENERATOR_ID type describes the Table Generator ID\r
+\r
+ Table Generator ID\r
+\r
+_______________________________________________________________________________\r
+| 31 | 30 |29 | 28 | 27 | 26 | 25 | 24 | 23 | 22 | 21 | 20 | 19 | 18 | 17| 16|\r
+-------------------------------------------------------------------------------\r
+|TNSID| 0 | TT | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0| 0|\r
+_______________________________________________________________________________\r
+_______________________________________________________________________________\r
+|15 | 14 | 13 | 12 | 11 | 10 | 9 | 8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0|\r
+-------------------------------------------------------------------------------\r
+| Table ID |\r
+_______________________________________________________________________________\r
+\r
+ Bit [31] - Table NameSpace ID (TNSID)\r
+ 0 - Standard\r
+ 1 - Custom/OEM\r
+\r
+ Bit [30] - Reserved, Must be Zero\r
+\r
+ Bit [29:28] - Table Type (TT)\r
+ 0 - ACPI Table\r
+ 1 - SMBIOS Table\r
+ 2 - DT (Device Tree) Table\r
+ 3 - Reserved (INVALID)\r
+\r
+ Bit [27:16] - Reserved, Must Be Zero\r
+\r
+ Bit [15:0] - Table ID\r
+\r
+ Standard ACPI Table IDs:\r
+ 0 - Reserved\r
+ 1 - RAW\r
+ 2 - FADT\r
+ 3 - DSDT\r
+ 4 - SSDT\r
+ 5 - MADT\r
+ 6 - GTDT\r
+ 7 - DBG2\r
+ 8 - SPCR\r
+ 9 - MCFG\r
+\r
+ Standard SMBIOS Table IDs:\r
+ 0 - Reserved\r
+ 1 - RAW\r
+ 2 - Table Type00\r
+ 3 - Table Type01\r
+ 4 - Table Type02\r
+ 5 - Table Type03\r
+ 6 - Table Type04\r
+ 7 - Table Type05\r
+ 8 - Table Type06\r
+ 9 - Table Type07\r
+ 10 - Table Type08\r
+ 11 - Table Type09\r
+ 12 - Table Type10\r
+ 13 - Table Type11\r
+ 14 - Table Type12\r
+ 15 - Table Type13\r
+ 16 - Table Type14\r
+ 17 - Table Type15\r
+ 18 - Table Type16\r
+ 19 - Table Type17\r
+ 20 - Table Type18\r
+ 21 - Table Type19\r
+ 22 - Table Type20\r
+ 23 - Table Type21\r
+ 24 - Table Type22\r
+ 25 - Table Type23\r
+ 26 - Table Type24\r
+ 27 - Table Type25\r
+ 28 - Table Type26\r
+ 29 - Table Type27\r
+ 30 - Table Type28\r
+ 31 - Table Type29\r
+ 32 - Table Type30\r
+ 33 - Table Type31\r
+ 34 - Table Type32\r
+ 35 - Table Type33\r
+ 36 - Table Type34\r
+ 37 - Table Type35\r
+ 38 - Table Type36\r
+ 39 - Table Type37\r
+ 40 - Table Type38\r
+ 41 - Table Type39\r
+ 42 - Table Type40\r
+ 43 - Table Type41\r
+ 44 - Table Type42\r
+ 45-127 - Reserved\r
+ 128 - Table Type126\r
+ 129 - Table Type127\r
+**/\r
+typedef UINT32 TABLE_GENERATOR_ID;\r
+\r
+/** This enum lists the Table Generator Types.\r
+*/\r
+typedef enum TableGeneratorType {\r
+ ETableGeneratorTypeAcpi = 0, ///< ACPI Table Generator Type.\r
+ ETableGeneratorTypeSmbios, ///< SMBIOS Table Generator Type.\r
+ ETableGeneratorTypeDt, ///< Device Tree Table Generator Type.\r
+ ETableGeneratorTypeReserved\r
+} ETABLE_GENERATOR_TYPE;\r
+\r
+/** This enum lists the namespaces for the Table Generators.\r
+*/\r
+typedef enum TableGeneratorNameSpace {\r
+ ETableGeneratorNameSpaceStd = 0, ///< Standard Namespace.\r
+ ETableGeneratorNameSpaceOem ///< OEM Namespace.\r
+} ETABLE_GENERATOR_NAMESPACE;\r
+\r
+/** A mask for the Table ID bits of TABLE_GENERATOR_ID.\r
+*/\r
+#define TABLE_ID_MASK 0xFF\r
+\r
+/** A mask for the Namespace ID bits of TABLE_GENERATOR_ID.\r
+*/\r
+#define TABLE_NAMESPACEID_MASK (BIT31)\r
+\r
+/** A mask for the Table Type bits of TABLE_GENERATOR_ID.\r
+*/\r
+#define TABLE_TYPE_MASK (BIT29 | BIT28)\r
+\r
+/** Starting bit position for the Table Type bits\r
+*/\r
+#define TABLE_TYPE_BIT_SHIFT 28\r
+\r
+/** Starting bit position for the Table Namespace ID bit\r
+*/\r
+#define TABLE_NAMESPACE_ID_BIT_SHIFT 31\r
+\r
+/** This macro returns the Table ID from the TableGeneratorId.\r
+\r
+ @param [in] TableGeneratorId The table generator ID.\r
+\r
+ @return the Table ID described by the TableGeneratorId.\r
+**/\r
+#define GET_TABLE_ID(TableGeneratorId) \\r
+ ((TableGeneratorId) & TABLE_ID_MASK)\r
+\r
+/** This macro returns the Table type from the TableGeneratorId.\r
+\r
+ @param [in] TableGeneratorId The table generator ID.\r
+\r
+ @return the Table type described by the TableGeneratorId.\r
+**/\r
+#define GET_TABLE_TYPE(TableGeneratorId) \\r
+ (((TableGeneratorId) & TABLE_TYPE_MASK) >> TABLE_TYPE_BIT_SHIFT)\r
+\r
+/** This macro returns the Namespace ID from the TableGeneratorId.\r
+\r
+ @param [in] TableGeneratorId The table generator ID.\r
+\r
+ @return the Namespace described by the TableGeneratorId.\r
+**/\r
+#define GET_TABLE_NAMESPACEID(TableGeneratorId) \\r
+ (((TableGeneratorId) & TABLE_NAMESPACEID_MASK) >> \\r
+ TABLE_NAMESPACE_ID_BIT_SHIFT)\r
+\r
+/** This macro checks if the TableGeneratorId is in the Standard Namespace.\r
+\r
+ @param [in] TableGeneratorId The table generator ID.\r
+\r
+ @return TRUE if the TableGeneratorId is in the Standard Namespace.\r
+**/\r
+#define IS_GENERATOR_NAMESPACE_STD(TableGeneratorId) \\r
+ ( \\r
+ GET_TABLE_NAMESPACEID(TableGeneratorId) == \\r
+ ETableGeneratorNameSpaceStd \\r
+ )\r
+\r
+/** This macro creates a TableGeneratorId\r
+\r
+ @param [in] TableType The table type.\r
+ @param [in] TableNameSpaceId The namespace ID for the table.\r
+ @param [in] TableId The table ID.\r
+\r
+ @return a TableGeneratorId calculated from the inputs.\r
+**/\r
+#define CREATE_TABLE_GEN_ID(TableType, TableNameSpaceId, TableId) \\r
+ ((((TableType) << TABLE_TYPE_BIT_SHIFT) & TABLE_TYPE_MASK) | \\r
+ (((TableNameSpaceId) << TABLE_NAMESPACE_ID_BIT_SHIFT) & \\r
+ TABLE_NAMESPACEID_MASK) | ((TableId) & TABLE_ID_MASK))\r
+\r
+/** Starting bit position for MAJOR revision\r
+*/\r
+#define MAJOR_REVISION_BIT_SHIFT 16\r
+\r
+/** A mask for Major revision.\r
+*/\r
+#define MAJOR_REVISION_MASK 0xFFFF\r
+\r
+/** A mask for Minor revision.\r
+*/\r
+#define MINOR_REVISION_MASK 0xFFFF\r
+\r
+/** This macro generates a Major.Minor version\r
+ where the Major and Minor fields are 16 bit.\r
+\r
+ @param [in] Major The Major revision.\r
+ @param [in] Minor The Minor revision.\r
+\r
+ @return a 32 bit representation of the type Major.Minor.\r
+**/\r
+#define CREATE_REVISION(Major, Minor) \\r
+ ((((Major) & MAJOR_REVISION_MASK) << MAJOR_REVISION_BIT_SHIFT) | \\r
+ ((Minor) & MINOR_REVISION_MASK))\r
+\r
+/** This macro returns the Major revision\r
+\r
+ Extracts Major from the 32 bit representation of the type Major.Minor\r
+\r
+ @param [in] Revision The Revision value which is 32 bit.\r
+\r
+ @return the Major part of the revision.\r
+**/\r
+#define GET_MAJOR_REVISION(Revision) \\r
+ (((Revision) >> MAJOR_REVISION_BIT_SHIFT) & MAJOR_REVISION_MASK)\r
+\r
+/** This macro returns the Minor revision\r
+\r
+ Extracts Minor from the 32 bit representation of the type Major.Minor\r
+\r
+ @param [in] Revision The Revision value which is 32 bit.\r
+\r
+ @return the Minor part of the revision.\r
+**/\r
+#define GET_MINOR_REVISION(Revision) ((Revision) & MINOR_REVISION_MASK)\r
+\r
+#endif // TABLE_GENERATOR_H_\r
+\r