diff options
Diffstat (limited to 'arch/mips/mti-malta/malta-int.c')
-rw-r--r-- | arch/mips/mti-malta/malta-int.c | 90 |
1 files changed, 48 insertions, 42 deletions
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c index ea176113fea9..3e0a9b35ba5c 100644 --- a/arch/mips/mti-malta/malta-int.c +++ b/arch/mips/mti-malta/malta-int.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/init.h> | 24 | #include <linux/init.h> |
25 | #include <linux/irq.h> | 25 | #include <linux/irq.h> |
26 | #include <linux/sched.h> | 26 | #include <linux/sched.h> |
27 | #include <linux/smp.h> | ||
27 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
28 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
29 | #include <linux/io.h> | 30 | #include <linux/io.h> |
@@ -332,6 +333,21 @@ static struct irqaction irq_call = { | |||
332 | }; | 333 | }; |
333 | #endif /* CONFIG_MIPS_MT_SMP */ | 334 | #endif /* CONFIG_MIPS_MT_SMP */ |
334 | 335 | ||
336 | static int gic_resched_int_base; | ||
337 | static int gic_call_int_base; | ||
338 | #define GIC_RESCHED_INT(cpu) (gic_resched_int_base+(cpu)) | ||
339 | #define GIC_CALL_INT(cpu) (gic_call_int_base+(cpu)) | ||
340 | |||
341 | unsigned int plat_ipi_call_int_xlate(unsigned int cpu) | ||
342 | { | ||
343 | return GIC_CALL_INT(cpu); | ||
344 | } | ||
345 | |||
346 | unsigned int plat_ipi_resched_int_xlate(unsigned int cpu) | ||
347 | { | ||
348 | return GIC_RESCHED_INT(cpu); | ||
349 | } | ||
350 | |||
335 | static struct irqaction i8259irq = { | 351 | static struct irqaction i8259irq = { |
336 | .handler = no_action, | 352 | .handler = no_action, |
337 | .name = "XT-PIC cascade" | 353 | .name = "XT-PIC cascade" |
@@ -369,7 +385,7 @@ static int __initdata msc_nr_eicirqs = ARRAY_SIZE(msc_eicirqmap); | |||
369 | * Interrupts and CPUs/Core Interrupts. The nature of the External | 385 | * Interrupts and CPUs/Core Interrupts. The nature of the External |
370 | * Interrupts is also defined here - polarity/trigger. | 386 | * Interrupts is also defined here - polarity/trigger. |
371 | */ | 387 | */ |
372 | static struct gic_intr_map gic_intr_map[] = { | 388 | static struct gic_intr_map gic_intr_map[GIC_NUM_INTRS] = { |
373 | { GIC_EXT_INTR(0), X, X, X, X, 0 }, | 389 | { GIC_EXT_INTR(0), X, X, X, X, 0 }, |
374 | { GIC_EXT_INTR(1), X, X, X, X, 0 }, | 390 | { GIC_EXT_INTR(1), X, X, X, X, 0 }, |
375 | { GIC_EXT_INTR(2), X, X, X, X, 0 }, | 391 | { GIC_EXT_INTR(2), X, X, X, X, 0 }, |
@@ -386,21 +402,14 @@ static struct gic_intr_map gic_intr_map[] = { | |||
386 | { GIC_EXT_INTR(13), 0, GIC_MAP_TO_NMI_MSK, GIC_POL_POS, GIC_TRIG_LEVEL, 0 }, | 402 | { GIC_EXT_INTR(13), 0, GIC_MAP_TO_NMI_MSK, GIC_POL_POS, GIC_TRIG_LEVEL, 0 }, |
387 | { GIC_EXT_INTR(14), 0, GIC_MAP_TO_NMI_MSK, GIC_POL_POS, GIC_TRIG_LEVEL, 0 }, | 403 | { GIC_EXT_INTR(14), 0, GIC_MAP_TO_NMI_MSK, GIC_POL_POS, GIC_TRIG_LEVEL, 0 }, |
388 | { GIC_EXT_INTR(15), X, X, X, X, 0 }, | 404 | { GIC_EXT_INTR(15), X, X, X, X, 0 }, |
389 | { GIC_EXT_INTR(16), 0, GIC_CPU_INT1, GIC_POL_POS, GIC_TRIG_EDGE, 1 }, | 405 | /* This is the end of the general interrupts now we do IPI ones */ |
390 | { GIC_EXT_INTR(17), 0, GIC_CPU_INT2, GIC_POL_POS, GIC_TRIG_EDGE, 1 }, | ||
391 | { GIC_EXT_INTR(18), 1, GIC_CPU_INT1, GIC_POL_POS, GIC_TRIG_EDGE, 1 }, | ||
392 | { GIC_EXT_INTR(19), 1, GIC_CPU_INT2, GIC_POL_POS, GIC_TRIG_EDGE, 1 }, | ||
393 | { GIC_EXT_INTR(20), 2, GIC_CPU_INT1, GIC_POL_POS, GIC_TRIG_EDGE, 1 }, | ||
394 | { GIC_EXT_INTR(21), 2, GIC_CPU_INT2, GIC_POL_POS, GIC_TRIG_EDGE, 1 }, | ||
395 | { GIC_EXT_INTR(22), 3, GIC_CPU_INT1, GIC_POL_POS, GIC_TRIG_EDGE, 1 }, | ||
396 | { GIC_EXT_INTR(23), 3, GIC_CPU_INT2, GIC_POL_POS, GIC_TRIG_EDGE, 1 }, | ||
397 | }; | 406 | }; |
398 | #endif | 407 | #endif |
399 | 408 | ||
400 | /* | 409 | /* |
401 | * GCMP needs to be detected before any SMP initialisation | 410 | * GCMP needs to be detected before any SMP initialisation |
402 | */ | 411 | */ |
403 | static int __init gcmp_probe(unsigned long addr, unsigned long size) | 412 | int __init gcmp_probe(unsigned long addr, unsigned long size) |
404 | { | 413 | { |
405 | if (gcmp_present >= 0) | 414 | if (gcmp_present >= 0) |
406 | return gcmp_present; | 415 | return gcmp_present; |
@@ -415,28 +424,36 @@ static int __init gcmp_probe(unsigned long addr, unsigned long size) | |||
415 | } | 424 | } |
416 | 425 | ||
417 | #if defined(CONFIG_MIPS_MT_SMP) | 426 | #if defined(CONFIG_MIPS_MT_SMP) |
427 | static void __init fill_ipi_map1(int baseintr, int cpu, int cpupin) | ||
428 | { | ||
429 | int intr = baseintr + cpu; | ||
430 | gic_intr_map[intr].intrnum = GIC_EXT_INTR(intr); | ||
431 | gic_intr_map[intr].cpunum = cpu; | ||
432 | gic_intr_map[intr].pin = cpupin; | ||
433 | gic_intr_map[intr].polarity = GIC_POL_POS; | ||
434 | gic_intr_map[intr].trigtype = GIC_TRIG_EDGE; | ||
435 | gic_intr_map[intr].ipiflag = 1; | ||
436 | ipi_map[cpu] |= (1 << (cpupin + 2)); | ||
437 | } | ||
438 | |||
418 | static void __init fill_ipi_map(void) | 439 | static void __init fill_ipi_map(void) |
419 | { | 440 | { |
420 | int i; | 441 | int cpu; |
421 | 442 | ||
422 | for (i = 0; i < ARRAY_SIZE(gic_intr_map); i++) { | 443 | for (cpu = 0; cpu < NR_CPUS; cpu++) { |
423 | if (gic_intr_map[i].ipiflag && (gic_intr_map[i].cpunum != X)) | 444 | fill_ipi_map1(gic_resched_int_base, cpu, GIC_CPU_INT1); |
424 | ipi_map[gic_intr_map[i].cpunum] |= | 445 | fill_ipi_map1(gic_call_int_base, cpu, GIC_CPU_INT2); |
425 | (1 << (gic_intr_map[i].pin + 2)); | ||
426 | } | 446 | } |
427 | } | 447 | } |
428 | #endif | 448 | #endif |
429 | 449 | ||
430 | void __init arch_init_irq(void) | 450 | void __init arch_init_irq(void) |
431 | { | 451 | { |
432 | int gic_present, gcmp_present; | ||
433 | |||
434 | init_i8259_irqs(); | 452 | init_i8259_irqs(); |
435 | 453 | ||
436 | if (!cpu_has_veic) | 454 | if (!cpu_has_veic) |
437 | mips_cpu_irq_init(); | 455 | mips_cpu_irq_init(); |
438 | 456 | ||
439 | gcmp_present = gcmp_probe(GCMP_BASE_ADDR, GCMP_ADDRSPACE_SZ); | ||
440 | if (gcmp_present) { | 457 | if (gcmp_present) { |
441 | GCMPGCB(GICBA) = GIC_BASE_ADDR | GCMP_GCB_GICBA_EN_MSK; | 458 | GCMPGCB(GICBA) = GIC_BASE_ADDR | GCMP_GCB_GICBA_EN_MSK; |
442 | gic_present = 1; | 459 | gic_present = 1; |
@@ -513,24 +530,10 @@ void __init arch_init_irq(void) | |||
513 | if (gic_present) { | 530 | if (gic_present) { |
514 | /* FIXME */ | 531 | /* FIXME */ |
515 | int i; | 532 | int i; |
516 | struct { | 533 | |
517 | unsigned int resched; | 534 | gic_call_int_base = GIC_NUM_INTRS - NR_CPUS; |
518 | unsigned int call; | 535 | gic_resched_int_base = gic_call_int_base - NR_CPUS; |
519 | } ipiirq[] = { | 536 | |
520 | { | ||
521 | .resched = GIC_IPI_EXT_INTR_RESCHED_VPE0, | ||
522 | .call = GIC_IPI_EXT_INTR_CALLFNC_VPE0}, | ||
523 | { | ||
524 | .resched = GIC_IPI_EXT_INTR_RESCHED_VPE1, | ||
525 | .call = GIC_IPI_EXT_INTR_CALLFNC_VPE1 | ||
526 | }, { | ||
527 | .resched = GIC_IPI_EXT_INTR_RESCHED_VPE2, | ||
528 | .call = GIC_IPI_EXT_INTR_CALLFNC_VPE2 | ||
529 | }, { | ||
530 | .resched = GIC_IPI_EXT_INTR_RESCHED_VPE3, | ||
531 | .call = GIC_IPI_EXT_INTR_CALLFNC_VPE3 | ||
532 | } | ||
533 | }; | ||
534 | fill_ipi_map(); | 537 | fill_ipi_map(); |
535 | gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, gic_intr_map, ARRAY_SIZE(gic_intr_map), MIPS_GIC_IRQ_BASE); | 538 | gic_init(GIC_BASE_ADDR, GIC_ADDRSPACE_SZ, gic_intr_map, ARRAY_SIZE(gic_intr_map), MIPS_GIC_IRQ_BASE); |
536 | if (!gcmp_present) { | 539 | if (!gcmp_present) { |
@@ -552,12 +555,15 @@ void __init arch_init_irq(void) | |||
552 | printk("CPU%d: status register now %08x\n", smp_processor_id(), read_c0_status()); | 555 | printk("CPU%d: status register now %08x\n", smp_processor_id(), read_c0_status()); |
553 | write_c0_status(0x1100dc00); | 556 | write_c0_status(0x1100dc00); |
554 | printk("CPU%d: status register frc %08x\n", smp_processor_id(), read_c0_status()); | 557 | printk("CPU%d: status register frc %08x\n", smp_processor_id(), read_c0_status()); |
555 | for (i = 0; i < ARRAY_SIZE(ipiirq); i++) { | 558 | for (i = 0; i < NR_CPUS; i++) { |
556 | setup_irq(MIPS_GIC_IRQ_BASE + ipiirq[i].resched, &irq_resched); | 559 | setup_irq(MIPS_GIC_IRQ_BASE + |
557 | setup_irq(MIPS_GIC_IRQ_BASE + ipiirq[i].call, &irq_call); | 560 | GIC_RESCHED_INT(i), &irq_resched); |
558 | 561 | setup_irq(MIPS_GIC_IRQ_BASE + | |
559 | set_irq_handler(MIPS_GIC_IRQ_BASE + ipiirq[i].resched, handle_percpu_irq); | 562 | GIC_CALL_INT(i), &irq_call); |
560 | set_irq_handler(MIPS_GIC_IRQ_BASE + ipiirq[i].call, handle_percpu_irq); | 563 | set_irq_handler(MIPS_GIC_IRQ_BASE + |
564 | GIC_RESCHED_INT(i), handle_percpu_irq); | ||
565 | set_irq_handler(MIPS_GIC_IRQ_BASE + | ||
566 | GIC_CALL_INT(i), handle_percpu_irq); | ||
561 | } | 567 | } |
562 | } else { | 568 | } else { |
563 | /* set up ipi interrupts */ | 569 | /* set up ipi interrupts */ |