提交 5f3b1a8b 编写于 作者: A Alexey Starikovskiy 提交者: Len Brown

ACPICA: Remove duplicate table definitions (non-conflicting)

Signed-off-by: NLen Brown <len.brown@intel.com>
上级 ad363f80
...@@ -66,7 +66,7 @@ static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id) { return ...@@ -66,7 +66,7 @@ static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id) { return
#define BAD_MADT_ENTRY(entry, end) ( \ #define BAD_MADT_ENTRY(entry, end) ( \
(!entry) || (unsigned long)entry + sizeof(*entry) > end || \ (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
((acpi_table_entry_header *)entry)->length < sizeof(*entry)) ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
#define PREFIX "ACPI: " #define PREFIX "ACPI: "
...@@ -79,7 +79,7 @@ int acpi_ioapic; ...@@ -79,7 +79,7 @@ int acpi_ioapic;
int acpi_strict; int acpi_strict;
EXPORT_SYMBOL(acpi_strict); EXPORT_SYMBOL(acpi_strict);
acpi_interrupt_flags acpi_sci_flags __initdata; u8 acpi_sci_flags __initdata;
int acpi_sci_override_gsi __initdata; int acpi_sci_override_gsi __initdata;
int acpi_skip_timer_override __initdata; int acpi_skip_timer_override __initdata;
int acpi_use_timer_override __initdata; int acpi_use_timer_override __initdata;
...@@ -246,11 +246,11 @@ static int __init acpi_parse_madt(struct acpi_table_header *header) ...@@ -246,11 +246,11 @@ static int __init acpi_parse_madt(struct acpi_table_header *header)
} }
static int __init static int __init
acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end) acpi_parse_lapic(struct acpi_subtable_header * header, const unsigned long end)
{ {
struct acpi_table_lapic *processor = NULL; struct acpi_madt_local_apic *processor = NULL;
processor = (struct acpi_table_lapic *)header; processor = (struct acpi_madt_local_apic *)header;
if (BAD_MADT_ENTRY(processor, end)) if (BAD_MADT_ENTRY(processor, end))
return -EINVAL; return -EINVAL;
...@@ -258,8 +258,8 @@ acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end) ...@@ -258,8 +258,8 @@ acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end)
acpi_table_print_madt_entry(header); acpi_table_print_madt_entry(header);
/* Record local apic id only when enabled */ /* Record local apic id only when enabled */
if (processor->flags.enabled) if (processor->lapic_flags & ACPI_MADT_ENABLED)
x86_acpiid_to_apicid[processor->acpi_id] = processor->id; x86_acpiid_to_apicid[processor->processor_id] = processor->id;
/* /*
* We need to register disabled CPU as well to permit * We need to register disabled CPU as well to permit
...@@ -269,18 +269,18 @@ acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end) ...@@ -269,18 +269,18 @@ acpi_parse_lapic(acpi_table_entry_header * header, const unsigned long end)
* when we use CPU hotplug. * when we use CPU hotplug.
*/ */
mp_register_lapic(processor->id, /* APIC ID */ mp_register_lapic(processor->id, /* APIC ID */
processor->flags.enabled); /* Enabled? */ processor->lapic_flags & ACPI_MADT_ENABLED); /* Enabled? */
return 0; return 0;
} }
static int __init static int __init
acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header, acpi_parse_lapic_addr_ovr(struct acpi_subtable_header * header,
const unsigned long end) const unsigned long end)
{ {
struct acpi_table_lapic_addr_ovr *lapic_addr_ovr = NULL; struct acpi_madt_local_apic_override *lapic_addr_ovr = NULL;
lapic_addr_ovr = (struct acpi_table_lapic_addr_ovr *)header; lapic_addr_ovr = (struct acpi_madt_local_apic_override *)header;
if (BAD_MADT_ENTRY(lapic_addr_ovr, end)) if (BAD_MADT_ENTRY(lapic_addr_ovr, end))
return -EINVAL; return -EINVAL;
...@@ -291,11 +291,11 @@ acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header, ...@@ -291,11 +291,11 @@ acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header,
} }
static int __init static int __init
acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end) acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long end)
{ {
struct acpi_table_lapic_nmi *lapic_nmi = NULL; struct acpi_madt_local_apic_nmi *lapic_nmi = NULL;
lapic_nmi = (struct acpi_table_lapic_nmi *)header; lapic_nmi = (struct acpi_madt_local_apic_nmi *)header;
if (BAD_MADT_ENTRY(lapic_nmi, end)) if (BAD_MADT_ENTRY(lapic_nmi, end))
return -EINVAL; return -EINVAL;
...@@ -313,11 +313,11 @@ acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end) ...@@ -313,11 +313,11 @@ acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end)
#ifdef CONFIG_X86_IO_APIC #ifdef CONFIG_X86_IO_APIC
static int __init static int __init
acpi_parse_ioapic(acpi_table_entry_header * header, const unsigned long end) acpi_parse_ioapic(struct acpi_subtable_header * header, const unsigned long end)
{ {
struct acpi_table_ioapic *ioapic = NULL; struct acpi_madt_io_apic *ioapic = NULL;
ioapic = (struct acpi_table_ioapic *)header; ioapic = (struct acpi_madt_io_apic *)header;
if (BAD_MADT_ENTRY(ioapic, end)) if (BAD_MADT_ENTRY(ioapic, end))
return -EINVAL; return -EINVAL;
...@@ -342,11 +342,11 @@ static void __init acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger) ...@@ -342,11 +342,11 @@ static void __init acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
polarity = 3; polarity = 3;
/* Command-line over-ride via acpi_sci= */ /* Command-line over-ride via acpi_sci= */
if (acpi_sci_flags.trigger) if (acpi_sci_flags & ACPI_MADT_TRIGGER_MASK)
trigger = acpi_sci_flags.trigger; trigger = (acpi_sci_flags & ACPI_MADT_TRIGGER_MASK) >> 2;
if (acpi_sci_flags.polarity) if (acpi_sci_flags & ACPI_MADT_POLARITY_MASK)
polarity = acpi_sci_flags.polarity; polarity = acpi_sci_flags & ACPI_MADT_POLARITY_MASK;
/* /*
* mp_config_acpi_legacy_irqs() already setup IRQs < 16 * mp_config_acpi_legacy_irqs() already setup IRQs < 16
...@@ -364,44 +364,45 @@ static void __init acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger) ...@@ -364,44 +364,45 @@ static void __init acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)
} }
static int __init static int __init
acpi_parse_int_src_ovr(acpi_table_entry_header * header, acpi_parse_int_src_ovr(struct acpi_subtable_header * header,
const unsigned long end) const unsigned long end)
{ {
struct acpi_table_int_src_ovr *intsrc = NULL; struct acpi_madt_interrupt_override *intsrc = NULL;
intsrc = (struct acpi_table_int_src_ovr *)header; intsrc = (struct acpi_madt_interrupt_override *)header;
if (BAD_MADT_ENTRY(intsrc, end)) if (BAD_MADT_ENTRY(intsrc, end))
return -EINVAL; return -EINVAL;
acpi_table_print_madt_entry(header); acpi_table_print_madt_entry(header);
if (intsrc->bus_irq == acpi_gbl_FADT.sci_interrupt) { if (intsrc->source_irq == acpi_gbl_FADT.sci_interrupt) {
acpi_sci_ioapic_setup(intsrc->global_irq, acpi_sci_ioapic_setup(intsrc->global_irq,
intsrc->flags.polarity, intsrc->inti_flags & ACPI_MADT_POLARITY_MASK,
intsrc->flags.trigger); (intsrc->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2);
return 0; return 0;
} }
if (acpi_skip_timer_override && if (acpi_skip_timer_override &&
intsrc->bus_irq == 0 && intsrc->global_irq == 2) { intsrc->source_irq == 0 && intsrc->global_irq == 2) {
printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n"); printk(PREFIX "BIOS IRQ0 pin2 override ignored.\n");
return 0; return 0;
} }
mp_override_legacy_irq(intsrc->bus_irq, mp_override_legacy_irq(intsrc->source_irq,
intsrc->flags.polarity, intsrc->inti_flags & ACPI_MADT_POLARITY_MASK,
intsrc->flags.trigger, intsrc->global_irq); (intsrc->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2,
intsrc->global_irq);
return 0; return 0;
} }
static int __init static int __init
acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end) acpi_parse_nmi_src(struct acpi_subtable_header * header, const unsigned long end)
{ {
struct acpi_table_nmi_src *nmi_src = NULL; struct acpi_madt_nmi_source *nmi_src = NULL;
nmi_src = (struct acpi_table_nmi_src *)header; nmi_src = (struct acpi_madt_nmi_source *)header;
if (BAD_MADT_ENTRY(nmi_src, end)) if (BAD_MADT_ENTRY(nmi_src, end))
return -EINVAL; return -EINVAL;
...@@ -417,7 +418,7 @@ acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end) ...@@ -417,7 +418,7 @@ acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end)
/* /*
* acpi_pic_sci_set_trigger() * acpi_pic_sci_set_trigger()
* *
* use ELCR to set PIC-mode trigger type for SCI * use ELCR to set PIC-mode trigger type for SCI
* *
* If a PIC-mode SCI is not recognized or gives spurious IRQ7's * If a PIC-mode SCI is not recognized or gives spurious IRQ7's
...@@ -511,7 +512,7 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu) ...@@ -511,7 +512,7 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
{ {
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *obj; union acpi_object *obj;
struct acpi_table_lapic *lapic; struct acpi_madt_local_apic *lapic;
cpumask_t tmp_map, new_map; cpumask_t tmp_map, new_map;
u8 physid; u8 physid;
int cpu; int cpu;
...@@ -529,10 +530,10 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu) ...@@ -529,10 +530,10 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
return -EINVAL; return -EINVAL;
} }
lapic = (struct acpi_table_lapic *)obj->buffer.pointer; lapic = (struct acpi_madt_local_apic *)obj->buffer.pointer;
if ((lapic->header.type != ACPI_MADT_LAPIC) || if (lapic->header.type != ACPI_MADT_TYPE_LOCAL_APIC ||
(!lapic->flags.enabled)) { !(lapic->lapic_flags & ACPI_MADT_ENABLED)) {
kfree(buffer.pointer); kfree(buffer.pointer);
return -EINVAL; return -EINVAL;
} }
...@@ -544,7 +545,7 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu) ...@@ -544,7 +545,7 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
buffer.pointer = NULL; buffer.pointer = NULL;
tmp_map = cpu_present_map; tmp_map = cpu_present_map;
mp_register_lapic(physid, lapic->flags.enabled); mp_register_lapic(physid, lapic->lapic_flags & ACPI_MADT_ENABLED);
/* /*
* If mp_register_lapic successfully generates a new logical cpu * If mp_register_lapic successfully generates a new logical cpu
...@@ -619,36 +620,30 @@ acpi_scan_rsdp(unsigned long start, unsigned long length) ...@@ -619,36 +620,30 @@ acpi_scan_rsdp(unsigned long start, unsigned long length)
return 0; return 0;
} }
static int __init acpi_parse_sbf(struct acpi_table_header *header) static int __init acpi_parse_sbf(struct acpi_table_header *table)
{ {
struct acpi_table_sbf *sb; struct acpi_table_boot *sb;
if (!header)
return -EINVAL;
sb = (struct acpi_table_sbf *)header; sb = (struct acpi_table_boot *)table;
if (!sb) { if (!sb) {
printk(KERN_WARNING PREFIX "Unable to map SBF\n"); printk(KERN_WARNING PREFIX "Unable to map SBF\n");
return -ENODEV; return -ENODEV;
} }
sbf_port = sb->sbf_cmos; /* Save CMOS port */ sbf_port = sb->cmos_index; /* Save CMOS port */
return 0; return 0;
} }
#ifdef CONFIG_HPET_TIMER #ifdef CONFIG_HPET_TIMER
static int __init acpi_parse_hpet(struct acpi_table_header *header) static int __init acpi_parse_hpet(struct acpi_table_header *table)
{ {
struct acpi_table_hpet *hpet_tbl; struct acpi_table_hpet *hpet_tbl;
struct resource *hpet_res; struct resource *hpet_res;
resource_size_t res_start; resource_size_t res_start;
if (!header) hpet_tbl = (struct acpi_table_hpet *)table;
return -EINVAL;
hpet_tbl = (struct acpi_table_hpet *)header;
if (!hpet_tbl) { if (!hpet_tbl) {
printk(KERN_WARNING PREFIX "Unable to map HPET\n"); printk(KERN_WARNING PREFIX "Unable to map HPET\n");
return -ENODEV; return -ENODEV;
...@@ -706,35 +701,28 @@ static int __init acpi_parse_hpet(struct acpi_table_header *header) ...@@ -706,35 +701,28 @@ static int __init acpi_parse_hpet(struct acpi_table_header *header)
extern u32 pmtmr_ioport; extern u32 pmtmr_ioport;
#endif #endif
static int __init acpi_parse_fadt(struct acpi_table_header *header) static int __init acpi_parse_fadt(struct acpi_table_header *table)
{ {
struct acpi_table_fadt *fadt = NULL;
fadt = (struct acpi_table_fadt *)header;
if (!fadt) {
printk(KERN_WARNING PREFIX "Unable to map FADT\n");
return 0;
}
#ifdef CONFIG_X86_PM_TIMER #ifdef CONFIG_X86_PM_TIMER
/* detect the location of the ACPI PM Timer */ /* detect the location of the ACPI PM Timer */
if (fadt->header.revision >= FADT2_REVISION_ID) { if (acpi_gbl_FADT.header.revision >= FADT2_REVISION_ID) {
/* FADT rev. 2 */ /* FADT rev. 2 */
if (fadt->xpm_timer_block.space_id != if (acpi_gbl_FADT.xpm_timer_block.space_id !=
ACPI_ADR_SPACE_SYSTEM_IO) ACPI_ADR_SPACE_SYSTEM_IO)
return 0; return 0;
pmtmr_ioport = fadt->xpm_timer_block.address; pmtmr_ioport = acpi_gbl_FADT.xpm_timer_block.address;
/* /*
* "X" fields are optional extensions to the original V1.0 * "X" fields are optional extensions to the original V1.0
* fields, so we must selectively expand V1.0 fields if the * fields, so we must selectively expand V1.0 fields if the
* corresponding X field is zero. * corresponding X field is zero.
*/ */
if (!pmtmr_ioport) if (!pmtmr_ioport)
pmtmr_ioport = fadt->pm_timer_block; pmtmr_ioport = acpi_gbl_FADT.pm_timer_block;
} else { } else {
/* FADT rev. 1 */ /* FADT rev. 1 */
pmtmr_ioport = fadt->pm_timer_block; pmtmr_ioport = acpi_gbl_FADT.pm_timer_block;
} }
if (pmtmr_ioport) if (pmtmr_ioport)
printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n", printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n",
...@@ -776,13 +764,13 @@ static int __init acpi_parse_madt_lapic_entries(void) ...@@ -776,13 +764,13 @@ static int __init acpi_parse_madt_lapic_entries(void)
if (!cpu_has_apic) if (!cpu_has_apic)
return -ENODEV; return -ENODEV;
/* /*
* Note that the LAPIC address is obtained from the MADT (32-bit value) * Note that the LAPIC address is obtained from the MADT (32-bit value)
* and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value). * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).
*/ */
count = count =
acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR, acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE,
acpi_parse_lapic_addr_ovr, 0); acpi_parse_lapic_addr_ovr, 0);
if (count < 0) { if (count < 0) {
printk(KERN_ERR PREFIX printk(KERN_ERR PREFIX
...@@ -792,7 +780,7 @@ static int __init acpi_parse_madt_lapic_entries(void) ...@@ -792,7 +780,7 @@ static int __init acpi_parse_madt_lapic_entries(void)
mp_register_lapic_address(acpi_lapic_addr); mp_register_lapic_address(acpi_lapic_addr);
count = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic, count = acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC, acpi_parse_lapic,
MAX_APICS); MAX_APICS);
if (!count) { if (!count) {
printk(KERN_ERR PREFIX "No LAPIC entries present\n"); printk(KERN_ERR PREFIX "No LAPIC entries present\n");
...@@ -805,7 +793,7 @@ static int __init acpi_parse_madt_lapic_entries(void) ...@@ -805,7 +793,7 @@ static int __init acpi_parse_madt_lapic_entries(void)
} }
count = count =
acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0); acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_NMI, acpi_parse_lapic_nmi, 0);
if (count < 0) { if (count < 0) {
printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
/* TBD: Cleanup to allow fallback to MPS */ /* TBD: Cleanup to allow fallback to MPS */
...@@ -834,7 +822,7 @@ static int __init acpi_parse_madt_ioapic_entries(void) ...@@ -834,7 +822,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)
return -ENODEV; return -ENODEV;
} }
if (!cpu_has_apic) if (!cpu_has_apic)
return -ENODEV; return -ENODEV;
/* /*
...@@ -847,7 +835,7 @@ static int __init acpi_parse_madt_ioapic_entries(void) ...@@ -847,7 +835,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)
} }
count = count =
acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic, acpi_table_parse_madt(ACPI_MADT_TYPE_IO_APIC, acpi_parse_ioapic,
MAX_IO_APICS); MAX_IO_APICS);
if (!count) { if (!count) {
printk(KERN_ERR PREFIX "No IOAPIC entries present\n"); printk(KERN_ERR PREFIX "No IOAPIC entries present\n");
...@@ -858,7 +846,7 @@ static int __init acpi_parse_madt_ioapic_entries(void) ...@@ -858,7 +846,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)
} }
count = count =
acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, acpi_table_parse_madt(ACPI_MADT_TYPE_INTERRUPT_OVERRIDE, acpi_parse_int_src_ovr,
NR_IRQ_VECTORS); NR_IRQ_VECTORS);
if (count < 0) { if (count < 0) {
printk(KERN_ERR PREFIX printk(KERN_ERR PREFIX
...@@ -878,7 +866,7 @@ static int __init acpi_parse_madt_ioapic_entries(void) ...@@ -878,7 +866,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)
mp_config_acpi_legacy_irqs(); mp_config_acpi_legacy_irqs();
count = count =
acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE, acpi_parse_nmi_src,
NR_IRQ_VECTORS); NR_IRQ_VECTORS);
if (count < 0) { if (count < 0) {
printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n"); printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
...@@ -900,7 +888,7 @@ static void __init acpi_process_madt(void) ...@@ -900,7 +888,7 @@ static void __init acpi_process_madt(void)
#ifdef CONFIG_X86_LOCAL_APIC #ifdef CONFIG_X86_LOCAL_APIC
int count, error; int count, error;
count = acpi_table_parse("APIC", acpi_parse_madt); count = acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt);
if (count >= 1) { if (count >= 1) {
/* /*
...@@ -1187,7 +1175,7 @@ int __init acpi_boot_table_init(void) ...@@ -1187,7 +1175,7 @@ int __init acpi_boot_table_init(void)
if (acpi_disabled && !acpi_ht) if (acpi_disabled && !acpi_ht)
return 1; return 1;
/* /*
* Initialize the ACPI boot-time table parser. * Initialize the ACPI boot-time table parser.
*/ */
error = acpi_table_init(); error = acpi_table_init();
...@@ -1196,7 +1184,7 @@ int __init acpi_boot_table_init(void) ...@@ -1196,7 +1184,7 @@ int __init acpi_boot_table_init(void)
return error; return error;
} }
acpi_table_parse("BOOT", acpi_parse_sbf); acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
/* /*
* blacklist may disable ACPI entirely * blacklist may disable ACPI entirely
...@@ -1224,7 +1212,7 @@ int __init acpi_boot_init(void) ...@@ -1224,7 +1212,7 @@ int __init acpi_boot_init(void)
if (acpi_disabled && !acpi_ht) if (acpi_disabled && !acpi_ht)
return 1; return 1;
acpi_table_parse("BOOT", acpi_parse_sbf); acpi_table_parse(ACPI_SIG_BOOT, acpi_parse_sbf);
/* /*
* set sci_int and PM timer address * set sci_int and PM timer address
...@@ -1236,7 +1224,7 @@ int __init acpi_boot_init(void) ...@@ -1236,7 +1224,7 @@ int __init acpi_boot_init(void)
*/ */
acpi_process_madt(); acpi_process_madt();
acpi_table_parse("HPET", acpi_parse_hpet); acpi_table_parse(ACPI_SIG_HPET, acpi_parse_hpet);
return 0; return 0;
} }
...@@ -1307,13 +1295,17 @@ static int __init setup_acpi_sci(char *s) ...@@ -1307,13 +1295,17 @@ static int __init setup_acpi_sci(char *s)
if (!s) if (!s)
return -EINVAL; return -EINVAL;
if (!strcmp(s, "edge")) if (!strcmp(s, "edge"))
acpi_sci_flags.trigger = 1; acpi_sci_flags = ACPI_MADT_TRIGGER_EDGE |
(acpi_sci_flags & ~ACPI_MADT_TRIGGER_MASK);
else if (!strcmp(s, "level")) else if (!strcmp(s, "level"))
acpi_sci_flags.trigger = 3; acpi_sci_flags = ACPI_MADT_TRIGGER_LEVEL |
(acpi_sci_flags & ~ACPI_MADT_TRIGGER_MASK);
else if (!strcmp(s, "high")) else if (!strcmp(s, "high"))
acpi_sci_flags.polarity = 1; acpi_sci_flags = ACPI_MADT_POLARITY_ACTIVE_HIGH |
(acpi_sci_flags & ~ACPI_MADT_POLARITY_MASK);
else if (!strcmp(s, "low")) else if (!strcmp(s, "low"))
acpi_sci_flags.polarity = 3; acpi_sci_flags = ACPI_MADT_POLARITY_ACTIVE_LOW |
(acpi_sci_flags & ~ACPI_MADT_POLARITY_MASK);
else else
return -EINVAL; return -EINVAL;
return 0; return 0;
......
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
#define BAD_MADT_ENTRY(entry, end) ( \ #define BAD_MADT_ENTRY(entry, end) ( \
(!entry) || (unsigned long)entry + sizeof(*entry) > end || \ (!entry) || (unsigned long)entry + sizeof(*entry) > end || \
((acpi_table_entry_header *)entry)->length < sizeof(*entry)) ((struct acpi_subtable_header *)entry)->length < sizeof(*entry))
#define PREFIX "ACPI: " #define PREFIX "ACPI: "
...@@ -94,7 +94,7 @@ const char *acpi_get_sysname(void) ...@@ -94,7 +94,7 @@ const char *acpi_get_sysname(void)
return "dig"; return "dig";
} }
xsdt = (struct acpi_table_xsdt *)__va(rsdp->xsdt_address); xsdt = (struct acpi_table_xsdt *)__va(rsdp->xsdt_physical_address);
hdr = &xsdt->header; hdr = &xsdt->header;
if (strncmp(hdr->signature, ACPI_SIG_XSDT, sizeof(ACPI_SIG_XSDT) - 1)) { if (strncmp(hdr->signature, ACPI_SIG_XSDT, sizeof(ACPI_SIG_XSDT) - 1)) {
printk(KERN_ERR printk(KERN_ERR
...@@ -169,12 +169,12 @@ struct acpi_table_madt *acpi_madt __initdata; ...@@ -169,12 +169,12 @@ struct acpi_table_madt *acpi_madt __initdata;
static u8 has_8259; static u8 has_8259;
static int __init static int __init
acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header, acpi_parse_lapic_addr_ovr(struct acpi_subtable_header * header,
const unsigned long end) const unsigned long end)
{ {
struct acpi_table_lapic_addr_ovr *lapic; struct acpi_madt_local_apic_override *lapic;
lapic = (struct acpi_table_lapic_addr_ovr *)header; lapic = (struct acpi_madt_local_apic_override *)header;
if (BAD_MADT_ENTRY(lapic, end)) if (BAD_MADT_ENTRY(lapic, end))
return -EINVAL; return -EINVAL;
...@@ -187,21 +187,20 @@ acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header, ...@@ -187,21 +187,20 @@ acpi_parse_lapic_addr_ovr(acpi_table_entry_header * header,
} }
static int __init static int __init
acpi_parse_lsapic(acpi_table_entry_header * header, const unsigned long end) acpi_parse_lsapic(struct acpi_subtable_header * header, const unsigned long end)
{ {
struct acpi_table_lsapic *lsapic; struct acpi_madt_local_sapic *lsapic;
lsapic = (struct acpi_table_lsapic *)header; lsapic = (struct acpi_madt_local_sapic *)header;
if (BAD_MADT_ENTRY(lsapic, end)) /*Skip BAD_MADT_ENTRY check, as lsapic size could vary */
return -EINVAL;
if (lsapic->flags.enabled) { if (lsapic->lapic_flags & ACPI_MADT_ENABLED) {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
smp_boot_data.cpu_phys_id[available_cpus] = smp_boot_data.cpu_phys_id[available_cpus] =
(lsapic->id << 8) | lsapic->eid; (lsapic->id << 8) | lsapic->eid;
#endif #endif
ia64_acpiid_to_sapicid[lsapic->acpi_id] = ia64_acpiid_to_sapicid[lsapic->processor_id] =
(lsapic->id << 8) | lsapic->eid; (lsapic->id << 8) | lsapic->eid;
++available_cpus; ++available_cpus;
} }
...@@ -211,11 +210,11 @@ acpi_parse_lsapic(acpi_table_entry_header * header, const unsigned long end) ...@@ -211,11 +210,11 @@ acpi_parse_lsapic(acpi_table_entry_header * header, const unsigned long end)
} }
static int __init static int __init
acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end) acpi_parse_lapic_nmi(struct acpi_subtable_header * header, const unsigned long end)
{ {
struct acpi_table_lapic_nmi *lacpi_nmi; struct acpi_madt_local_apic_nmi *lacpi_nmi;
lacpi_nmi = (struct acpi_table_lapic_nmi *)header; lacpi_nmi = (struct acpi_madt_local_apic_nmi *)header;
if (BAD_MADT_ENTRY(lacpi_nmi, end)) if (BAD_MADT_ENTRY(lacpi_nmi, end))
return -EINVAL; return -EINVAL;
...@@ -225,11 +224,11 @@ acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end) ...@@ -225,11 +224,11 @@ acpi_parse_lapic_nmi(acpi_table_entry_header * header, const unsigned long end)
} }
static int __init static int __init
acpi_parse_iosapic(acpi_table_entry_header * header, const unsigned long end) acpi_parse_iosapic(struct acpi_subtable_header * header, const unsigned long end)
{ {
struct acpi_table_iosapic *iosapic; struct acpi_madt_io_sapic *iosapic;
iosapic = (struct acpi_table_iosapic *)header; iosapic = (struct acpi_madt_io_sapic *)header;
if (BAD_MADT_ENTRY(iosapic, end)) if (BAD_MADT_ENTRY(iosapic, end))
return -EINVAL; return -EINVAL;
...@@ -240,13 +239,13 @@ acpi_parse_iosapic(acpi_table_entry_header * header, const unsigned long end) ...@@ -240,13 +239,13 @@ acpi_parse_iosapic(acpi_table_entry_header * header, const unsigned long end)
static unsigned int __initdata acpi_madt_rev; static unsigned int __initdata acpi_madt_rev;
static int __init static int __init
acpi_parse_plat_int_src(acpi_table_entry_header * header, acpi_parse_plat_int_src(struct acpi_subtable_header * header,
const unsigned long end) const unsigned long end)
{ {
struct acpi_table_plat_int_src *plintsrc; struct acpi_madt_interrupt_source *plintsrc;
int vector; int vector;
plintsrc = (struct acpi_table_plat_int_src *)header; plintsrc = (struct acpi_madt_interrupt_source *)header;
if (BAD_MADT_ENTRY(plintsrc, end)) if (BAD_MADT_ENTRY(plintsrc, end))
return -EINVAL; return -EINVAL;
...@@ -257,19 +256,19 @@ acpi_parse_plat_int_src(acpi_table_entry_header * header, ...@@ -257,19 +256,19 @@ acpi_parse_plat_int_src(acpi_table_entry_header * header,
*/ */
vector = iosapic_register_platform_intr(plintsrc->type, vector = iosapic_register_platform_intr(plintsrc->type,
plintsrc->global_irq, plintsrc->global_irq,
plintsrc->iosapic_vector, plintsrc->io_sapic_vector,
plintsrc->eid, plintsrc->eid,
plintsrc->id, plintsrc->id,
(plintsrc->flags.polarity == ((plintsrc->inti_flags & ACPI_MADT_POLARITY_MASK) ==
1) ? IOSAPIC_POL_HIGH : ACPI_MADT_POLARITY_ACTIVE_HIGH) ?
IOSAPIC_POL_LOW, IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
(plintsrc->flags.trigger == ((plintsrc->inti_flags & ACPI_MADT_TRIGGER_MASK) ==
1) ? IOSAPIC_EDGE : ACPI_MADT_TRIGGER_EDGE) ?
IOSAPIC_LEVEL); IOSAPIC_EDGE : IOSAPIC_LEVEL);
platform_intr_list[plintsrc->type] = vector; platform_intr_list[plintsrc->type] = vector;
if (acpi_madt_rev > 1) { if (acpi_madt_rev > 1) {
acpi_cpei_override = plintsrc->plint_flags.cpei_override_flag; acpi_cpei_override = plintsrc->flags & ACPI_MADT_CPEI_OVERRIDE;
} }
/* /*
...@@ -324,30 +323,32 @@ unsigned int get_cpei_target_cpu(void) ...@@ -324,30 +323,32 @@ unsigned int get_cpei_target_cpu(void)
} }
static int __init static int __init
acpi_parse_int_src_ovr(acpi_table_entry_header * header, acpi_parse_int_src_ovr(struct acpi_subtable_header * header,
const unsigned long end) const unsigned long end)
{ {
struct acpi_table_int_src_ovr *p; struct acpi_madt_interrupt_override *p;
p = (struct acpi_table_int_src_ovr *)header; p = (struct acpi_madt_interrupt_override *)header;
if (BAD_MADT_ENTRY(p, end)) if (BAD_MADT_ENTRY(p, end))
return -EINVAL; return -EINVAL;
iosapic_override_isa_irq(p->bus_irq, p->global_irq, iosapic_override_isa_irq(p->source_irq, p->global_irq,
(p->flags.polarity == ((p->inti_flags & ACPI_MADT_POLARITY_MASK) ==
1) ? IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW, ACPI_MADT_POLARITY_ACTIVE_HIGH) ?
(p->flags.trigger == IOSAPIC_POL_HIGH : IOSAPIC_POL_LOW,
1) ? IOSAPIC_EDGE : IOSAPIC_LEVEL); ((p->inti_flags & ACPI_MADT_TRIGGER_MASK) ==
ACPI_MADT_TRIGGER_EDGE) ?
IOSAPIC_EDGE : IOSAPIC_LEVEL);
return 0; return 0;
} }
static int __init static int __init
acpi_parse_nmi_src(acpi_table_entry_header * header, const unsigned long end) acpi_parse_nmi_src(struct acpi_subtable_header * header, const unsigned long end)
{ {
struct acpi_table_nmi_src *nmi_src; struct acpi_madt_nmi_source *nmi_src;
nmi_src = (struct acpi_table_nmi_src *)header; nmi_src = (struct acpi_madt_nmi_source *)header;
if (BAD_MADT_ENTRY(nmi_src, end)) if (BAD_MADT_ENTRY(nmi_src, end))
return -EINVAL; return -EINVAL;
...@@ -371,12 +372,12 @@ static void __init acpi_madt_oem_check(char *oem_id, char *oem_table_id) ...@@ -371,12 +372,12 @@ static void __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
} }
} }
static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size) static int __init acpi_parse_madt(struct acpi_table_header *table)
{ {
if (!phys_addr || !size) if (!table)
return -EINVAL; return -EINVAL;
acpi_madt = (struct acpi_table_madt *)__va(phys_addr); acpi_madt = (struct acpi_table_madt *)table;
acpi_madt_rev = acpi_madt->header.revision; acpi_madt_rev = acpi_madt->header.revision;
...@@ -384,14 +385,14 @@ static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size) ...@@ -384,14 +385,14 @@ static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
#ifdef CONFIG_ITANIUM #ifdef CONFIG_ITANIUM
has_8259 = 1; /* Firmware on old Itanium systems is broken */ has_8259 = 1; /* Firmware on old Itanium systems is broken */
#else #else
has_8259 = acpi_madt->flags.pcat_compat; has_8259 = acpi_madt->flags & ACPI_MADT_PCAT_COMPAT;
#endif #endif
iosapic_system_init(has_8259); iosapic_system_init(has_8259);
/* Get base address of IPI Message Block */ /* Get base address of IPI Message Block */
if (acpi_madt->lapic_address) if (acpi_madt->address)
ipi_base_addr = ioremap(acpi_madt->lapic_address, 0); ipi_base_addr = ioremap(acpi_madt->address, 0);
printk(KERN_INFO PREFIX "Local APIC address %p\n", ipi_base_addr); printk(KERN_INFO PREFIX "Local APIC address %p\n", ipi_base_addr);
...@@ -413,23 +414,24 @@ static u32 __devinitdata pxm_flag[PXM_FLAG_LEN]; ...@@ -413,23 +414,24 @@ static u32 __devinitdata pxm_flag[PXM_FLAG_LEN];
#define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag)) #define pxm_bit_test(bit) (test_bit(bit,(void *)pxm_flag))
static struct acpi_table_slit __initdata *slit_table; static struct acpi_table_slit __initdata *slit_table;
static int get_processor_proximity_domain(struct acpi_table_processor_affinity *pa) static int get_processor_proximity_domain(struct acpi_srat_cpu_affinity *pa)
{ {
int pxm; int pxm;
pxm = pa->proximity_domain; pxm = pa->proximity_domain_lo;
if (ia64_platform_is("sn2")) if (ia64_platform_is("sn2"))
pxm += pa->reserved[0] << 8; pxm += pa->proximity_domain_hi[0] << 8;
return pxm; return pxm;
} }
static int get_memory_proximity_domain(struct acpi_table_memory_affinity *ma) static int get_memory_proximity_domain(struct acpi_srat_mem_affinity *ma)
{ {
int pxm; int pxm;
pxm = ma->proximity_domain; pxm = ma->proximity_domain;
if (ia64_platform_is("sn2")) if (ia64_platform_is("sn2"))
pxm += ma->reserved1[0] << 8; pxm += ma->reserved << 8;
return pxm; return pxm;
} }
...@@ -442,7 +444,7 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit) ...@@ -442,7 +444,7 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
u32 len; u32 len;
len = sizeof(struct acpi_table_header) + 8 len = sizeof(struct acpi_table_header) + 8
+ slit->localities * slit->localities; + slit->locality_count * slit->locality_count;
if (slit->header.length != len) { if (slit->header.length != len) {
printk(KERN_ERR printk(KERN_ERR
"ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n", "ACPI 2.0 SLIT: size mismatch: %d expected, %d actual\n",
...@@ -454,11 +456,11 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit) ...@@ -454,11 +456,11 @@ void __init acpi_numa_slit_init(struct acpi_table_slit *slit)
} }
void __init void __init
acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa) acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
{ {
int pxm; int pxm;
if (!pa->flags.enabled) if (!(pa->flags & ACPI_SRAT_CPU_ENABLED))
return; return;
pxm = get_processor_proximity_domain(pa); pxm = get_processor_proximity_domain(pa);
...@@ -467,14 +469,14 @@ acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa) ...@@ -467,14 +469,14 @@ acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa)
pxm_bit_set(pxm); pxm_bit_set(pxm);
node_cpuid[srat_num_cpus].phys_id = node_cpuid[srat_num_cpus].phys_id =
(pa->apic_id << 8) | (pa->lsapic_eid); (pa->apic_id << 8) | (pa->local_sapic_eid);
/* nid should be overridden as logical node id later */ /* nid should be overridden as logical node id later */
node_cpuid[srat_num_cpus].nid = pxm; node_cpuid[srat_num_cpus].nid = pxm;
srat_num_cpus++; srat_num_cpus++;
} }
void __init void __init
acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma) acpi_numa_memory_affinity_init(struct acpi_srat_mem_affinity *ma)
{ {
unsigned long paddr, size; unsigned long paddr, size;
int pxm; int pxm;
...@@ -483,13 +485,11 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma) ...@@ -483,13 +485,11 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
pxm = get_memory_proximity_domain(ma); pxm = get_memory_proximity_domain(ma);
/* fill node memory chunk structure */ /* fill node memory chunk structure */
paddr = ma->base_addr_hi; paddr = ma->base_address;
paddr = (paddr << 32) | ma->base_addr_lo; size = ma->length;
size = ma->length_hi;
size = (size << 32) | ma->length_lo;
/* Ignore disabled entries */ /* Ignore disabled entries */
if (!ma->flags.enabled) if (!(ma->flags & ACPI_SRAT_MEM_ENABLED))
return; return;
/* record this node in proximity bitmap */ /* record this node in proximity bitmap */
...@@ -560,16 +560,16 @@ void __init acpi_numa_arch_fixup(void) ...@@ -560,16 +560,16 @@ void __init acpi_numa_arch_fixup(void)
if (!slit_table) if (!slit_table)
return; return;
memset(numa_slit, -1, sizeof(numa_slit)); memset(numa_slit, -1, sizeof(numa_slit));
for (i = 0; i < slit_table->localities; i++) { for (i = 0; i < slit_table->locality_count; i++) {
if (!pxm_bit_test(i)) if (!pxm_bit_test(i))
continue; continue;
node_from = pxm_to_node(i); node_from = pxm_to_node(i);
for (j = 0; j < slit_table->localities; j++) { for (j = 0; j < slit_table->locality_count; j++) {
if (!pxm_bit_test(j)) if (!pxm_bit_test(j))
continue; continue;
node_to = pxm_to_node(j); node_to = pxm_to_node(j);
node_distance(node_from, node_to) = node_distance(node_from, node_to) =
slit_table->entry[i * slit_table->localities + j]; slit_table->entry[i * slit_table->locality_count + j];
} }
} }
...@@ -614,15 +614,15 @@ void acpi_unregister_gsi(u32 gsi) ...@@ -614,15 +614,15 @@ void acpi_unregister_gsi(u32 gsi)
EXPORT_SYMBOL(acpi_unregister_gsi); EXPORT_SYMBOL(acpi_unregister_gsi);
static int __init acpi_parse_fadt(unsigned long phys_addr, unsigned long size) static int __init acpi_parse_fadt(struct acpi_table_header *table)
{ {
struct acpi_table_header *fadt_header; struct acpi_table_header *fadt_header;
struct acpi_table_fadt *fadt; struct acpi_table_fadt *fadt;
if (!phys_addr || !size) if (!table)
return -EINVAL; return -EINVAL;
fadt_header = (struct acpi_table_header *)__va(phys_addr); fadt_header = (struct acpi_table_header *)table;
if (fadt_header->revision != 3) if (fadt_header->revision != 3)
return -ENODEV; /* Only deal with ACPI 2.0 FADT */ return -ENODEV; /* Only deal with ACPI 2.0 FADT */
...@@ -655,7 +655,7 @@ int __init acpi_boot_init(void) ...@@ -655,7 +655,7 @@ int __init acpi_boot_init(void)
* information -- the successor to MPS tables. * information -- the successor to MPS tables.
*/ */
if (acpi_table_parse(ACPI_APIC, acpi_parse_madt) < 1) { if (acpi_table_parse(ACPI_SIG_MADT, acpi_parse_madt) < 1) {
printk(KERN_ERR PREFIX "Can't find MADT\n"); printk(KERN_ERR PREFIX "Can't find MADT\n");
goto skip_madt; goto skip_madt;
} }
...@@ -663,40 +663,40 @@ int __init acpi_boot_init(void) ...@@ -663,40 +663,40 @@ int __init acpi_boot_init(void)
/* Local APIC */ /* Local APIC */
if (acpi_table_parse_madt if (acpi_table_parse_madt
(ACPI_MADT_LAPIC_ADDR_OVR, acpi_parse_lapic_addr_ovr, 0) < 0) (ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE, acpi_parse_lapic_addr_ovr, 0) < 0)
printk(KERN_ERR PREFIX printk(KERN_ERR PREFIX
"Error parsing LAPIC address override entry\n"); "Error parsing LAPIC address override entry\n");
if (acpi_table_parse_madt(ACPI_MADT_LSAPIC, acpi_parse_lsapic, NR_CPUS) if (acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_SAPIC, acpi_parse_lsapic, NR_CPUS)
< 1) < 1)
printk(KERN_ERR PREFIX printk(KERN_ERR PREFIX
"Error parsing MADT - no LAPIC entries\n"); "Error parsing MADT - no LAPIC entries\n");
if (acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0) if (acpi_table_parse_madt(ACPI_MADT_TYPE_LOCAL_APIC_NMI, acpi_parse_lapic_nmi, 0)
< 0) < 0)
printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n"); printk(KERN_ERR PREFIX "Error parsing LAPIC NMI entry\n");
/* I/O APIC */ /* I/O APIC */
if (acpi_table_parse_madt if (acpi_table_parse_madt
(ACPI_MADT_IOSAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1) (ACPI_MADT_TYPE_IO_SAPIC, acpi_parse_iosapic, NR_IOSAPICS) < 1)
printk(KERN_ERR PREFIX printk(KERN_ERR PREFIX
"Error parsing MADT - no IOSAPIC entries\n"); "Error parsing MADT - no IOSAPIC entries\n");
/* System-Level Interrupt Routing */ /* System-Level Interrupt Routing */
if (acpi_table_parse_madt if (acpi_table_parse_madt
(ACPI_MADT_PLAT_INT_SRC, acpi_parse_plat_int_src, (ACPI_MADT_TYPE_INTERRUPT_SOURCE, acpi_parse_plat_int_src,
ACPI_MAX_PLATFORM_INTERRUPTS) < 0) ACPI_MAX_PLATFORM_INTERRUPTS) < 0)
printk(KERN_ERR PREFIX printk(KERN_ERR PREFIX
"Error parsing platform interrupt source entry\n"); "Error parsing platform interrupt source entry\n");
if (acpi_table_parse_madt if (acpi_table_parse_madt
(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr, 0) < 0) (ACPI_MADT_TYPE_INTERRUPT_OVERRIDE, acpi_parse_int_src_ovr, 0) < 0)
printk(KERN_ERR PREFIX printk(KERN_ERR PREFIX
"Error parsing interrupt source overrides entry\n"); "Error parsing interrupt source overrides entry\n");
if (acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src, 0) < 0) if (acpi_table_parse_madt(ACPI_MADT_TYPE_NMI_SOURCE, acpi_parse_nmi_src, 0) < 0)
printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n"); printk(KERN_ERR PREFIX "Error parsing NMI SRC entry\n");
skip_madt: skip_madt:
...@@ -706,7 +706,7 @@ int __init acpi_boot_init(void) ...@@ -706,7 +706,7 @@ int __init acpi_boot_init(void)
* gets interrupts such as power and sleep buttons. If it's not * gets interrupts such as power and sleep buttons. If it's not
* on a Legacy interrupt, it needs to be setup. * on a Legacy interrupt, it needs to be setup.
*/ */
if (acpi_table_parse(ACPI_FADT, acpi_parse_fadt) < 1) if (acpi_table_parse(ACPI_SIG_FADT, acpi_parse_fadt) < 1)
printk(KERN_ERR PREFIX "Can't find FADT\n"); printk(KERN_ERR PREFIX "Can't find FADT\n");
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
...@@ -839,7 +839,7 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu) ...@@ -839,7 +839,7 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
{ {
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *obj; union acpi_object *obj;
struct acpi_table_lsapic *lsapic; struct acpi_madt_local_sapic *lsapic;
cpumask_t tmp_map; cpumask_t tmp_map;
long physid; long physid;
int cpu; int cpu;
...@@ -851,16 +851,16 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu) ...@@ -851,16 +851,16 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
return -EINVAL; return -EINVAL;
obj = buffer.pointer; obj = buffer.pointer;
if (obj->type != ACPI_TYPE_BUFFER || if (obj->type != ACPI_TYPE_BUFFER)
obj->buffer.length < sizeof(*lsapic)) { {
kfree(buffer.pointer); kfree(buffer.pointer);
return -EINVAL; return -EINVAL;
} }
lsapic = (struct acpi_table_lsapic *)obj->buffer.pointer; lsapic = (struct acpi_madt_local_sapic *)obj->buffer.pointer;
if ((lsapic->header.type != ACPI_MADT_LSAPIC) || if ((lsapic->header.type != ACPI_MADT_TYPE_LOCAL_SAPIC) ||
(!lsapic->flags.enabled)) { (!lsapic->lapic_flags & ACPI_MADT_ENABLED)) {
kfree(buffer.pointer); kfree(buffer.pointer);
return -EINVAL; return -EINVAL;
} }
...@@ -880,7 +880,7 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu) ...@@ -880,7 +880,7 @@ int acpi_map_lsapic(acpi_handle handle, int *pcpu)
cpu_set(cpu, cpu_present_map); cpu_set(cpu, cpu_present_map);
ia64_cpu_to_sapicid[cpu] = physid; ia64_cpu_to_sapicid[cpu] = physid;
ia64_acpiid_to_sapicid[lsapic->acpi_id] = ia64_cpu_to_sapicid[cpu]; ia64_acpiid_to_sapicid[lsapic->processor_id] = ia64_cpu_to_sapicid[cpu];
*pcpu = cpu; *pcpu = cpu;
return (0); return (0);
...@@ -917,7 +917,7 @@ acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret) ...@@ -917,7 +917,7 @@ acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
{ {
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
union acpi_object *obj; union acpi_object *obj;
struct acpi_table_iosapic *iosapic; struct acpi_madt_io_sapic *iosapic;
unsigned int gsi_base; unsigned int gsi_base;
int pxm, node; int pxm, node;
...@@ -935,9 +935,9 @@ acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret) ...@@ -935,9 +935,9 @@ acpi_map_iosapic(acpi_handle handle, u32 depth, void *context, void **ret)
return AE_OK; return AE_OK;
} }
iosapic = (struct acpi_table_iosapic *)obj->buffer.pointer; iosapic = (struct acpi_madt_io_sapic *)obj->buffer.pointer;
if (iosapic->header.type != ACPI_MADT_IOSAPIC) { if (iosapic->header.type != ACPI_MADT_TYPE_IO_SAPIC) {
kfree(buffer.pointer); kfree(buffer.pointer);
return AE_OK; return AE_OK;
} }
......
...@@ -620,15 +620,16 @@ void __init acpi_early_init(void) ...@@ -620,15 +620,16 @@ void __init acpi_early_init(void)
#ifdef CONFIG_X86 #ifdef CONFIG_X86
if (!acpi_ioapic) { if (!acpi_ioapic) {
extern acpi_interrupt_flags acpi_sci_flags; extern u8 acpi_sci_flags;
/* compatible (0) means level (3) */ /* compatible (0) means level (3) */
if (acpi_sci_flags.trigger == 0) if (!(acpi_sci_flags & ACPI_MADT_TRIGGER_MASK)) {
acpi_sci_flags.trigger = 3; acpi_sci_flags &= ~ACPI_MADT_TRIGGER_MASK;
acpi_sci_flags |= ACPI_MADT_TRIGGER_LEVEL;
}
/* Set PIC-mode SCI trigger type */ /* Set PIC-mode SCI trigger type */
acpi_pic_sci_set_trigger(acpi_gbl_FADT.sci_interrupt, acpi_pic_sci_set_trigger(acpi_gbl_FADT.sci_interrupt,
acpi_sci_flags.trigger); (acpi_sci_flags & ACPI_MADT_TRIGGER_MASK) >> 2);
} else { } else {
extern int acpi_sci_override_gsi; extern int acpi_sci_override_gsi;
/* /*
......
...@@ -43,90 +43,92 @@ static char *mps_inti_flags_trigger[] = { "dfl", "edge", "res", "level" }; ...@@ -43,90 +43,92 @@ static char *mps_inti_flags_trigger[] = { "dfl", "edge", "res", "level" };
static struct acpi_table_desc initial_tables[ACPI_MAX_TABLES] __initdata; static struct acpi_table_desc initial_tables[ACPI_MAX_TABLES] __initdata;
void acpi_table_print_madt_entry(acpi_table_entry_header * header) void acpi_table_print_madt_entry(struct acpi_subtable_header * header)
{ {
if (!header) if (!header)
return; return;
switch (header->type) { switch (header->type) {
case ACPI_MADT_LAPIC: case ACPI_MADT_TYPE_LOCAL_APIC:
{ {
struct acpi_table_lapic *p = struct acpi_madt_local_apic *p =
(struct acpi_table_lapic *)header; (struct acpi_madt_local_apic *)header;
printk(KERN_INFO PREFIX printk(KERN_INFO PREFIX
"LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n", "LAPIC (acpi_id[0x%02x] lapic_id[0x%02x] %s)\n",
p->acpi_id, p->id, p->processor_id, p->id,
p->flags.enabled ? "enabled" : "disabled"); (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
} }
break; break;
case ACPI_MADT_IOAPIC: case ACPI_MADT_TYPE_IO_APIC:
{ {
struct acpi_table_ioapic *p = struct acpi_madt_io_apic *p =
(struct acpi_table_ioapic *)header; (struct acpi_madt_io_apic *)header;
printk(KERN_INFO PREFIX printk(KERN_INFO PREFIX
"IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n", "IOAPIC (id[0x%02x] address[0x%08x] gsi_base[%d])\n",
p->id, p->address, p->global_irq_base); p->id, p->address, p->global_irq_base);
} }
break; break;
case ACPI_MADT_INT_SRC_OVR: case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
{ {
struct acpi_table_int_src_ovr *p = struct acpi_madt_interrupt_override *p =
(struct acpi_table_int_src_ovr *)header; (struct acpi_madt_interrupt_override *)header;
printk(KERN_INFO PREFIX printk(KERN_INFO PREFIX
"INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n", "INT_SRC_OVR (bus %d bus_irq %d global_irq %d %s %s)\n",
p->bus, p->bus_irq, p->global_irq, p->bus, p->source_irq, p->global_irq,
mps_inti_flags_polarity[p->flags.polarity], mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK],
mps_inti_flags_trigger[p->flags.trigger]); mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2]);
if (p->flags.reserved) if (p->inti_flags &
~(ACPI_MADT_POLARITY_MASK | ACPI_MADT_TRIGGER_MASK))
printk(KERN_INFO PREFIX printk(KERN_INFO PREFIX
"INT_SRC_OVR unexpected reserved flags: 0x%x\n", "INT_SRC_OVR unexpected reserved flags: 0x%x\n",
p->flags.reserved); p->inti_flags &
~(ACPI_MADT_POLARITY_MASK | ACPI_MADT_TRIGGER_MASK));
} }
break; break;
case ACPI_MADT_NMI_SRC: case ACPI_MADT_TYPE_NMI_SOURCE:
{ {
struct acpi_table_nmi_src *p = struct acpi_madt_nmi_source *p =
(struct acpi_table_nmi_src *)header; (struct acpi_madt_nmi_source *)header;
printk(KERN_INFO PREFIX printk(KERN_INFO PREFIX
"NMI_SRC (%s %s global_irq %d)\n", "NMI_SRC (%s %s global_irq %d)\n",
mps_inti_flags_polarity[p->flags.polarity], mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK],
mps_inti_flags_trigger[p->flags.trigger], mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2],
p->global_irq); p->global_irq);
} }
break; break;
case ACPI_MADT_LAPIC_NMI: case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
{ {
struct acpi_table_lapic_nmi *p = struct acpi_madt_local_apic_nmi *p =
(struct acpi_table_lapic_nmi *)header; (struct acpi_madt_local_apic_nmi *)header;
printk(KERN_INFO PREFIX printk(KERN_INFO PREFIX
"LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n", "LAPIC_NMI (acpi_id[0x%02x] %s %s lint[0x%x])\n",
p->acpi_id, p->processor_id,
mps_inti_flags_polarity[p->flags.polarity], mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK ],
mps_inti_flags_trigger[p->flags.trigger], mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2],
p->lint); p->lint);
} }
break; break;
case ACPI_MADT_LAPIC_ADDR_OVR: case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
{ {
struct acpi_table_lapic_addr_ovr *p = struct acpi_madt_local_apic_override *p =
(struct acpi_table_lapic_addr_ovr *)header; (struct acpi_madt_local_apic_override *)header;
printk(KERN_INFO PREFIX printk(KERN_INFO PREFIX
"LAPIC_ADDR_OVR (address[%p])\n", "LAPIC_ADDR_OVR (address[%p])\n",
(void *)(unsigned long)p->address); (void *)(unsigned long)p->address);
} }
break; break;
case ACPI_MADT_IOSAPIC: case ACPI_MADT_TYPE_IO_SAPIC:
{ {
struct acpi_table_iosapic *p = struct acpi_madt_io_sapic *p =
(struct acpi_table_iosapic *)header; (struct acpi_madt_io_sapic *)header;
printk(KERN_INFO PREFIX printk(KERN_INFO PREFIX
"IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n", "IOSAPIC (id[0x%x] address[%p] gsi_base[%d])\n",
p->id, (void *)(unsigned long)p->address, p->id, (void *)(unsigned long)p->address,
...@@ -134,26 +136,26 @@ void acpi_table_print_madt_entry(acpi_table_entry_header * header) ...@@ -134,26 +136,26 @@ void acpi_table_print_madt_entry(acpi_table_entry_header * header)
} }
break; break;
case ACPI_MADT_LSAPIC: case ACPI_MADT_TYPE_LOCAL_SAPIC:
{ {
struct acpi_table_lsapic *p = struct acpi_madt_local_sapic *p =
(struct acpi_table_lsapic *)header; (struct acpi_madt_local_sapic *)header;
printk(KERN_INFO PREFIX printk(KERN_INFO PREFIX
"LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n", "LSAPIC (acpi_id[0x%02x] lsapic_id[0x%02x] lsapic_eid[0x%02x] %s)\n",
p->acpi_id, p->id, p->eid, p->processor_id, p->id, p->eid,
p->flags.enabled ? "enabled" : "disabled"); (p->lapic_flags & ACPI_MADT_ENABLED) ? "enabled" : "disabled");
} }
break; break;
case ACPI_MADT_PLAT_INT_SRC: case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
{ {
struct acpi_table_plat_int_src *p = struct acpi_madt_interrupt_source *p =
(struct acpi_table_plat_int_src *)header; (struct acpi_madt_interrupt_source *)header;
printk(KERN_INFO PREFIX printk(KERN_INFO PREFIX
"PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n", "PLAT_INT_SRC (%s %s type[0x%x] id[0x%04x] eid[0x%x] iosapic_vector[0x%x] global_irq[0x%x]\n",
mps_inti_flags_polarity[p->flags.polarity], mps_inti_flags_polarity[p->inti_flags & ACPI_MADT_POLARITY_MASK],
mps_inti_flags_trigger[p->flags.trigger], mps_inti_flags_trigger[(p->inti_flags & ACPI_MADT_TRIGGER_MASK) >> 2],
p->type, p->id, p->eid, p->iosapic_vector, p->type, p->id, p->eid, p->io_sapic_vector,
p->global_irq); p->global_irq);
} }
break; break;
...@@ -175,7 +177,7 @@ acpi_table_parse_madt_family(char *id, ...@@ -175,7 +177,7 @@ acpi_table_parse_madt_family(char *id,
unsigned int max_entries) unsigned int max_entries)
{ {
struct acpi_table_header *madt = NULL; struct acpi_table_header *madt = NULL;
acpi_table_entry_header *entry; struct acpi_subtable_header *entry;
unsigned int count = 0; unsigned int count = 0;
unsigned long madt_end; unsigned long madt_end;
...@@ -183,7 +185,6 @@ acpi_table_parse_madt_family(char *id, ...@@ -183,7 +185,6 @@ acpi_table_parse_madt_family(char *id,
return -EINVAL; return -EINVAL;
/* Locate the MADT (if exists). There should only be one. */ /* Locate the MADT (if exists). There should only be one. */
acpi_get_table(id, 0, &madt); acpi_get_table(id, 0, &madt);
if (!madt) { if (!madt) {
...@@ -195,17 +196,17 @@ acpi_table_parse_madt_family(char *id, ...@@ -195,17 +196,17 @@ acpi_table_parse_madt_family(char *id,
/* Parse all entries looking for a match. */ /* Parse all entries looking for a match. */
entry = (acpi_table_entry_header *) entry = (struct acpi_subtable_header *)
((unsigned long)madt + madt_size); ((unsigned long)madt + madt_size);
while (((unsigned long)entry) + sizeof(acpi_table_entry_header) < while (((unsigned long)entry) + sizeof(struct acpi_subtable_header) <
madt_end) { madt_end) {
if (entry->type == entry_id if (entry->type == entry_id
&& (!max_entries || count++ < max_entries)) && (!max_entries || count++ < max_entries))
if (handler(entry, madt_end)) if (handler(entry, madt_end))
return -EINVAL; return -EINVAL;
entry = (acpi_table_entry_header *) entry = (struct acpi_subtable_header *)
((unsigned long)entry + entry->length); ((unsigned long)entry + entry->length);
} }
if (max_entries && count > max_entries) { if (max_entries && count > max_entries) {
...@@ -217,10 +218,10 @@ acpi_table_parse_madt_family(char *id, ...@@ -217,10 +218,10 @@ acpi_table_parse_madt_family(char *id,
} }
int __init int __init
acpi_table_parse_madt(enum acpi_madt_entry_id id, acpi_table_parse_madt(enum acpi_madt_type id,
acpi_madt_entry_handler handler, unsigned int max_entries) acpi_madt_entry_handler handler, unsigned int max_entries)
{ {
return acpi_table_parse_madt_family("APIC", return acpi_table_parse_madt_family(ACPI_SIG_MADT,
sizeof(struct acpi_table_madt), id, sizeof(struct acpi_table_madt), id,
handler, max_entries); handler, max_entries);
} }
...@@ -228,7 +229,6 @@ acpi_table_parse_madt(enum acpi_madt_entry_id id, ...@@ -228,7 +229,6 @@ acpi_table_parse_madt(enum acpi_madt_entry_id id,
int __init acpi_table_parse(char *id, acpi_table_handler handler) int __init acpi_table_parse(char *id, acpi_table_handler handler)
{ {
struct acpi_table_header *table = NULL; struct acpi_table_header *table = NULL;
if (!handler) if (!handler)
return -EINVAL; return -EINVAL;
...@@ -245,10 +245,11 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler) ...@@ -245,10 +245,11 @@ int __init acpi_table_parse(char *id, acpi_table_handler handler)
* *
* find RSDP, find and checksum SDT/XSDT. * find RSDP, find and checksum SDT/XSDT.
* checksum all tables, print SDT/XSDT * checksum all tables, print SDT/XSDT
* *
* result: sdt_entry[] is initialized * result: sdt_entry[] is initialized
*/ */
int __init acpi_table_init(void) int __init acpi_table_init(void)
{ {
acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0); acpi_initialize_tables(initial_tables, ACPI_MAX_TABLES, 0);
......
...@@ -58,106 +58,6 @@ typedef struct { ...@@ -58,106 +58,6 @@ typedef struct {
u8 length; u8 length;
} __attribute__ ((packed)) acpi_table_entry_header; } __attribute__ ((packed)) acpi_table_entry_header;
/* Multiple APIC Description Table (MADT) */
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 { enum acpi_interrupt_id {
ACPI_INTERRUPT_PMI = 1, ACPI_INTERRUPT_PMI = 1,
ACPI_INTERRUPT_INIT, ACPI_INTERRUPT_INIT,
...@@ -285,7 +185,7 @@ typedef int (*acpi_table_handler) (struct acpi_table_header *header); ...@@ -285,7 +185,7 @@ typedef int (*acpi_table_handler) (struct acpi_table_header *header);
extern acpi_table_handler acpi_table_ops[ACPI_TABLE_COUNT]; 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_madt_entry_handler) (struct acpi_subtable_header *header, const unsigned long end);
char * __acpi_map_table (unsigned long phys_addr, unsigned long size); char * __acpi_map_table (unsigned long phys_addr, unsigned long size);
unsigned long acpi_find_rsdp (void); unsigned long acpi_find_rsdp (void);
...@@ -295,11 +195,11 @@ int acpi_numa_init (void); ...@@ -295,11 +195,11 @@ int acpi_numa_init (void);
int acpi_table_init (void); int acpi_table_init (void);
int acpi_table_parse (char *id, acpi_table_handler handler); int acpi_table_parse (char *id, acpi_table_handler handler);
int acpi_table_parse_madt (enum acpi_madt_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries); int acpi_table_parse_madt (enum acpi_madt_type 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_table_parse_srat (enum acpi_srat_entry_id id, acpi_madt_entry_handler handler, unsigned int max_entries);
int acpi_parse_mcfg (struct acpi_table_header *header); int acpi_parse_mcfg (struct acpi_table_header *header);
void acpi_table_print (struct acpi_table_header *header, unsigned long phys_addr); 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_madt_entry (struct acpi_subtable_header *madt);
void acpi_table_print_srat_entry (acpi_table_entry_header *srat); void acpi_table_print_srat_entry (acpi_table_entry_header *srat);
/* the following four functions are architecture-dependent */ /* the following four functions are architecture-dependent */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册