diff options
Diffstat (limited to 'arch/mips/mti-malta/malta-int.c')
-rw-r--r-- | arch/mips/mti-malta/malta-int.c | 89 |
1 files changed, 47 insertions, 42 deletions
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c index b4eaf137e4a7..a8756f82c31b 100644 --- a/arch/mips/mti-malta/malta-int.c +++ b/arch/mips/mti-malta/malta-int.c | |||
@@ -331,6 +331,21 @@ 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)) | ||
339 | |||
340 | unsigned int plat_ipi_call_int_xlate(unsigned int cpu) | ||
341 | { | ||
342 | return GIC_CALL_INT(cpu); | ||
343 | } | ||
344 | |||
345 | unsigned int plat_ipi_resched_int_xlate(unsigned int cpu) | ||
346 | { | ||
347 | return GIC_RESCHED_INT(cpu); | ||
348 | } | ||
334 | #endif /* CONFIG_MIPS_MT_SMP */ | 349 | #endif /* CONFIG_MIPS_MT_SMP */ |
335 | 350 | ||
336 | static struct irqaction i8259irq = { | 351 | static struct irqaction i8259irq = { |
@@ -370,7 +385,7 @@ static int __initdata msc_nr_eicirqs = ARRAY_SIZE(msc_eicirqmap); | |||
370 | * Interrupts and CPUs/Core Interrupts. The nature of the External | 385 | * Interrupts and CPUs/Core Interrupts. The nature of the External |
371 | * Interrupts is also defined here - polarity/trigger. | 386 | * Interrupts is also defined here - polarity/trigger. |
372 | */ | 387 | */ |
373 | static struct gic_intr_map gic_intr_map[] = { | 388 | static struct gic_intr_map gic_intr_map[GIC_NUM_INTRS] = { |
374 | { GIC_EXT_INTR(0), X, X, X, X, 0 }, | 389 | { GIC_EXT_INTR(0), X, X, X, X, 0 }, |
375 | { GIC_EXT_INTR(1), X, X, X, X, 0 }, | 390 | { GIC_EXT_INTR(1), X, X, X, X, 0 }, |
376 | { GIC_EXT_INTR(2), X, X, X, X, 0 }, | 391 | { GIC_EXT_INTR(2), X, X, X, X, 0 }, |
@@ -387,21 +402,14 @@ 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 }, | 402 | { 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 }, | 403 | { 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 }, | 404 | { 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 }, | 405 | /* 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 | }; | 406 | }; |
399 | #endif | 407 | #endif |
400 | 408 | ||
401 | /* | 409 | /* |
402 | * GCMP needs to be detected before any SMP initialisation | 410 | * GCMP needs to be detected before any SMP initialisation |
403 | */ | 411 | */ |
404 | static int __init gcmp_probe(unsigned long addr, unsigned long size) | 412 | int __init gcmp_probe(unsigned long addr, unsigned long size) |
405 | { | 413 | { |
406 | if (gcmp_present >= 0) | 414 | if (gcmp_present >= 0) |
407 | return gcmp_present; | 415 | return gcmp_present; |
@@ -416,28 +424,36 @@ static int __init gcmp_probe(unsigned long addr, unsigned long size) | |||
416 | } | 424 | } |
417 | 425 | ||
418 | #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 | |||
419 | static void __init fill_ipi_map(void) | 439 | static void __init fill_ipi_map(void) |
420 | { | 440 | { |
421 | int i; | 441 | int cpu; |
422 | 442 | ||
423 | for (i = 0; i < ARRAY_SIZE(gic_intr_map); i++) { | 443 | for (cpu = 0; cpu < NR_CPUS; cpu++) { |
424 | if (gic_intr_map[i].ipiflag && (gic_intr_map[i].cpunum != X)) | 444 | fill_ipi_map1(gic_resched_int_base, cpu, GIC_CPU_INT1); |
425 | ipi_map[gic_intr_map[i].cpunum] |= | 445 | fill_ipi_map1(gic_call_int_base, cpu, GIC_CPU_INT2); |
426 | (1 << (gic_intr_map[i].pin + 2)); | ||
427 | } | 446 | } |
428 | } | 447 | } |
429 | #endif | 448 | #endif |
430 | 449 | ||
431 | void __init arch_init_irq(void) | 450 | void __init arch_init_irq(void) |
432 | { | 451 | { |
433 | int gic_present, gcmp_present; | ||
434 | |||
435 | init_i8259_irqs(); | 452 | init_i8259_irqs(); |
436 | 453 | ||
437 | if (!cpu_has_veic) | 454 | if (!cpu_has_veic) |
438 | mips_cpu_irq_init(); | 455 | mips_cpu_irq_init(); |
439 | 456 | ||
440 | gcmp_present = gcmp_probe(GCMP_BASE_ADDR, GCMP_ADDRSPACE_SZ); | ||
441 | if (gcmp_present) { | 457 | if (gcmp_present) { |
442 | GCMPGCB(GICBA) = GIC_BASE_ADDR | GCMP_GCB_GICBA_EN_MSK; | 458 | GCMPGCB(GICBA) = GIC_BASE_ADDR | GCMP_GCB_GICBA_EN_MSK; |
443 | gic_present = 1; | 459 | gic_present = 1; |
@@ -514,24 +530,10 @@ void __init arch_init_irq(void) | |||
514 | if (gic_present) { | 530 | if (gic_present) { |
515 | /* FIXME */ | 531 | /* FIXME */ |
516 | int i; | 532 | int i; |
517 | struct { | 533 | |
518 | unsigned int resched; | 534 | gic_call_int_base = GIC_NUM_INTRS - NR_CPUS; |
519 | unsigned int call; | 535 | gic_resched_int_base = gic_call_int_base - NR_CPUS; |
520 | } ipiirq[] = { | 536 | |
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(); | 537 | fill_ipi_map(); |
536 | 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); |
537 | if (!gcmp_present) { | 539 | if (!gcmp_present) { |
@@ -553,12 +555,15 @@ void __init arch_init_irq(void) | |||
553 | 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()); |
554 | write_c0_status(0x1100dc00); | 556 | write_c0_status(0x1100dc00); |
555 | 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()); |
556 | for (i = 0; i < ARRAY_SIZE(ipiirq); i++) { | 558 | for (i = 0; i < NR_CPUS; i++) { |
557 | setup_irq(MIPS_GIC_IRQ_BASE + ipiirq[i].resched, &irq_resched); | 559 | setup_irq(MIPS_GIC_IRQ_BASE + |
558 | setup_irq(MIPS_GIC_IRQ_BASE + ipiirq[i].call, &irq_call); | 560 | GIC_RESCHED_INT(i), &irq_resched); |
559 | 561 | setup_irq(MIPS_GIC_IRQ_BASE + | |
560 | set_irq_handler(MIPS_GIC_IRQ_BASE + ipiirq[i].resched, handle_percpu_irq); | 562 | GIC_CALL_INT(i), &irq_call); |
561 | 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); | ||
562 | } | 567 | } |
563 | } else { | 568 | } else { |
564 | /* set up ipi interrupts */ | 569 | /* set up ipi interrupts */ |