26 #include <linux/sched.h>
31 #include <linux/kernel.h>
32 #include <linux/random.h>
34 #include <asm/traps.h>
35 #include <asm/i8259.h>
37 #include <asm/irq_regs.h>
47 #include <asm/setup.h>
51 static unsigned long _msc01_biu_base;
52 static unsigned long _gcmp_base;
53 static unsigned int ipi_map[
NR_CPUS];
57 static inline int mips_pcibios_iack(
void)
101 static inline int get_int(
void)
107 irq = mips_pcibios_iack();
120 static void malta_hw0_irqdispatch(
void)
133 static void malta_ipi_irqdispatch(
void)
144 static void corehi_irqdispatch(
void)
146 unsigned int intedge, intsteer, pcicmd, pcibadaddr;
147 unsigned int pcimstat, intisr, inten, intpol;
148 unsigned int intrcause, datalo, datahi;
153 "Cause : %08lx\nbadVaddr : %08lx\n",
197 die(
"CoreHi interrupt", regs);
200 static inline int clz(
unsigned long x)
216 static inline unsigned int irq_ffs(
unsigned int pending)
218 #if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
224 t0 = pending & 0xf000;
228 pending = pending <<
t0;
230 t0 = pending & 0xc000;
234 pending = pending <<
t0;
236 t0 = pending & 0x8000;
281 irq = irq_ffs(pending);
284 malta_hw0_irqdispatch();
286 malta_ipi_irqdispatch();
291 #ifdef CONFIG_MIPS_MT_SMP
294 #define GIC_MIPS_CPU_IPI_RESCHED_IRQ 3
295 #define GIC_MIPS_CPU_IPI_CALL_IRQ 4
297 #define MIPS_CPU_IPI_RESCHED_IRQ 0
298 #define C_RESCHED C_SW0
299 #define MIPS_CPU_IPI_CALL_IRQ 1
301 static int cpu_ipi_resched_irq, cpu_ipi_call_irq;
303 static void ipi_resched_dispatch(
void)
308 static void ipi_call_dispatch(
void)
328 .
handler = ipi_resched_interrupt,
330 .name =
"IPI_resched"
340 static int gic_resched_int_base;
341 static int gic_call_int_base;
342 #define GIC_RESCHED_INT(cpu) (gic_resched_int_base+(cpu))
343 #define GIC_CALL_INT(cpu) (gic_call_int_base+(cpu))
357 .name =
"XT-PIC cascade",
361 static struct irqaction corehi_irqaction = {
394 #define GIC_CPU_NMI GIC_MAP_TO_NMI_MSK
456 #if defined(CONFIG_MIPS_MT_SMP)
457 static void __init fill_ipi_map1(
int baseintr,
int cpu,
int cpupin)
461 gic_intr_map[
intr].
pin = cpupin;
465 ipi_map[
cpu] |= (1 << (cpupin + 2));
468 static void __init fill_ipi_map(
void)
472 for (cpu = 0; cpu <
NR_CPUS; cpu++) {
497 _msc01_biu_base = (
unsigned long)
541 #ifdef CONFIG_MIPS_MT_SMTC
555 for (i = 0; i < 16; i++)
572 #if defined(CONFIG_MIPS_MT_SMP)
574 gic_resched_int_base = gic_call_int_base -
NR_CPUS;
581 i =
REG(_msc01_biu_base, MSC01_SC_CFG);
582 REG(_msc01_biu_base, MSC01_SC_CFG) =
586 #if defined(CONFIG_MIPS_MT_SMP)
598 for (i = 0; i <
NR_CPUS; i++) {
606 #if defined(CONFIG_MIPS_MT_SMP)
635 static char *
tr[8] = {
636 "mem",
"gcr",
"gic",
"mmio",
637 "0x04",
"0x05",
"0x06",
"0x07"
640 static char *mcmd[32] = {
642 [0x01] =
"Legacy Write",
643 [0x02] =
"Legacy Read",
649 [0x08] =
"Coherent Read Own",
650 [0x09] =
"Coherent Read Share",
651 [0x0a] =
"Coherent Read Discard",
652 [0x0b] =
"Coherent Ready Share Always",
653 [0x0c] =
"Coherent Upgrade",
654 [0x0d] =
"Coherent Writeback",
657 [0x10] =
"Coherent Copyback",
658 [0x11] =
"Coherent Copyback Invalidate",
659 [0x12] =
"Coherent Invalidate",
660 [0x13] =
"Coherent Write Invalidate",
661 [0x14] =
"Coherent Completion Sync",
675 static char *
core[8] = {
676 "Invalid/OK",
"Invalid/Data",
677 "Shared/OK",
"Shared/Data",
678 "Modified/OK",
"Modified/Data",
679 "Exclusive/OK",
"Exclusive/Data"
682 static char *causes[32] = {
683 "None",
"GC_WR_ERR",
"GC_RD_ERR",
"COH_WR_ERR",
684 "COH_RD_ERR",
"MMIO_WR_ERR",
"MMIO_RD_ERR",
"0x07",
685 "0x08",
"0x09",
"0x0a",
"0x0b",
686 "0x0c",
"0x0d",
"0x0e",
"0x0f",
687 "0x10",
"0x11",
"0x12",
"0x13",
688 "0x14",
"0x15",
"0x16",
"INTVN_WR_ERR",
689 "INTVN_RD_ERR",
"0x19",
"0x1a",
"0x1b",
690 "0x1c",
"0x1d",
"0x1e",
"0x1f"
699 unsigned long cm_error =
GCMPGCB(GCMEC);
700 unsigned long cm_addr =
GCMPGCB(GCMEA);
701 unsigned long cm_other =
GCMPGCB(GCMEO);
702 unsigned long cause, ocause;
709 unsigned long cca_bits = (cm_error >> 15) & 7;
710 unsigned long tr_bits = (cm_error >> 12) & 7;
711 unsigned long mcmd_bits = (cm_error >> 7) & 0x1f;
712 unsigned long stag_bits = (cm_error >> 3) & 15;
713 unsigned long sport_bits = (cm_error >> 0) & 7;
716 "CCA=%lu TR=%s MCmd=%s STag=%lu "
718 cca_bits, tr[tr_bits], mcmd[mcmd_bits],
719 stag_bits, sport_bits);
722 unsigned long c3_bits = (cm_error >> 18) & 7;
723 unsigned long c2_bits = (cm_error >> 15) & 7;
724 unsigned long c1_bits = (cm_error >> 12) & 7;
725 unsigned long c0_bits = (cm_error >> 9) & 7;
726 unsigned long sc_bit = (cm_error >> 8) & 1;
727 unsigned long mcmd_bits = (cm_error >> 3) & 0x1f;
728 unsigned long sport_bits = (cm_error >> 0) & 7;
730 "C3=%s C2=%s C1=%s C0=%s SC=%s "
731 "MCmd=%s SPort=%lu\n",
732 core[c3_bits], core[c2_bits],
733 core[c1_bits], core[c0_bits],
734 sc_bit ?
"True" :
"False",
735 mcmd[mcmd_bits], sport_bits);
741 printk(
"CM_ERROR=%08lx %s <%s>\n", cm_error,
743 printk(
"CM_ADDR =%08lx\n", cm_addr);
744 printk(
"CM_OTHER=%08lx %s\n", cm_other, causes[ocause]);