diff options
author | Tim Anderson <tanderson@mvista.com> | 2009-06-17 19:22:25 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2009-07-03 10:45:26 -0400 |
commit | a214cef9a5d06894785dca1f967c9c324cc84c17 (patch) | |
tree | 9cad1695afea9987ea979f59a614f39ef2ea8ada /arch/mips/mti-malta | |
parent | 9306c8def6abc2dbde4ac75eb6c631606b8fc1dd (diff) |
MIPS: CMP: Extend IPI handling to CPU number
This takes the current IPI interrupt assignment from the fix number of 4
to the number of CPUs defined in the system.
Signed-off-by: Tim Anderson <tanderson@mvista.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/mti-malta')
-rw-r--r-- | arch/mips/mti-malta/malta-int.c | 74 |
1 files changed, 36 insertions, 38 deletions
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c index b4eaf137e4a..4e14972dcfc 100644 --- a/arch/mips/mti-malta/malta-int.c +++ b/arch/mips/mti-malta/malta-int.c | |||
@@ -331,6 +331,11 @@ static struct irqaction irq_call = { | |||
331 | .flags = IRQF_DISABLED|IRQF_PERCPU, | 331 | .flags = IRQF_DISABLED|IRQF_PERCPU, |
332 | .name = "IPI_call" | 332 | .name = "IPI_call" |
333 | }; | 333 | }; |
334 | |||
335 | static int gic_resched_int_base; | ||
336 | static int gic_call_int_base; | ||
337 | #define GIC_RESCHED_INT(cpu) (gic_resched_int_base+(cpu)) | ||
338 | #define GIC_CALL_INT(cpu) (gic_call_int_base+(cpu)) | ||
334 | #endif /* CONFIG_MIPS_MT_SMP */ | 339 | #endif /* CONFIG_MIPS_MT_SMP */ |
335 | 340 | ||
336 | static struct irqaction i8259irq = { | 341 | static struct irqaction i8259irq = { |
@@ -370,7 +375,7 @@ static int __initdata msc_nr_eicirqs = ARRAY_SIZE(msc_eicirqmap); | |||
370 | * Interrupts and CPUs/Core Interrupts. The nature of the External | 375 | * Interrupts and CPUs/Core Interrupts. The nature of the External |
371 | * Interrupts is also defined here - polarity/trigger. | 376 | * Interrupts is also defined here - polarity/trigger. |
372 | */ | 377 | */ |
373 | static struct gic_intr_map gic_intr_map[] = { | 378 | static struct gic_intr_map gic_intr_map[GIC_NUM_INTRS] = { |
374 | { GIC_EXT_INTR(0), X, X, X, X, 0 }, | 379 | { GIC_EXT_INTR(0), X, X, X, X, 0 }, |
375 | { GIC_EXT_INTR(1), X, X, X, X, 0 }, | 380 | { GIC_EXT_INTR(1), X, X, X, X, 0 }, |
376 | { GIC_EXT_INTR(2), X, X, X, X, 0 }, | 381 | { GIC_EXT_INTR(2), X, X, X, X, 0 }, |
@@ -387,14 +392,7 @@ static struct gic_intr_map gic_intr_map[] = { | |||
387 | { GIC_EXT_INTR(13), 0, GIC_MAP_TO_NMI_MSK, GIC_POL_POS, GIC_TRIG_LEVEL, 0 }, | 392 | { GIC_EXT_INTR(13), 0, GIC_MAP_TO_NMI_MSK, GIC_POL_POS, GIC_TRIG_LEVEL, 0 }, |
388 | { GIC_EXT_INTR(14), 0, GIC_MAP_TO_NMI_MSK, GIC_POL_POS, GIC_TRIG_LEVEL, 0 }, | 393 | { GIC_EXT_INTR(14), 0, GIC_MAP_TO_NMI_MSK, GIC_POL_POS, GIC_TRIG_LEVEL, 0 }, |
389 | { GIC_EXT_INTR(15), X, X, X, X, 0 }, | 394 | { GIC_EXT_INTR(15), X, X, X, X, 0 }, |
390 | { GIC_EXT_INTR(16), 0, GIC_CPU_INT1, GIC_POL_POS, GIC_TRIG_EDGE, 1 }, | 395 | /* This is the end of the general interrupts now we do IPI ones */ |
391 | { GIC_EXT_INTR(17), 0, GIC_CPU_INT2, GIC_POL_POS, GIC_TRIG_EDGE, 1 }, | ||
392 | { GIC_EXT_INTR(18), 1, GIC_CPU_INT1, GIC_POL_POS, GIC_TRIG_EDGE, 1 }, | ||
393 | { GIC_EXT_INTR(19), 1, GIC_CPU_INT2, GIC_POL_POS, GIC_TRIG_EDGE, 1 }, | ||
394 | { GIC_EXT_INTR(20), 2, GIC_CPU_INT1, GIC_POL_POS, GIC_TRIG_EDGE, 1 }, | ||
395 | { GIC_EXT_INTR(21), 2, GIC_CPU_INT2, GIC_POL_POS, GIC_TRIG_EDGE, 1 }, | ||
396 | { GIC_EXT_INTR(22), 3, GIC_CPU_INT1, GIC_POL_POS, GIC_TRIG_EDGE, 1 }, | ||
397 | { GIC_EXT_INTR(23), 3, GIC_CPU_INT2, GIC_POL_POS, GIC_TRIG_EDGE, 1 }, | ||
398 | }; | 396 | }; |
399 | #endif | 397 | #endif |
400 | 398 | ||
@@ -416,14 +414,25 @@ static int __init gcmp_probe(unsigned long addr, unsigned long size) | |||
416 | } | 414 | } |
417 | 415 | ||
418 | #if defined(CONFIG_MIPS_MT_SMP) | 416 | #if defined(CONFIG_MIPS_MT_SMP) |
417 | static void __init fill_ipi_map1(int baseintr, int cpu, int cpupin) | ||
418 | { | ||
419 | int intr = baseintr + cpu; | ||
420 | gic_intr_map[intr].intrnum = GIC_EXT_INTR(intr); | ||
421 | gic_intr_map[intr].cpunum = cpu; | ||
422 | gic_intr_map[intr].pin = cpupin; | ||
423 | gic_intr_map[intr].polarity = GIC_POL_POS; | ||
424 | gic_intr_map[intr].trigtype = GIC_TRIG_EDGE; | ||
425 | gic_intr_map[intr].ipiflag = 1; | ||
426 | ipi_map[cpu] |= (1 << (cpupin + 2)); | ||
427 | } | ||
428 | |||
419 | static void __init fill_ipi_map(void) | 429 | static void __init fill_ipi_map(void) |
420 | { | 430 | { |
421 | int i; | 431 | int cpu; |
422 | 432 | ||
423 | for (i = 0; i < ARRAY_SIZE(gic_intr_map); i++) { | 433 | for (cpu = 0; cpu < NR_CPUS; cpu++) { |
424 | if (gic_intr_map[i].ipiflag && (gic_intr_map[i].cpunum != X)) | 434 | fill_ipi_map1(gic_resched_int_base, cpu, GIC_CPU_INT1); |
425 | ipi_map[gic_intr_map[i].cpunum] |= | 435 | fill_ipi_map1(gic_call_int_base, cpu, GIC_CPU_INT2); |
426 | (1 << (gic_intr_map[i].pin + 2)); | ||
427 | } | 436 | } |
428 | } | 437 | } |
429 | #endif | 438 | #endif |
@@ -514,24 +523,10 @@ void __init arch_init_irq(void) | |||
514 | if (gic_present) { | 523 | if (gic_present) { |
515 | /* FIXME */ | 524 | /* FIXME */ |
516 | int i; | 525 | int i; |
517 | struct { | 526 | |
518 | unsigned int resched; | 527 | gic_call_int_base = GIC_NUM_INTRS - NR_CPUS; |
519 | unsigned int call; | 528 | gic_resched_int_base = gic_call_int_base - NR_CPUS; |
520 | } ipiirq[] = { | 529 | |
521 | { | ||
522 | .resched = GIC_IPI_EXT_INTR_RESCHED_VPE0, | ||
523 | .call = GIC_IPI_EXT_INTR_CALLFNC_VPE0}, | ||
524 | { | ||
525 | .resched = GIC_IPI_EXT_INTR_RESCHED_VPE1, | ||
526 | .call = GIC_IPI_EXT_INTR_CALLFNC_VPE1 | ||
527 | }, { | ||
528 | .resched = GIC_IPI_EXT_INTR_RESCHED_VPE2, | ||
529 | .call = GIC_IPI_EXT_INTR_CALLFNC_VPE2 | ||
530 | }, { | ||
531 | .resched = GIC_IPI_EXT_INTR_RESCHED_VPE3, | ||
532 | .call = GIC_IPI_EXT_INTR_CALLFNC_VPE3 | ||
533 | } | ||
534 | }; | ||
535 | fill_ipi_map(); | 530 | fill_ipi_map(); |
536 | gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, gic_intr_map, ARRAY_SIZE(gic_intr_map), MIPS_GIC_IRQ_BASE); | 531 | gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, gic_intr_map, ARRAY_SIZE(gic_intr_map), MIPS_GIC_IRQ_BASE); |
537 | if (!gcmp_present) { | 532 | if (!gcmp_present) { |
@@ -553,12 +548,15 @@ void __init arch_init_irq(void) | |||
553 | printk("CPU%d: status register now %08x\n", smp_processor_id(), read_c0_status()); | 548 | printk("CPU%d: status register now %08x\n", smp_processor_id(), read_c0_status()); |
554 | write_c0_status(0x1100dc00); | 549 | write_c0_status(0x1100dc00); |
555 | printk("CPU%d: status register frc %08x\n", smp_processor_id(), read_c0_status()); | 550 | printk("CPU%d: status register frc %08x\n", smp_processor_id(), read_c0_status()); |
556 | for (i = 0; i < ARRAY_SIZE(ipiirq); i++) { | 551 | for (i = 0; i < NR_CPUS; i++) { |
557 | setup_irq(MIPS_GIC_IRQ_BASE + ipiirq[i].resched, &irq_resched); | 552 | setup_irq(MIPS_GIC_IRQ_BASE + |
558 | setup_irq(MIPS_GIC_IRQ_BASE + ipiirq[i].call, &irq_call); | 553 | GIC_RESCHED_INT(i), &irq_resched); |
559 | 554 | setup_irq(MIPS_GIC_IRQ_BASE + | |
560 | set_irq_handler(MIPS_GIC_IRQ_BASE + ipiirq[i].resched, handle_percpu_irq); | 555 | GIC_CALL_INT(i), &irq_call); |
561 | set_irq_handler(MIPS_GIC_IRQ_BASE + ipiirq[i].call, handle_percpu_irq); | 556 | set_irq_handler(MIPS_GIC_IRQ_BASE + |
557 | GIC_RESCHED_INT(i), handle_percpu_irq); | ||
558 | set_irq_handler(MIPS_GIC_IRQ_BASE + | ||
559 | GIC_CALL_INT(i), handle_percpu_irq); | ||
562 | } | 560 | } |
563 | } else { | 561 | } else { |
564 | /* set up ipi interrupts */ | 562 | /* set up ipi interrupts */ |