| 1 | # SuperIO SSTD generator |
| 2 | |
| 3 | This page describes the common SSDT ACPI generator for SuperIO chips that can |
| 4 | be found in coreboot. |
| 5 | |
| 6 | ## Functional description |
| 7 | |
| 8 | In order to automatically generate ACPI functions you need to add |
| 9 | a new `chip superio/common` and `device pnp xx.0 on` to your devicetree. |
| 10 | |
| 11 | The xx denotes the hexadecimal address of the SuperIO. |
| 12 | |
| 13 | Place the regular LDN pnp devices behind those two entries. |
| 14 | |
| 15 | The code will automatically guess the function based on the decoded |
| 16 | I/O range and ISA IRQ number. |
| 17 | |
| 18 | ## Example devicetree.cb |
| 19 | |
| 20 | This example is based on AST2400. |
| 21 | |
| 22 | ``` |
| 23 | # Add a "container" for proper ACPI code generation |
| 24 | chip superio/common |
| 25 | device pnp 2e.0 on # just for the base device, not for the LDNs |
| 26 | chip superio/aspeed/ast2400 |
| 27 | device pnp 2e.0 off end |
| 28 | device pnp 2e.2 on # SUART1 |
| 29 | io 0x60 = 0x3f8 |
| 30 | irq 0x70 = 4 |
| 31 | end |
| 32 | device pnp 2e.3 on # SUART2 |
| 33 | io 0x60 = 0x2f8 |
| 34 | irq 0x70 = 3 |
| 35 | end |
| 36 | device pnp 2e.4 on # SWC |
| 37 | io 0x60 = 0xa00 |
| 38 | io 0x62 = 0xa10 |
| 39 | io 0x64 = 0xa20 |
| 40 | io 0x66 = 0xa30 |
| 41 | irq 0x70 = 0 |
| 42 | end |
| 43 | end |
| 44 | end |
| 45 | end |
| 46 | ``` |
| 47 | |
| 48 | ## Automatically generated methods |
| 49 | |
| 50 | The following methods are generated for each SuperIO: |
| 51 | ## AMTX() |
| 52 | Acquire the global mutex and enter config mode. |
| 53 | It's called this at the beginning of an atomic operation to make sure |
| 54 | no other ACPI code messes with the config space while working on it. |
| 55 | |
| 56 | ## RMTX() |
| 57 | Exit config mode and release the global mutex. |
| 58 | It's called at the end of an atomic operation. |
| 59 | |
| 60 | ## SLDN(Arg0) |
| 61 | Selects the (virtual) LDN given as Arg0. |
| 62 | This method isn't guarded with the global mutex. |
| 63 | |
| 64 | ## DLDN(Arg0) |
| 65 | Disables the (virtual) LDN given as Arg0. |
| 66 | This method acquires the global mutex. |
| 67 | |
| 68 | ## QLDN(Arg0) |
| 69 | Queries the state of the (virtual) LDN given as Arg0. |
| 70 | This method quires the global mutex. |
| 71 | |
| 72 | ## TODO |
| 73 | |
| 74 | 1) Add ACPI HIDs to every SuperIO driver |
| 75 | 2) Generate support methods that allow |
| 76 | * Setting resource settings at runtime |
| 77 | * Getting resource settings at runtime |