http://linux-acpi.bkbits.net/linux-acpi-test-2.6.5 len.brown@intel.com|ChangeSet|20040321064102|60961 len.brown diff -Nru a/arch/i386/kernel/acpi/boot.c b/arch/i386/kernel/acpi/boot.c --- a/arch/i386/kernel/acpi/boot.c Mon Mar 22 13:19:06 2004 +++ b/arch/i386/kernel/acpi/boot.c Mon Mar 22 13:19:06 2004 @@ -351,6 +351,7 @@ #endif /* CONFIG_ACPI_BUS */ #ifdef CONFIG_X86_IO_APIC +/* deprecated in favor of acpi_gsi_to_irq */ int acpi_irq_to_vector(u32 irq) { if (use_pci_vector() && !platform_legacy_irq(irq)) @@ -359,6 +360,17 @@ } #endif +int acpi_gsi_to_irq(u32 gsi, unsigned int *irq) +{ +#ifdef CONFIG_X86_IO_APIC + if (use_pci_vector() && !platform_legacy_irq(gsi)) + *irq = IO_APIC_VECTOR(gsi); + else +#endif + *irq = gsi; + return 0; +} + static unsigned long __init acpi_scan_rsdp ( unsigned long start, @@ -668,7 +680,7 @@ */ error = acpi_table_init(); if (error) { - acpi_disabled = 1; + disable_acpi(); return error; } @@ -680,7 +692,7 @@ error = acpi_blacklisted(); if (error) { printk(KERN_WARNING PREFIX "BIOS listed in blacklist, disabling ACPI support\n"); - acpi_disabled = 1; + disable_acpi(); return error; } diff -Nru a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c --- a/arch/i386/kernel/dmi_scan.c Mon Mar 22 13:19:06 2004 +++ b/arch/i386/kernel/dmi_scan.c Mon Mar 22 13:19:06 2004 @@ -523,13 +523,13 @@ #ifdef CONFIG_ACPI_BOOT -extern int acpi_disabled, acpi_force; +extern int acpi_force; -static __init __attribute__((unused)) int disable_acpi(struct dmi_blacklist *d) +static __init __attribute__((unused)) int dmi_disable_acpi(struct dmi_blacklist *d) { if (!acpi_force) { printk(KERN_NOTICE "%s detected: acpi off\n",d->ident); - acpi_disabled = 1; + disable_acpi(); } else { printk(KERN_NOTICE "Warning: DMI blacklist says broken, but acpi forced\n"); @@ -537,8 +537,6 @@ return 0; } -extern int acpi_ht; - /* * Limit ACPI to CPU enumeration for HT */ @@ -546,7 +544,7 @@ { if (!acpi_force) { printk(KERN_NOTICE "%s detected: force use of acpi=ht\n", d->ident); - acpi_disabled = 1; + disable_acpi(); acpi_ht = 1; } else { printk(KERN_NOTICE @@ -933,7 +931,7 @@ * Boxes that need ACPI disabled */ - { disable_acpi, "IBM Thinkpad", { + { dmi_disable_acpi, "IBM Thinkpad", { MATCH(DMI_BOARD_VENDOR, "IBM"), MATCH(DMI_BOARD_NAME, "2629H1G"), NO_MATCH, NO_MATCH }}, @@ -1063,8 +1061,7 @@ if (disable && !acpi_force) { printk(KERN_NOTICE "ACPI disabled because your bios is from %s and too old\n", s); printk(KERN_NOTICE "You can enable it with acpi=force\n"); - acpi_disabled = 1; - acpi_ht = 0; + disable_acpi(); } } } diff -Nru a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c --- a/arch/i386/kernel/mpparse.c Mon Mar 22 13:19:06 2004 +++ b/arch/i386/kernel/mpparse.c Mon Mar 22 13:19:06 2004 @@ -1,5 +1,5 @@ /* - * Intel Multiprocessor Specificiation 1.1 and 1.4 + * Intel Multiprocessor Specification 1.1 and 1.4 * compliant MP-table parsing routines. * * (c) 1995 Alan Cox, Building #3 @@ -37,6 +37,7 @@ /* Have we found an MP table */ int smp_found_config; +unsigned int __initdata maxcpus = NR_CPUS; /* * Various Linux-internal data structures created from the @@ -168,8 +169,14 @@ } if (num_processors >= NR_CPUS) { - printk(KERN_WARNING "NR_CPUS limit of %i reached. Cannot " - "boot CPU(apicid 0x%x).\n", NR_CPUS, m->mpc_apicid); + printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached." + " Processor ignored.\n", NR_CPUS); + return; + } + + if (num_processors >= maxcpus) { + printk(KERN_WARNING "WARNING: maxcpus limit of %i reached." + " Processor ignored.\n", maxcpus); return; } num_processors++; @@ -844,25 +851,25 @@ struct mp_ioapic_routing { int apic_id; - int irq_start; - int irq_end; + int gsi_base; + int gsi_end; u32 pin_programmed[4]; } mp_ioapic_routing[MAX_IO_APICS]; static int __init mp_find_ioapic ( - int irq) + int gsi) { int i = 0; - /* Find the IOAPIC that manages this IRQ. */ + /* Find the IOAPIC that manages this GSI. */ for (i = 0; i < nr_ioapics; i++) { - if ((irq >= mp_ioapic_routing[i].irq_start) - && (irq <= mp_ioapic_routing[i].irq_end)) + if ((gsi >= mp_ioapic_routing[i].gsi_base) + && (gsi <= mp_ioapic_routing[i].gsi_end)) return i; } - printk(KERN_ERR "ERROR: Unable to locate IOAPIC for IRQ %d\n", irq); + printk(KERN_ERR "ERROR: Unable to locate IOAPIC for GSI %d\n", gsi); return -1; } @@ -871,7 +878,7 @@ void __init mp_register_ioapic ( u8 id, u32 address, - u32 irq_base) + u32 gsi_base) { int idx = 0; @@ -897,19 +904,19 @@ mp_ioapics[idx].mpc_apicver = io_apic_get_version(idx); /* - * Build basic IRQ lookup table to facilitate irq->io_apic lookups - * and to prevent reprogramming of IOAPIC pins (PCI IRQs). + * Build basic GSI lookup table to facilitate gsi->io_apic lookups + * and to prevent reprogramming of IOAPIC pins (PCI GSIs). */ mp_ioapic_routing[idx].apic_id = mp_ioapics[idx].mpc_apicid; - mp_ioapic_routing[idx].irq_start = irq_base; - mp_ioapic_routing[idx].irq_end = irq_base + + mp_ioapic_routing[idx].gsi_base = gsi_base; + mp_ioapic_routing[idx].gsi_end = gsi_base + io_apic_get_redir_entries(idx); printk("IOAPIC[%d]: apic_id %d, version %d, address 0x%lx, " - "IRQ %d-%d\n", idx, mp_ioapics[idx].mpc_apicid, + "GSI %d-%d\n", idx, mp_ioapics[idx].mpc_apicid, mp_ioapics[idx].mpc_apicver, mp_ioapics[idx].mpc_apicaddr, - mp_ioapic_routing[idx].irq_start, - mp_ioapic_routing[idx].irq_end); + mp_ioapic_routing[idx].gsi_base, + mp_ioapic_routing[idx].gsi_end); return; } @@ -919,7 +926,7 @@ u8 bus_irq, u8 polarity, u8 trigger, - u32 global_irq) + u32 gsi) { struct mpc_config_intsrc intsrc; int i = 0; @@ -928,12 +935,12 @@ int pin = -1; /* - * Convert 'global_irq' to 'ioapic.pin'. + * Convert 'gsi' to 'ioapic.pin'. */ - ioapic = mp_find_ioapic(global_irq); + ioapic = mp_find_ioapic(gsi); if (ioapic < 0) return; - pin = global_irq - mp_ioapic_routing[ioapic].irq_start; + pin = gsi - mp_ioapic_routing[ioapic].gsi_base; /* * TBD: This check is for faulty timer entries, where the override @@ -958,7 +965,7 @@ /* * If an existing [IOAPIC.PIN -> IRQ] routing entry exists we override it. - * Otherwise create a new entry (e.g. global_irq == 2). + * Otherwise create a new entry (e.g. gsi == 2). */ for (i = 0; i < mp_irq_entries; i++) { if ((mp_irqs[i].mpc_srcbus == intsrc.mpc_srcbus) @@ -1029,7 +1036,7 @@ extern FADT_DESCRIPTOR acpi_fadt; -void __init mp_config_ioapic_for_sci(int irq) +void __init mp_config_ioapic_for_sci(u32 gsi) { int ioapic; int ioapic_pin; @@ -1076,11 +1083,11 @@ */ flags = entry->flags; acpi_fadt.sci_int = entry->global_irq; - irq = entry->global_irq; + gsi = entry->global_irq; - ioapic = mp_find_ioapic(irq); + ioapic = mp_find_ioapic(gsi); - ioapic_pin = irq - mp_ioapic_routing[ioapic].irq_start; + ioapic_pin = gsi - mp_ioapic_routing[ioapic].gsi_base; /* * MPS INTI flags: @@ -1088,7 +1095,7 @@ * polarity: 0=default, 1=high, 3=low * Per ACPI spec, default for SCI means level/low. */ - io_apic_set_pci_routing(ioapic, ioapic_pin, irq, + io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, (flags.trigger == 1 ? 0 : 1), (flags.polarity == 1 ? 0 : 1)); } @@ -1100,7 +1107,7 @@ struct acpi_prt_entry *entry = NULL; int ioapic = -1; int ioapic_pin = 0; - int irq = 0; + int gsi = 0; int idx, bit = 0; int edge_level = 0; int active_high_low = 0; @@ -1112,39 +1119,39 @@ list_for_each(node, &acpi_prt.entries) { entry = list_entry(node, struct acpi_prt_entry, node); - /* Need to get irq for dynamic entry */ + /* Need to get gsi for dynamic entry */ if (entry->link.handle) { - irq = acpi_pci_link_get_irq(entry->link.handle, entry->link.index, &edge_level, &active_high_low); - if (!irq) + gsi = acpi_pci_link_get_irq(entry->link.handle, entry->link.index, &edge_level, &active_high_low); + if (!gsi) continue; } else { - /* Hardwired IRQ. Assume PCI standard settings */ - irq = entry->link.index; + /* Hardwired GSI. Assume PCI standard settings */ + gsi = entry->link.index; edge_level = 1; active_high_low = 1; } /* Don't set up the ACPI SCI because it's already set up */ - if (acpi_fadt.sci_int == irq) { - irq = acpi_irq_to_vector(irq); - entry->irq = irq; /* we still need to set entry's irq */ + if (acpi_fadt.sci_int == gsi) { + /* we still need to set entry's irq */ + acpi_gsi_to_irq(gsi, &entry->irq); continue; } - ioapic = mp_find_ioapic(irq); + ioapic = mp_find_ioapic(gsi); if (ioapic < 0) continue; - ioapic_pin = irq - mp_ioapic_routing[ioapic].irq_start; + ioapic_pin = gsi - mp_ioapic_routing[ioapic].gsi_base; if (es7000_plat) { - if (!ioapic && (irq < 16)) - irq += 16; + if (!ioapic && (gsi < 16)) + gsi += 16; } /* * Avoid pin reprogramming. PRTs typically include entries - * with redundant pin->irq mappings (but unique PCI devices); + * with redundant pin->gsi mappings (but unique PCI devices); * we only only program the IOAPIC on the first. */ bit = ioapic_pin % 32; @@ -1158,19 +1165,19 @@ if ((1<irq = acpi_irq_to_vector(irq); + acpi_gsi_to_irq(gsi, &entry->irq); continue; } mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<irq = acpi_irq_to_vector(irq); - } + if (!io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, edge_level, active_high_low)) { + acpi_gsi_to_irq(gsi, &entry->irq); + } printk(KERN_DEBUG "%02x:%02x:%02x[%c] -> %d-%d -> IRQ %d\n", - entry->id.segment, entry->id.bus, - entry->id.device, ('A' + entry->pin), - mp_ioapic_routing[ioapic].apic_id, ioapic_pin, + entry->id.segment, entry->id.bus, + entry->id.device, ('A' + entry->pin), + mp_ioapic_routing[ioapic].apic_id, ioapic_pin, entry->irq); } diff -Nru a/arch/i386/kernel/setup.c b/arch/i386/kernel/setup.c --- a/arch/i386/kernel/setup.c Mon Mar 22 13:19:06 2004 +++ b/arch/i386/kernel/setup.c Mon Mar 22 13:19:06 2004 @@ -83,7 +83,6 @@ EXPORT_SYMBOL(acpi_disabled); #ifdef CONFIG_ACPI_BOOT -extern int __initdata acpi_ht; int __initdata acpi_force = 0; #endif @@ -560,17 +559,28 @@ } } +#ifdef CONFIG_SMP + /* + * If the BIOS enumerates physical processors before logical, + * maxcpus=N at enumeration-time can be used to disable HT. + */ + else if (!memcmp(from, "maxcpus=", 8)) { + extern unsigned int maxcpus; + + maxcpus = simple_strtoul(from + 8, NULL, 0); + } +#endif + #ifdef CONFIG_ACPI_BOOT /* "acpi=off" disables both ACPI table parsing and interpreter */ else if (!memcmp(from, "acpi=off", 8)) { - acpi_ht = 0; - acpi_disabled = 1; + disable_acpi(); } /* acpi=force to over-ride black-list */ else if (!memcmp(from, "acpi=force", 10)) { acpi_force = 1; - acpi_ht=1; + acpi_ht = 1; acpi_disabled = 0; } @@ -581,8 +591,9 @@ /* Limit ACPI just to boot-time to enable HT */ else if (!memcmp(from, "acpi=ht", 7)) { + if (!acpi_force) + disable_acpi(); acpi_ht = 1; - if (!acpi_force) acpi_disabled = 1; } /* "pci=noacpi" disables ACPI interrupt routing */ diff -Nru a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c --- a/arch/ia64/kernel/acpi.c Mon Mar 22 13:19:06 2004 +++ b/arch/ia64/kernel/acpi.c Mon Mar 22 13:19:06 2004 @@ -62,8 +62,6 @@ unsigned char acpi_kbd_controller_present = 1; unsigned char acpi_legacy_devices; -int acpi_disabled; /* XXX this shouldn't be needed---we can't boot without ACPI! */ - const char * acpi_get_sysname (void) { diff -Nru a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c --- a/arch/x86_64/kernel/mpparse.c Mon Mar 22 13:19:06 2004 +++ b/arch/x86_64/kernel/mpparse.c Mon Mar 22 13:19:06 2004 @@ -33,6 +33,7 @@ /* Have we found an MP table */ int smp_found_config; +unsigned int __initdata maxcpus = NR_CPUS; int acpi_found_madt; @@ -117,6 +118,17 @@ Dprintk(" Bootup CPU\n"); boot_cpu_id = m->mpc_apicid; } + if (num_processors >= NR_CPUS) { + printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached." + " Processor ignored.\n", NR_CPUS); + return; + } + if (num_processors >= maxcpus) { + printk(KERN_WARNING "WARNING: maxcpus limit of %i reached." + " Processor ignored.\n", maxcpus); + return; + } + num_processors++; if (m->mpc_apicid > MAX_APICS) { diff -Nru a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c --- a/arch/x86_64/kernel/setup.c Mon Mar 22 13:19:06 2004 +++ b/arch/x86_64/kernel/setup.c Mon Mar 22 13:19:06 2004 @@ -201,7 +201,18 @@ for (;;) { if (c != ' ') goto next_char; - + +#ifdef CONFIG_SMP + /* + * If the BIOS enumerates physical processors before logical, + * maxcpus=N at enumeration-time can be used to disable HT. + */ + else if (!memcmp(from, "maxcpus=", 8)) { + extern unsigned int maxcpus; + + maxcpus = simple_strtoul(from + 8, NULL, 0); + } +#endif #ifdef CONFIG_ACPI_BOOT /* "acpi=off" disables both ACPI table parsing and interpreter init */ if (!memcmp(from, "acpi=off", 8)) diff -Nru a/drivers/acpi/bus.c b/drivers/acpi/bus.c --- a/drivers/acpi/bus.c Mon Mar 22 13:19:06 2004 +++ b/drivers/acpi/bus.c Mon Mar 22 13:19:06 2004 @@ -704,29 +704,14 @@ pm_active = 1; else { printk(KERN_INFO PREFIX "APM is already active, exiting\n"); - acpi_disabled = 1; + disable_acpi(); result = -ENODEV; } #endif } else - acpi_disabled = 1; + disable_acpi(); return_VALUE(result); } - -static int __init acpi_setup(char *str) -{ - while (str && *str) { - if (strncmp(str, "off", 3) == 0) - acpi_disabled = 1; - str = strchr(str, ','); - if (str) - str += strspn(str, ", \t"); - } - return 1; -} - subsys_initcall(acpi_init); - -__setup("acpi=", acpi_setup); diff -Nru a/drivers/acpi/numa.c b/drivers/acpi/numa.c --- a/drivers/acpi/numa.c Mon Mar 22 13:19:06 2004 +++ b/drivers/acpi/numa.c Mon Mar 22 13:19:06 2004 @@ -32,12 +32,19 @@ #include #include +#define ACPI_NUMA 0x80000000 +#define _COMPONENT ACPI_NUMA + ACPI_MODULE_NAME ("numa") + extern int __init acpi_table_parse_madt_family (enum acpi_table_id id, unsigned long madt_size, int entry_id, acpi_madt_entry_handler handler, unsigned int max_entries); void __init acpi_table_print_srat_entry ( acpi_table_entry_header *header) { + + ACPI_FUNCTION_NAME ("acpi_table_print_srat_entry"); + if (!header) return; @@ -47,7 +54,7 @@ { struct acpi_table_processor_affinity *p = (struct acpi_table_processor_affinity*) header; - ACPI_DEBUG_PRINT((ACPI_DB_INFO "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n", + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SRAT Processor (id[0x%02x] eid[0x%02x]) in proximity domain %d %s\n", p->apic_id, p->lsapic_eid, p->proximity_domain, p->flags.enabled?"enabled":"disabled")); } @@ -57,7 +64,7 @@ { struct acpi_table_memory_affinity *p = (struct acpi_table_memory_affinity*) header; - ACPI_DEBUG_PRINT((ACPI_DB_INFO "SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n", + ACPI_DEBUG_PRINT((ACPI_DB_INFO, "SRAT Memory (0x%08x%08x length 0x%08x%08x type 0x%x) in proximity domain %d %s%s\n", p->base_addr_hi, p->base_addr_lo, p->length_hi, p->length_lo, p->memory_type, p->proximity_domain, p->flags.enabled ? "enabled" : "disabled", diff -Nru a/drivers/char/sonypi.h b/drivers/char/sonypi.h --- a/drivers/char/sonypi.h Mon Mar 22 13:19:06 2004 +++ b/drivers/char/sonypi.h Mon Mar 22 13:19:06 2004 @@ -396,7 +396,6 @@ } #ifdef CONFIG_ACPI -extern int acpi_disabled; #define SONYPI_ACPI_ACTIVE (!acpi_disabled) #else #define SONYPI_ACPI_ACTIVE 0 diff -Nru a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h --- a/include/acpi/acpi_bus.h Mon Mar 22 13:19:06 2004 +++ b/include/acpi/acpi_bus.h Mon Mar 22 13:19:06 2004 @@ -32,8 +32,6 @@ #define PREFIX "ACPI: " -extern int acpi_disabled; - /* TBD: Make dynamic */ #define ACPI_MAX_HANDLES 10 struct acpi_handle_list { diff -Nru a/include/asm-i386/acpi.h b/include/asm-i386/acpi.h --- a/include/asm-i386/acpi.h Mon Mar 22 13:19:06 2004 +++ b/include/asm-i386/acpi.h Mon Mar 22 13:19:06 2004 @@ -116,13 +116,17 @@ extern int acpi_ioapic; extern int acpi_noirq; extern int acpi_strict; +extern int acpi_disabled; +extern int acpi_ht; +static inline void disable_acpi(void) { acpi_disabled = 1; acpi_ht = 0; } /* Fixmap pages to reserve for ACPI boot-time tables (see fixmap.h) */ #define FIX_ACPI_PAGES 4 +extern int acpi_gsi_to_irq(u32 gsi, unsigned int *irq); #ifdef CONFIG_X86_IO_APIC extern int skip_ioapic_setup; -extern int acpi_irq_to_vector(u32 irq); +extern int acpi_irq_to_vector(u32 irq); /* deprecated in favor of acpi_gsi_to_irq */ static inline void disable_ioapic_setup(void) { diff -Nru a/include/asm-i386/mpspec.h b/include/asm-i386/mpspec.h --- a/include/asm-i386/mpspec.h Mon Mar 22 13:19:06 2004 +++ b/include/asm-i386/mpspec.h Mon Mar 22 13:19:06 2004 @@ -30,15 +30,15 @@ #ifdef CONFIG_ACPI_BOOT extern void mp_register_lapic (u8 id, u8 enabled); extern void mp_register_lapic_address (u64 address); -extern void mp_register_ioapic (u8 id, u32 address, u32 irq_base); -extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 global_irq); +extern void mp_register_ioapic (u8 id, u32 address, u32 gsi_base); +extern void mp_override_legacy_irq (u8 bus_irq, u8 polarity, u8 trigger, u32 gsi); extern void mp_config_acpi_legacy_irqs (void); extern void mp_parse_prt (void); #ifdef CONFIG_X86_IO_APIC -extern void mp_config_ioapic_for_sci(int irq); +extern void mp_config_ioapic_for_sci(u32 gsi); #else -static inline void mp_config_ioapic_for_sci(int irq) +static inline void mp_config_ioapic_for_sci(u32 gsi) { } #endif #endif /*CONFIG_ACPI_BOOT*/ diff -Nru a/include/asm-ia64/acpi.h b/include/asm-ia64/acpi.h --- a/include/asm-ia64/acpi.h Mon Mar 22 13:19:06 2004 +++ b/include/asm-ia64/acpi.h Mon Mar 22 13:19:06 2004 @@ -88,7 +88,9 @@ #define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Acq) \ ((Acq) = ia64_acpi_release_global_lock((unsigned int *) GLptr)) +#define acpi_disabled 0 /* ACPI always enabled on IA64 */ #define acpi_strict 1 /* no ACPI spec workarounds on IA64 */ +static inline void disable_acpi(void) { } const char *acpi_get_sysname (void); int acpi_request_vector (u32 int_type); diff -Nru a/include/asm-x86_64/acpi.h b/include/asm-x86_64/acpi.h --- a/include/asm-x86_64/acpi.h Mon Mar 22 13:19:06 2004 +++ b/include/asm-x86_64/acpi.h Mon Mar 22 13:19:06 2004 @@ -105,6 +105,9 @@ extern int acpi_ioapic; extern int acpi_noirq; extern int acpi_strict; +extern int acpi_disabled; +extern int acpi_ht; +static inline void disable_acpi(void) { acpi_disabled = 1; acpi_ht = 0; } /* Fixmap pages to reserve for ACPI boot-time tables (see fixmap.h) */ #define FIX_ACPI_PAGES 4