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 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
35 #include <linux/list.h>
37 #include <acpi/acpi.h>
38 #include <acpi/acpi_bus.h>
39 #include <acpi/acpi_drivers.h>
40 #include <acpi/acpi_numa.h>
46 enum acpi_irq_model_id {
47 ACPI_IRQ_MODEL_PIC = 0,
48 ACPI_IRQ_MODEL_IOAPIC,
49 ACPI_IRQ_MODEL_IOSAPIC,
50 ACPI_IRQ_MODEL_PLATFORM,
54 extern enum acpi_irq_model_id acpi_irq_model;
59 } __attribute__ ((packed)) acpi_table_entry_header;
61 /* Multiple APIC Description Table (MADT) */
63 enum acpi_madt_entry_id {
66 ACPI_MADT_INT_SRC_OVR,
69 ACPI_MADT_LAPIC_ADDR_OVR,
72 ACPI_MADT_PLAT_INT_SRC,
80 } __attribute__ ((packed)) acpi_interrupt_flags;
82 struct acpi_table_lapic {
83 acpi_table_entry_header header;
90 } __attribute__ ((packed));
92 struct acpi_table_ioapic {
93 acpi_table_entry_header header;
98 } __attribute__ ((packed));
100 struct acpi_table_int_src_ovr {
101 acpi_table_entry_header header;
105 acpi_interrupt_flags flags;
106 } __attribute__ ((packed));
108 struct acpi_table_nmi_src {
109 acpi_table_entry_header header;
110 acpi_interrupt_flags flags;
112 } __attribute__ ((packed));
114 struct acpi_table_lapic_nmi {
115 acpi_table_entry_header header;
117 acpi_interrupt_flags flags;
119 } __attribute__ ((packed));
121 struct acpi_table_lapic_addr_ovr {
122 acpi_table_entry_header header;
125 } __attribute__ ((packed));
127 struct acpi_table_iosapic {
128 acpi_table_entry_header header;
133 } __attribute__ ((packed));
135 struct acpi_table_lsapic {
136 acpi_table_entry_header header;
145 } __attribute__ ((packed));
147 struct acpi_table_plat_int_src {
148 acpi_table_entry_header header;
149 acpi_interrupt_flags flags;
150 u8 type; /* See acpi_interrupt_type */
156 u32 cpei_override_flag:1;
159 } __attribute__ ((packed));
161 enum acpi_interrupt_id {
162 ACPI_INTERRUPT_PMI = 1,
168 #define ACPI_SPACE_MEM 0
170 struct acpi_gen_regaddr {
177 } __attribute__ ((packed));
181 * http://www.microsoft.com/whdc/hwdev/resources/specs/simp_bios.mspx
183 struct acpi_table_sbf
196 } __attribute__ ((packed));
199 * System Resource Affinity Table (SRAT)
200 * http://www.microsoft.com/whdc/hwdev/platform/proc/SRAT.mspx
203 enum acpi_srat_entry_id {
204 ACPI_SRAT_PROCESSOR_AFFINITY = 0,
205 ACPI_SRAT_MEMORY_AFFINITY,
206 ACPI_SRAT_ENTRY_COUNT
209 struct acpi_table_processor_affinity {
210 acpi_table_entry_header header;
219 } __attribute__ ((packed));
221 struct acpi_table_memory_affinity {
222 acpi_table_entry_header header;
229 u32 memory_type; /* See acpi_address_range_id */
236 } __attribute__ ((packed));
238 enum acpi_address_range_id {
239 ACPI_ADDRESS_RANGE_MEMORY = 1,
240 ACPI_ADDRESS_RANGE_RESERVED = 2,
241 ACPI_ADDRESS_RANGE_ACPI = 3,
242 ACPI_ADDRESS_RANGE_NVS = 4,
243 ACPI_ADDRESS_RANGE_COUNT
249 /* Defined in PCI Firmware Specification 3.0 */
250 struct acpi_table_mcfg_config {
253 u16 pci_segment_group_number;
257 } __attribute__ ((packed));
262 ACPI_TABLE_UNKNOWN = 0,
284 typedef int (*acpi_table_handler) (struct acpi_table_header *header);
286 extern acpi_table_handler acpi_table_ops[ACPI_TABLE_COUNT];
288 typedef int (*acpi_madt_entry_handler) (acpi_table_entry_header *header, const unsigned long end);
290 char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
291 unsigned long acpi_find_rsdp (void);
292 int acpi_boot_init (void);
293 int acpi_boot_table_init (void);
294 int acpi_numa_init (void);
296 int acpi_table_init (void);
297 int acpi_table_parse (char *id, acpi_table_handler handler);
298 int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries);
299 int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries);
300 int acpi_parse_mcfg (struct acpi_table_header *header);
301 void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr);
302 void acpi_table_print_madt_entry (acpi_table_entry_header *madt);
303 void acpi_table_print_srat_entry (acpi_table_entry_header *srat);
305 /* the following four functions are architecture-dependent */
306 #ifdef CONFIG_HAVE_ARCH_PARSE_SRAT
307 #define NR_NODE_MEMBLKS MAX_NUMNODES
308 #define acpi_numa_slit_init(slit) do {} while (0)
309 #define acpi_numa_processor_affinity_init(pa) do {} while (0)
310 #define acpi_numa_memory_affinity_init(ma) do {} while (0)
311 #define acpi_numa_arch_fixup() do {} while (0)
313 void acpi_numa_slit_init (struct acpi_table_slit *slit);
314 void acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa);
315 void acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma);
316 void acpi_numa_arch_fixup(void);
319 #ifdef CONFIG_ACPI_HOTPLUG_CPU
320 /* Arch dependent functions for cpu hotplug support */
321 int acpi_map_lsapic(acpi_handle handle, int *pcpu);
322 int acpi_unmap_lsapic(int cpu);
323 #endif /* CONFIG_ACPI_HOTPLUG_CPU */
325 int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base);
326 int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base);
328 extern int acpi_mp_config;
330 extern struct acpi_table_mcfg_config *pci_mmcfg_config;
331 extern int pci_mmcfg_config_num;
334 extern unsigned long acpi_video_flags;
336 #else /* !CONFIG_ACPI */
338 #define acpi_mp_config 0
340 #endif /* !CONFIG_ACPI */
342 int acpi_register_gsi (u32 gsi, int triggering, int polarity);
343 int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
346 * This function undoes the effect of one call to acpi_register_gsi().
347 * If this matches the last registration, any IRQ resources for gsi
350 void acpi_unregister_gsi (u32 gsi);
354 struct acpi_prt_entry {
355 struct list_head node;
356 struct acpi_pci_id id;
365 struct acpi_prt_list {
367 struct list_head entries;
372 int acpi_pci_irq_enable (struct pci_dev *dev);
373 void acpi_penalize_isa_irq(int irq, int active);
375 void acpi_pci_irq_disable (struct pci_dev *dev);
377 struct acpi_pci_driver {
378 struct acpi_pci_driver *next;
379 int (*add)(acpi_handle handle);
380 void (*remove)(acpi_handle handle);
383 int acpi_pci_register_driver(struct acpi_pci_driver *driver);
384 void acpi_pci_unregister_driver(struct acpi_pci_driver *driver);
386 #endif /* CONFIG_ACPI */
388 #ifdef CONFIG_ACPI_EC
390 extern int ec_read(u8 addr, u8 *val);
391 extern int ec_write(u8 addr, u8 val);
392 extern int ec_transaction(u8 command,
393 const u8 *wdata, unsigned wdata_len,
394 u8 *rdata, unsigned rdata_len);
396 #endif /*CONFIG_ACPI_EC*/
398 extern int acpi_blacklisted(void);
399 extern void acpi_bios_year(char *s);
401 #define ACPI_CSTATE_LIMIT_DEFINED /* for driver builds */
405 * Set highest legal C-state
406 * 0: C0 okay, but not C1
407 * 1: C1 okay, but not C2
408 * 2: C2 okay, but not C3 etc.
411 extern unsigned int max_cstate;
413 static inline unsigned int acpi_get_cstate_limit(void)
417 static inline void acpi_set_cstate_limit(unsigned int new_limit)
419 max_cstate = new_limit;
423 static inline unsigned int acpi_get_cstate_limit(void) { return 0; }
424 static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; }
427 #ifdef CONFIG_ACPI_NUMA
428 int acpi_get_pxm(acpi_handle handle);
429 int acpi_get_node(acpi_handle *handle);
431 static inline int acpi_get_pxm(acpi_handle handle)
435 static inline int acpi_get_node(acpi_handle *handle)
440 extern int acpi_paddr_to_node(u64 start_addr, u64 size);
442 extern int pnpacpi_disabled;
444 #else /* CONFIG_ACPI */
446 static inline int acpi_boot_init(void)
451 static inline int acpi_boot_table_init(void)
456 #endif /* CONFIG_ACPI */
457 #endif /*_LINUX_ACPI_H*/