| 1 |
How to add a new ACPI table to ACPICA and the iASL compiler. |
| 2 |
------------------------------------------------------------ |
| 3 |
|
| 4 |
There are four main tasks that are needed to provide support for a |
| 5 |
new 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 |
|
| 13 |
Notes for each of these tasks provided below. |
| 14 |
|
| 15 |
|
| 16 |
1) Header Support |
| 17 |
----------------- |
| 18 |
|
| 19 |
New 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 |
|
| 23 |
Use ACPI_TABLE_HEADER for the common ACPI table header. |
| 24 |
Subtables should be defined separately from the main table. |
| 25 |
Don'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. |
| 28 |
For tables not defined in the ACPI spec, add a comment to indicate where |
| 29 |
the table came from. |
| 30 |
Use other table definitions for additional guidance. |
| 31 |
|
| 32 |
|
| 33 |
2) iASL Disassembler Support |
| 34 |
---------------------------- |
| 35 |
|
| 36 |
Add definition of the table (and subtables) in common/dmtbinfo.c |
| 37 |
Add table access macro(s) of the form ACPI_xxxx_OFFSET |
| 38 |
Add ACPI_DMT_TERMINATOR at the end of every table/subtable definition |
| 39 |
|
| 40 |
Add externals for the table/subtable definitions in acdisasm.h |
| 41 |
Add an entry for the new table in the AcpiDmTableData in common/dmtable.c |
| 42 |
|
| 43 |
If there are no subtables, add the AcpiDmTableInfoXXXX name to the |
| 44 |
AcpiDmTableData and it will automatically be disassembled. |
| 45 |
|
| 46 |
If there are subtables, a dump routine must be written: |
| 47 |
Add an AcpiDmDumpXXXX function to dmtbdump.c -- note, code for another |
| 48 |
similar table can often be ported for the new table. |
| 49 |
Add an external for this function to acdisasm.h |
| 50 |
Add this function to the AcpiDmTableData entry for the new ACPI table |
| 51 |
|
| 52 |
Debug/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 |
|
| 60 |
3) iASL Table Compiler Support |
| 61 |
------------------------------ |
| 62 |
|
| 63 |
Simple 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 |
|
| 66 |
Complex tables with subtables will require a compile routine with a name |
| 67 |
of the form DtCompileXXXX. |
| 68 |
Add a DtCompileXXXX function to the dttable.c module. |
| 69 |
Add an external for this function in dtcompiler.h |
| 70 |
Add this function to the AcpiDmTableData entry for the new ACPI table |
| 71 |
in common/dmtable.c |
| 72 |
|
| 73 |
|
| 74 |
4) Template Support (-T iASL option) |
| 75 |
------------------------------------ |
| 76 |
|
| 77 |
Create 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 |
|
| 81 |
Compile the example file with the -sc option. This will create a C |
| 82 |
array that contains the table contents. |
| 83 |
|
| 84 |
Add this array to the dttemplate.h file. Name the array TemplateXXXX. |
| 85 |
Add this array name to the AcpiDmTableData entry for the new ACPI table |
| 86 |
|
| 87 |
Debug/Test: Create the template file. Compile the file. Disassemble the file. |
| 88 |
Compile the disassembly file. |