aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/x86/kernel/mpparse.c14
-rw-r--r--include/asm-x86/io_apic.h6
2 files changed, 9 insertions, 11 deletions
diff --git a/arch/x86/kernel/mpparse.c b/arch/x86/kernel/mpparse.c
index 534790b6d0f1..23e8432a9826 100644
--- a/arch/x86/kernel/mpparse.c
+++ b/arch/x86/kernel/mpparse.c
@@ -799,7 +799,6 @@ void __init find_smp_config(void)
799#ifdef CONFIG_X86_IO_APIC 799#ifdef CONFIG_X86_IO_APIC
800 800
801#define MP_ISA_BUS 0 801#define MP_ISA_BUS 0
802#define MP_MAX_IOAPIC_PIN 127
803 802
804extern struct mp_ioapic_routing mp_ioapic_routing[MAX_IO_APICS]; 803extern struct mp_ioapic_routing mp_ioapic_routing[MAX_IO_APICS];
805 804
@@ -982,9 +981,8 @@ void __init mp_config_acpi_legacy_irqs(void)
982 981
983int mp_register_gsi(u32 gsi, int triggering, int polarity) 982int mp_register_gsi(u32 gsi, int triggering, int polarity)
984{ 983{
985 int ioapic = -1; 984 int ioapic;
986 int ioapic_pin = 0; 985 int ioapic_pin;
987 int idx, bit = 0;
988#ifdef CONFIG_X86_32 986#ifdef CONFIG_X86_32
989#define MAX_GSI_NUM 4096 987#define MAX_GSI_NUM 4096
990#define IRQ_COMPRESSION_START 64 988#define IRQ_COMPRESSION_START 64
@@ -1024,15 +1022,13 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity)
1024 * with redundant pin->gsi mappings (but unique PCI devices); 1022 * with redundant pin->gsi mappings (but unique PCI devices);
1025 * we only program the IOAPIC on the first. 1023 * we only program the IOAPIC on the first.
1026 */ 1024 */
1027 bit = ioapic_pin % 32; 1025 if (ioapic_pin > MP_MAX_IOAPIC_PIN) {
1028 idx = (ioapic_pin < 32) ? 0 : (ioapic_pin / 32);
1029 if (idx > 3) {
1030 printk(KERN_ERR "Invalid reference to IOAPIC pin " 1026 printk(KERN_ERR "Invalid reference to IOAPIC pin "
1031 "%d-%d\n", mp_ioapic_routing[ioapic].apic_id, 1027 "%d-%d\n", mp_ioapic_routing[ioapic].apic_id,
1032 ioapic_pin); 1028 ioapic_pin);
1033 return gsi; 1029 return gsi;
1034 } 1030 }
1035 if ((1 << bit) & mp_ioapic_routing[ioapic].pin_programmed[idx]) { 1031 if (test_bit(ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed)) {
1036 Dprintk(KERN_DEBUG "Pin %d-%d already programmed\n", 1032 Dprintk(KERN_DEBUG "Pin %d-%d already programmed\n",
1037 mp_ioapic_routing[ioapic].apic_id, ioapic_pin); 1033 mp_ioapic_routing[ioapic].apic_id, ioapic_pin);
1038#ifdef CONFIG_X86_32 1034#ifdef CONFIG_X86_32
@@ -1042,7 +1038,7 @@ int mp_register_gsi(u32 gsi, int triggering, int polarity)
1042#endif 1038#endif
1043 } 1039 }
1044 1040
1045 mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1 << bit); 1041 set_bit(ioapic_pin, mp_ioapic_routing[ioapic].pin_programmed);
1046#ifdef CONFIG_X86_32 1042#ifdef CONFIG_X86_32
1047 /* 1043 /*
1048 * For GSI >= 64, use IRQ compression 1044 * For GSI >= 64, use IRQ compression
diff --git a/include/asm-x86/io_apic.h b/include/asm-x86/io_apic.h
index 0c9e17c73e05..d593e14f0341 100644
--- a/include/asm-x86/io_apic.h
+++ b/include/asm-x86/io_apic.h
@@ -1,7 +1,7 @@
1#ifndef __ASM_IO_APIC_H 1#ifndef __ASM_IO_APIC_H
2#define __ASM_IO_APIC_H 2#define __ASM_IO_APIC_H
3 3
4#include <asm/types.h> 4#include <linux/types.h>
5#include <asm/mpspec.h> 5#include <asm/mpspec.h>
6#include <asm/apicdef.h> 6#include <asm/apicdef.h>
7 7
@@ -110,11 +110,13 @@ extern int nr_ioapic_registers[MAX_IO_APICS];
110 * MP-BIOS irq configuration table structures: 110 * MP-BIOS irq configuration table structures:
111 */ 111 */
112 112
113#define MP_MAX_IOAPIC_PIN 127
114
113struct mp_ioapic_routing { 115struct mp_ioapic_routing {
114 int apic_id; 116 int apic_id;
115 int gsi_base; 117 int gsi_base;
116 int gsi_end; 118 int gsi_end;
117 u32 pin_programmed[4]; 119 DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1);
118}; 120};
119 121
120/* I/O APIC entries */ 122/* I/O APIC entries */