aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2006-09-26 04:52:30 -0400
committerAndi Kleen <andi@basil.nowhere.org>2006-09-26 04:52:30 -0400
commit55f05ffaa788e039df2f1ebe0d7bfbcb6f39d0b4 (patch)
tree9b4da733f1afd01fea6622468b41561522e62cfa /arch
parentdfa4698c50bf85b7927214b0e4a3dc4bc3b3c4a9 (diff)
[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: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86_64/kernel/io_apic.c92
-rw-r--r--arch/x86_64/kernel/mpparse.c9
2 files changed, 26 insertions, 75 deletions
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index 8bbff64c20d7..a1412042b918 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -308,7 +308,7 @@ static int __init find_isa_irq_pin(int irq, int type)
308 for (i = 0; i < mp_irq_entries; i++) { 308 for (i = 0; i < mp_irq_entries; i++) {
309 int lbus = mp_irqs[i].mpc_srcbus; 309 int lbus = mp_irqs[i].mpc_srcbus;
310 310
311 if (mp_bus_id_to_type[lbus] == MP_BUS_ISA && 311 if (test_bit(lbus, mp_bus_not_pci) &&
312 (mp_irqs[i].mpc_irqtype == type) && 312 (mp_irqs[i].mpc_irqtype == type) &&
313 (mp_irqs[i].mpc_srcbusirq == irq)) 313 (mp_irqs[i].mpc_srcbusirq == irq))
314 314
@@ -324,7 +324,7 @@ static int __init find_isa_irq_apic(int irq, int type)
324 for (i = 0; i < mp_irq_entries; i++) { 324 for (i = 0; i < mp_irq_entries; i++) {
325 int lbus = mp_irqs[i].mpc_srcbus; 325 int lbus = mp_irqs[i].mpc_srcbus;
326 326
327 if ((mp_bus_id_to_type[lbus] == MP_BUS_ISA) && 327 if (test_bit(lbus, mp_bus_not_pci) &&
328 (mp_irqs[i].mpc_irqtype == type) && 328 (mp_irqs[i].mpc_irqtype == type) &&
329 (mp_irqs[i].mpc_srcbusirq == irq)) 329 (mp_irqs[i].mpc_srcbusirq == irq))
330 break; 330 break;
@@ -364,7 +364,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin)
364 mp_irqs[i].mpc_dstapic == MP_APIC_ALL) 364 mp_irqs[i].mpc_dstapic == MP_APIC_ALL)
365 break; 365 break;
366 366
367 if ((mp_bus_id_to_type[lbus] == MP_BUS_PCI) && 367 if (!test_bit(lbus, mp_bus_not_pci) &&
368 !mp_irqs[i].mpc_irqtype && 368 !mp_irqs[i].mpc_irqtype &&
369 (bus == lbus) && 369 (bus == lbus) &&
370 (slot == ((mp_irqs[i].mpc_srcbusirq >> 2) & 0x1f))) { 370 (slot == ((mp_irqs[i].mpc_srcbusirq >> 2) & 0x1f))) {
@@ -410,28 +410,11 @@ static int __init MPBIOS_polarity(int idx)
410 switch (mp_irqs[idx].mpc_irqflag & 3) 410 switch (mp_irqs[idx].mpc_irqflag & 3)
411 { 411 {
412 case 0: /* conforms, ie. bus-type dependent polarity */ 412 case 0: /* conforms, ie. bus-type dependent polarity */
413 { 413 if (test_bit(bus, mp_bus_not_pci))
414 switch (mp_bus_id_to_type[bus]) 414 polarity = default_ISA_polarity(idx);
415 { 415 else
416 case MP_BUS_ISA: /* ISA pin */ 416 polarity = default_PCI_polarity(idx);
417 {
418 polarity = default_ISA_polarity(idx);
419 break;
420 }
421 case MP_BUS_PCI: /* PCI pin */
422 {
423 polarity = default_PCI_polarity(idx);
424 break;
425 }
426 default:
427 {
428 printk(KERN_WARNING "broken BIOS!!\n");
429 polarity = 1;
430 break;
431 }
432 }
433 break; 417 break;
434 }
435 case 1: /* high active */ 418 case 1: /* high active */
436 { 419 {
437 polarity = 0; 420 polarity = 0;
@@ -469,28 +452,11 @@ static int MPBIOS_trigger(int idx)
469 switch ((mp_irqs[idx].mpc_irqflag>>2) & 3) 452 switch ((mp_irqs[idx].mpc_irqflag>>2) & 3)
470 { 453 {
471 case 0: /* conforms, ie. bus-type dependent */ 454 case 0: /* conforms, ie. bus-type dependent */
472 { 455 if (test_bit(bus, mp_bus_not_pci))
473 switch (mp_bus_id_to_type[bus]) 456 trigger = default_ISA_trigger(idx);
474 { 457 else
475 case MP_BUS_ISA: /* ISA pin */ 458 trigger = default_PCI_trigger(idx);
476 {
477 trigger = default_ISA_trigger(idx);
478 break;
479 }
480 case MP_BUS_PCI: /* PCI pin */
481 {
482 trigger = default_PCI_trigger(idx);
483 break;
484 }
485 default:
486 {
487 printk(KERN_WARNING "broken BIOS!!\n");
488 trigger = 1;
489 break;
490 }
491 }
492 break; 459 break;
493 }
494 case 1: /* edge */ 460 case 1: /* edge */
495 { 461 {
496 trigger = 0; 462 trigger = 0;
@@ -596,31 +562,17 @@ static int pin_2_irq(int idx, int apic, int pin)
596 if (mp_irqs[idx].mpc_dstirq != pin) 562 if (mp_irqs[idx].mpc_dstirq != pin)
597 printk(KERN_ERR "broken BIOS or MPTABLE parser, ayiee!!\n"); 563 printk(KERN_ERR "broken BIOS or MPTABLE parser, ayiee!!\n");
598 564
599 switch (mp_bus_id_to_type[bus]) 565 if (test_bit(bus, mp_bus_not_pci)) {
600 { 566 irq = mp_irqs[idx].mpc_srcbusirq;
601 case MP_BUS_ISA: /* ISA pin */ 567 } else {
602 { 568 /*
603 irq = mp_irqs[idx].mpc_srcbusirq; 569 * PCI IRQs are mapped in order
604 break; 570 */
605 } 571 i = irq = 0;
606 case MP_BUS_PCI: /* PCI pin */ 572 while (i < apic)
607 { 573 irq += nr_ioapic_registers[i++];
608 /* 574 irq += pin;
609 * PCI IRQs are mapped in order 575 irq = gsi_irq_sharing(irq);
610 */
611 i = irq = 0;
612 while (i < apic)
613 irq += nr_ioapic_registers[i++];
614 irq += pin;
615 irq = gsi_irq_sharing(irq);
616 break;
617 }
618 default:
619 {
620 printk(KERN_ERR "unknown bus type %d.\n",bus);
621 irq = 0;
622 break;
623 }
624 } 576 }
625 BUG_ON(irq >= NR_IRQS); 577 BUG_ON(irq >= NR_IRQS);
626 return irq; 578 return irq;
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
index c12acc3b5552..a8d38c0bb449 100644
--- a/arch/x86_64/kernel/mpparse.c
+++ b/arch/x86_64/kernel/mpparse.c
@@ -42,7 +42,7 @@ int acpi_found_madt;
42 * MP-table. 42 * MP-table.
43 */ 43 */
44unsigned char apic_version [MAX_APICS]; 44unsigned char apic_version [MAX_APICS];
45unsigned char mp_bus_id_to_type [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; 45DECLARE_BITMAP(mp_bus_not_pci, MAX_MP_BUSSES);
46int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 }; 46int mp_bus_id_to_pci_bus [MAX_MP_BUSSES] = { [0 ... MAX_MP_BUSSES-1] = -1 };
47 47
48static int mp_current_pci_id = 0; 48static int mp_current_pci_id = 0;
@@ -173,9 +173,9 @@ static void __init MP_bus_info (struct mpc_config_bus *m)
173 Dprintk("Bus #%d is %s\n", m->mpc_busid, str); 173 Dprintk("Bus #%d is %s\n", m->mpc_busid, str);
174 174
175 if (strncmp(str, "ISA", 3) == 0) { 175 if (strncmp(str, "ISA", 3) == 0) {
176 mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA; 176 set_bit(m->mpc_busid, mp_bus_not_pci);
177 } else if (strncmp(str, "PCI", 3) == 0) { 177 } else if (strncmp(str, "PCI", 3) == 0) {
178 mp_bus_id_to_type[m->mpc_busid] = MP_BUS_PCI; 178 clear_bit(m->mpc_busid, mp_bus_not_pci);
179 mp_bus_id_to_pci_bus[m->mpc_busid] = mp_current_pci_id; 179 mp_bus_id_to_pci_bus[m->mpc_busid] = mp_current_pci_id;
180 mp_current_pci_id++; 180 mp_current_pci_id++;
181 } else { 181 } else {
@@ -808,8 +808,7 @@ void __init mp_config_acpi_legacy_irqs (void)
808 /* 808 /*
809 * Fabricate the legacy ISA bus (bus #31). 809 * Fabricate the legacy ISA bus (bus #31).
810 */ 810 */
811 mp_bus_id_to_type[MP_ISA_BUS] = MP_BUS_ISA; 811 set_bit(MP_ISA_BUS, mp_bus_not_pci);
812 Dprintk("Bus #%d is ISA\n", MP_ISA_BUS);
813 812
814 /* 813 /*
815 * Locate the IOAPIC that manages the ISA IRQs (0-15). 814 * Locate the IOAPIC that manages the ISA IRQs (0-15).