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