Commit 55f05ffa authored by Andi Kleen's avatar Andi Kleen Committed by Andi Kleen

[PATCH] Replace mp bus array with bitmap for bus not pci

Since we only support PCI and ISA legacy busses now there is no need to
have an full array with checking.
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
parent dfa4698c
...@@ -308,7 +308,7 @@ static int __init find_isa_irq_pin(int irq, int type) ...@@ -308,7 +308,7 @@ static int __init find_isa_irq_pin(int irq, int type)
for (i = 0; i < mp_irq_entries; i++) { for (i = 0; i < mp_irq_entries; i++) {
int lbus = mp_irqs[i].mpc_srcbus; int lbus = mp_irqs[i].mpc_srcbus;
if (mp_bus_id_to_type[lbus] == MP_BUS_ISA && if (test_bit(lbus, mp_bus_not_pci) &&
(mp_irqs[i].mpc_irqtype == type) && (mp_irqs[i].mpc_irqtype == type) &&
(mp_irqs[i].mpc_srcbusirq == irq)) (mp_irqs[i].mpc_srcbusirq == irq))
...@@ -324,7 +324,7 @@ static int __init find_isa_irq_apic(int irq, int type) ...@@ -324,7 +324,7 @@ static int __init find_isa_irq_apic(int irq, int type)
for (i = 0; i < mp_irq_entries; i++) { for (i = 0; i < mp_irq_entries; i++) {
int lbus = mp_irqs[i].mpc_srcbus; int lbus = mp_irqs[i].mpc_srcbus;
if ((mp_bus_id_to_type[lbus] == MP_BUS_ISA) && if (test_bit(lbus, mp_bus_not_pci) &&
(mp_irqs[i].mpc_irqtype == type) && (mp_irqs[i].mpc_irqtype == type) &&
(mp_irqs[i].mpc_srcbusirq == irq)) (mp_irqs[i].mpc_srcbusirq == irq))
break; break;
...@@ -364,7 +364,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin) ...@@ -364,7 +364,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin)
mp_irqs[i].mpc_dstapic == MP_APIC_ALL) mp_irqs[i].mpc_dstapic == MP_APIC_ALL)
break; break;
if ((mp_bus_id_to_type[lbus] == MP_BUS_PCI) && if (!test_bit(lbus, mp_bus_not_pci) &&
!mp_irqs[i].mpc_irqtype && !mp_irqs[i].mpc_irqtype &&
(bus == lbus) && (bus == lbus) &&
(slot == ((mp_irqs[i].mpc_srcbusirq >> 2) & 0x1f))) { (slot == ((mp_irqs[i].mpc_srcbusirq >> 2) & 0x1f))) {
...@@ -410,28 +410,11 @@ static int __init MPBIOS_polarity(int idx) ...@@ -410,28 +410,11 @@ static int __init MPBIOS_polarity(int idx)
switch (mp_irqs[idx].mpc_irqflag & 3) switch (mp_irqs[idx].mpc_irqflag & 3)
{ {
case 0: /* conforms, ie. bus-type dependent polarity */ case 0: /* conforms, ie. bus-type dependent polarity */
{ if (test_bit(bus, mp_bus_not_pci))
switch (mp_bus_id_to_type[bus]) polarity = default_ISA_polarity(idx);
{ else
case MP_BUS_ISA: /* ISA pin */ polarity = default_PCI_polarity(idx);
{
polarity = default_ISA_polarity(idx);
break;
}
case MP_BUS_PCI: /* PCI pin */
{
polarity = default_PCI_polarity(idx);
break;
}
default:
{
printk(KERN_WARNING "broken BIOS!!\n");
polarity = 1;
break;
}
}
break; break;
}
case 1: /* high active */ case 1: /* high active */
{ {
polarity = 0; polarity = 0;
...@@ -469,28 +452,11 @@ static int MPBIOS_trigger(int idx) ...@@ -469,28 +452,11 @@ static int MPBIOS_trigger(int idx)
switch ((mp_irqs[idx].mpc_irqflag>>2) & 3) switch ((mp_irqs[idx].mpc_irqflag>>2) & 3)
{ {
case 0: /* conforms, ie. bus-type dependent */ case 0: /* conforms, ie. bus-type dependent */
{ if (test_bit(bus, mp_bus_not_pci))
switch (mp_bus_id_to_type[bus]) trigger = default_ISA_trigger(idx);
{ else
case MP_BUS_ISA: /* ISA pin */ trigger = default_PCI_trigger(idx);
{
trigger = default_ISA_trigger(idx);
break;
}
case MP_BUS_PCI: /* PCI pin */
{
trigger = default_PCI_trigger(idx);
break;
}
default:
{
printk(KERN_WARNING "broken BIOS!!\n");
trigger = 1;
break;
}
}
break; break;
}
case 1: /* edge */ case 1: /* edge */
{ {
trigger = 0; trigger = 0;
...@@ -596,31 +562,17 @@ static int pin_2_irq(int idx, int apic, int pin) ...@@ -596,31 +562,17 @@ static int pin_2_irq(int idx, int apic, int pin)
if (mp_irqs[idx].mpc_dstirq != pin) if (mp_irqs[idx].mpc_dstirq != pin)
printk(KERN_ERR "broken BIOS or MPTABLE parser, ayiee!!\n"); printk(KERN_ERR "broken BIOS or MPTABLE parser, ayiee!!\n");
switch (mp_bus_id_to_type[bus]) if (test_bit(bus, mp_bus_not_pci)) {
{ irq = mp_irqs[idx].mpc_srcbusirq;
case MP_BUS_ISA: /* ISA pin */ } else {
{ /*
irq = mp_irqs[idx].mpc_srcbusirq; * PCI IRQs are mapped in order
break; */
} i = irq = 0;
case MP_BUS_PCI: /* PCI pin */ while (i < apic)
{ irq += nr_ioapic_registers[i++];
/* irq += pin;
* PCI IRQs are mapped in order irq = gsi_irq_sharing(irq);
*/
i = irq = 0;
while (i < apic)
irq += nr_ioapic_registers[i++];
irq += pin;
irq = gsi_irq_sharing(irq);
break;
}
default:
{
printk(KERN_ERR "unknown bus type %d.\n",bus);
irq = 0;
break;
}
} }
BUG_ON(irq >= NR_IRQS); BUG_ON(irq >= NR_IRQS);
return irq; return irq;
......
...@@ -42,7 +42,7 @@ int acpi_found_madt; ...@@ -42,7 +42,7 @@ int acpi_found_madt;
* MP-table. * MP-table.
*/ */
unsigned char apic_version [MAX_APICS]; unsigned char apic_version [MAX_APICS];
unsigned char mp_bus_id_to_type [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 };
static int mp_current_pci_id = 0; static int mp_current_pci_id = 0;
...@@ -173,9 +173,9 @@ static void __init MP_bus_info (struct mpc_config_bus *m) ...@@ -173,9 +173,9 @@ static void __init MP_bus_info (struct mpc_config_bus *m)
Dprintk("Bus #%d is %s\n", m->mpc_busid, str); Dprintk("Bus #%d is %s\n", m->mpc_busid, str);
if (strncmp(str, "ISA", 3) == 0) { if (strncmp(str, "ISA", 3) == 0) {
mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA; set_bit(m->mpc_busid, mp_bus_not_pci);
} else if (strncmp(str, "PCI", 3) == 0) { } else if (strncmp(str, "PCI", 3) == 0) {
mp_bus_id_to_type[m->mpc_busid] = MP_BUS_PCI; clear_bit(m->mpc_busid, mp_bus_not_pci);
mp_bus_id_to_pci_bus[m->mpc_busid] = mp_current_pci_id; mp_bus_id_to_pci_bus[m->mpc_busid] = mp_current_pci_id;
mp_current_pci_id++; mp_current_pci_id++;
} else { } else {
...@@ -808,8 +808,7 @@ void __init mp_config_acpi_legacy_irqs (void) ...@@ -808,8 +808,7 @@ void __init mp_config_acpi_legacy_irqs (void)
/* /*
* Fabricate the legacy ISA bus (bus #31). * Fabricate the legacy ISA bus (bus #31).
*/ */
mp_bus_id_to_type[MP_ISA_BUS] = MP_BUS_ISA; set_bit(MP_ISA_BUS, mp_bus_not_pci);
Dprintk("Bus #%d is ISA\n", MP_ISA_BUS);
/* /*
* Locate the IOAPIC that manages the ISA IRQs (0-15). * Locate the IOAPIC that manages the ISA IRQs (0-15).
......
...@@ -159,13 +159,7 @@ struct mpc_config_lintsrc ...@@ -159,13 +159,7 @@ struct mpc_config_lintsrc
#define MAX_MP_BUSSES 256 #define MAX_MP_BUSSES 256
/* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */ /* Each PCI slot may be a combo card with its own bus. 4 IRQ pins per slot. */
#define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4) #define MAX_IRQ_SOURCES (MAX_MP_BUSSES * 4)
enum mp_bustype { extern DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
MP_BUS_ISA = 1,
MP_BUS_EISA,
MP_BUS_PCI,
MP_BUS_MCA
};
extern unsigned char mp_bus_id_to_type [MAX_MP_BUSSES];
extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES]; extern int mp_bus_id_to_pci_bus [MAX_MP_BUSSES];
extern unsigned int boot_cpu_physical_apicid; extern unsigned int boot_cpu_physical_apicid;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment