## Automatically generated incremental diff ## From: linux-2.4.22-bk56 ## To: linux-2.4.22-bk57 ## Robot: $Id: make-incremental-diff,v 1.11 2002/02/20 02:59:33 hpa Exp $ diff -urN linux-2.4.22-bk56/Documentation/kernel-parameters.txt linux-2.4.22-bk57/Documentation/kernel-parameters.txt --- linux-2.4.22-bk56/Documentation/kernel-parameters.txt 2003-11-20 02:49:54.000000000 -0800 +++ linux-2.4.22-bk57/Documentation/kernel-parameters.txt 2003-11-20 02:50:01.000000000 -0800 @@ -73,7 +73,16 @@ off Disable ACPI ht Limit ACPI to boot-time LAPIC enumeration for HT, disabling the run-time AML interpreter. - + + acpi_pic_sci= [HW,ACPI] ACPI System Conrol Interrupt trigger mode + level Force PIC-mode SCI to Level Trigger (default) + edge Force PIC-mode SCI to Edge Trigger + + acpi_irq_balance ACPI will balance active IRQs + acpi_irq_nobalance ACPI will not move active IRQs + acpi_irq_pci= If irq_balance, Clear listed IRQs for use by PCI + acpi_irq_isa= If irq_balance, Mark listed IRQs used by ISA + ad1816= [HW,SOUND] ad1848= [HW,SOUND] diff -urN linux-2.4.22-bk56/MAINTAINERS linux-2.4.22-bk57/MAINTAINERS --- linux-2.4.22-bk56/MAINTAINERS 2003-11-20 02:49:54.000000000 -0800 +++ linux-2.4.22-bk57/MAINTAINERS 2003-11-20 02:50:01.000000000 -0800 @@ -163,8 +163,8 @@ S: Supported ACPI -P: Andy Grover -M: andrew.grover@intel.com +P: Len Brown +M: len.brown@intel.com L: acpi-devel@lists.sourceforge.net W: http://sf.net/projects/acpi/ S: Maintained diff -urN linux-2.4.22-bk56/Makefile linux-2.4.22-bk57/Makefile --- linux-2.4.22-bk56/Makefile 2003-11-20 02:49:54.000000000 -0800 +++ linux-2.4.22-bk57/Makefile 2003-11-20 02:50:01.000000000 -0800 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 4 SUBLEVEL = 22 -EXTRAVERSION = -bk56 +EXTRAVERSION = -bk57 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) diff -urN linux-2.4.22-bk56/arch/i386/kernel/acpi.c linux-2.4.22-bk57/arch/i386/kernel/acpi.c --- linux-2.4.22-bk56/arch/i386/kernel/acpi.c 2003-11-20 02:49:54.000000000 -0800 +++ linux-2.4.22-bk57/arch/i386/kernel/acpi.c 2003-11-20 02:50:01.000000000 -0800 @@ -58,6 +58,7 @@ #ifdef CONFIG_ACPI_BOOT extern int acpi_disabled; +extern int acpi_irq; extern int acpi_ht; enum acpi_irq_model_id acpi_irq_model; @@ -415,7 +416,7 @@ * If MPS is present, it will handle them, * otherwise the system will stay in PIC mode */ - if (acpi_disabled) { + if (acpi_disabled || !acpi_irq) { return 1; } @@ -458,6 +459,8 @@ acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC; + acpi_irq_balance_set(NULL); + acpi_ioapic = 1; if (acpi_lapic && acpi_ioapic) @@ -472,29 +475,66 @@ #ifdef CONFIG_ACPI_BUS /* - * Set specified PIC IRQ to level triggered mode. + * "acpi_pic_sci=level" (current default) + * programs the PIC-mode SCI to Level Trigger. + * (NO-OP if the BIOS set Level Trigger already) + * + * If a PIC-mode SCI is not recogznied or gives spurious IRQ7's + * it may require Edge Trigger -- use "acpi_pic_sci=edge" + * (NO-OP if the BIOS set Edge Trigger already) * * Port 0x4d0-4d1 are ECLR1 and ECLR2, the Edge/Level Control Registers * for the 8259 PIC. bit[n] = 1 means irq[n] is Level, otherwise Edge. * ECLR1 is IRQ's 0-7 (IRQ 0, 1, 2 must be 0) * ECLR2 is IRQ's 8-15 (IRQ 8, 13 must be 0) - * - * As the BIOS should have done this for us, - * print a warning if the IRQ wasn't already set to level. */ -void acpi_pic_set_level_irq(unsigned int irq) +static __initdata int acpi_pic_sci_trigger; /* 0: level, 1: edge */ + +void __init +acpi_pic_sci_set_trigger(unsigned int irq) { unsigned char mask = 1 << (irq & 7); unsigned int port = 0x4d0 + (irq >> 3); unsigned char val = inb(port); + + printk(PREFIX "IRQ%d SCI:", irq); if (!(val & mask)) { - printk(KERN_WARNING PREFIX "IRQ %d was Edge Triggered, " - "setting to Level Triggerd\n", irq); - outb(val | mask, port); + printk(" Edge"); + + if (!acpi_pic_sci_trigger) { + printk(" set to Level"); + outb(val | mask, port); + } + } else { + printk(" Level"); + + if (acpi_pic_sci_trigger) { + printk(" set to Edge"); + outb(val | mask, port); + } + } + printk(" Trigger.\n"); +} + +int __init +acpi_pic_sci_setup(char *str) +{ + while (str && *str) { + if (strncmp(str, "level", 5) == 0) + acpi_pic_sci_trigger = 0; /* force level trigger */ + if (strncmp(str, "edge", 4) == 0) + acpi_pic_sci_trigger = 1; /* force edge trigger */ + str = strchr(str, ','); + if (str) + str += strspn(str, ", \t"); } + return 1; } + +__setup("acpi_pic_sci=", acpi_pic_sci_setup); + #endif /* CONFIG_ACPI_BUS */ diff -urN linux-2.4.22-bk56/arch/i386/kernel/dmi_scan.c linux-2.4.22-bk57/arch/i386/kernel/dmi_scan.c --- linux-2.4.22-bk56/arch/i386/kernel/dmi_scan.c 2003-11-20 02:49:54.000000000 -0800 +++ linux-2.4.22-bk57/arch/i386/kernel/dmi_scan.c 2003-11-20 02:50:01.000000000 -0800 @@ -970,6 +970,7 @@ 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; } } } diff -urN linux-2.4.22-bk56/arch/i386/kernel/io_apic.c linux-2.4.22-bk57/arch/i386/kernel/io_apic.c --- linux-2.4.22-bk56/arch/i386/kernel/io_apic.c 2003-11-20 02:49:54.000000000 -0800 +++ linux-2.4.22-bk57/arch/i386/kernel/io_apic.c 2003-11-20 02:50:01.000000000 -0800 @@ -1088,10 +1088,6 @@ unsigned char old_id; unsigned long flags; - if (acpi_ioapic) - /* This gets done during IOAPIC enumeration for ACPI. */ - return; - if (clustered_apic_mode) /* We don't have a good way to do this yet - hack */ phys_id_present_map = (u_long) 0xf; @@ -1720,12 +1716,14 @@ /* * Set up IO-APIC IRQ routing. */ - setup_ioapic_ids_from_mpc(); + if (!acpi_ioapic) + setup_ioapic_ids_from_mpc(); sync_Arb_IDs(); setup_IO_APIC_irqs(); init_IO_APIC_traps(); check_timer(); - print_IO_APIC(); + if (!acpi_ioapic) + print_IO_APIC(); } diff -urN linux-2.4.22-bk56/arch/i386/kernel/mpparse.c linux-2.4.22-bk57/arch/i386/kernel/mpparse.c --- linux-2.4.22-bk56/arch/i386/kernel/mpparse.c 2003-11-20 02:49:54.000000000 -0800 +++ linux-2.4.22-bk57/arch/i386/kernel/mpparse.c 2003-11-20 02:50:01.000000000 -0800 @@ -1140,7 +1140,7 @@ */ for (i = 0; i < mp_irq_entries; i++) { if ((mp_irqs[i].mpc_dstapic == intsrc.mpc_dstapic) - && (mp_irqs[i].mpc_dstirq == intsrc.mpc_dstirq)) { + && (mp_irqs[i].mpc_srcbusirq == intsrc.mpc_srcbusirq)) { mp_irqs[i] = intsrc; found = 1; break; @@ -1361,6 +1361,8 @@ entry->irq); } + print_IO_APIC(); + return; } diff -urN linux-2.4.22-bk56/arch/i386/kernel/setup.c linux-2.4.22-bk57/arch/i386/kernel/setup.c --- linux-2.4.22-bk56/arch/i386/kernel/setup.c 2003-11-20 02:49:54.000000000 -0800 +++ linux-2.4.22-bk57/arch/i386/kernel/setup.c 2003-11-20 02:50:01.000000000 -0800 @@ -120,6 +120,7 @@ #include #include #include +#include #include /* * Machine setup.. @@ -184,6 +185,7 @@ EXPORT_SYMBOL(acpi_disabled); #ifdef CONFIG_ACPI_BOOT + int acpi_irq __initdata = 1; /* enable IRQ */ int acpi_ht __initdata = 1; /* enable HT */ #endif @@ -850,6 +852,10 @@ if (!acpi_force) acpi_disabled = 1; } + else if (!memcmp(from, "pci=noacpi", 10)) { + acpi_irq = 0; + } + /* disable IO-APIC */ else if (!memcmp(from, "noapic", 6)) disable_ioapic_setup(); diff -urN linux-2.4.22-bk56/arch/x86_64/kernel/Makefile linux-2.4.22-bk57/arch/x86_64/kernel/Makefile --- linux-2.4.22-bk56/arch/x86_64/kernel/Makefile 2003-08-25 04:44:40.000000000 -0700 +++ linux-2.4.22-bk57/arch/x86_64/kernel/Makefile 2003-11-20 02:50:01.000000000 -0800 @@ -37,7 +37,7 @@ obj-$(CONFIG_GART_IOMMU) += pci-gart.o aperture.o obj-$(CONFIG_DUMMY_IOMMU) += pci-nommu.o obj-$(CONFIG_MCE) += bluesmoke.o -obj-$(CONFIG_ACPI) += acpi.o +obj-$(CONFIG_ACPI_BOOT) += acpi.o obj-$(CONFIG_ACPI_SLEEP) += acpi_wakeup.o suspend.o diff -urN linux-2.4.22-bk56/arch/x86_64/kernel/acpi.c linux-2.4.22-bk57/arch/x86_64/kernel/acpi.c --- linux-2.4.22-bk56/arch/x86_64/kernel/acpi.c 2003-11-20 02:49:55.000000000 -0800 +++ linux-2.4.22-bk57/arch/x86_64/kernel/acpi.c 2003-11-20 02:50:01.000000000 -0800 @@ -48,6 +48,8 @@ #define PREFIX "ACPI: " +int acpi_lapic = 0; +int acpi_ioapic = 0; /* -------------------------------------------------------------------------- Boot-time Configuration @@ -55,6 +57,7 @@ #ifdef CONFIG_ACPI_BOOT +extern int acpi_irq; enum acpi_irq_model_id acpi_irq_model; @@ -117,8 +120,6 @@ #ifdef CONFIG_X86_LOCAL_APIC -int acpi_lapic; - static u64 acpi_lapic_addr __initdata = APIC_DEFAULT_PHYS_BASE; @@ -204,9 +205,8 @@ #endif /*CONFIG_X86_LOCAL_APIC*/ -#ifdef CONFIG_X86_IO_APIC +#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER) -int acpi_ioapic; static int __init acpi_parse_ioapic ( @@ -268,7 +268,8 @@ return 0; } -#endif /*CONFIG_X86_IO_APIC*/ +#endif /*CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER*/ + static int __init acpi_parse_hpet ( @@ -293,29 +294,66 @@ #ifdef CONFIG_ACPI_BUS /* - * Set specified PIC IRQ to level triggered mode. + * "acpi_pic_sci=level" (current default) + * programs the PIC-mode SCI to Level Trigger. + * (NO-OP if the BIOS set Level Trigger already) + * + * If a PIC-mode SCI is not recogznied or gives spurious IRQ7's + * it may require Edge Trigger -- use "acpi_pic_sci=edge" + * (NO-OP if the BIOS set Edge Trigger already) * * Port 0x4d0-4d1 are ECLR1 and ECLR2, the Edge/Level Control Registers * for the 8259 PIC. bit[n] = 1 means irq[n] is Level, otherwise Edge. * ECLR1 is IRQ's 0-7 (IRQ 0, 1, 2 must be 0) * ECLR2 is IRQ's 8-15 (IRQ 8, 13 must be 0) - * - * As the BIOS should have done this for us, - * print a warning if the IRQ wasn't already set to level. */ -void acpi_pic_set_level_irq(unsigned int irq) +static __initdata int acpi_pic_sci_trigger; /* 0: level, 1: edge */ + +void __init +acpi_pic_sci_set_trigger(unsigned int irq) { unsigned char mask = 1 << (irq & 7); unsigned int port = 0x4d0 + (irq >> 3); unsigned char val = inb(port); + + printk(PREFIX "IRQ%d SCI:", irq); if (!(val & mask)) { - printk(KERN_WARNING PREFIX "IRQ %d was Edge Triggered, " - "setting to Level Triggerd\n", irq); - outb(val | mask, port); + printk(" Edge"); + + if (!acpi_pic_sci_trigger) { + printk(" set to Level"); + outb(val | mask, port); + } + } else { + printk(" Level"); + + if (acpi_pic_sci_trigger) { + printk(" set to Edge"); + outb(val | mask, port); + } } + printk(" Trigger.\n"); } + +int __init +acpi_pic_sci_setup(char *str) +{ + while (str && *str) { + if (strncmp(str, "level", 5) == 0) + acpi_pic_sci_trigger = 0; /* force level trigger */ + if (strncmp(str, "edge", 4) == 0) + acpi_pic_sci_trigger = 1; /* force edge trigger */ + str = strchr(str, ','); + if (str) + str += strspn(str, ", \t"); + } + return 1; +} + +__setup("acpi_pic_sci=", acpi_pic_sci_setup); + #endif /* CONFIG_ACPI_BUS */ static unsigned long __init @@ -363,6 +401,9 @@ { int result = 0; + if (acpi_disabled) + return(1); + /* * The default interrupt routing model is PIC (8259). This gets * overriden if IOAPICs are enumerated (below). @@ -458,7 +499,8 @@ #endif /*CONFIG_X86_LOCAL_APIC*/ -#ifdef CONFIG_X86_IO_APIC +#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER) + /* * if "noapic" boot option, don't look for IO-APICs @@ -474,6 +516,25 @@ * -------- */ + /* + * ACPI interpreter is required to complete interrupt setup, + * so if it is off, don't enumerate the io-apics with ACPI. + * If MPS is present, it will handle them, + * otherwise the system will stay in PIC mode + */ + if (acpi_disabled || !acpi_irq) { + return 1; + } + + /* + * if "noapic" boot option, don't look for IO-APICs + */ + if (ioapic_setup_disabled()) { + printk(KERN_INFO PREFIX "Skipping IOAPIC probe " + "due to 'noapic' option.\n"); + return 1; + } + result = acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic); if (!result) { printk(KERN_ERR PREFIX "No IOAPIC entries present\n"); @@ -503,18 +564,19 @@ acpi_irq_model = ACPI_IRQ_MODEL_IOAPIC; - acpi_ioapic = 1; + acpi_irq_balance_set(NULL); -#endif /*CONFIG_X86_IO_APIC*/ + acpi_ioapic = 1; -#ifdef CONFIG_X86_LOCAL_APIC if (acpi_lapic && acpi_ioapic) smp_found_config = 1; -#endif + result = acpi_table_parse(ACPI_HPET, acpi_parse_hpet); if (result < 0) printk("ACPI: no HPET table found (%d).\n", result); +#endif /*CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER*/ + return 0; } diff -urN linux-2.4.22-bk56/arch/x86_64/kernel/e820.c linux-2.4.22-bk57/arch/x86_64/kernel/e820.c --- linux-2.4.22-bk56/arch/x86_64/kernel/e820.c 2003-11-20 02:49:55.000000000 -0800 +++ linux-2.4.22-bk57/arch/x86_64/kernel/e820.c 2003-11-20 02:50:01.000000000 -0800 @@ -15,9 +15,12 @@ #include #include #include +#include +#include extern unsigned long table_start, table_end; extern char _end[]; +extern void pci_disable_acpi(); extern struct resource code_resource, data_resource, vram_resource; @@ -501,6 +504,7 @@ extern char command_line[], saved_command_line[]; extern int fallback_aper_order; extern int iommu_setup(char *opt); +extern int acpi_irq; void __init parse_mem_cmdline (char ** cmdline_p) { @@ -550,8 +554,10 @@ disable_ioapic_setup(); else if (!memcmp(from, "nolocalapic", 11) || !memcmp(from,"nolapic",7)) apic_disabled = 1; - else if (!memcmp(from, "pci=noacpi", 10)) - use_acpi_pci = 0; + else if (!memcmp(from, "pci=noacpi", 10)) { + pci_disable_acpi(); + acpi_irq = 0; + } else if (!memcmp(from,"apic",4)) { extern int ioapic_force; ioapic_force = 1; diff -urN linux-2.4.22-bk56/arch/x86_64/kernel/io_apic.c linux-2.4.22-bk57/arch/x86_64/kernel/io_apic.c --- linux-2.4.22-bk56/arch/x86_64/kernel/io_apic.c 2003-11-20 02:49:55.000000000 -0800 +++ linux-2.4.22-bk57/arch/x86_64/kernel/io_apic.c 2003-11-20 02:50:01.000000000 -0800 @@ -776,7 +776,7 @@ entry.vector = vector; /* - * The timer IRQ doesnt have to know that behind the + * The timer IRQ doesn't have to know that behind the * scene we have a 8259A-master in AEOI mode ... */ irq_desc[0].handler = &ioapic_edge_irq_type; @@ -1112,10 +1112,6 @@ unsigned char old_id; unsigned long flags; - if (acpi_ioapic) - /* This gets done during IOAPIC enumeration for ACPI. */ - return; - /* * Set the IOAPIC ID to the value stored in the MPC table. */ @@ -1652,7 +1648,7 @@ printk(" failed.\n"); if (nmi_watchdog) { - printk(KERN_WARNING "timer doesnt work through the IO-APIC - disabling NMI Watchdog!\n"); + printk(KERN_WARNING "timer doesn't work through the IO-APIC - disabling NMI Watchdog!\n"); nmi_watchdog = 0; } @@ -1713,12 +1709,14 @@ /* * Set up IO-APIC IRQ routing. */ - setup_ioapic_ids_from_mpc(); + if (!acpi_ioapic) + setup_ioapic_ids_from_mpc(); sync_Arb_IDs(); setup_IO_APIC_irqs(); init_IO_APIC_traps(); check_timer(); - print_IO_APIC(); + if (!acpi_ioapic) + print_IO_APIC(); } @@ -1826,7 +1824,7 @@ } -int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level ,int active_high_low) +int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low) { struct IO_APIC_route_entry entry; unsigned long flags; @@ -1849,7 +1847,7 @@ entry.dest_mode = INT_DELIVERY_MODE; entry.dest.logical.logical_dest = TARGET_CPUS; entry.mask = 1; /* Disabled (masked) */ - entry.trigger = edge_level; + entry.trigger = edge_level; entry.polarity = active_high_low; add_pin_to_irq(irq, ioapic, pin); @@ -1857,7 +1855,7 @@ entry.vector = assign_irq_vector(irq); printk(KERN_DEBUG "IOAPIC[%d]: Set PCI routing entry (%d-%d -> 0x%x -> " - "IRQ %d) Mode:%i Active:%i\n", ioapic, + "IRQ %d Mode:%i Active:%i)\n", ioapic, mp_ioapics[ioapic].mpc_apicid, pin, entry.vector, irq, edge_level, active_high_low); if (edge_level) diff -urN linux-2.4.22-bk56/arch/x86_64/kernel/mpparse.c linux-2.4.22-bk57/arch/x86_64/kernel/mpparse.c --- linux-2.4.22-bk56/arch/x86_64/kernel/mpparse.c 2003-11-20 02:49:55.000000000 -0800 +++ linux-2.4.22-bk57/arch/x86_64/kernel/mpparse.c 2003-11-20 02:50:01.000000000 -0800 @@ -691,7 +691,7 @@ MP_processor_info(&processor); } -#ifdef CONFIG_X86_IO_APIC +#if defined(CONFIG_X86_IO_APIC) && defined(CONFIG_ACPI_INTERPRETER) #define MP_ISA_BUS 0 #define MP_MAX_IOAPIC_PIN 127 @@ -1026,12 +1026,14 @@ mp_ioapic_routing[ioapic].apic_id, ioapic_pin, vector, entry->irq); } - + + print_IO_APIC(); + return; } #endif /*CONFIG_ACPI_PCI*/ -#endif /*CONFIG_X86_IO_APIC*/ +#endif /*CONFIG_X86_IO_APIC && CONFIG_ACPI_INTERPRETER*/ #endif /*CONFIG_ACPI_BOOT*/ diff -urN linux-2.4.22-bk56/arch/x86_64/kernel/pci-pc.c linux-2.4.22-bk57/arch/x86_64/kernel/pci-pc.c --- linux-2.4.22-bk56/arch/x86_64/kernel/pci-pc.c 2003-11-20 02:49:55.000000000 -0800 +++ linux-2.4.22-bk57/arch/x86_64/kernel/pci-pc.c 2003-11-20 02:50:01.000000000 -0800 @@ -570,6 +570,14 @@ return; } +static int use_acpi_pci __initdata = 1; + +__init void pci_disable_acpi(void) +{ + use_acpi_pci = 0; + return; +} + void __devinit pcibios_init(void) { struct pci_ops *dir = NULL; diff -urN linux-2.4.22-bk56/arch/x86_64/kernel/setup.c linux-2.4.22-bk57/arch/x86_64/kernel/setup.c --- linux-2.4.22-bk56/arch/x86_64/kernel/setup.c 2003-11-20 02:49:55.000000000 -0800 +++ linux-2.4.22-bk57/arch/x86_64/kernel/setup.c 2003-11-20 02:50:01.000000000 -0800 @@ -49,6 +49,10 @@ #include int acpi_disabled = 0; +#ifdef CONFIG_ACPI_BOOT +int acpi_irq __initdata = 1; /* enable IRQ */ +#endif + /* * Machine setup.. diff -urN linux-2.4.22-bk56/drivers/acpi/bus.c linux-2.4.22-bk57/drivers/acpi/bus.c --- linux-2.4.22-bk56/drivers/acpi/bus.c 2003-11-20 02:49:55.000000000 -0800 +++ linux-2.4.22-bk57/drivers/acpi/bus.c 2003-11-20 02:50:02.000000000 -0800 @@ -49,7 +49,7 @@ #define PREFIX "ACPI: " -extern void acpi_pic_set_level_irq(unsigned int irq); +extern void __init acpi_pic_sci_set_trigger(unsigned int irq); extern int acpi_disabled; @@ -1881,7 +1881,7 @@ if (acpi_ioapic) mp_config_ioapic_for_sci(acpi_fadt.sci_int); else - acpi_pic_set_level_irq(acpi_fadt.sci_int); + acpi_pic_sci_set_trigger(acpi_fadt.sci_int); #endif status = acpi_enable_subsystem(ACPI_FULL_INITIALIZATION); diff -urN linux-2.4.22-bk56/drivers/acpi/pci_link.c linux-2.4.22-bk57/drivers/acpi/pci_link.c --- linux-2.4.22-bk56/drivers/acpi/pci_link.c 2003-11-20 02:49:55.000000000 -0800 +++ linux-2.4.22-bk57/drivers/acpi/pci_link.c 2003-11-20 02:50:02.000000000 -0800 @@ -95,7 +95,7 @@ void *context) { struct acpi_pci_link *link = (struct acpi_pci_link *) context; - int i = 0; + u32 i = 0; ACPI_FUNCTION_TRACE("acpi_pci_link_check_possible"); @@ -290,7 +290,10 @@ if (!link->irq.active) { ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "No active IRQ resource found\n")); - printk(KERN_WARNING "_CRS returns NULL! Using IRQ %d for device (%s [%s]).\n", irq, acpi_device_name(link->device), acpi_device_bid(link->device)); + printk(KERN_WARNING "_CRS returns NULL! Using IRQ %d for" + "device (%s [%s]).\n", irq, + acpi_device_name(link->device), + acpi_device_bid(link->device)); link->irq.active = irq; } @@ -428,30 +431,67 @@ PCI Link IRQ Management -------------------------------------------------------------------------- */ -#define ACPI_MAX_IRQS 256 -#define ACPI_MAX_ISA_IRQ 16 - /* - * IRQ penalties are used to promote PCI IRQ balancing. We set each ISA- - * possible IRQ (0-15) with a default penalty relative to its feasibility - * for PCI's use: + * "acpi_irq_balance" (default in APIC mode) enables ACPI to use PIC Interrupt + * Link Devices to move the PIRQs around to minimize sharing. + * + * "acpi_irq_nobalance" (default in PIC mode) tells ACPI not to move any PIC IRQs + * that the BIOS has already set to active. This is necessary because + * ACPI has no automatic means of knowing what ISA IRQs are used. Note that + * if the BIOS doesn't set a Link Device active, ACPI needs to program it + * even if acpi_irq_nobalance is set. + * + * A tables of penalties avoids directing PCI interrupts to well known + * ISA IRQs. Boot params are available to over-ride the default table: * - * Never use: 0, 1, 2 (timer, keyboard, and cascade) - * Avoid using: 13, 14, and 15 (FP error and IDE) - * Penalize: 3, 4, 6, 7, 12 (known ISA uses) + * List interrupts that are free for PCI use. + * acpi_irq_pci=n[,m] * - * Thus we're left with IRQs 5, 9, 10, 11, and everything above 15 (IO[S]APIC) - * as 'best bets' for PCI use. + * List interrupts that should not be used for PCI: + * acpi_irq_isa=n[,m] + * + * Note that PCI IRQ routers have a list of possible IRQs, + * which may not include the IRQs this table says are available. + * + * Since this heuristic can't tell the difference between a link + * that no device will attach to, vs. a link which may be shared + * by multiple active devices -- it is not optimal. + * + * If interrupt performance is that important, get an IO-APIC system + * with a pin dedicated to each device. Or for that matter, an MSI + * enabled system. */ +#define ACPI_MAX_IRQS 256 +#define ACPI_MAX_ISA_IRQ 16 + +#define PIRQ_PENALTY_PCI_AVAILABLE (0) +#define PIRQ_PENALTY_PCI_POSSIBLE (16*16) +#define PIRQ_PENALTY_PCI_USING (16*16*16) +#define PIRQ_PENALTY_ISA_TYPICAL (16*16*16*16) +#define PIRQ_PENALTY_ISA_USED (16*16*16*16*16) +#define PIRQ_PENALTY_ISA_ALWAYS (16*16*16*16*16*16) + static int acpi_irq_penalty[ACPI_MAX_IRQS] = { - 1000000, 1000000, 1000000, 10000, - 10000, 0, 10000, 10000, - 10000, 0, 0, 0, - 10000, 100000, 100000, 100000, + PIRQ_PENALTY_ISA_ALWAYS, /* IRQ0 timer */ + PIRQ_PENALTY_ISA_ALWAYS, /* IRQ1 keyboard */ + PIRQ_PENALTY_ISA_ALWAYS, /* IRQ2 cascade */ + PIRQ_PENALTY_ISA_TYPICAL, /* IRQ3 serial */ + PIRQ_PENALTY_ISA_TYPICAL, /* IRQ4 serial */ + PIRQ_PENALTY_ISA_TYPICAL, /* IRQ5 sometimes SoundBlaster */ + PIRQ_PENALTY_ISA_TYPICAL, /* IRQ6 */ + PIRQ_PENALTY_ISA_TYPICAL, /* IRQ7 parallel, spurious */ + PIRQ_PENALTY_ISA_TYPICAL, /* IRQ8 rtc, sometimes */ + PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ9 PCI, often acpi */ + PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ10 PCI */ + PIRQ_PENALTY_PCI_AVAILABLE, /* IRQ11 PCI */ + PIRQ_PENALTY_ISA_TYPICAL, /* IRQ12 mouse */ + PIRQ_PENALTY_ISA_USED, /* IRQ13 fpe, sometimes */ + PIRQ_PENALTY_ISA_USED, /* IRQ14 ide0 */ + PIRQ_PENALTY_ISA_USED, /* IRQ15 ide1 */ + /* >IRQ15 */ }; - int acpi_pci_link_check (void) { @@ -472,20 +512,30 @@ continue; } - if (link->irq.active) - acpi_irq_penalty[link->irq.active] += 100; - else if (link->irq.possible_count) { - int penalty = 100 / link->irq.possible_count; - for (i=0; iirq.possible_count; i++) { + /* + * reflect the possible and active irqs in the penalty table -- + * useful for breaking ties. + */ + if (link->irq.possible_count) { + int penalty = PIRQ_PENALTY_PCI_POSSIBLE / link->irq.possible_count; + + for (i = 0; i < link->irq.possible_count; i++) { if (link->irq.possible[i] < ACPI_MAX_ISA_IRQ) acpi_irq_penalty[link->irq.possible[i]] += penalty; } + + } else if (link->irq.active) { + acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_POSSIBLE; } } + /* Add a penalty for the SCI */ + acpi_irq_penalty[acpi_fadt.sci_int] += PIRQ_PENALTY_PCI_USING; return_VALUE(0); } +static int acpi_irq_balance; /* 0: static, 1: balance */ + static int acpi_pci_link_allocate(struct acpi_pci_link* link) { int irq; int i; @@ -499,12 +549,14 @@ irq = link->irq.active; } else { irq = link->irq.possible[0]; + } + if (acpi_irq_balance || !link->irq.active) { /* * Select the best IRQ. This is done in reverse to promote * the use of IRQs 9, 10, 11, and >15. */ - for (i=(link->irq.possible_count-1); i>0; i--) { + for (i = (link->irq.possible_count - 1); i >= 0; i--) { if (acpi_irq_penalty[irq] > acpi_irq_penalty[link->irq.possible[i]]) irq = link->irq.possible[i]; } @@ -517,13 +569,14 @@ acpi_device_bid(link->device)); return_VALUE(-ENODEV); } else { - acpi_irq_penalty[link->irq.active] += 100; + acpi_irq_penalty[link->irq.active] += PIRQ_PENALTY_PCI_USING; printk(PREFIX "%s [%s] enabled at IRQ %d\n", acpi_device_name(link->device), acpi_device_bid(link->device), link->irq.active); } link->irq.setonboot = 1; + return_VALUE(0); } @@ -606,9 +659,12 @@ if (result) goto end; + /* query and set link->irq.active */ acpi_pci_link_get_current(link); - printk(PREFIX "%s [%s] (IRQs", acpi_device_name(device), acpi_device_bid(device)); +//#ifdef CONFIG_ACPI_DEBUG + printk(PREFIX "%s [%s] (IRQs", acpi_device_name(device), + acpi_device_bid(device)); for (i = 0; i < link->irq.possible_count; i++) { if (link->irq.active == link->irq.possible[i]) { printk(" *%d", link->irq.possible[i]); @@ -618,6 +674,7 @@ printk(" %d", link->irq.possible[i]); } printk(")\n"); +//#endif /* CONFIG_ACPI_DEBUG */ /* TBD: Acquire/release lock */ list_add_tail(&link->node, &acpi_link.entries); @@ -653,6 +710,77 @@ return_VALUE(0); } +/* + * modify acpi_irq_penalty[] from cmdline + */ +static int __init acpi_irq_penalty_update(char *str, int used) +{ + int i; + + for (i = 0; i < 16; i++) { + int retval; + int irq; + + retval = get_option(&str,&irq); + + if (!retval) + break; /* no number found */ + + if (irq < 0) + continue; + + if (irq >= ACPI_MAX_IRQS) + continue; + + if (used) + acpi_irq_penalty[irq] += PIRQ_PENALTY_ISA_USED; + else + acpi_irq_penalty[irq] = PIRQ_PENALTY_PCI_AVAILABLE; + + if (retval != 2) /* no next number */ + break; + } + return 1; +} + +/* + * Over-ride default table to reserve additional IRQs for use by ISA + * e.g. acpi_irq_isa=5 + * Useful for telling ACPI how not to interfere with your ISA sound card. + */ +static int __init acpi_irq_isa(char *str) +{ + return(acpi_irq_penalty_update(str, 1)); +} +__setup("acpi_irq_isa=", acpi_irq_isa); + +/* + * Over-ride default table to free additional IRQs for use by PCI + * e.g. acpi_irq_pci=7,15 + * Used for acpi_irq_balance to free up IRQs to reduce PCI IRQ sharing. + */ +static int __init acpi_irq_pci(char *str) +{ + return(acpi_irq_penalty_update(str, 0)); +} +__setup("acpi_irq_pci=", acpi_irq_pci); + +static int __init acpi_irq_nobalance_set(char *str) +{ +printk("ACPI STATIC SET\n"); + acpi_irq_balance = 0; + return(1); +} +__setup("acpi_irq_nobalance", acpi_irq_nobalance_set); + +int __init acpi_irq_balance_set(char *str) +{ +printk("ACPI BALANCE SET\n"); + acpi_irq_balance = 1; + return(1); +} +__setup("acpi_irq_balance", acpi_irq_balance_set); + int __init acpi_pci_link_init (void) diff -urN linux-2.4.22-bk56/drivers/acpi/system.c linux-2.4.22-bk57/drivers/acpi/system.c --- linux-2.4.22-bk56/drivers/acpi/system.c 2003-11-20 02:49:55.000000000 -0800 +++ linux-2.4.22-bk57/drivers/acpi/system.c 2003-11-20 02:50:02.000000000 -0800 @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -92,7 +93,13 @@ static void acpi_power_off (void) { - acpi_suspend(ACPI_STATE_S5); + if (unlikely(in_interrupt())) + BUG(); + acpi_enter_sleep_state_prep(ACPI_STATE_S5); + ACPI_DISABLE_IRQS(); + acpi_enter_sleep_state(ACPI_STATE_S5); + + printk(KERN_EMERG "ACPI: can not power off machine\n"); } #endif /*CONFIG_PM*/ diff -urN linux-2.4.22-bk56/drivers/char/synclink.c linux-2.4.22-bk57/drivers/char/synclink.c --- linux-2.4.22-bk56/drivers/char/synclink.c 2003-11-20 02:49:56.000000000 -0800 +++ linux-2.4.22-bk57/drivers/char/synclink.c 2003-11-20 02:50:12.000000000 -0800 @@ -945,7 +945,7 @@ name: "synclink", id_table: synclink_pci_tbl, probe: synclink_init_one, - remove: synclink_remove_one, + remove: __devexit_p(synclink_remove_one), }; static struct tty_driver serial_driver, callout_driver; diff -urN linux-2.4.22-bk56/drivers/scsi/megaraid2.c linux-2.4.22-bk57/drivers/scsi/megaraid2.c --- linux-2.4.22-bk56/drivers/scsi/megaraid2.c 2003-11-20 02:49:57.000000000 -0800 +++ linux-2.4.22-bk57/drivers/scsi/megaraid2.c 2003-11-20 02:50:31.000000000 -0800 @@ -2400,7 +2400,7 @@ *len = (u32)cmd->request_bufflen; if( scb->dma_direction == PCI_DMA_TODEVICE ) { - pci_dma_sync_sg(adapter->host->pci_dev, sgl, cmd->use_sg, + pci_dma_sync_sg(adapter->host->pci_dev, cmd->request_buffer, cmd->use_sg, PCI_DMA_TODEVICE); } diff -urN linux-2.4.22-bk56/drivers/sound/cmpci.c linux-2.4.22-bk57/drivers/sound/cmpci.c --- linux-2.4.22-bk56/drivers/sound/cmpci.c 2003-11-20 02:49:57.000000000 -0800 +++ linux-2.4.22-bk57/drivers/sound/cmpci.c 2003-11-20 02:50:33.000000000 -0800 @@ -1865,8 +1865,11 @@ cnt = count; if (cnt <= 0) { start_adc(s); - if (file->f_flags & O_NONBLOCK) - return ret ? ret : -EAGAIN; + if (file->f_flags & O_NONBLOCK) { + if (!ret) + ret = -EAGAIN; + goto out; + } if (!schedule_timeout(HZ)) { printk(KERN_DEBUG "cmpci: read: chip lockup? dmasz %u fragsz %u count %i hwptr %u swptr %u\n", s->dma_adc.dmasize, s->dma_adc.fragsize, s->dma_adc.count, @@ -1879,12 +1882,18 @@ s->dma_adc.count = s->dma_adc.hwptr = s->dma_adc.swptr = 0; spin_unlock_irqrestore(&s->lock, flags); } - if (signal_pending(current)) - return ret ? ret : -ERESTARTSYS; + if (signal_pending(current)) { + if (!ret) + ret = -ERESTARTSYS; + goto out; + } continue; } - if (copy_to_user(buffer, s->dma_adc.rawbuf + swptr, cnt)) - return ret ? ret : -EFAULT; + if (copy_to_user(buffer, s->dma_adc.rawbuf + swptr, cnt)) { + if (!ret) + ret = -EFAULT; + goto out; + } swptr = (swptr + cnt) % s->dma_adc.dmasize; spin_lock_irqsave(&s->lock, flags); s->dma_adc.swptr = swptr; @@ -1895,7 +1904,8 @@ start_adc_unlocked(s); spin_unlock_irqrestore(&s->lock, flags); } - remove_wait_queue(&s->dma_adc.wait, &wait); +out: + remove_wait_queue(&s->dma_adc.wait, &wait); set_current_state(TASK_RUNNING); return ret; } diff -urN linux-2.4.22-bk56/include/acpi/acpi_bus.h linux-2.4.22-bk57/include/acpi/acpi_bus.h --- linux-2.4.22-bk56/include/acpi/acpi_bus.h 2003-08-25 04:44:43.000000000 -0700 +++ linux-2.4.22-bk57/include/acpi/acpi_bus.h 2003-11-20 02:50:40.000000000 -0800 @@ -35,6 +35,7 @@ #include +extern int acpi_disabled; /* TBD: Make dynamic */ #define ACPI_MAX_HANDLES 10 diff -urN linux-2.4.22-bk56/include/asm-i386/acpi.h linux-2.4.22-bk57/include/asm-i386/acpi.h --- linux-2.4.22-bk56/include/asm-i386/acpi.h 2003-11-20 02:49:58.000000000 -0800 +++ linux-2.4.22-bk57/include/asm-i386/acpi.h 2003-11-20 02:50:40.000000000 -0800 @@ -110,33 +110,20 @@ extern int acpi_lapic; extern int acpi_ioapic; - /* Fixmap pages to reserve for ACPI boot-time tables (see fixmap.h) */ #define FIX_ACPI_PAGES 4 -#ifdef CONFIG_X86_IO_APIC -extern int skip_ioapic_setup; - -static inline void disable_ioapic_setup(void) -{ - skip_ioapic_setup = 1; -} - -static inline int ioapic_setup_disabled(void) -{ - return skip_ioapic_setup; -} - -#else -static inline void disable_ioapic_setup(void) -{ } - -#endif - -#else /* CONFIG_ACPI_BOOT */ +#else /* !CONFIG_ACPI_BOOT */ # define acpi_lapic 0 # define acpi_ioapic 0 +#endif /* !CONFIG_ACPI_BOOT */ + +#ifdef CONFIG_ACPI_PCI +extern int acpi_irq_balance_set(char *str); +#else +static inline int acpi_irq_balance_set(char *str) +{ return 0; } #endif #ifdef CONFIG_ACPI_SLEEP diff -urN linux-2.4.22-bk56/include/asm-i386/io_apic.h linux-2.4.22-bk57/include/asm-i386/io_apic.h --- linux-2.4.22-bk56/include/asm-i386/io_apic.h 2003-08-25 04:44:43.000000000 -0700 +++ linux-2.4.22-bk57/include/asm-i386/io_apic.h 2003-11-20 02:50:40.000000000 -0800 @@ -131,9 +131,6 @@ (void) *(IO_APIC_BASE(apic)+4); } -/* 1 if "noapic" boot option passed */ -extern int skip_ioapic_setup; - /* * If we use the IO-APIC for IRQ routing, disable automatic * assignment of PCI IRQ's. @@ -147,8 +144,24 @@ extern int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int active_high_low); #endif -#else /* !CONFIG_X86_IO_APIC */ +extern int skip_ioapic_setup; /* 1 for "noapic" */ + +static inline void disable_ioapic_setup(void) +{ + skip_ioapic_setup = 1; +} + +static inline int ioapic_setup_disabled(void) +{ + return skip_ioapic_setup; +} + +#else /* !CONFIG_X86_IO_APIC */ #define io_apic_assign_pci_irqs 0 -#endif + +static inline void disable_ioapic_setup(void) +{ } + +#endif /* !CONFIG_X86_IO_APIC */ #endif diff -urN linux-2.4.22-bk56/include/asm-x86_64/acpi.h linux-2.4.22-bk57/include/asm-x86_64/acpi.h --- linux-2.4.22-bk56/include/asm-x86_64/acpi.h 2003-11-20 02:49:58.000000000 -0800 +++ linux-2.4.22-bk57/include/asm-x86_64/acpi.h 2003-11-20 02:50:41.000000000 -0800 @@ -104,28 +104,26 @@ :"0"(n_hi), "1"(n_lo)) -#ifndef CONFIG_ACPI_BOOT -#define acpi_lapic 0 -#define acpi_ioapic 0 -#else -#ifdef CONFIG_X86_LOCAL_APIC +#ifdef CONFIG_ACPI_BOOT extern int acpi_lapic; -#else -#define acpi_lapic 0 -#endif -#ifdef CONFIG_X86_IO_APIC extern int acpi_ioapic; -#else -static inline void disable_ioapic_setup(void) -{ } -#define acpi_ioapic 0 -#endif /* Fixmap pages to reserve for ACPI boot-time tables (see fixmap.h) */ #define FIX_ACPI_PAGES 4 -#endif /*CONFIG_ACPI_BOOT*/ +#else /* CONFIG_ACPI_BOOT */ +# define acpi_lapic 0 +# define acpi_ioapic 0 + +#endif + +#ifdef CONFIG_ACPI_PCI +extern int acpi_irq_balance_set(char *str); +#else +static inline int acpi_irq_balance_set(char *str) +{ return 0; } +#endif #ifdef CONFIG_ACPI_SLEEP diff -urN linux-2.4.22-bk56/include/asm-x86_64/apic.h linux-2.4.22-bk57/include/asm-x86_64/apic.h --- linux-2.4.22-bk56/include/asm-x86_64/apic.h 2003-11-20 02:49:58.000000000 -0800 +++ linux-2.4.22-bk57/include/asm-x86_64/apic.h 2003-06-13 07:51:38.000000000 -0700 @@ -102,17 +102,4 @@ #define esr_disable 0 extern unsigned boot_cpu_id; -extern int skip_ioapic_setup; - -static inline void disable_ioapic_setup(void) -{ - - skip_ioapic_setup = 1; -} - -static inline int ioapic_setup_disabled(void) -{ - return skip_ioapic_setup; -} - #endif /* __ASM_APIC_H */ diff -urN linux-2.4.22-bk56/include/asm-x86_64/io_apic.h linux-2.4.22-bk57/include/asm-x86_64/io_apic.h --- linux-2.4.22-bk56/include/asm-x86_64/io_apic.h 2003-11-20 02:49:58.000000000 -0800 +++ linux-2.4.22-bk57/include/asm-x86_64/io_apic.h 2003-11-20 02:50:41.000000000 -0800 @@ -141,9 +141,26 @@ */ #define io_apic_assign_pci_irqs (mp_irq_entries && !skip_ioapic_setup) -#else /* !CONFIG_X86_IO_APIC */ +extern int skip_ioapic_setup; /* 1 for "noapic" */ + +static inline void disable_ioapic_setup(void) +{ + skip_ioapic_setup = 1; +} + +static inline int ioapic_setup_disabled(void) +{ + return skip_ioapic_setup; +} + +#else /* !CONFIG_X86_IO_APIC */ + #define io_apic_assign_pci_irqs 0 -#endif + +static inline void disable_ioapic_setup(void) +{ } + +#endif /* !CONFIG_X86_IO_APIC */ extern int io_apic_get_unique_id (int ioapic, int apic_id); extern int io_apic_get_version (int ioapic);