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 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32 #include <linux/list.h>
34 #include <acpi/acpi.h>
35 #include <acpi/acpi_bus.h>
36 #include <acpi/acpi_drivers.h>
40 #ifdef CONFIG_ACPI_BOOT
42 enum acpi_irq_model_id
{
43 ACPI_IRQ_MODEL_PIC
= 0,
44 ACPI_IRQ_MODEL_IOAPIC
,
45 ACPI_IRQ_MODEL_IOSAPIC
,
49 extern enum acpi_irq_model_id acpi_irq_model
;
52 /* Root System Description Pointer (RSDP) */
54 struct acpi_table_rsdp
{
60 } __attribute__ ((packed
));
62 struct acpi20_table_rsdp
{
72 } __attribute__ ((packed
));
77 } __attribute__ ((packed
)) acpi_table_entry_header
;
79 /* Root System Description Table (RSDT) */
81 struct acpi_table_rsdt
{
82 struct acpi_table_header header
;
84 } __attribute__ ((packed
));
86 /* Extended System Description Table (XSDT) */
88 struct acpi_table_xsdt
{
89 struct acpi_table_header header
;
91 } __attribute__ ((packed
));
93 /* Fixed ACPI Description Table (FADT) */
95 struct acpi_table_fadt
{
96 struct acpi_table_header header
;
100 } __attribute__ ((packed
));
102 /* Multiple APIC Description Table (MADT) */
104 struct acpi_table_madt
{
105 struct acpi_table_header header
;
111 } __attribute__ ((packed
));
113 enum acpi_madt_entry_id
{
116 ACPI_MADT_INT_SRC_OVR
,
119 ACPI_MADT_LAPIC_ADDR_OVR
,
122 ACPI_MADT_PLAT_INT_SRC
,
123 ACPI_MADT_ENTRY_COUNT
130 } __attribute__ ((packed
)) acpi_interrupt_flags
;
132 struct acpi_table_lapic
{
133 acpi_table_entry_header header
;
140 } __attribute__ ((packed
));
142 struct acpi_table_ioapic
{
143 acpi_table_entry_header header
;
148 } __attribute__ ((packed
));
150 struct acpi_table_int_src_ovr
{
151 acpi_table_entry_header header
;
155 acpi_interrupt_flags flags
;
156 } __attribute__ ((packed
));
158 struct acpi_table_nmi_src
{
159 acpi_table_entry_header header
;
160 acpi_interrupt_flags flags
;
162 } __attribute__ ((packed
));
164 struct acpi_table_lapic_nmi
{
165 acpi_table_entry_header header
;
167 acpi_interrupt_flags flags
;
169 } __attribute__ ((packed
));
171 struct acpi_table_lapic_addr_ovr
{
172 acpi_table_entry_header header
;
175 } __attribute__ ((packed
));
177 struct acpi_table_iosapic
{
178 acpi_table_entry_header header
;
183 } __attribute__ ((packed
));
185 struct acpi_table_lsapic
{
186 acpi_table_entry_header header
;
195 } __attribute__ ((packed
));
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 */
206 } __attribute__ ((packed
));
208 enum acpi_interrupt_id
{
209 ACPI_INTERRUPT_PMI
= 1,
215 #define ACPI_SPACE_MEM 0
217 struct acpi_gen_regaddr
{
224 } __attribute__ ((packed
));
226 struct acpi_table_hpet
{
227 struct acpi_table_header header
;
229 struct acpi_gen_regaddr addr
;
233 } __attribute__ ((packed
));
237 * http://www.microsoft.com/whdc/hwdev/resources/specs/simp_bios.mspx
239 struct acpi_table_sbf
252 } __attribute__ ((packed
));
255 * System Resource Affinity Table (SRAT)
256 * http://www.microsoft.com/whdc/hwdev/platform/proc/SRAT.mspx
259 struct acpi_table_srat
{
260 struct acpi_table_header header
;
263 } __attribute__ ((packed
));
265 enum acpi_srat_entry_id
{
266 ACPI_SRAT_PROCESSOR_AFFINITY
= 0,
267 ACPI_SRAT_MEMORY_AFFINITY
,
268 ACPI_SRAT_ENTRY_COUNT
271 struct acpi_table_processor_affinity
{
272 acpi_table_entry_header header
;
281 } __attribute__ ((packed
));
283 struct acpi_table_memory_affinity
{
284 acpi_table_entry_header header
;
291 u32 memory_type
; /* See acpi_address_range_id */
298 } __attribute__ ((packed
));
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
309 * System Locality Information Table (SLIT)
310 * see http://devresource.hp.com/devresource/docs/techpapers/ia64/slit.pdf
313 struct acpi_table_slit
{
314 struct acpi_table_header header
;
316 u8 entry
[1]; /* real size = localities^2 */
317 } __attribute__ ((packed
));
319 /* Smart Battery Description Table (SBST) */
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
));
328 /* Embedded Controller Boot Resources Table (ECDT) */
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
;
337 } __attribute__ ((packed
));
341 struct acpi_table_mcfg
{
342 struct acpi_table_header header
;
346 } __attribute__ ((packed
));
351 ACPI_TABLE_UNKNOWN
= 0,
373 typedef int (*acpi_table_handler
) (unsigned long phys_addr
, unsigned long size
);
375 extern acpi_table_handler acpi_table_ops
[ACPI_TABLE_COUNT
];
377 typedef int (*acpi_madt_entry_handler
) (acpi_table_entry_header
*header
, const unsigned long end
);
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_numa_init (void);
384 int acpi_table_init (void);
385 int acpi_table_parse (enum acpi_table_id id
, acpi_table_handler handler
);
386 int acpi_get_table_header_early (enum acpi_table_id id
, struct acpi_table_header
**header
);
387 int acpi_table_parse_madt (enum acpi_madt_entry_id id
, acpi_madt_entry_handler handler
, unsigned int max_entries
);
388 int acpi_table_parse_srat (enum acpi_srat_entry_id id
, acpi_madt_entry_handler handler
, unsigned int max_entries
);
389 void acpi_table_print (struct acpi_table_header
*header
, unsigned long phys_addr
);
390 void acpi_table_print_madt_entry (acpi_table_entry_header
*madt
);
391 void acpi_table_print_srat_entry (acpi_table_entry_header
*srat
);
393 /* the following four functions are architecture-dependent */
394 void acpi_numa_slit_init (struct acpi_table_slit
*slit
);
395 void acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity
*pa
);
396 void acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity
*ma
);
397 void acpi_numa_arch_fixup(void);
399 extern int acpi_mp_config
;
401 extern u32 pci_mmcfg_base_addr
;
403 extern int sbf_port
;
405 #else /*!CONFIG_ACPI_BOOT*/
407 #define acpi_mp_config 0
409 static inline int acpi_boot_init(void)
414 #endif /*!CONFIG_ACPI_BOOT*/
416 unsigned int acpi_register_gsi (u32 gsi
, int edge_level
, int active_high_low
);
417 int acpi_gsi_to_irq (u32 gsi
, unsigned int *irq
);
419 #ifdef CONFIG_ACPI_PCI
421 struct acpi_prt_entry
{
422 struct list_head node
;
423 struct acpi_pci_id id
;
432 struct acpi_prt_list
{
434 struct list_head entries
;
437 extern struct acpi_prt_list acpi_prt
;
441 int acpi_pci_irq_enable (struct pci_dev
*dev
);
443 struct acpi_pci_driver
{
444 struct acpi_pci_driver
*next
;
445 int (*add
)(acpi_handle handle
);
446 void (*remove
)(acpi_handle handle
);
449 int acpi_pci_register_driver(struct acpi_pci_driver
*driver
);
450 void acpi_pci_unregister_driver(struct acpi_pci_driver
*driver
);
452 #endif /*CONFIG_ACPI_PCI*/
454 #ifdef CONFIG_ACPI_EC
456 extern int ec_read(u8 addr
, u8
*val
);
457 extern int ec_write(u8 addr
, u8 val
);
459 #endif /*CONFIG_ACPI_EC*/
461 #ifdef CONFIG_ACPI_INTERPRETER
463 extern int acpi_blacklisted(void);
464 extern void acpi_bios_year(char *s
);
466 #else /*!CONFIG_ACPI_INTERPRETER*/
468 static inline int acpi_blacklisted(void)
473 #endif /*!CONFIG_ACPI_INTERPRETER*/
475 #endif /*_LINUX_ACPI_H*/