diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/acpi.h |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'include/linux/acpi.h')
-rw-r--r-- | include/linux/acpi.h | 536 |
1 files changed, 536 insertions, 0 deletions
diff --git a/include/linux/acpi.h b/include/linux/acpi.h new file mode 100644 index 000000000000..aefe6d051ace --- /dev/null +++ b/include/linux/acpi.h | |||
@@ -0,0 +1,536 @@ | |||
1 | /* | ||
2 | * acpi.h - ACPI Interface | ||
3 | * | ||
4 | * Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com> | ||
5 | * | ||
6 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | * | ||
22 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
23 | */ | ||
24 | |||
25 | #ifndef _LINUX_ACPI_H | ||
26 | #define _LINUX_ACPI_H | ||
27 | |||
28 | #ifndef _LINUX | ||
29 | #define _LINUX | ||
30 | #endif | ||
31 | |||
32 | #include <linux/list.h> | ||
33 | |||
34 | #include <acpi/acpi.h> | ||
35 | #include <acpi/acpi_bus.h> | ||
36 | #include <acpi/acpi_drivers.h> | ||
37 | #include <asm/acpi.h> | ||
38 | |||
39 | |||
40 | #ifdef CONFIG_ACPI_BOOT | ||
41 | |||
42 | enum acpi_irq_model_id { | ||
43 | ACPI_IRQ_MODEL_PIC = 0, | ||
44 | ACPI_IRQ_MODEL_IOAPIC, | ||
45 | ACPI_IRQ_MODEL_IOSAPIC, | ||
46 | ACPI_IRQ_MODEL_COUNT | ||
47 | }; | ||
48 | |||
49 | extern enum acpi_irq_model_id acpi_irq_model; | ||
50 | |||
51 | |||
52 | /* Root System Description Pointer (RSDP) */ | ||
53 | |||
54 | struct acpi_table_rsdp { | ||
55 | char signature[8]; | ||
56 | u8 checksum; | ||
57 | char oem_id[6]; | ||
58 | u8 revision; | ||
59 | u32 rsdt_address; | ||
60 | } __attribute__ ((packed)); | ||
61 | |||
62 | struct acpi20_table_rsdp { | ||
63 | char signature[8]; | ||
64 | u8 checksum; | ||
65 | char oem_id[6]; | ||
66 | u8 revision; | ||
67 | u32 rsdt_address; | ||
68 | u32 length; | ||
69 | u64 xsdt_address; | ||
70 | u8 ext_checksum; | ||
71 | u8 reserved[3]; | ||
72 | } __attribute__ ((packed)); | ||
73 | |||
74 | typedef struct { | ||
75 | u8 type; | ||
76 | u8 length; | ||
77 | } __attribute__ ((packed)) acpi_table_entry_header; | ||
78 | |||
79 | /* Root System Description Table (RSDT) */ | ||
80 | |||
81 | struct acpi_table_rsdt { | ||
82 | struct acpi_table_header header; | ||
83 | u32 entry[8]; | ||
84 | } __attribute__ ((packed)); | ||
85 | |||
86 | /* Extended System Description Table (XSDT) */ | ||
87 | |||
88 | struct acpi_table_xsdt { | ||
89 | struct acpi_table_header header; | ||
90 | u64 entry[1]; | ||
91 | } __attribute__ ((packed)); | ||
92 | |||
93 | /* Fixed ACPI Description Table (FADT) */ | ||
94 | |||
95 | struct acpi_table_fadt { | ||
96 | struct acpi_table_header header; | ||
97 | u32 facs_addr; | ||
98 | u32 dsdt_addr; | ||
99 | /* ... */ | ||
100 | } __attribute__ ((packed)); | ||
101 | |||
102 | /* Multiple APIC Description Table (MADT) */ | ||
103 | |||
104 | struct acpi_table_madt { | ||
105 | struct acpi_table_header header; | ||
106 | u32 lapic_address; | ||
107 | struct { | ||
108 | u32 pcat_compat:1; | ||
109 | u32 reserved:31; | ||
110 | } flags; | ||
111 | } __attribute__ ((packed)); | ||
112 | |||
113 | enum acpi_madt_entry_id { | ||
114 | ACPI_MADT_LAPIC = 0, | ||
115 | ACPI_MADT_IOAPIC, | ||
116 | ACPI_MADT_INT_SRC_OVR, | ||
117 | ACPI_MADT_NMI_SRC, | ||
118 | ACPI_MADT_LAPIC_NMI, | ||
119 | ACPI_MADT_LAPIC_ADDR_OVR, | ||
120 | ACPI_MADT_IOSAPIC, | ||
121 | ACPI_MADT_LSAPIC, | ||
122 | ACPI_MADT_PLAT_INT_SRC, | ||
123 | ACPI_MADT_ENTRY_COUNT | ||
124 | }; | ||
125 | |||
126 | typedef struct { | ||
127 | u16 polarity:2; | ||
128 | u16 trigger:2; | ||
129 | u16 reserved:12; | ||
130 | } __attribute__ ((packed)) acpi_interrupt_flags; | ||
131 | |||
132 | struct acpi_table_lapic { | ||
133 | acpi_table_entry_header header; | ||
134 | u8 acpi_id; | ||
135 | u8 id; | ||
136 | struct { | ||
137 | u32 enabled:1; | ||
138 | u32 reserved:31; | ||
139 | } flags; | ||
140 | } __attribute__ ((packed)); | ||
141 | |||
142 | struct acpi_table_ioapic { | ||
143 | acpi_table_entry_header header; | ||
144 | u8 id; | ||
145 | u8 reserved; | ||
146 | u32 address; | ||
147 | u32 global_irq_base; | ||
148 | } __attribute__ ((packed)); | ||
149 | |||
150 | struct acpi_table_int_src_ovr { | ||
151 | acpi_table_entry_header header; | ||
152 | u8 bus; | ||
153 | u8 bus_irq; | ||
154 | u32 global_irq; | ||
155 | acpi_interrupt_flags flags; | ||
156 | } __attribute__ ((packed)); | ||
157 | |||
158 | struct acpi_table_nmi_src { | ||
159 | acpi_table_entry_header header; | ||
160 | acpi_interrupt_flags flags; | ||
161 | u32 global_irq; | ||
162 | } __attribute__ ((packed)); | ||
163 | |||
164 | struct acpi_table_lapic_nmi { | ||
165 | acpi_table_entry_header header; | ||
166 | u8 acpi_id; | ||
167 | acpi_interrupt_flags flags; | ||
168 | u8 lint; | ||
169 | } __attribute__ ((packed)); | ||
170 | |||
171 | struct acpi_table_lapic_addr_ovr { | ||
172 | acpi_table_entry_header header; | ||
173 | u8 reserved[2]; | ||
174 | u64 address; | ||
175 | } __attribute__ ((packed)); | ||
176 | |||
177 | struct acpi_table_iosapic { | ||
178 | acpi_table_entry_header header; | ||
179 | u8 id; | ||
180 | u8 reserved; | ||
181 | u32 global_irq_base; | ||
182 | u64 address; | ||
183 | } __attribute__ ((packed)); | ||
184 | |||
185 | struct acpi_table_lsapic { | ||
186 | acpi_table_entry_header header; | ||
187 | u8 acpi_id; | ||
188 | u8 id; | ||
189 | u8 eid; | ||
190 | u8 reserved[3]; | ||
191 | struct { | ||
192 | u32 enabled:1; | ||
193 | u32 reserved:31; | ||
194 | } flags; | ||
195 | } __attribute__ ((packed)); | ||
196 | |||
197 | struct acpi_table_plat_int_src { | ||
198 | acpi_table_entry_header header; | ||
199 | acpi_interrupt_flags flags; | ||
200 | u8 type; /* See acpi_interrupt_type */ | ||
201 | u8 id; | ||
202 | u8 eid; | ||
203 | u8 iosapic_vector; | ||
204 | u32 global_irq; | ||
205 | u32 reserved; | ||
206 | } __attribute__ ((packed)); | ||
207 | |||
208 | enum acpi_interrupt_id { | ||
209 | ACPI_INTERRUPT_PMI = 1, | ||
210 | ACPI_INTERRUPT_INIT, | ||
211 | ACPI_INTERRUPT_CPEI, | ||
212 | ACPI_INTERRUPT_COUNT | ||
213 | }; | ||
214 | |||
215 | #define ACPI_SPACE_MEM 0 | ||
216 | |||
217 | struct acpi_gen_regaddr { | ||
218 | u8 space_id; | ||
219 | u8 bit_width; | ||
220 | u8 bit_offset; | ||
221 | u8 resv; | ||
222 | u32 addrl; | ||
223 | u32 addrh; | ||
224 | } __attribute__ ((packed)); | ||
225 | |||
226 | struct acpi_table_hpet { | ||
227 | struct acpi_table_header header; | ||
228 | u32 id; | ||
229 | struct acpi_gen_regaddr addr; | ||
230 | u8 number; | ||
231 | u16 min_tick; | ||
232 | u8 page_protect; | ||
233 | } __attribute__ ((packed)); | ||
234 | |||
235 | /* | ||
236 | * Simple Boot Flags | ||
237 | * http://www.microsoft.com/whdc/hwdev/resources/specs/simp_bios.mspx | ||
238 | */ | ||
239 | struct acpi_table_sbf | ||
240 | { | ||
241 | u8 sbf_signature[4]; | ||
242 | u32 sbf_len; | ||
243 | u8 sbf_revision; | ||
244 | u8 sbf_csum; | ||
245 | u8 sbf_oemid[6]; | ||
246 | u8 sbf_oemtable[8]; | ||
247 | u8 sbf_revdata[4]; | ||
248 | u8 sbf_creator[4]; | ||
249 | u8 sbf_crearev[4]; | ||
250 | u8 sbf_cmos; | ||
251 | u8 sbf_spare[3]; | ||
252 | } __attribute__ ((packed)); | ||
253 | |||
254 | /* | ||
255 | * System Resource Affinity Table (SRAT) | ||
256 | * http://www.microsoft.com/whdc/hwdev/platform/proc/SRAT.mspx | ||
257 | */ | ||
258 | |||
259 | struct acpi_table_srat { | ||
260 | struct acpi_table_header header; | ||
261 | u32 table_revision; | ||
262 | u64 reserved; | ||
263 | } __attribute__ ((packed)); | ||
264 | |||
265 | enum acpi_srat_entry_id { | ||
266 | ACPI_SRAT_PROCESSOR_AFFINITY = 0, | ||
267 | ACPI_SRAT_MEMORY_AFFINITY, | ||
268 | ACPI_SRAT_ENTRY_COUNT | ||
269 | }; | ||
270 | |||
271 | struct acpi_table_processor_affinity { | ||
272 | acpi_table_entry_header header; | ||
273 | u8 proximity_domain; | ||
274 | u8 apic_id; | ||
275 | struct { | ||
276 | u32 enabled:1; | ||
277 | u32 reserved:31; | ||
278 | } flags; | ||
279 | u8 lsapic_eid; | ||
280 | u8 reserved[7]; | ||
281 | } __attribute__ ((packed)); | ||
282 | |||
283 | struct acpi_table_memory_affinity { | ||
284 | acpi_table_entry_header header; | ||
285 | u8 proximity_domain; | ||
286 | u8 reserved1[5]; | ||
287 | u32 base_addr_lo; | ||
288 | u32 base_addr_hi; | ||
289 | u32 length_lo; | ||
290 | u32 length_hi; | ||
291 | u32 memory_type; /* See acpi_address_range_id */ | ||
292 | struct { | ||
293 | u32 enabled:1; | ||
294 | u32 hot_pluggable:1; | ||
295 | u32 reserved:30; | ||
296 | } flags; | ||
297 | u64 reserved2; | ||
298 | } __attribute__ ((packed)); | ||
299 | |||
300 | enum acpi_address_range_id { | ||
301 | ACPI_ADDRESS_RANGE_MEMORY = 1, | ||
302 | ACPI_ADDRESS_RANGE_RESERVED = 2, | ||
303 | ACPI_ADDRESS_RANGE_ACPI = 3, | ||
304 | ACPI_ADDRESS_RANGE_NVS = 4, | ||
305 | ACPI_ADDRESS_RANGE_COUNT | ||
306 | }; | ||
307 | |||
308 | /* | ||
309 | * System Locality Information Table (SLIT) | ||
310 | * see http://devresource.hp.com/devresource/docs/techpapers/ia64/slit.pdf | ||
311 | */ | ||
312 | |||
313 | struct acpi_table_slit { | ||
314 | struct acpi_table_header header; | ||
315 | u64 localities; | ||
316 | u8 entry[1]; /* real size = localities^2 */ | ||
317 | } __attribute__ ((packed)); | ||
318 | |||
319 | /* Smart Battery Description Table (SBST) */ | ||
320 | |||
321 | struct acpi_table_sbst { | ||
322 | struct acpi_table_header header; | ||
323 | u32 warning; /* Warn user */ | ||
324 | u32 low; /* Critical sleep */ | ||
325 | u32 critical; /* Critical shutdown */ | ||
326 | } __attribute__ ((packed)); | ||
327 | |||
328 | /* Embedded Controller Boot Resources Table (ECDT) */ | ||
329 | |||
330 | struct acpi_table_ecdt { | ||
331 | struct acpi_table_header header; | ||
332 | struct acpi_generic_address ec_control; | ||
333 | struct acpi_generic_address ec_data; | ||
334 | u32 uid; | ||
335 | u8 gpe_bit; | ||
336 | char ec_id[0]; | ||
337 | } __attribute__ ((packed)); | ||
338 | |||
339 | /* PCI MMCONFIG */ | ||
340 | |||
341 | struct acpi_table_mcfg { | ||
342 | struct acpi_table_header header; | ||
343 | u8 reserved[8]; | ||
344 | u32 base_address; | ||
345 | u32 base_reserved; | ||
346 | } __attribute__ ((packed)); | ||
347 | |||
348 | /* Table Handlers */ | ||
349 | |||
350 | enum acpi_table_id { | ||
351 | ACPI_TABLE_UNKNOWN = 0, | ||
352 | ACPI_APIC, | ||
353 | ACPI_BOOT, | ||
354 | ACPI_DBGP, | ||
355 | ACPI_DSDT, | ||
356 | ACPI_ECDT, | ||
357 | ACPI_ETDT, | ||
358 | ACPI_FADT, | ||
359 | ACPI_FACS, | ||
360 | ACPI_OEMX, | ||
361 | ACPI_PSDT, | ||
362 | ACPI_SBST, | ||
363 | ACPI_SLIT, | ||
364 | ACPI_SPCR, | ||
365 | ACPI_SRAT, | ||
366 | ACPI_SSDT, | ||
367 | ACPI_SPMI, | ||
368 | ACPI_HPET, | ||
369 | ACPI_MCFG, | ||
370 | ACPI_TABLE_COUNT | ||
371 | }; | ||
372 | |||
373 | typedef int (*acpi_table_handler) (unsigned long phys_addr, unsigned long size); | ||
374 | |||
375 | extern acpi_table_handler acpi_table_ops[ACPI_TABLE_COUNT]; | ||
376 | |||
377 | typedef int (*acpi_madt_entry_handler) (acpi_table_entry_header *header, const unsigned long end); | ||
378 | |||
379 | char * __acpi_map_table (unsigned long phys_addr, unsigned long size); | ||
380 | unsigned long acpi_find_rsdp (void); | ||
381 | int acpi_boot_init (void); | ||
382 | int acpi_boot_table_init (void); | ||
383 | int acpi_numa_init (void); | ||
384 | |||
385 | int acpi_table_init (void); | ||
386 | int acpi_table_parse (enum acpi_table_id id, acpi_table_handler handler); | ||
387 | int acpi_get_table_header_early (enum acpi_table_id id, struct acpi_table_header **header); | ||
388 | int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries); | ||
389 | int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries); | ||
390 | void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr); | ||
391 | void acpi_table_print_madt_entry (acpi_table_entry_header *madt); | ||
392 | void acpi_table_print_srat_entry (acpi_table_entry_header *srat); | ||
393 | |||
394 | /* the following four functions are architecture-dependent */ | ||
395 | void acpi_numa_slit_init (struct acpi_table_slit *slit); | ||
396 | void acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa); | ||
397 | void acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma); | ||
398 | void acpi_numa_arch_fixup(void); | ||
399 | |||
400 | #ifdef CONFIG_ACPI_HOTPLUG_CPU | ||
401 | /* Arch dependent functions for cpu hotplug support */ | ||
402 | int acpi_map_lsapic(acpi_handle handle, int *pcpu); | ||
403 | int acpi_unmap_lsapic(int cpu); | ||
404 | #endif /* CONFIG_ACPI_HOTPLUG_CPU */ | ||
405 | |||
406 | extern int acpi_mp_config; | ||
407 | |||
408 | extern u32 pci_mmcfg_base_addr; | ||
409 | |||
410 | extern int sbf_port ; | ||
411 | |||
412 | #else /*!CONFIG_ACPI_BOOT*/ | ||
413 | |||
414 | #define acpi_mp_config 0 | ||
415 | |||
416 | static inline int acpi_boot_init(void) | ||
417 | { | ||
418 | return 0; | ||
419 | } | ||
420 | |||
421 | static inline int acpi_boot_table_init(void) | ||
422 | { | ||
423 | return 0; | ||
424 | } | ||
425 | |||
426 | #endif /*!CONFIG_ACPI_BOOT*/ | ||
427 | |||
428 | unsigned int acpi_register_gsi (u32 gsi, int edge_level, int active_high_low); | ||
429 | int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); | ||
430 | |||
431 | /* | ||
432 | * This function undoes the effect of one call to acpi_register_gsi(). | ||
433 | * If this matches the last registration, any IRQ resources for gsi | ||
434 | * are freed. | ||
435 | */ | ||
436 | #ifdef CONFIG_ACPI_DEALLOCATE_IRQ | ||
437 | void acpi_unregister_gsi (u32 gsi); | ||
438 | #endif | ||
439 | |||
440 | #ifdef CONFIG_ACPI_PCI | ||
441 | |||
442 | struct acpi_prt_entry { | ||
443 | struct list_head node; | ||
444 | struct acpi_pci_id id; | ||
445 | u8 pin; | ||
446 | struct { | ||
447 | acpi_handle handle; | ||
448 | u32 index; | ||
449 | } link; | ||
450 | u32 irq; | ||
451 | }; | ||
452 | |||
453 | struct acpi_prt_list { | ||
454 | int count; | ||
455 | struct list_head entries; | ||
456 | }; | ||
457 | |||
458 | struct pci_dev; | ||
459 | |||
460 | int acpi_pci_irq_enable (struct pci_dev *dev); | ||
461 | void acpi_penalize_isa_irq(int irq); | ||
462 | |||
463 | #ifdef CONFIG_ACPI_DEALLOCATE_IRQ | ||
464 | void acpi_pci_irq_disable (struct pci_dev *dev); | ||
465 | #endif | ||
466 | |||
467 | struct acpi_pci_driver { | ||
468 | struct acpi_pci_driver *next; | ||
469 | int (*add)(acpi_handle handle); | ||
470 | void (*remove)(acpi_handle handle); | ||
471 | }; | ||
472 | |||
473 | int acpi_pci_register_driver(struct acpi_pci_driver *driver); | ||
474 | void acpi_pci_unregister_driver(struct acpi_pci_driver *driver); | ||
475 | |||
476 | #endif /*CONFIG_ACPI_PCI*/ | ||
477 | |||
478 | #ifdef CONFIG_ACPI_EC | ||
479 | |||
480 | extern int ec_read(u8 addr, u8 *val); | ||
481 | extern int ec_write(u8 addr, u8 val); | ||
482 | |||
483 | #endif /*CONFIG_ACPI_EC*/ | ||
484 | |||
485 | #ifdef CONFIG_ACPI_INTERPRETER | ||
486 | |||
487 | extern int acpi_blacklisted(void); | ||
488 | extern void acpi_bios_year(char *s); | ||
489 | |||
490 | #else /*!CONFIG_ACPI_INTERPRETER*/ | ||
491 | |||
492 | static inline int acpi_blacklisted(void) | ||
493 | { | ||
494 | return 0; | ||
495 | } | ||
496 | |||
497 | #endif /*!CONFIG_ACPI_INTERPRETER*/ | ||
498 | |||
499 | #define ACPI_CSTATE_LIMIT_DEFINED /* for driver builds */ | ||
500 | #ifdef CONFIG_ACPI | ||
501 | |||
502 | /* | ||
503 | * Set highest legal C-state | ||
504 | * 0: C0 okay, but not C1 | ||
505 | * 1: C1 okay, but not C2 | ||
506 | * 2: C2 okay, but not C3 etc. | ||
507 | */ | ||
508 | |||
509 | extern unsigned int max_cstate; | ||
510 | |||
511 | static inline unsigned int acpi_get_cstate_limit(void) | ||
512 | { | ||
513 | return max_cstate; | ||
514 | } | ||
515 | static inline void acpi_set_cstate_limit(unsigned int new_limit) | ||
516 | { | ||
517 | max_cstate = new_limit; | ||
518 | return; | ||
519 | } | ||
520 | #else | ||
521 | static inline unsigned int acpi_get_cstate_limit(void) { return 0; } | ||
522 | static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; } | ||
523 | #endif | ||
524 | |||
525 | #ifdef CONFIG_ACPI_NUMA | ||
526 | int acpi_get_pxm(acpi_handle handle); | ||
527 | #else | ||
528 | static inline int acpi_get_pxm(acpi_handle handle) | ||
529 | { | ||
530 | return 0; | ||
531 | } | ||
532 | #endif | ||
533 | |||
534 | extern int pnpacpi_disabled; | ||
535 | |||
536 | #endif /*_LINUX_ACPI_H*/ | ||