epia-m support
[coreboot.git] / src / arch / i386 / include / arch / acpi.h
1 /*
2  * Initial LinuxBIOS ACPI Support - headers and defines.
3  * 
4  * written by Stefan Reinauer <stepan@openbios.org>
5  * (C) 2004 SUSE LINUX AG
6  *
7  * The ACPI table structs are based on the Linux kernel sources.
8  * 
9  */
10 /* ACPI FADT & FACS added by Nick Barker <nick.barker9@btinternet.com>
11  * those parts (C) 2004 Nick Barker
12  */
13
14
15 #ifndef __ASM_ACPI_H
16 #define __ASM_ACPI_H
17
18 #if HAVE_ACPI_TABLES==1
19
20 typedef unsigned char u8;
21 typedef unsigned short u16;
22 typedef unsigned int u32;
23 typedef unsigned long long u64;
24
25 #define RSDP_NAME               "RSDP"
26 #define RSDP_SIG                "RSD PTR "  /* RSDT Pointer signature */
27
28 /* ACPI 2.0 table RSDP */
29
30 typedef struct acpi_rsdp {
31         char  signature[8];
32         u8    checksum;
33         char  oem_id[6];
34         u8    revision;
35         u32   rsdt_address;
36         u32   length;
37         u64   xsdt_address;
38         u8    ext_checksum;
39         u8    reserved[3];
40 } __attribute__((packed)) acpi_rsdp_t;
41
42 /* Generic Address Container */
43
44 typedef struct acpi_gen_regaddr {
45         u8  space_id;
46         u8  bit_width;
47         u8  bit_offset;
48         u8  resv;
49         u32 addrl;
50         u32 addrh;
51 } __attribute__ ((packed)) acpi_addr_t;
52
53 /* Generic ACPI Header, provided by (almost) all tables */
54
55 typedef struct acpi_table_header         /* ACPI common table header */
56 {
57         char signature [4];          /* ACPI signature (4 ASCII characters) */\
58         u32  length;                 /* Length of table, in bytes, including header */\
59         u8   revision;               /* ACPI Specification minor version # */\
60         u8   checksum;               /* To make sum of entire table == 0 */\
61         char oem_id [6];             /* OEM identification */\
62         char oem_table_id [8];       /* OEM table identification */\
63         u32  oem_revision;           /* OEM revision number */\
64         char asl_compiler_id [4];    /* ASL compiler vendor ID */\
65         u32  asl_compiler_revision;  /* ASL compiler revision number */
66 } __attribute__ ((packed)) acpi_header_t;
67
68 /* RSDT */
69
70 typedef struct acpi_rsdt {
71         struct acpi_table_header header;
72         u32 entry[8];
73 } __attribute__ ((packed)) acpi_rsdt_t;
74
75 /* HPET TIMERS */
76
77 typedef struct acpi_hpet {
78         struct acpi_table_header header;
79         u32 id;
80         struct acpi_gen_regaddr addr;
81         u8 number;
82         u16 min_tick;
83         u8 attributes;
84 } __attribute__ ((packed)) acpi_hpet_t;
85
86 typedef struct acpi_madt {
87         struct acpi_table_header header;
88         u32 lapic_addr;
89         u32 flags;
90 } __attribute__ ((packed)) acpi_madt_t;
91
92 enum acpi_apic_types {
93         LocalApic               = 0,
94         IOApic                  = 1,
95         IRQSourceOverride       = 2,
96         NMI                     = 3,
97         LocalApicNMI            = 4,
98         LApicAddressOverride    = 5,
99         IOSApic                 = 6,
100         LocalSApic              = 7,
101         PlatformIRQSources      = 8
102 };
103
104 typedef struct acpi_madt_lapic {
105         u8 type;
106         u8 length;
107         u8 processor_id;
108         u8 apic_id;
109         u32 flags;
110 } __attribute__ ((packed)) acpi_madt_lapic_t;
111
112 typedef struct acpi_madt_lapic_nmi {
113         u8 type;
114         u8 length;
115         u8 processor_id;
116         u16 flags;
117         u8 lint;
118 } __attribute__ ((packed)) acpi_madt_lapic_nmi_t;
119
120
121 typedef struct acpi_madt_ioapic {
122         u8 type;
123         u8 length;
124         u8 ioapic_id;
125         u8 reserved;
126         u32 ioapic_addr;
127         u32 gsi_base;
128 } __attribute__ ((packed)) acpi_madt_ioapic_t;
129
130 typedef struct acpi_madt_irqoverride {
131         u8 type;
132         u8 length;
133         u8 bus;
134         u8 source;
135         u32 gsirq;
136         u16 flags;
137 } __attribute__ ((packed)) acpi_madt_irqoverride_t;
138
139
140 typedef struct acpi_fadt {
141         struct acpi_table_header header;
142         u32 firmware_ctrl;
143         u32 dsdt;
144         u8 res1;
145         u8 preferred_pm_profile;
146         u16 sci_int;
147         u32 smi_cmd;
148         u8 acpi_enable;
149         u8 acpi_disable;
150         u8 s4bios_req;
151         u8 pstate_cnt;
152         u32 pm1a_evt_blk;
153         u32 pm1b_evt_blk;
154         u32 pm1a_cnt_blk;
155         u32 pm1b_cnt_blk;
156         u32 pm2_cnt_blk;
157         u32 pm_tmr_blk;
158         u32 gpe0_blk;
159         u32 gpe1_blk;
160         u8 pm1_evt_len;
161         u8 pm1_cnt_len;
162         u8 pm2_cnt_len;
163         u8 pm_tmr_len;
164         u8 gpe0_blk_len;
165         u8 gpe1_blk_len;
166         u8 gpe1_base;
167         u8 cst_cnt;
168         u16 p_lvl2_lat;
169         u16 p_lvl3_lat;
170         u16 flush_size;
171         u16 flush_stride;
172         u8 duty_offset;
173         u8 duty_width;
174         u8 day_alrm;
175         u8 mon_alrm;
176         u8 century;
177         u16 iapc_boot_arch;
178         u8 res2;
179         u32 flags;
180         struct acpi_gen_regaddr reset_reg;
181         u8 reset_value;
182         u8 res3;
183         u8 res4;
184         u8 res5;
185         u32 x_firmware_ctl_l;
186         u32 x_firmware_ctl_h;
187         u32 x_dsdt_l;
188         u32 x_dsdt_h;
189         struct acpi_gen_regaddr x_pm1a_evt_blk;
190         struct acpi_gen_regaddr x_pm1b_evt_blk;
191         struct acpi_gen_regaddr x_pm1a_cnt_blk;
192         struct acpi_gen_regaddr x_pm1b_cnt_blk;
193         struct acpi_gen_regaddr x_pm2_cnt_blk;
194         struct acpi_gen_regaddr x_pm_tmr_blk;
195         struct acpi_gen_regaddr x_gpe0_blk;
196         struct acpi_gen_regaddr x_gpe1_blk;
197 } __attribute__ ((packed)) acpi_fadt_t;
198
199 typedef struct acpi_facs {
200         char signature[4];
201         u32 length;
202         u32 hardware_signature;
203         u32 firmware_waking_vector;
204         u32 global_lock;
205         u32 flags;
206         u32 x_firmware_waking_vector_l;
207         u32 x_firmware_waking_vector_h;
208         u8 version;
209         u8 resv[33];
210 } __attribute__ ((packed)) acpi_facs_t;
211
212
213 unsigned long write_acpi_tables(unsigned long addr);
214
215 #else // HAVE_ACPI_TABLES
216
217 #define write_acpi_tables(start) (start)
218
219 #endif
220
221 #endif