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 enum acpi_interrupt_id {
62 ACPI_INTERRUPT_PMI = 1,
68 #define ACPI_SPACE_MEM 0
70 struct acpi_gen_regaddr {
77 } __attribute__ ((packed));
81 * http://www.microsoft.com/whdc/hwdev/resources/specs/simp_bios.mspx
96 } __attribute__ ((packed));
99 * System Resource Affinity Table (SRAT)
100 * http://www.microsoft.com/whdc/hwdev/platform/proc/SRAT.mspx
103 enum acpi_srat_entry_id {
104 ACPI_SRAT_PROCESSOR_AFFINITY = 0,
105 ACPI_SRAT_MEMORY_AFFINITY,
106 ACPI_SRAT_ENTRY_COUNT
109 struct acpi_table_processor_affinity {
110 acpi_table_entry_header header;
119 } __attribute__ ((packed));
121 struct acpi_table_memory_affinity {
122 acpi_table_entry_header header;
129 u32 memory_type; /* See acpi_address_range_id */
136 } __attribute__ ((packed));
138 enum acpi_address_range_id {
139 ACPI_ADDRESS_RANGE_MEMORY = 1,
140 ACPI_ADDRESS_RANGE_RESERVED = 2,
141 ACPI_ADDRESS_RANGE_ACPI = 3,
142 ACPI_ADDRESS_RANGE_NVS = 4,
143 ACPI_ADDRESS_RANGE_COUNT
149 /* Defined in PCI Firmware Specification 3.0 */
150 struct acpi_table_mcfg_config {
153 u16 pci_segment_group_number;
157 } __attribute__ ((packed));
162 ACPI_TABLE_UNKNOWN = 0,
184 typedef int (*acpi_table_handler) (struct acpi_table_header *header);
186 extern acpi_table_handler acpi_table_ops[ACPI_TABLE_COUNT];
188 typedef int (*acpi_madt_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
190 char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
191 unsigned long acpi_find_rsdp (void);
192 int acpi_boot_init (void);
193 int acpi_boot_table_init (void);
194 int acpi_numa_init (void);
196 int acpi_table_init (void);
197 int acpi_table_parse (char *id, acpi_table_handler handler);
198 int acpi_table_parse_madt (enum acpi_madt_type id, acpi_madt_entry_handler handler, unsigned int max_entries);
199 int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries);
200 int acpi_parse_mcfg (struct acpi_table_header *header);
201 void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr);
202 void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
203 void acpi_table_print_srat_entry (acpi_table_entry_header *srat);
205 /* the following four functions are architecture-dependent */
206 #ifdef CONFIG_HAVE_ARCH_PARSE_SRAT
207 #define NR_NODE_MEMBLKS MAX_NUMNODES
208 #define acpi_numa_slit_init(slit) do {} while (0)
209 #define acpi_numa_processor_affinity_init(pa) do {} while (0)
210 #define acpi_numa_memory_affinity_init(ma) do {} while (0)
211 #define acpi_numa_arch_fixup() do {} while (0)
213 void acpi_numa_slit_init (struct acpi_table_slit *slit);
214 void acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa);
215 void acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma);
216 void acpi_numa_arch_fixup(void);
219 #ifdef CONFIG_ACPI_HOTPLUG_CPU
220 /* Arch dependent functions for cpu hotplug support */
221 int acpi_map_lsapic(acpi_handle handle, int *pcpu);
222 int acpi_unmap_lsapic(int cpu);
223 #endif /* CONFIG_ACPI_HOTPLUG_CPU */
225 int acpi_register_ioapic(acpi_handle handle, u64 phys_addr, u32 gsi_base);
226 int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base);
228 extern int acpi_mp_config;
230 extern struct acpi_table_mcfg_config *pci_mmcfg_config;
231 extern int pci_mmcfg_config_num;
234 extern unsigned long acpi_video_flags;
236 #else /* !CONFIG_ACPI */
238 #define acpi_mp_config 0
240 #endif /* !CONFIG_ACPI */
242 int acpi_register_gsi (u32 gsi, int triggering, int polarity);
243 int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
246 * This function undoes the effect of one call to acpi_register_gsi().
247 * If this matches the last registration, any IRQ resources for gsi
250 void acpi_unregister_gsi (u32 gsi);
254 struct acpi_prt_entry {
255 struct list_head node;
256 struct acpi_pci_id id;
265 struct acpi_prt_list {
267 struct list_head entries;
272 int acpi_pci_irq_enable (struct pci_dev *dev);
273 void acpi_penalize_isa_irq(int irq, int active);
275 void acpi_pci_irq_disable (struct pci_dev *dev);
277 struct acpi_pci_driver {
278 struct acpi_pci_driver *next;
279 int (*add)(acpi_handle handle);
280 void (*remove)(acpi_handle handle);
283 int acpi_pci_register_driver(struct acpi_pci_driver *driver);
284 void acpi_pci_unregister_driver(struct acpi_pci_driver *driver);
286 #endif /* CONFIG_ACPI */
288 #ifdef CONFIG_ACPI_EC
290 extern int ec_read(u8 addr, u8 *val);
291 extern int ec_write(u8 addr, u8 val);
292 extern int ec_transaction(u8 command,
293 const u8 *wdata, unsigned wdata_len,
294 u8 *rdata, unsigned rdata_len);
296 #endif /*CONFIG_ACPI_EC*/
298 extern int acpi_blacklisted(void);
299 extern void acpi_bios_year(char *s);
301 #define ACPI_CSTATE_LIMIT_DEFINED /* for driver builds */
305 * Set highest legal C-state
306 * 0: C0 okay, but not C1
307 * 1: C1 okay, but not C2
308 * 2: C2 okay, but not C3 etc.
311 extern unsigned int max_cstate;
313 static inline unsigned int acpi_get_cstate_limit(void)
317 static inline void acpi_set_cstate_limit(unsigned int new_limit)
319 max_cstate = new_limit;
323 static inline unsigned int acpi_get_cstate_limit(void) { return 0; }
324 static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; }
327 #ifdef CONFIG_ACPI_NUMA
328 int acpi_get_pxm(acpi_handle handle);
329 int acpi_get_node(acpi_handle *handle);
331 static inline int acpi_get_pxm(acpi_handle handle)
335 static inline int acpi_get_node(acpi_handle *handle)
340 extern int acpi_paddr_to_node(u64 start_addr, u64 size);
342 extern int pnpacpi_disabled;
344 #else /* CONFIG_ACPI */
346 static inline int acpi_boot_init(void)
351 static inline int acpi_boot_table_init(void)
356 #endif /* CONFIG_ACPI */
357 #endif /*_LINUX_ACPI_H*/