2 * Initial LinuxBIOS ACPI Support - headers and defines.
4 * written by Stefan Reinauer <stepan@openbios.org>
5 * (C) 2004 SUSE LINUX AG
7 * The ACPI table structs are based on the Linux kernel sources.
10 /* ACPI FADT & FACS added by Nick Barker <nick.barker9@btinternet.com>
11 * those parts (C) 2004 Nick Barker
18 #if HAVE_ACPI_TABLES==1
20 typedef unsigned char u8;
21 typedef unsigned short u16;
22 typedef unsigned int u32;
23 typedef unsigned long long u64;
25 #define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */
26 #define RSDP_NAME "RSDP"
28 #define RSDT_NAME "RSDT"
29 #define HPET_NAME "HPET"
30 #define MADT_NAME "APIC"
32 #define RSDT_TABLE "RSDT "
33 #define HPET_TABLE "AMD64 "
34 #define MADT_TABLE "MADT "
36 #define OEM_ID "LXBIOS"
39 /* ACPI 2.0 table RSDP */
41 typedef struct acpi_rsdp {
51 } __attribute__((packed)) acpi_rsdp_t;
53 /* Generic Address Container */
55 typedef struct acpi_gen_regaddr {
62 } __attribute__ ((packed)) acpi_addr_t;
64 /* Generic ACPI Header, provided by (almost) all tables */
66 typedef struct acpi_table_header /* ACPI common table header */
68 char signature [4]; /* ACPI signature (4 ASCII characters) */\
69 u32 length; /* Length of table, in bytes, including header */\
70 u8 revision; /* ACPI Specification minor version # */\
71 u8 checksum; /* To make sum of entire table == 0 */\
72 char oem_id [6]; /* OEM identification */\
73 char oem_table_id [8]; /* OEM table identification */\
74 u32 oem_revision; /* OEM revision number */\
75 char asl_compiler_id [4]; /* ASL compiler vendor ID */\
76 u32 asl_compiler_revision; /* ASL compiler revision number */
77 } __attribute__ ((packed)) acpi_header_t;
80 typedef struct acpi_rsdt {
81 struct acpi_table_header header;
83 } __attribute__ ((packed)) acpi_rsdt_t;
86 typedef struct acpi_xsdt {
87 struct acpi_table_header header;
89 } __attribute__ ((packed)) acpi_xsdt_t;
94 typedef struct acpi_hpet {
95 struct acpi_table_header header;
97 struct acpi_gen_regaddr addr;
101 } __attribute__ ((packed)) acpi_hpet_t;
103 typedef struct acpi_madt {
104 struct acpi_table_header header;
107 } __attribute__ ((packed)) acpi_madt_t;
109 enum acpi_apic_types {
112 IRQSourceOverride = 2,
115 LApicAddressOverride = 5,
118 PlatformIRQSources = 8
121 typedef struct acpi_madt_lapic {
127 } __attribute__ ((packed)) acpi_madt_lapic_t;
129 typedef struct acpi_madt_lapic_nmi {
135 } __attribute__ ((packed)) acpi_madt_lapic_nmi_t;
138 typedef struct acpi_madt_ioapic {
145 } __attribute__ ((packed)) acpi_madt_ioapic_t;
147 typedef struct acpi_madt_irqoverride {
154 } __attribute__ ((packed)) acpi_madt_irqoverride_t;
157 typedef struct acpi_fadt {
158 struct acpi_table_header header;
162 u8 preferred_pm_profile;
197 struct acpi_gen_regaddr reset_reg;
202 u32 x_firmware_ctl_l;
203 u32 x_firmware_ctl_h;
206 struct acpi_gen_regaddr x_pm1a_evt_blk;
207 struct acpi_gen_regaddr x_pm1b_evt_blk;
208 struct acpi_gen_regaddr x_pm1a_cnt_blk;
209 struct acpi_gen_regaddr x_pm1b_cnt_blk;
210 struct acpi_gen_regaddr x_pm2_cnt_blk;
211 struct acpi_gen_regaddr x_pm_tmr_blk;
212 struct acpi_gen_regaddr x_gpe0_blk;
213 struct acpi_gen_regaddr x_gpe1_blk;
214 } __attribute__ ((packed)) acpi_fadt_t;
216 typedef struct acpi_facs {
219 u32 hardware_signature;
220 u32 firmware_waking_vector;
223 u32 x_firmware_waking_vector_l;
224 u32 x_firmware_waking_vector_h;
227 } __attribute__ ((packed)) acpi_facs_t;
229 /* These are implemented by the target port */
230 unsigned long write_acpi_tables(unsigned long addr);
231 unsigned long acpi_dump_apics(unsigned long current);
234 /* These can be used by the target port */
235 u8 acpi_checksum(u8 *table, u32 length);
236 void acpi_add_table(acpi_rsdt_t *rsdt, void *table);
237 int acpi_create_madt_lapic(acpi_madt_lapic_t *lapic, u8 cpu, u8 apic);
238 int acpi_create_madt_ioapic(acpi_madt_ioapic_t *ioapic, u8 id, u32 addr,u32 gsi_base);
239 void acpi_create_madt(acpi_madt_t *madt);
240 void acpi_create_hpet(acpi_hpet_t *hpet);
241 void acpi_create_facs(acpi_facs_t *facs);
242 void acpi_write_rsdt(acpi_rsdt_t *rsdt);
243 void acpi_write_rsdp(acpi_rsdp_t *rsdp, acpi_rsdt_t *rsdt);
245 #define ACPI_WRITE_MADT_IOAPIC(dev,id) \
247 struct resource *res; \
248 res = find_resource(dev, PCI_BASE_ADDRESS_0); \
250 current += acpi_create_madt_ioapic( \
251 (acpi_madt_ioapic_t *)current, \
252 id, res->base, gsi_base); \
256 #define IO_APIC_ADDR 0xfec00000UL
258 #else // HAVE_ACPI_TABLES
260 #define write_acpi_tables(start) (start)