1 1.1.1.1.6.2 yamt How to add a new ACPI table to ACPICA and the iASL compiler. 2 1.1.1.1.6.2 yamt ------------------------------------------------------------ 3 1.1.1.1.6.2 yamt 4 1.1.1.1.6.2 yamt There are four main tasks that are needed to provide support for a 5 1.1.1.1.6.2 yamt new ACPI table: 6 1.1.1.1.6.2 yamt 1) Create a full definition of the table and any subtables 7 1.1.1.1.6.2 yamt in the ACPICA headers. 8 1.1.1.1.6.2 yamt 2) Add disassembler support for the new table 9 1.1.1.1.6.2 yamt 3) Add iASL table compiler support for the new table 10 1.1.1.1.6.2 yamt 4) Create a default template for the new table for iASL -T 11 1.1.1.1.6.2 yamt option. 12 1.1.1.1.6.2 yamt 13 1.1.1.1.6.2 yamt Notes for each of these tasks provided below. 14 1.1.1.1.6.2 yamt 15 1.1.1.1.6.2 yamt 16 1.1.1.1.6.2 yamt 1) Header Support 17 1.1.1.1.6.2 yamt ----------------- 18 1.1.1.1.6.2 yamt 19 1.1.1.1.6.2 yamt New tables should be added to the appropriate header: 20 1.1.1.1.6.2 yamt actbl2.h: Used for new tables that are not defined in the ACPI spec. 21 1.1.1.1.6.2 yamt actbl3.h: Used for new tables that are defined in the ACPI spec. 22 1.1.1.1.6.2 yamt 23 1.1.1.1.6.2 yamt Use ACPI_TABLE_HEADER for the common ACPI table header. 24 1.1.1.1.6.2 yamt Subtables should be defined separately from the main table. 25 1.1.1.1.6.2 yamt Don't add placeholder fields for subtables and other multiple data items. 26 1.1.1.1.6.2 yamt (Don't use xxxxx[1] for a field that can have multiple items.) 27 1.1.1.1.6.2 yamt The disassembler and data table compiler depends on this. 28 1.1.1.1.6.2 yamt For tables not defined in the ACPI spec, add a comment to indicate where 29 1.1.1.1.6.2 yamt the table came from. 30 1.1.1.1.6.2 yamt Use other table definitions for additional guidance. 31 1.1.1.1.6.2 yamt 32 1.1.1.1.6.2 yamt 33 1.1.1.1.6.2 yamt 2) iASL Disassembler Support 34 1.1.1.1.6.2 yamt ---------------------------- 35 1.1.1.1.6.2 yamt 36 1.1.1.1.6.2 yamt Add definition of the table (and subtables) in common/dmtbinfo.c 37 1.1.1.1.6.2 yamt Add table access macro(s) of the form ACPI_xxxx_OFFSET 38 1.1.1.1.6.2 yamt Add ACPI_DMT_TERMINATOR at the end of every table/subtable definition 39 1.1.1.1.6.2 yamt 40 1.1.1.1.6.2 yamt Add externals for the table/subtable definitions in acdisasm.h 41 1.1.1.1.6.2 yamt Add an entry for the new table in the AcpiDmTableData in common/dmtable.c 42 1.1.1.1.6.2 yamt 43 1.1.1.1.6.2 yamt If there are no subtables, add the AcpiDmTableInfoXXXX name to the 44 1.1.1.1.6.2 yamt AcpiDmTableData and it will automatically be disassembled. 45 1.1.1.1.6.2 yamt 46 1.1.1.1.6.2 yamt If there are subtables, a dump routine must be written: 47 1.1.1.1.6.2 yamt Add an AcpiDmDumpXXXX function to dmtbdump.c -- note, code for another 48 1.1.1.1.6.2 yamt similar table can often be ported for the new table. 49 1.1.1.1.6.2 yamt Add an external for this function to acdisasm.h 50 1.1.1.1.6.2 yamt Add this function to the AcpiDmTableData entry for the new ACPI table 51 1.1.1.1.6.2 yamt 52 1.1.1.1.6.2 yamt Debug/Test: Either find an existing example of the new ACPI table, or 53 1.1.1.1.6.2 yamt create one using the "generic ACPI table support" included in the 54 1.1.1.1.6.2 yamt iASL data table compiler. Use the -G option to force a 55 1.1.1.1.6.2 yamt generic compile. It is often best to create the table from scratch, 56 1.1.1.1.6.2 yamt since this clearly exposes the dependencies (lengths, offsets, etc.) 57 1.1.1.1.6.2 yamt that the Table Compiler support will need to generate. 58 1.1.1.1.6.2 yamt 59 1.1.1.1.6.2 yamt 60 1.1.1.1.6.2 yamt 3) iASL Table Compiler Support 61 1.1.1.1.6.2 yamt ------------------------------ 62 1.1.1.1.6.2 yamt 63 1.1.1.1.6.2 yamt Simple tables do not require a compile routine. The definition of the 64 1.1.1.1.6.2 yamt table in common/dmtbinfo.c (created in step 2 above) will suffice. 65 1.1.1.1.6.2 yamt 66 1.1.1.1.6.2 yamt Complex tables with subtables will require a compile routine with a name 67 1.1.1.1.6.2 yamt of the form DtCompileXXXX. 68 1.1.1.1.6.2 yamt Add a DtCompileXXXX function to the dttable.c module. 69 1.1.1.1.6.2 yamt Add an external for this function in dtcompiler.h 70 1.1.1.1.6.2 yamt Add this function to the AcpiDmTableData entry for the new ACPI table 71 1.1.1.1.6.2 yamt in common/dmtable.c 72 1.1.1.1.6.2 yamt 73 1.1.1.1.6.2 yamt 74 1.1.1.1.6.2 yamt 4) Template Support (-T iASL option) 75 1.1.1.1.6.2 yamt ------------------------------------ 76 1.1.1.1.6.2 yamt 77 1.1.1.1.6.2 yamt Create an example of the new ACPI table. This example should create 78 1.1.1.1.6.2 yamt multiple subtables (if supported), and multiple instances of any 79 1.1.1.1.6.2 yamt variable length data. 80 1.1.1.1.6.2 yamt 81 1.1.1.1.6.2 yamt Compile the example file with the -sc option. This will create a C 82 1.1.1.1.6.2 yamt array that contains the table contents. 83 1.1.1.1.6.2 yamt 84 1.1.1.1.6.2 yamt Add this array to the dttemplate.h file. Name the array TemplateXXXX. 85 1.1.1.1.6.2 yamt Add this array name to the AcpiDmTableData entry for the new ACPI table 86 1.1.1.1.6.2 yamt 87 1.1.1.1.6.2 yamt Debug/Test: Create the template file. Compile the file. Disassemble the file. 88 1.1.1.1.6.2 yamt Compile the disassembly file. 89