diff options
Diffstat (limited to 'arch/i386/kernel')
-rw-r--r-- | arch/i386/kernel/mpparse.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/arch/i386/kernel/mpparse.c b/arch/i386/kernel/mpparse.c index 0a061056b828..383a11600d2c 100644 --- a/arch/i386/kernel/mpparse.c +++ b/arch/i386/kernel/mpparse.c | |||
@@ -1058,11 +1058,20 @@ void __init mp_config_acpi_legacy_irqs (void) | |||
1058 | } | 1058 | } |
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | #define MAX_GSI_NUM 4096 | ||
1062 | |||
1061 | int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) | 1063 | int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) |
1062 | { | 1064 | { |
1063 | int ioapic = -1; | 1065 | int ioapic = -1; |
1064 | int ioapic_pin = 0; | 1066 | int ioapic_pin = 0; |
1065 | int idx, bit = 0; | 1067 | int idx, bit = 0; |
1068 | static int pci_irq = 16; | ||
1069 | /* | ||
1070 | * Mapping between Global System Interrups, which | ||
1071 | * represent all possible interrupts, and IRQs | ||
1072 | * assigned to actual devices. | ||
1073 | */ | ||
1074 | static int gsi_to_irq[MAX_GSI_NUM]; | ||
1066 | 1075 | ||
1067 | #ifdef CONFIG_ACPI_BUS | 1076 | #ifdef CONFIG_ACPI_BUS |
1068 | /* Don't set up the ACPI SCI because it's already set up */ | 1077 | /* Don't set up the ACPI SCI because it's already set up */ |
@@ -1097,11 +1106,26 @@ int mp_register_gsi (u32 gsi, int edge_level, int active_high_low) | |||
1097 | if ((1<<bit) & mp_ioapic_routing[ioapic].pin_programmed[idx]) { | 1106 | if ((1<<bit) & mp_ioapic_routing[ioapic].pin_programmed[idx]) { |
1098 | Dprintk(KERN_DEBUG "Pin %d-%d already programmed\n", | 1107 | Dprintk(KERN_DEBUG "Pin %d-%d already programmed\n", |
1099 | mp_ioapic_routing[ioapic].apic_id, ioapic_pin); | 1108 | mp_ioapic_routing[ioapic].apic_id, ioapic_pin); |
1100 | return gsi; | 1109 | return gsi_to_irq[gsi]; |
1101 | } | 1110 | } |
1102 | 1111 | ||
1103 | mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); | 1112 | mp_ioapic_routing[ioapic].pin_programmed[idx] |= (1<<bit); |
1104 | 1113 | ||
1114 | if (edge_level) { | ||
1115 | /* | ||
1116 | * For PCI devices assign IRQs in order, avoiding gaps | ||
1117 | * due to unused I/O APIC pins. | ||
1118 | */ | ||
1119 | int irq = gsi; | ||
1120 | if (gsi < MAX_GSI_NUM) { | ||
1121 | gsi = pci_irq++; | ||
1122 | gsi_to_irq[irq] = gsi; | ||
1123 | } else { | ||
1124 | printk(KERN_ERR "GSI %u is too high\n", gsi); | ||
1125 | return gsi; | ||
1126 | } | ||
1127 | } | ||
1128 | |||
1105 | io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, | 1129 | io_apic_set_pci_routing(ioapic, ioapic_pin, gsi, |
1106 | edge_level == ACPI_EDGE_SENSITIVE ? 0 : 1, | 1130 | edge_level == ACPI_EDGE_SENSITIVE ? 0 : 1, |
1107 | active_high_low == ACPI_ACTIVE_HIGH ? 0 : 1); | 1131 | active_high_low == ACPI_ACTIVE_HIGH ? 0 : 1); |