md: change ITERATE_RDEV_GENERIC to rdev_for_each_list, and remove ITERATE_RDEV_PENDING.
[safe/jmp/linux-2.6] / include / linux / acpi.h
index b3e8a26..63f2e6e 100644 (file)
 #endif
 
 #include <linux/list.h>
+#include <linux/mod_devicetable.h>
 
 #include <acpi/acpi.h>
 #include <acpi/acpi_bus.h>
 #include <acpi/acpi_drivers.h>
 #include <acpi/acpi_numa.h>
 #include <asm/acpi.h>
+#include <linux/dmi.h>
 
 
 #ifdef CONFIG_ACPI
@@ -53,120 +55,6 @@ enum acpi_irq_model_id {
 
 extern enum acpi_irq_model_id  acpi_irq_model;
 
-typedef struct {
-       u8                      type;
-       u8                      length;
-} __attribute__ ((packed)) acpi_table_entry_header;
-
-/* Multiple APIC Description Table (MADT) */
-
-struct acpi_table_madt {
-       struct acpi_table_header header;
-       u32                     lapic_address;
-       struct {
-               u32                     pcat_compat:1;
-               u32                     reserved:31;
-       }                       flags;
-} __attribute__ ((packed));
-
-enum acpi_madt_entry_id {
-       ACPI_MADT_LAPIC = 0,
-       ACPI_MADT_IOAPIC,
-       ACPI_MADT_INT_SRC_OVR,
-       ACPI_MADT_NMI_SRC,
-       ACPI_MADT_LAPIC_NMI,
-       ACPI_MADT_LAPIC_ADDR_OVR,
-       ACPI_MADT_IOSAPIC,
-       ACPI_MADT_LSAPIC,
-       ACPI_MADT_PLAT_INT_SRC,
-       ACPI_MADT_ENTRY_COUNT
-};
-
-typedef struct {
-       u16                     polarity:2;
-       u16                     trigger:2;
-       u16                     reserved:12;
-} __attribute__ ((packed)) acpi_interrupt_flags;
-
-struct acpi_table_lapic {
-       acpi_table_entry_header header;
-       u8                      acpi_id;
-       u8                      id;
-       struct {
-               u32                     enabled:1;
-               u32                     reserved:31;
-       }                       flags;
-} __attribute__ ((packed));
-
-struct acpi_table_ioapic {
-       acpi_table_entry_header header;
-       u8                      id;
-       u8                      reserved;
-       u32                     address;
-       u32                     global_irq_base;
-} __attribute__ ((packed));
-
-struct acpi_table_int_src_ovr {
-       acpi_table_entry_header header;
-       u8                      bus;
-       u8                      bus_irq;
-       u32                     global_irq;
-       acpi_interrupt_flags    flags;
-} __attribute__ ((packed));
-
-struct acpi_table_nmi_src {
-       acpi_table_entry_header header;
-       acpi_interrupt_flags    flags;
-       u32                     global_irq;
-} __attribute__ ((packed));
-
-struct acpi_table_lapic_nmi {
-       acpi_table_entry_header header;
-       u8                      acpi_id;
-       acpi_interrupt_flags    flags;
-       u8                      lint;
-} __attribute__ ((packed));
-
-struct acpi_table_lapic_addr_ovr {
-       acpi_table_entry_header header;
-       u8                      reserved[2];
-       u64                     address;
-} __attribute__ ((packed));
-
-struct acpi_table_iosapic {
-       acpi_table_entry_header header;
-       u8                      id;
-       u8                      reserved;
-       u32                     global_irq_base;
-       u64                     address;
-} __attribute__ ((packed));
-
-struct acpi_table_lsapic {
-       acpi_table_entry_header header;
-       u8                      acpi_id;
-       u8                      id;
-       u8                      eid;
-       u8                      reserved[3];
-       struct {
-               u32                     enabled:1;
-               u32                     reserved:31;
-       }                       flags;
-} __attribute__ ((packed));
-
-struct acpi_table_plat_int_src {
-       acpi_table_entry_header header;
-       acpi_interrupt_flags    flags;
-       u8                      type;   /* See acpi_interrupt_type */
-       u8                      id;
-       u8                      eid;
-       u8                      iosapic_vector;
-       u32                     global_irq;
-       struct {
-               u32                     cpei_override_flag:1;
-               u32                     reserved:31;
-       }                       plint_flags;
-} __attribute__ ((packed));
-
 enum acpi_interrupt_id {
        ACPI_INTERRUPT_PMI      = 1,
        ACPI_INTERRUPT_INIT,
@@ -176,89 +64,6 @@ enum acpi_interrupt_id {
 
 #define        ACPI_SPACE_MEM          0
 
-struct acpi_gen_regaddr {
-       u8  space_id;
-       u8  bit_width;
-       u8  bit_offset;
-       u8  resv;
-       u32 addrl;
-       u32 addrh;
-} __attribute__ ((packed));
-
-struct acpi_table_hpet {
-       struct acpi_table_header header;
-       u32 id;
-       struct acpi_gen_regaddr addr;
-       u8 number;
-       u16 min_tick;
-       u8 page_protect;
-} __attribute__ ((packed));
-
-/*
- * Simple Boot Flags
- * http://www.microsoft.com/whdc/hwdev/resources/specs/simp_bios.mspx
- */
-struct acpi_table_sbf
-{
-       u8 sbf_signature[4];
-       u32 sbf_len;
-       u8 sbf_revision;
-       u8 sbf_csum;
-       u8 sbf_oemid[6];
-       u8 sbf_oemtable[8];
-       u8 sbf_revdata[4];
-       u8 sbf_creator[4];
-       u8 sbf_crearev[4];
-       u8 sbf_cmos;
-       u8 sbf_spare[3];
-} __attribute__ ((packed));
-
-/*
- * System Resource Affinity Table (SRAT)
- * http://www.microsoft.com/whdc/hwdev/platform/proc/SRAT.mspx
- */
-
-struct acpi_table_srat {
-       struct acpi_table_header header;
-       u32                     table_revision;
-       u64                     reserved;
-} __attribute__ ((packed));
-
-enum acpi_srat_entry_id {
-       ACPI_SRAT_PROCESSOR_AFFINITY = 0,
-       ACPI_SRAT_MEMORY_AFFINITY,
-       ACPI_SRAT_ENTRY_COUNT
-};
-
-struct acpi_table_processor_affinity {
-       acpi_table_entry_header header;
-       u8                      proximity_domain;
-       u8                      apic_id;
-       struct {
-               u32                     enabled:1;
-               u32                     reserved:31;
-       }                       flags;
-       u8                      lsapic_eid;
-       u8                      reserved[7];
-} __attribute__ ((packed));
-
-struct acpi_table_memory_affinity {
-       acpi_table_entry_header header;
-       u8                      proximity_domain;
-       u8                      reserved1[5];
-       u32                     base_addr_lo;
-       u32                     base_addr_hi;
-       u32                     length_lo;
-       u32                     length_hi;
-       u32                     memory_type;    /* See acpi_address_range_id */
-       struct {
-               u32                     enabled:1;
-               u32                     hot_pluggable:1;
-               u32                     reserved:30;
-       }                       flags;
-       u64                     reserved2;
-} __attribute__ ((packed));
-
 enum acpi_address_range_id {
        ACPI_ADDRESS_RANGE_MEMORY = 1,
        ACPI_ADDRESS_RANGE_RESERVED = 2,
@@ -267,84 +72,12 @@ enum acpi_address_range_id {
        ACPI_ADDRESS_RANGE_COUNT
 };
 
-/*
- * System Locality Information Table (SLIT)
- *   see http://devresource.hp.com/devresource/docs/techpapers/ia64/slit.pdf
- */
-
-struct acpi_table_slit {
-       struct acpi_table_header header;
-       u64                     localities;
-       u8                      entry[1];       /* real size = localities^2 */
-} __attribute__ ((packed));
-
-/* Smart Battery Description Table (SBST) */
-
-struct acpi_table_sbst {
-       struct acpi_table_header header;
-       u32                     warning;        /* Warn user */
-       u32                     low;            /* Critical sleep */
-       u32                     critical;       /* Critical shutdown */
-} __attribute__ ((packed));
-
-/* Embedded Controller Boot Resources Table (ECDT) */
-
-struct acpi_table_ecdt {
-       struct acpi_table_header        header;
-       struct acpi_generic_address     ec_control;
-       struct acpi_generic_address     ec_data;
-       u32                             uid;
-       u8                              gpe_bit;
-       char                            ec_id[0];
-} __attribute__ ((packed));
-
-/* PCI MMCONFIG */
-
-/* Defined in PCI Firmware Specification 3.0 */
-struct acpi_table_mcfg_config {
-       u32                             base_address;
-       u32                             base_reserved;
-       u16                             pci_segment_group_number;
-       u8                              start_bus_number;
-       u8                              end_bus_number;
-       u8                              reserved[4];
-} __attribute__ ((packed));
-struct acpi_table_mcfg {
-       struct acpi_table_header        header;
-       u8                              reserved[8];
-       struct acpi_table_mcfg_config   config[0];
-} __attribute__ ((packed));
 
 /* Table Handlers */
 
-enum acpi_table_id {
-       ACPI_TABLE_UNKNOWN = 0,
-       ACPI_APIC,
-       ACPI_BOOT,
-       ACPI_DBGP,
-       ACPI_DSDT,
-       ACPI_ECDT,
-       ACPI_ETDT,
-       ACPI_FADT,
-       ACPI_FACS,
-       ACPI_OEMX,
-       ACPI_PSDT,
-       ACPI_SBST,
-       ACPI_SLIT,
-       ACPI_SPCR,
-       ACPI_SRAT,
-       ACPI_SSDT,
-       ACPI_SPMI,
-       ACPI_HPET,
-       ACPI_MCFG,
-       ACPI_TABLE_COUNT
-};
-
-typedef int (*acpi_table_handler) (unsigned long phys_addr, unsigned long size);
+typedef int (*acpi_table_handler) (struct acpi_table_header *table);
 
-extern acpi_table_handler acpi_table_ops[ACPI_TABLE_COUNT];
-
-typedef int (*acpi_madt_entry_handler) (acpi_table_entry_header *header, const unsigned long end);
+typedef int (*acpi_table_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
 
 char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
 unsigned long acpi_find_rsdp (void);
@@ -353,14 +86,12 @@ int acpi_boot_table_init (void);
 int acpi_numa_init (void);
 
 int acpi_table_init (void);
-int acpi_table_parse (enum acpi_table_id id, acpi_table_handler handler);
-int acpi_get_table_header_early (enum acpi_table_id id, struct acpi_table_header **header);
-int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries);
-int acpi_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries);
-int acpi_parse_mcfg (unsigned long phys_addr, unsigned long size);
-void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr);
-void acpi_table_print_madt_entry (acpi_table_entry_header *madt);
-void acpi_table_print_srat_entry (acpi_table_entry_header *srat);
+int acpi_table_parse (char *id, acpi_table_handler handler);
+int __init acpi_table_parse_entries(char *id, unsigned long table_size,
+       int entry_id, acpi_table_entry_handler handler, unsigned int max_entries);
+int acpi_table_parse_madt (enum acpi_madt_type id, acpi_table_entry_handler handler, unsigned int max_entries);
+int acpi_parse_mcfg (struct acpi_table_header *header);
+void acpi_table_print_madt_entry (struct acpi_subtable_header *madt);
 
 /* the following four functions are architecture-dependent */
 #ifdef CONFIG_HAVE_ARCH_PARSE_SRAT
@@ -371,8 +102,8 @@ void acpi_table_print_srat_entry (acpi_table_entry_header *srat);
 #define acpi_numa_arch_fixup() do {} while (0)
 #else
 void acpi_numa_slit_init (struct acpi_table_slit *slit);
-void acpi_numa_processor_affinity_init (struct acpi_table_processor_affinity *pa);
-void acpi_numa_memory_affinity_init (struct acpi_table_memory_affinity *ma);
+void acpi_numa_processor_affinity_init (struct acpi_srat_cpu_affinity *pa);
+void acpi_numa_memory_affinity_init (struct acpi_srat_mem_affinity *ma);
 void acpi_numa_arch_fixup(void);
 #endif
 
@@ -387,11 +118,11 @@ int acpi_unregister_ioapic(acpi_handle handle, u32 gsi_base);
 
 extern int acpi_mp_config;
 
-extern struct acpi_table_mcfg_config *pci_mmcfg_config;
+extern struct acpi_mcfg_allocation *pci_mmcfg_config;
 extern int pci_mmcfg_config_num;
 
 extern int sbf_port;
-extern unsigned long acpi_video_flags;
+extern unsigned long acpi_realmode_flags;
 
 #else  /* !CONFIG_ACPI */
 
@@ -402,6 +133,11 @@ extern unsigned long acpi_video_flags;
 int acpi_register_gsi (u32 gsi, int triggering, int polarity);
 int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
 
+#ifdef CONFIG_X86_IO_APIC
+extern int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity);
+#else
+#define acpi_get_override_irq(bus, trigger, polarity) (-1)
+#endif
 /*
  * This function undoes the effect of one call to acpi_register_gsi().
  * If this matches the last registration, any IRQ resources for gsi
@@ -451,37 +187,14 @@ extern int ec_read(u8 addr, u8 *val);
 extern int ec_write(u8 addr, u8 val);
 extern int ec_transaction(u8 command,
                           const u8 *wdata, unsigned wdata_len,
-                          u8 *rdata, unsigned rdata_len);
+                          u8 *rdata, unsigned rdata_len,
+                         int force_poll);
 
 #endif /*CONFIG_ACPI_EC*/
 
 extern int acpi_blacklisted(void);
-extern void acpi_bios_year(char *s);
-
-#define        ACPI_CSTATE_LIMIT_DEFINED       /* for driver builds */
-#ifdef CONFIG_ACPI
-
-/*
- * Set highest legal C-state
- * 0: C0 okay, but not C1
- * 1: C1 okay, but not C2
- * 2: C2 okay, but not C3 etc.
- */
-
-extern unsigned int max_cstate;
-
-static inline unsigned int acpi_get_cstate_limit(void)
-{
-       return max_cstate;
-}
-static inline void acpi_set_cstate_limit(unsigned int new_limit)
-{
-       max_cstate = new_limit;
-       return;
-}
-#else
-static inline unsigned int acpi_get_cstate_limit(void) { return 0; }
-static inline void acpi_set_cstate_limit(unsigned int new_limit) { return; }
+#ifdef CONFIG_DMI
+extern void acpi_dmi_osi_linux(int enable, const struct dmi_system_id *d);
 #endif
 
 #ifdef CONFIG_ACPI_NUMA
@@ -501,6 +214,9 @@ extern int acpi_paddr_to_node(u64 start_addr, u64 size);
 
 extern int pnpacpi_disabled;
 
+#define PXM_INVAL      (-1)
+#define NID_INVAL      (-1)
+
 #else  /* CONFIG_ACPI */
 
 static inline int acpi_boot_init(void)
@@ -513,5 +229,5 @@ static inline int acpi_boot_table_init(void)
        return 0;
 }
 
-#endif /* CONFIG_ACPI */
+#endif /* !CONFIG_ACPI */
 #endif /*_LINUX_ACPI_H*/