2 * acpi.h - ACPI Interface
4 * Copyright (C) 2001 Paul Diefenbaugh <paul.s.diefenbaugh@intel.com>
6 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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.
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.
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
22 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28 #include <linux/config.h>
36 #include <linux/list.h>
38 #include <acpi/acpi.h>
39 #include <acpi/acpi_bus.h>
40 #include <acpi/acpi_drivers.h>
44 #ifdef CONFIG_ACPI_BOOT
46 enum acpi_irq_model_id
{
47 ACPI_IRQ_MODEL_PIC
= 0,
48 ACPI_IRQ_MODEL_IOAPIC
,
49 ACPI_IRQ_MODEL_IOSAPIC
,
53 extern enum acpi_irq_model_id acpi_irq_model
;
56 /* Root System Description Pointer (RSDP) */
58 struct acpi_table_rsdp
{
64 } __attribute__ ((packed
));
66 struct acpi20_table_rsdp
{
76 } __attribute__ ((packed
));
81 } __attribute__ ((packed
)) acpi_table_entry_header
;
83 /* Root System Description Table (RSDT) */
85 struct acpi_table_rsdt
{
86 struct acpi_table_header header
;
88 } __attribute__ ((packed
));
90 /* Extended System Description Table (XSDT) */
92 struct acpi_table_xsdt
{
93 struct acpi_table_header header
;
95 } __attribute__ ((packed
));
97 /* Fixed ACPI Description Table (FADT) */
99 struct acpi_table_fadt
{
100 struct acpi_table_header header
;
104 } __attribute__ ((packed
));
106 /* Multiple APIC Description Table (MADT) */
108 struct acpi_table_madt
{
109 struct acpi_table_header header
;
115 } __attribute__ ((packed
));
117 enum acpi_madt_entry_id
{
120 ACPI_MADT_INT_SRC_OVR
,
123 ACPI_MADT_LAPIC_ADDR_OVR
,
126 ACPI_MADT_PLAT_INT_SRC
,
127 ACPI_MADT_ENTRY_COUNT
134 } __attribute__ ((packed
)) acpi_interrupt_flags
;
136 struct acpi_table_lapic
{
137 acpi_table_entry_header header
;
144 } __attribute__ ((packed
));
146 struct acpi_table_ioapic
{
147 acpi_table_entry_header header
;
152 } __attribute__ ((packed
));
154 struct acpi_table_int_src_ovr
{
155 acpi_table_entry_header header
;
159 acpi_interrupt_flags flags
;
160 } __attribute__ ((packed
));
162 struct acpi_table_nmi_src
{
163 acpi_table_entry_header header
;
164 acpi_interrupt_flags flags
;
166 } __attribute__ ((packed
));
168 struct acpi_table_lapic_nmi
{
169 acpi_table_entry_header header
;
171 acpi_interrupt_flags flags
;
173 } __attribute__ ((packed
));
175 struct acpi_table_lapic_addr_ovr
{
176 acpi_table_entry_header header
;
179 } __attribute__ ((packed
));
181 struct acpi_table_iosapic
{
182 acpi_table_entry_header header
;
187 } __attribute__ ((packed
));
189 struct acpi_table_lsapic
{
190 acpi_table_entry_header header
;
199 } __attribute__ ((packed
));
201 struct acpi_table_plat_int_src
{
202 acpi_table_entry_header header
;
203 acpi_interrupt_flags flags
;
204 u8 type
; /* See acpi_interrupt_type */
210 } __attribute__ ((packed
));
212 enum acpi_interrupt_id
{
213 ACPI_INTERRUPT_PMI
= 1,
219 #define ACPI_SPACE_MEM 0
221 struct acpi_gen_regaddr
{
228 } __attribute__ ((packed
));
230 struct acpi_table_hpet
{
231 struct acpi_table_header header
;
233 struct acpi_gen_regaddr addr
;
237 } __attribute__ ((packed
));
241 * http://www.microsoft.com/whdc/hwdev/resources/specs/simp_bios.mspx
243 struct acpi_table_sbf
256 } __attribute__ ((packed
));
259 * System Resource Affinity Table (SRAT)
260 * http://www.microsoft.com/whdc/hwdev/platform/proc/SRAT.mspx
263 struct acpi_table_srat
{
264 struct acpi_table_header header
;
267 } __attribute__ ((packed
));
269 enum acpi_srat_entry_id
{
270 ACPI_SRAT_PROCESSOR_AFFINITY
= 0,
271 ACPI_SRAT_MEMORY_AFFINITY
,
272 ACPI_SRAT_ENTRY_COUNT
275 struct acpi_table_processor_affinity
{
276 acpi_table_entry_header header
;
285 } __attribute__ ((packed
));
287 struct acpi_table_memory_affinity
{
288 acpi_table_entry_header header
;
295 u32 memory_type
; /* See acpi_address_range_id */
302 } __attribute__ ((packed
));
304 enum acpi_address_range_id
{
305 ACPI_ADDRESS_RANGE_MEMORY
= 1,
306 ACPI_ADDRESS_RANGE_RESERVED
= 2,
307 ACPI_ADDRESS_RANGE_ACPI
= 3,
308 ACPI_ADDRESS_RANGE_NVS
= 4,
309 ACPI_ADDRESS_RANGE_COUNT
313 * System Locality Information Table (SLIT)
314 * see http://devresource.hp.com/devresource/docs/techpapers/ia64/slit.pdf
317 struct acpi_table_slit
{
318 struct acpi_table_header header
;
320 u8 entry
[1]; /* real size = localities^2 */
321 } __attribute__ ((packed
));
323 /* Smart Battery Description Table (SBST) */
325 struct acpi_table_sbst
{
326 struct acpi_table_header header
;
327 u32 warning
; /* Warn user */
328 u32 low
; /* Critical sleep */
329 u32 critical
; /* Critical shutdown */
330 } __attribute__ ((packed
));
332 /* Embedded Controller Boot Resources Table (ECDT) */
334 struct acpi_table_ecdt
{
335 struct acpi_table_header header
;
336 struct acpi_generic_address ec_control
;
337 struct acpi_generic_address ec_data
;
341 } __attribute__ ((packed
));
345 struct acpi_table_mcfg
{
346 struct acpi_table_header header
;
350 } __attribute__ ((packed
));
355 ACPI_TABLE_UNKNOWN
= 0,
377 typedef int (*acpi_table_handler
) (unsigned long phys_addr
, unsigned long size
);
379 extern acpi_table_handler acpi_table_ops
[ACPI_TABLE_COUNT
];
381 typedef int (*acpi_madt_entry_handler
) (acpi_table_entry_header
*header
, const unsigned long end
);
383 char * __acpi_map_table (unsigned long phys_addr
, unsigned long size
);
384 unsigned long acpi_find_rsdp (void);
385 int acpi_boot_init (void);
386 int acpi_boot_table_init (void);
387 int acpi_numa_init (void);
389 int acpi_table_init (void);
390 int acpi_table_parse (enum acpi_table_id id
, acpi_table_handler handler
);
391 int acpi_get_table_header_early (enum acpi_table_id id
, struct acpi_table_header
**header
);
392 int acpi_table_parse_madt (enum acpi_madt_entry_id id
, acpi_madt_entry_handler handler
, unsigned int max_entries
);
393 int acpi_table_parse_srat (enum acpi_srat_entry_id id
, acpi_madt_entry_handler handler
, unsigned int max_entries
);
394 void acpi_table_print (struct acpi_table_header
*header
, unsigned long phys_addr
);
395 void acpi_table_print_madt_entry (acpi_table_entry_header
*madt
);
396 void acpi_table_print_srat_entry (acpi_table_entry_header
*srat
);
398 /* the following four functions are architecture-dependent */
399 void acpi_numa_slit_init (struct acpi_table_slit
*slit
);
400 void acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity
*pa
);
401 void acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity
*ma
);
402 void acpi_numa_arch_fixup(void);
404 #ifdef CONFIG_ACPI_HOTPLUG_CPU
405 /* Arch dependent functions for cpu hotplug support */
406 int acpi_map_lsapic(acpi_handle handle
, int *pcpu
);
407 int acpi_unmap_lsapic(int cpu
);
408 #endif /* CONFIG_ACPI_HOTPLUG_CPU */
410 extern int acpi_mp_config
;
412 extern u32 pci_mmcfg_base_addr
;
414 extern int sbf_port
;
416 #else /*!CONFIG_ACPI_BOOT*/
418 #define acpi_mp_config 0
420 static inline int acpi_boot_init(void)
425 static inline int acpi_boot_table_init(void)
430 #endif /*!CONFIG_ACPI_BOOT*/
432 unsigned int acpi_register_gsi (u32 gsi
, int edge_level
, int active_high_low
);
433 int acpi_gsi_to_irq (u32 gsi
, unsigned int *irq
);
436 * This function undoes the effect of one call to acpi_register_gsi().
437 * If this matches the last registration, any IRQ resources for gsi
440 #ifdef CONFIG_ACPI_DEALLOCATE_IRQ
441 void acpi_unregister_gsi (u32 gsi
);
444 #ifdef CONFIG_ACPI_PCI
446 struct acpi_prt_entry
{
447 struct list_head node
;
448 struct acpi_pci_id id
;
457 struct acpi_prt_list
{
459 struct list_head entries
;
464 int acpi_pci_irq_enable (struct pci_dev
*dev
);
465 void acpi_penalize_isa_irq(int irq
);
467 #ifdef CONFIG_ACPI_DEALLOCATE_IRQ
468 void acpi_pci_irq_disable (struct pci_dev
*dev
);
471 struct acpi_pci_driver
{
472 struct acpi_pci_driver
*next
;
473 int (*add
)(acpi_handle handle
);
474 void (*remove
)(acpi_handle handle
);
477 int acpi_pci_register_driver(struct acpi_pci_driver
*driver
);
478 void acpi_pci_unregister_driver(struct acpi_pci_driver
*driver
);
480 #endif /*CONFIG_ACPI_PCI*/
482 #ifdef CONFIG_ACPI_EC
484 extern int ec_read(u8 addr
, u8
*val
);
485 extern int ec_write(u8 addr
, u8 val
);
487 #endif /*CONFIG_ACPI_EC*/
489 #ifdef CONFIG_ACPI_INTERPRETER
491 extern int acpi_blacklisted(void);
492 extern void acpi_bios_year(char *s
);
494 #else /*!CONFIG_ACPI_INTERPRETER*/
496 static inline int acpi_blacklisted(void)
501 #endif /*!CONFIG_ACPI_INTERPRETER*/
503 #define ACPI_CSTATE_LIMIT_DEFINED /* for driver builds */
507 * Set highest legal C-state
508 * 0: C0 okay, but not C1
509 * 1: C1 okay, but not C2
510 * 2: C2 okay, but not C3 etc.
513 extern unsigned int max_cstate
;
515 static inline unsigned int acpi_get_cstate_limit(void)
519 static inline void acpi_set_cstate_limit(unsigned int new_limit
)
521 max_cstate
= new_limit
;
525 static inline unsigned int acpi_get_cstate_limit(void) { return 0; }
526 static inline void acpi_set_cstate_limit(unsigned int new_limit
) { return; }
529 #ifdef CONFIG_ACPI_NUMA
530 int acpi_get_pxm(acpi_handle handle
);
532 static inline int acpi_get_pxm(acpi_handle handle
)
538 extern int pnpacpi_disabled
;
540 #endif /* CONFIG_ACPI */
541 #endif /*_LINUX_ACPI_H*/