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;
93 typedef struct acpi_hpet {
94 struct acpi_table_header header;
96 struct acpi_gen_regaddr addr;
100 } __attribute__ ((packed)) acpi_hpet_t;
102 typedef struct acpi_madt {
103 struct acpi_table_header header;
106 } __attribute__ ((packed)) acpi_madt_t;
108 enum acpi_apic_types {
111 IRQSourceOverride = 2,
114 LApicAddressOverride = 5,
117 PlatformIRQSources = 8
120 typedef struct acpi_madt_lapic {
126 } __attribute__ ((packed)) acpi_madt_lapic_t;
128 typedef struct acpi_madt_lapic_nmi {
134 } __attribute__ ((packed)) acpi_madt_lapic_nmi_t;
137 typedef struct acpi_madt_ioapic {
144 } __attribute__ ((packed)) acpi_madt_ioapic_t;
146 typedef struct acpi_madt_irqoverride {
153 } __attribute__ ((packed)) acpi_madt_irqoverride_t;
156 typedef struct acpi_fadt {
157 struct acpi_table_header header;
161 u8 preferred_pm_profile;
196 struct acpi_gen_regaddr reset_reg;
201 u32 x_firmware_ctl_l;
202 u32 x_firmware_ctl_h;
205 struct acpi_gen_regaddr x_pm1a_evt_blk;
206 struct acpi_gen_regaddr x_pm1b_evt_blk;
207 struct acpi_gen_regaddr x_pm1a_cnt_blk;
208 struct acpi_gen_regaddr x_pm1b_cnt_blk;
209 struct acpi_gen_regaddr x_pm2_cnt_blk;
210 struct acpi_gen_regaddr x_pm_tmr_blk;
211 struct acpi_gen_regaddr x_gpe0_blk;
212 struct acpi_gen_regaddr x_gpe1_blk;
213 } __attribute__ ((packed)) acpi_fadt_t;
215 typedef struct acpi_facs {
218 u32 hardware_signature;
219 u32 firmware_waking_vector;
222 u32 x_firmware_waking_vector_l;
223 u32 x_firmware_waking_vector_h;
226 } __attribute__ ((packed)) acpi_facs_t;
228 /* These are implemented by the target port */
229 unsigned long write_acpi_tables(unsigned long addr);
230 unsigned long acpi_dump_apics(unsigned long current);
233 /* These can be used by the target port */
234 u8 acpi_checksum(u8 *table, u32 length);
235 void acpi_add_table(acpi_rsdt_t *rsdt, void *table);
236 int acpi_create_madt_lapic(acpi_madt_lapic_t *lapic, u8 cpu, u8 apic);
237 int acpi_create_madt_ioapic(acpi_madt_ioapic_t *ioapic, u8 id, u32 addr,u32 gsi_base);
238 void acpi_create_madt(acpi_madt_t *madt);
239 void acpi_create_hpet(acpi_hpet_t *hpet);
240 void acpi_create_facs(acpi_facs_t *facs);
241 void acpi_write_rsdt(acpi_rsdt_t *rsdt);
242 void acpi_write_rsdp(acpi_rsdp_t *rsdp, acpi_rsdt_t *rsdt);
244 #define ACPI_WRITE_MADT_IOAPIC(dev,id) \
246 struct resource *res; \
247 res = find_resource(dev, PCI_BASE_ADDRESS_0); \
249 current += acpi_create_madt_ioapic( \
250 (acpi_madt_ioapic_t *)current, \
251 id, res->base, gsi_base); \
255 #define IO_APIC_ADDR 0xfec00000UL
257 #else // HAVE_ACPI_TABLES
259 #define write_acpi_tables(start) (start)