aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2007-11-17 01:05:28 -0500
committerLen Brown <len.brown@intel.com>2007-11-20 01:16:29 -0500
commit61fd47e0c84764f49b4e52bfd8170fac52636f00 (patch)
treec94c7b8c43dee4bb123900f49ef781607ee0d6fb
parentf0714d20234062bd0a8f49a6b32f7d1d7f3c2943 (diff)
ACPI: fix two IRQ8 issues in IOAPIC mode
Use mp_irqs[] to get PNP device's interrupt polarity and trigger. There are two reasons to do this: 1. BIOS bug for PNP interrupt 2. BIOS explictly does override mp_irqs[] should cover all the cases. http://bugzilla.kernel.org/show_bug.cgi?id=5243 http://bugzilla.kernel.org/show_bug.cgi?id=7679 http://bugzilla.kernel.org/show_bug.cgi?id=9153 [lenb: fixed !IOAPIC and 64-bit !SMP builds] Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--arch/x86/kernel/io_apic_32.c21
-rw-r--r--arch/x86/kernel/io_apic_64.c24
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c18
-rw-r--r--include/linux/acpi.h5
4 files changed, 65 insertions, 3 deletions
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index f35c6eb33da9..6bb80ea5f4ee 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -962,7 +962,7 @@ static int EISA_ELCR(unsigned int irq)
962#define default_MCA_trigger(idx) (1) 962#define default_MCA_trigger(idx) (1)
963#define default_MCA_polarity(idx) (0) 963#define default_MCA_polarity(idx) (0)
964 964
965static int __init MPBIOS_polarity(int idx) 965static int MPBIOS_polarity(int idx)
966{ 966{
967 int bus = mp_irqs[idx].mpc_srcbus; 967 int bus = mp_irqs[idx].mpc_srcbus;
968 int polarity; 968 int polarity;
@@ -2830,6 +2830,25 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int edge_level, int a
2830 return 0; 2830 return 0;
2831} 2831}
2832 2832
2833int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity)
2834{
2835 int i;
2836
2837 if (skip_ioapic_setup)
2838 return -1;
2839
2840 for (i = 0; i < mp_irq_entries; i++)
2841 if (mp_irqs[i].mpc_irqtype == mp_INT &&
2842 mp_irqs[i].mpc_srcbusirq == bus_irq)
2843 break;
2844 if (i >= mp_irq_entries)
2845 return -1;
2846
2847 *trigger = irq_trigger(i);
2848 *polarity = irq_polarity(i);
2849 return 0;
2850}
2851
2833#endif /* CONFIG_ACPI */ 2852#endif /* CONFIG_ACPI */
2834 2853
2835static int __init parse_disable_timer_pin_1(char *arg) 2854static int __init parse_disable_timer_pin_1(char *arg)
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index 953328b55a30..435a8c9b55f8 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -546,7 +546,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin)
546#define default_PCI_trigger(idx) (1) 546#define default_PCI_trigger(idx) (1)
547#define default_PCI_polarity(idx) (1) 547#define default_PCI_polarity(idx) (1)
548 548
549static int __init MPBIOS_polarity(int idx) 549static int MPBIOS_polarity(int idx)
550{ 550{
551 int bus = mp_irqs[idx].mpc_srcbus; 551 int bus = mp_irqs[idx].mpc_srcbus;
552 int polarity; 552 int polarity;
@@ -2222,8 +2222,27 @@ int io_apic_set_pci_routing (int ioapic, int pin, int irq, int triggering, int p
2222 return 0; 2222 return 0;
2223} 2223}
2224 2224
2225#endif /* CONFIG_ACPI */
2226 2225
2226int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity)
2227{
2228 int i;
2229
2230 if (skip_ioapic_setup)
2231 return -1;
2232
2233 for (i = 0; i < mp_irq_entries; i++)
2234 if (mp_irqs[i].mpc_irqtype == mp_INT &&
2235 mp_irqs[i].mpc_srcbusirq == bus_irq)
2236 break;
2237 if (i >= mp_irq_entries)
2238 return -1;
2239
2240 *trigger = irq_trigger(i);
2241 *polarity = irq_polarity(i);
2242 return 0;
2243}
2244
2245#endif /* CONFIG_ACPI */
2227 2246
2228/* 2247/*
2229 * This function currently is only a helper for the i386 smp boot process where 2248 * This function currently is only a helper for the i386 smp boot process where
@@ -2260,3 +2279,4 @@ void __init setup_ioapic_dest(void)
2260 } 2279 }
2261} 2280}
2262#endif 2281#endif
2282
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index 0e3b8d0ff06b..11adab13f2b7 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -75,6 +75,7 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
75{ 75{
76 int i = 0; 76 int i = 0;
77 int irq; 77 int irq;
78 int p, t;
78 79
79 if (!valid_IRQ(gsi)) 80 if (!valid_IRQ(gsi))
80 return; 81 return;
@@ -85,6 +86,23 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
85 if (i >= PNP_MAX_IRQ) 86 if (i >= PNP_MAX_IRQ)
86 return; 87 return;
87 88
89 /*
90 * in IO-APIC mode, use overrided attribute. Two reasons:
91 * 1. BIOS bug in DSDT
92 * 2. BIOS uses IO-APIC mode Interrupt Source Override
93 */
94 if (!acpi_get_override_irq(gsi, &t, &p)) {
95 t = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE;
96 p = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH;
97
98 if (triggering != t || polarity != p) {
99 pnp_warn("IRQ %d override to %s, %s",
100 gsi, t ? "edge":"level", p ? "low":"high");
101 triggering = t;
102 polarity = p;
103 }
104 }
105
88 res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag 106 res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag
89 res->irq_resource[i].flags |= irq_flags(triggering, polarity); 107 res->irq_resource[i].flags |= irq_flags(triggering, polarity);
90 irq = acpi_register_gsi(gsi, triggering, polarity); 108 irq = acpi_register_gsi(gsi, triggering, polarity);
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 8ccedf7a0a5a..e3c16c981e46 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -132,6 +132,11 @@ extern unsigned long acpi_realmode_flags;
132int acpi_register_gsi (u32 gsi, int triggering, int polarity); 132int acpi_register_gsi (u32 gsi, int triggering, int polarity);
133int acpi_gsi_to_irq (u32 gsi, unsigned int *irq); 133int acpi_gsi_to_irq (u32 gsi, unsigned int *irq);
134 134
135#ifdef CONFIG_X86_IO_APIC
136extern int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity);
137#else
138#define acpi_get_override_irq(bus, trigger, polarity) (-1)
139#endif
135/* 140/*
136 * This function undoes the effect of one call to acpi_register_gsi(). 141 * This function undoes the effect of one call to acpi_register_gsi().
137 * If this matches the last registration, any IRQ resources for gsi 142 * If this matches the last registration, any IRQ resources for gsi