make the linux-ppc packags be in synch with other platforms
[tangerine.git] / arch / x86_64-pc / kernel / acpi.h
blob6d5830afd32cc05d4e0fc6b867e1646c66f126b7
1 /*
2 Copyright © 1995-2008, The AROS Development Team. All rights reserved.
3 $Id: acpi.h,v 1.1 2004/01/02 22:23:57 nicja Exp $
5 Desc: AROS ACPI Definitions.
6 Lang: english
7 */
8 #ifndef __AROS_ACPI_H__
9 #define __AROS_ACPI_H__
11 #ifndef EXEC_LISTS_H
12 # include <exec/lists.h>
13 #endif
14 #ifndef EXEC_SEMAPHORES
15 # include <exec/semaphores.h>
16 #endif
17 #ifndef UTILITY_HOOKS_H
18 # include <utility/hooks.h>
19 #endif
21 #ifndef ACPI_MAX_TABLES
22 #define ACPI_MAX_TABLES 32
23 #endif
25 struct KernelACPIData {
26 BOOL kb_APIC_Enabled;
27 int kb_APIC_IRQ_Model;
28 IPTR kb_APIC_Driver;
30 IPTR kb_ACPI_SDT_Phys;
31 int kb_ACPI_SDT_Count;
32 IPTR kb_ACPI_SDT_Entry[ACPI_MAX_TABLES];
33 /*..*/
34 int kb_ACPI_Disabled;
35 int kb_ACPI_IRQ;
37 int kb_ACPI_HT;
39 int kb_ACPI_LAPIC;
40 int kb_ACPI_IOAPIC;
42 BOOL kb_SMP_Enabled;
43 int kb_SMP_Config;
46 /* Table Handlers */
47 enum acpi_table_id {
48 ACPI_TABLE_UNKNOWN = 0,
49 ACPI_APIC,
50 ACPI_BOOT,
51 ACPI_DBGP,
52 ACPI_DSDT,
53 ACPI_ECDT,
54 ACPI_ETDT,
55 ACPI_FADT,
56 ACPI_FACS,
57 ACPI_OEMX,
58 ACPI_PSDT,
59 ACPI_SBST,
60 ACPI_SLIT,
61 ACPI_SPCR,
62 ACPI_SRAT,
63 ACPI_SSDT,
64 ACPI_SPMI,
65 ACPI_HPET,
66 ACPI_TABLE_COUNT
69 /* System Description Table (RSDT/XSDT) */
70 struct acpi_table_sdt
72 unsigned long pa;
73 enum acpi_table_id id;
74 unsigned long size;
77 struct acpi_table_hook
79 struct MinNode h_MinNode;
80 IPTR (*h_Entry)(); /* Main entry point */
81 IPTR (*h_SubEntry)(); /* Secondary entry point */
82 unsigned long phys_addr;
83 unsigned long size;
86 struct acpi_madt_entry_hook
88 struct MinNode h_MinNode;
89 IPTR (*h_Entry)(); /* Main entry point */
90 IPTR (*h_SubEntry)(); /* Secondary entry point */
91 struct acpi_table_entry_header *header;
94 /********** ACPI structure definitions ****************/
96 /* ACPI 2.0 Generic Address Structure (GAS) */
98 struct acpi_generic_address
100 unsigned char address_space_id; /* Address space where struct or register exists. */
101 unsigned char register_bit_width; /* Size in bits of given register */
102 unsigned char register_bit_offset; /* Bit offset within the register */
103 unsigned char reserved; /* Must be 0 */
104 UQUAD address; /* 64-bit address of struct or register */
107 /********** ACPI DEFINITIONS ****************/
109 #define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \
110 char signature [4]; /* ACPI signature (4 ASCII characters) */\
111 unsigned int length; /* Length of table, in bytes, including header */\
112 unsigned char revision; /* ACPI Specification minor version # */\
113 unsigned char checksum; /* To make sum of entire table == 0 */\
114 char oem_id [6]; /* OEM identification */\
115 char oem_table_id [8]; /* OEM table identification */\
116 unsigned int oem_revision; /* OEM revision number */\
117 char asl_compiler_id [4]; /* ASL compiler vendor ID */\
118 unsigned int asl_compiler_revision; /* ASL compiler revision number */
121 struct acpi_table_header /* ACPI common table header */
123 ACPI_TABLE_HEADER_DEF
126 /* Table Handlers */
128 enum acpi_irq_model_id
130 ACPI_IRQ_MODEL_PIC = 0,
131 ACPI_IRQ_MODEL_IOAPIC,
132 ACPI_IRQ_MODEL_IOSAPIC,
133 ACPI_IRQ_MODEL_COUNT
136 /* Root System Description Pointer "RSDP" structures */
138 struct acpi_table_rsdp
140 char signature[8];
141 unsigned char checksum;
142 char oem_id[6];
143 unsigned char revision;
144 unsigned int rsdt_address;
147 struct acpi20_table_rsdp
149 char signature[8];
150 unsigned char checksum;
151 char oem_id[6];
152 unsigned char revision;
153 unsigned int rsdt_address;
154 unsigned int length;
155 UQUAD xsdt_address;
156 unsigned char ext_checksum;
157 unsigned char reserved[3];
160 struct acpi_table_entry_header
162 unsigned char type;
163 unsigned char length;
166 /* Root System Description Table "RSDT" structures */
168 struct acpi_table_rsdt
170 struct acpi_table_header header;
171 unsigned int entry[8];
174 /* Extended System Description Table "XSDT" structures */
176 struct acpi_table_xsdt
178 struct acpi_table_header header;
179 UQUAD entry[1];
182 /* Fixed ACPI Description Table "FADT" structures */
184 struct acpi_table_fadt
186 struct acpi_table_header header;
187 unsigned int facs_addr;
188 unsigned int dsdt_addr;
189 /* ... */
192 /* Multiple APIC Description Table "MADT" structures */
194 struct acpi_table_madt
196 struct acpi_table_header header;
197 unsigned int lapic_address;
198 struct
200 unsigned int pcat_compat:1;
201 unsigned int reserved:31;
202 } flags;
205 enum acpi_madt_entry_id
207 ACPI_MADT_LAPIC = 0,
208 ACPI_MADT_IOAPIC,
209 ACPI_MADT_INT_SRC_OVR,
210 ACPI_MADT_NMI_SRC,
211 ACPI_MADT_LAPIC_NMI,
212 ACPI_MADT_LAPIC_ADDR_OVR,
213 ACPI_MADT_IOSAPIC,
214 ACPI_MADT_LSAPIC,
215 ACPI_MADT_PLAT_INT_SRC,
216 ACPI_MADT_ENTRY_COUNT
219 typedef struct
221 UWORD polarity:2;
222 UWORD trigger:2;
223 UWORD reserved:12;
224 } acpi_interrupt_flags;
226 struct acpi_table_lapic
228 struct acpi_table_entry_header header;
229 unsigned char acpi_id;
230 unsigned char id;
231 struct
233 unsigned int enabled:1;
234 unsigned int reserved:31;
235 } flags;
238 struct acpi_table_ioapic
240 struct acpi_table_entry_header header;
241 unsigned char id;
242 unsigned char reserved;
243 unsigned int address;
244 unsigned int global_irq_base;
247 struct acpi_table_int_src_ovr
249 struct acpi_table_entry_header header;
250 unsigned char bus;
251 unsigned char bus_irq;
252 unsigned int global_irq;
253 acpi_interrupt_flags flags;
256 struct acpi_table_nmi_src
258 struct acpi_table_entry_header header;
259 acpi_interrupt_flags flags;
260 unsigned int global_irq;
263 struct acpi_table_lapic_nmi
265 struct acpi_table_entry_header header;
266 unsigned char acpi_id;
267 acpi_interrupt_flags flags;
268 unsigned char lint;
271 struct acpi_table_lapic_addr_ovr
273 struct acpi_table_entry_header header;
274 unsigned char reserved[2];
275 UQUAD address;
278 struct acpi_table_iosapic
280 struct acpi_table_entry_header header;
281 unsigned char id;
282 unsigned char reserved;
283 unsigned int global_irq_base;
284 UQUAD address;
287 struct acpi_table_lsapic
289 struct acpi_table_entry_header header;
290 unsigned char acpi_id;
291 unsigned char id;
292 unsigned char eid;
293 unsigned char reserved[3];
294 struct {
295 unsigned int enabled:1;
296 unsigned int reserved:31;
297 } flags;
300 struct acpi_table_plat_int_src
302 struct acpi_table_entry_header header;
303 acpi_interrupt_flags flags;
304 unsigned char type; /* See acpi_interrupt_type */
305 unsigned char id;
306 unsigned char eid;
307 unsigned char iosapic_vector;
308 unsigned int global_irq;
309 unsigned int reserved;
312 enum acpi_interrupt_id
314 ACPI_INTERRUPT_PMI = 1,
315 ACPI_INTERRUPT_INIT,
316 ACPI_INTERRUPT_CPEI,
317 ACPI_INTERRUPT_COUNT
320 #define ACPI_SPACE_MEM 0
322 struct acpi_gen_regaddr
324 unsigned char space_id;
325 unsigned char bit_width;
326 unsigned char bit_offset;
327 unsigned char resv;
328 unsigned int addrl;
329 unsigned int addrh;
332 struct acpi_table_hpet
334 struct acpi_table_header header;
335 unsigned int id;
336 struct acpi_gen_regaddr addr;
337 unsigned char number;
338 UWORD min_tick;
339 unsigned char page_protect;
343 * System Resource Affinity Table (SRAT)
344 * see http://www.microsoft.com/hwdev/design/srat.htm
346 struct acpi_table_srat
348 struct acpi_table_header header;
349 unsigned int table_revision;
350 UQUAD reserved;
353 enum acpi_srat_entry_id
355 ACPI_SRAT_PROCESSOR_AFFINITY = 0,
356 ACPI_SRAT_MEMORY_AFFINITY,
357 ACPI_SRAT_ENTRY_COUNT
360 struct acpi_table_processor_affinity {
361 struct acpi_table_entry_header header;
362 unsigned char proximity_domain;
363 unsigned char apic_id;
364 struct
366 unsigned int enabled:1;
367 unsigned int reserved:31;
368 } flags;
369 unsigned char lsapic_eid;
370 unsigned char reserved[7];
373 struct acpi_table_memory_affinity {
374 struct acpi_table_entry_header header;
375 unsigned char proximity_domain;
376 unsigned char reserved1[5];
377 unsigned int base_addr_lo;
378 unsigned int base_addr_hi;
379 unsigned int length_lo;
380 unsigned int length_hi;
381 unsigned int memory_type; /* See acpi_address_range_id */
382 struct
384 unsigned int enabled:1;
385 unsigned int hot_pluggable:1;
386 unsigned int reserved:30;
387 } flags;
388 UQUAD reserved2;
391 enum acpi_address_range_id
393 ACPI_ADDRESS_RANGE_MEMORY = 1,
394 ACPI_ADDRESS_RANGE_RESERVED = 2,
395 ACPI_ADDRESS_RANGE_ACPI = 3,
396 ACPI_ADDRESS_RANGE_NVS = 4,
397 ACPI_ADDRESS_RANGE_COUNT
401 * System Locality Information Table (SLIT)
402 * see http://devresource.hp.com/devresource/docs/techpapers/ia64/slit.pdf
404 struct acpi_table_slit
406 struct acpi_table_header header;
407 UQUAD localities;
408 unsigned char entry[1]; /* real size = localities^2 */
411 /* Smart Battery Description Table (SBST) */
412 struct acpi_table_sbst
414 struct acpi_table_header header;
415 unsigned int warning; /* Warn user */
416 unsigned int low; /* Critical sleep */
417 unsigned int critical; /* Critical shutdown */
420 /* Embedded Controller Boot Resources Table (ECDT) */
421 struct acpi_table_ecdt
423 struct acpi_table_header header;
424 struct acpi_generic_address ec_control;
425 struct acpi_generic_address ec_data;
426 unsigned int uid;
427 unsigned char gpe_bit;
428 char ec_id[0];
431 /* ACPI Table Parser hook func protos */
433 AROS_UFP1(int, ACPI_hook_Table_MADT_Parse,
434 AROS_UFPA(struct acpi_table_hook *, table_hook, A0));
435 AROS_UFP1(int, ACPI_hook_Table_LAPIC_Parse,
436 AROS_UFPA(struct acpi_madt_entry_hook *, table_hook, A0));
437 AROS_UFP1(int, ACPI_hook_Table_LAPIC_Addr_Ovr_Parse,
438 AROS_UFPA(struct acpi_madt_entry_hook *, table_hook, A0));
439 AROS_UFP1(int, ACPI_hook_Table_LAPIC_NMI_Parse,
440 AROS_UFPA(struct acpi_madt_entry_hook *, table_hook, A0));
441 AROS_UFP1(int, ACPI_hook_Table_IOAPIC_Parse,
442 AROS_UFPA(struct acpi_madt_entry_hook *, table_hook, A0));
443 AROS_UFP1(int, ACPI_hook_Table_Int_Src_Ovr_Parse,
444 AROS_UFPA(struct acpi_madt_entry_hook *, table_hook, A0));
445 AROS_UFP1(int, ACPI_hook_Table_NMI_Src_Parse,
446 AROS_UFPA(struct acpi_madt_entry_hook *, table_hook, A0));
447 AROS_UFP1(int, ACPI_hook_Table_HPET_Parse,
448 AROS_UFPA(struct acpi_table_hook *, table_hook, A0));
450 #endif /* __AROS_ACPI_H__ */