diff options
author | Akinobu Mita <akinobu.mita@gmail.com> | 2008-04-19 10:55:13 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-26 11:35:47 -0400 |
commit | a1a33fa315b8a5a390f1132681485209500ff5b5 (patch) | |
tree | b61888d030a7c5becc4b2b8bb6e93b9527d04b74 /arch | |
parent | 4abc1a0068945ac078fb0a00a359cd3be2e7dd8d (diff) |
x86: use bitmap library for pin_programmed
Use bitmap library for pin_programmed rather than reinvent
bitmaps.
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/mpparse.c | 14 |
1 files changed, 5 insertions, 9 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 | ||
804 | extern struct mp_ioapic_routing mp_ioapic_routing[MAX_IO_APICS]; | 803 | extern 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 | ||
983 | int mp_register_gsi(u32 gsi, int triggering, int polarity) | 982 | int 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 |