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