2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
6 * Carsten Langgaard, carstenl@mips.com
7 * Copyright (C) 2000, 2001, 2004 MIPS Technologies, Inc.
8 * Copyright (C) 2001 Ralf Baechle
9 * Copyright (C) 2013 Imagination Technologies Ltd.
11 * Routines for generic manipulation of the interrupts found on the MIPS
12 * Malta board. The interrupt controller is located in the South Bridge
13 * a PIIX4 device with two internal 82C95 interrupt controllers.
15 #include <linux/init.h>
16 #include <linux/irq.h>
17 #include <linux/sched.h>
18 #include <linux/smp.h>
19 #include <linux/interrupt.h>
21 #include <linux/kernel_stat.h>
22 #include <linux/kernel.h>
23 #include <linux/random.h>
25 #include <asm/traps.h>
26 #include <asm/i8259.h>
27 #include <asm/irq_cpu.h>
28 #include <asm/irq_regs.h>
29 #include <asm/mips-cm.h>
30 #include <asm/mips-boards/malta.h>
31 #include <asm/mips-boards/maltaint.h>
32 #include <asm/gt64120.h>
33 #include <asm/mips-boards/generic.h>
34 #include <asm/mips-boards/msc01_pci.h>
35 #include <asm/msc01_ic.h>
37 #include <asm/setup.h>
40 static unsigned long _msc01_biu_base
;
41 static unsigned int ipi_map
[NR_CPUS
];
43 static DEFINE_RAW_SPINLOCK(mips_irq_lock
);
45 static inline int mips_pcibios_iack(void)
50 * Determine highest priority pending interrupt by performing
51 * a PCI Interrupt Acknowledge cycle.
53 switch (mips_revision_sconid
) {
54 case MIPS_REVISION_SCON_SOCIT
:
55 case MIPS_REVISION_SCON_ROCIT
:
56 case MIPS_REVISION_SCON_SOCITSC
:
57 case MIPS_REVISION_SCON_SOCITSCP
:
58 MSC_READ(MSC01_PCI_IACK
, irq
);
61 case MIPS_REVISION_SCON_GT64120
:
62 irq
= GT_READ(GT_PCI0_IACK_OFS
);
65 case MIPS_REVISION_SCON_BONITO
:
66 /* The following will generate a PCI IACK cycle on the
67 * Bonito controller. It's a little bit kludgy, but it
68 * was the easiest way to implement it in hardware at
71 BONITO_PCIMAP_CFG
= 0x20000;
73 /* Flush Bonito register block */
74 (void) BONITO_PCIMAP_CFG
;
77 irq
= __raw_readl((u32
*)_pcictrl_bonito_pcicfg
);
80 BONITO_PCIMAP_CFG
= 0;
83 pr_emerg("Unknown system controller.\n");
89 static inline int get_int(void)
93 raw_spin_lock_irqsave(&mips_irq_lock
, flags
);
95 irq
= mips_pcibios_iack();
98 * The only way we can decide if an interrupt is spurious
99 * is by checking the 8259 registers. This needs a spinlock
100 * on an SMP system, so leave it up to the generic code...
103 raw_spin_unlock_irqrestore(&mips_irq_lock
, flags
);
108 static void malta_hw0_irqdispatch(void)
114 /* interrupt has already been cleared */
118 do_IRQ(MALTA_INT_BASE
+ irq
);
120 #ifdef CONFIG_MIPS_VPE_APSP_API_MT
126 static void malta_ipi_irqdispatch(void)
130 if (gic_compare_int())
131 do_IRQ(MIPS_GIC_IRQ_BASE
);
135 return; /* interrupt has already been cleared */
137 do_IRQ(MIPS_GIC_IRQ_BASE
+ irq
);
140 static void corehi_irqdispatch(void)
142 unsigned int intedge
, intsteer
, pcicmd
, pcibadaddr
;
143 unsigned int pcimstat
, intisr
, inten
, intpol
;
144 unsigned int intrcause
, datalo
, datahi
;
145 struct pt_regs
*regs
= get_irq_regs();
147 pr_emerg("CoreHI interrupt, shouldn't happen, we die here!\n");
148 pr_emerg("epc : %08lx\nStatus: %08lx\n"
149 "Cause : %08lx\nbadVaddr : %08lx\n",
150 regs
->cp0_epc
, regs
->cp0_status
,
151 regs
->cp0_cause
, regs
->cp0_badvaddr
);
153 /* Read all the registers and then print them as there is a
154 problem with interspersed printk's upsetting the Bonito controller.
155 Do it for the others too.
158 switch (mips_revision_sconid
) {
159 case MIPS_REVISION_SCON_SOCIT
:
160 case MIPS_REVISION_SCON_ROCIT
:
161 case MIPS_REVISION_SCON_SOCITSC
:
162 case MIPS_REVISION_SCON_SOCITSCP
:
165 case MIPS_REVISION_SCON_GT64120
:
166 intrcause
= GT_READ(GT_INTRCAUSE_OFS
);
167 datalo
= GT_READ(GT_CPUERR_ADDRLO_OFS
);
168 datahi
= GT_READ(GT_CPUERR_ADDRHI_OFS
);
169 pr_emerg("GT_INTRCAUSE = %08x\n", intrcause
);
170 pr_emerg("GT_CPUERR_ADDR = %02x%08x\n",
173 case MIPS_REVISION_SCON_BONITO
:
174 pcibadaddr
= BONITO_PCIBADADDR
;
175 pcimstat
= BONITO_PCIMSTAT
;
176 intisr
= BONITO_INTISR
;
177 inten
= BONITO_INTEN
;
178 intpol
= BONITO_INTPOL
;
179 intedge
= BONITO_INTEDGE
;
180 intsteer
= BONITO_INTSTEER
;
181 pcicmd
= BONITO_PCICMD
;
182 pr_emerg("BONITO_INTISR = %08x\n", intisr
);
183 pr_emerg("BONITO_INTEN = %08x\n", inten
);
184 pr_emerg("BONITO_INTPOL = %08x\n", intpol
);
185 pr_emerg("BONITO_INTEDGE = %08x\n", intedge
);
186 pr_emerg("BONITO_INTSTEER = %08x\n", intsteer
);
187 pr_emerg("BONITO_PCICMD = %08x\n", pcicmd
);
188 pr_emerg("BONITO_PCIBADADDR = %08x\n", pcibadaddr
);
189 pr_emerg("BONITO_PCIMSTAT = %08x\n", pcimstat
);
193 die("CoreHi interrupt", regs
);
196 static inline int clz(unsigned long x
)
210 * Version of ffs that only looks at bits 12..15.
212 static inline unsigned int irq_ffs(unsigned int pending
)
214 #if defined(CONFIG_CPU_MIPS32) || defined(CONFIG_CPU_MIPS64)
215 return -clz(pending
) + 31 - CAUSEB_IP
;
220 t0
= pending
& 0xf000;
224 pending
= pending
<< t0
;
226 t0
= pending
& 0xc000;
230 pending
= pending
<< t0
;
232 t0
= pending
& 0x8000;
236 /* pending = pending << t0; */
243 * IRQs on the Malta board look basically (barring software IRQs which we
244 * don't use at all and all external interrupt sources are combined together
245 * on hardware interrupt 0 (MIPS IRQ 2)) like:
249 * 0 Software (ignored)
250 * 1 Software (ignored)
251 * 2 Combined hardware interrupt (hw0)
252 * 3 Hardware (ignored)
253 * 4 Hardware (ignored)
254 * 5 Hardware (ignored)
255 * 6 Hardware (ignored)
256 * 7 R4k timer (what we use)
258 * We handle the IRQ according to _our_ priority which is:
260 * Highest ---- R4k Timer
261 * Lowest ---- Combined hardware interrupt
263 * then we just return, if multiple IRQs are pending then we will just take
264 * another exception, big deal.
267 asmlinkage
void plat_irq_dispatch(void)
269 unsigned int pending
= read_c0_cause() & read_c0_status() & ST0_IM
;
272 if (unlikely(!pending
)) {
273 spurious_interrupt();
277 irq
= irq_ffs(pending
);
279 if (irq
== MIPSCPU_INT_I8259A
)
280 malta_hw0_irqdispatch();
281 else if (gic_present
&& ((1 << irq
) & ipi_map
[smp_processor_id()]))
282 malta_ipi_irqdispatch();
284 do_IRQ(MIPS_CPU_IRQ_BASE
+ irq
);
287 #ifdef CONFIG_MIPS_MT_SMP
289 #define MIPS_CPU_IPI_RESCHED_IRQ 0 /* SW int 0 for resched */
290 #define C_RESCHED C_SW0
291 #define MIPS_CPU_IPI_CALL_IRQ 1 /* SW int 1 for resched */
293 static int cpu_ipi_resched_irq
, cpu_ipi_call_irq
;
295 static void ipi_resched_dispatch(void)
297 do_IRQ(MIPS_CPU_IRQ_BASE
+ MIPS_CPU_IPI_RESCHED_IRQ
);
300 static void ipi_call_dispatch(void)
302 do_IRQ(MIPS_CPU_IRQ_BASE
+ MIPS_CPU_IPI_CALL_IRQ
);
305 #endif /* CONFIG_MIPS_MT_SMP */
307 #ifdef CONFIG_MIPS_GIC_IPI
309 #define GIC_MIPS_CPU_IPI_RESCHED_IRQ 3
310 #define GIC_MIPS_CPU_IPI_CALL_IRQ 4
312 static irqreturn_t
ipi_resched_interrupt(int irq
, void *dev_id
)
314 #ifdef CONFIG_MIPS_VPE_APSP_API_CMP
324 static irqreturn_t
ipi_call_interrupt(int irq
, void *dev_id
)
326 smp_call_function_interrupt();
331 static struct irqaction irq_resched
= {
332 .handler
= ipi_resched_interrupt
,
333 .flags
= IRQF_PERCPU
,
334 .name
= "IPI_resched"
337 static struct irqaction irq_call
= {
338 .handler
= ipi_call_interrupt
,
339 .flags
= IRQF_PERCPU
,
342 #endif /* CONFIG_MIPS_GIC_IPI */
344 static int gic_resched_int_base
;
345 static int gic_call_int_base
;
346 #define GIC_RESCHED_INT(cpu) (gic_resched_int_base+(cpu))
347 #define GIC_CALL_INT(cpu) (gic_call_int_base+(cpu))
349 unsigned int plat_ipi_call_int_xlate(unsigned int cpu
)
351 return GIC_CALL_INT(cpu
);
354 unsigned int plat_ipi_resched_int_xlate(unsigned int cpu
)
356 return GIC_RESCHED_INT(cpu
);
359 static struct irqaction i8259irq
= {
360 .handler
= no_action
,
361 .name
= "XT-PIC cascade",
362 .flags
= IRQF_NO_THREAD
,
365 static struct irqaction corehi_irqaction
= {
366 .handler
= no_action
,
368 .flags
= IRQF_NO_THREAD
,
371 static msc_irqmap_t msc_irqmap
[] __initdata
= {
372 {MSC01C_INT_TMR
, MSC01_IRQ_EDGE
, 0},
373 {MSC01C_INT_PCI
, MSC01_IRQ_LEVEL
, 0},
375 static int msc_nr_irqs __initdata
= ARRAY_SIZE(msc_irqmap
);
377 static msc_irqmap_t msc_eicirqmap
[] __initdata
= {
378 {MSC01E_INT_SW0
, MSC01_IRQ_LEVEL
, 0},
379 {MSC01E_INT_SW1
, MSC01_IRQ_LEVEL
, 0},
380 {MSC01E_INT_I8259A
, MSC01_IRQ_LEVEL
, 0},
381 {MSC01E_INT_SMI
, MSC01_IRQ_LEVEL
, 0},
382 {MSC01E_INT_COREHI
, MSC01_IRQ_LEVEL
, 0},
383 {MSC01E_INT_CORELO
, MSC01_IRQ_LEVEL
, 0},
384 {MSC01E_INT_TMR
, MSC01_IRQ_EDGE
, 0},
385 {MSC01E_INT_PCI
, MSC01_IRQ_LEVEL
, 0},
386 {MSC01E_INT_PERFCTR
, MSC01_IRQ_LEVEL
, 0},
387 {MSC01E_INT_CPUCTR
, MSC01_IRQ_LEVEL
, 0}
390 static int msc_nr_eicirqs __initdata
= ARRAY_SIZE(msc_eicirqmap
);
393 * This GIC specific tabular array defines the association between External
394 * Interrupts and CPUs/Core Interrupts. The nature of the External
395 * Interrupts is also defined here - polarity/trigger.
398 #define GIC_CPU_NMI GIC_MAP_TO_NMI_MSK
401 static struct gic_intr_map gic_intr_map
[GIC_NUM_INTRS
] = {
405 { 0, GIC_CPU_INT0
, GIC_POL_POS
, GIC_TRIG_LEVEL
, GIC_FLAG_TRANSPARENT
},
406 { 0, GIC_CPU_INT1
, GIC_POL_POS
, GIC_TRIG_LEVEL
, GIC_FLAG_TRANSPARENT
},
407 { 0, GIC_CPU_INT2
, GIC_POL_POS
, GIC_TRIG_LEVEL
, GIC_FLAG_TRANSPARENT
},
408 { 0, GIC_CPU_INT3
, GIC_POL_POS
, GIC_TRIG_LEVEL
, GIC_FLAG_TRANSPARENT
},
409 { 0, GIC_CPU_INT4
, GIC_POL_POS
, GIC_TRIG_LEVEL
, GIC_FLAG_TRANSPARENT
},
410 { 0, GIC_CPU_INT3
, GIC_POL_POS
, GIC_TRIG_LEVEL
, GIC_FLAG_TRANSPARENT
},
411 { 0, GIC_CPU_INT3
, GIC_POL_POS
, GIC_TRIG_LEVEL
, GIC_FLAG_TRANSPARENT
},
414 { 0, GIC_CPU_INT3
, GIC_POL_POS
, GIC_TRIG_LEVEL
, GIC_FLAG_TRANSPARENT
},
415 { 0, GIC_CPU_NMI
, GIC_POL_POS
, GIC_TRIG_LEVEL
, GIC_FLAG_TRANSPARENT
},
416 { 0, GIC_CPU_NMI
, GIC_POL_POS
, GIC_TRIG_LEVEL
, GIC_FLAG_TRANSPARENT
},
418 /* The remainder of this table is initialised by fill_ipi_map */
422 #ifdef CONFIG_MIPS_GIC_IPI
423 static void __init
fill_ipi_map1(int baseintr
, int cpu
, int cpupin
)
425 int intr
= baseintr
+ cpu
;
426 gic_intr_map
[intr
].cpunum
= cpu
;
427 gic_intr_map
[intr
].pin
= cpupin
;
428 gic_intr_map
[intr
].polarity
= GIC_POL_POS
;
429 gic_intr_map
[intr
].trigtype
= GIC_TRIG_EDGE
;
430 gic_intr_map
[intr
].flags
= GIC_FLAG_IPI
;
431 ipi_map
[cpu
] |= (1 << (cpupin
+ 2));
434 static void __init
fill_ipi_map(void)
438 for (cpu
= 0; cpu
< nr_cpu_ids
; cpu
++) {
439 fill_ipi_map1(gic_resched_int_base
, cpu
, GIC_CPU_INT1
);
440 fill_ipi_map1(gic_call_int_base
, cpu
, GIC_CPU_INT2
);
445 void __init
arch_init_ipiirq(int irq
, struct irqaction
*action
)
447 setup_irq(irq
, action
);
448 irq_set_handler(irq
, handle_percpu_irq
);
451 void __init
arch_init_irq(void)
458 if (mips_cm_present()) {
459 write_gcr_gic_base(GIC_BASE_ADDR
| CM_GCR_GIC_BASE_GICEN_MSK
);
462 if (mips_revision_sconid
== MIPS_REVISION_SCON_ROCIT
) {
463 _msc01_biu_base
= (unsigned long)
464 ioremap_nocache(MSC01_BIU_REG_BASE
,
465 MSC01_BIU_ADDRSPACE_SZ
);
466 gic_present
= (REG(_msc01_biu_base
, MSC01_SC_CFG
) &
467 MSC01_SC_CFG_GICPRES_MSK
) >>
468 MSC01_SC_CFG_GICPRES_SHF
;
472 pr_debug("GIC present\n");
474 switch (mips_revision_sconid
) {
475 case MIPS_REVISION_SCON_SOCIT
:
476 case MIPS_REVISION_SCON_ROCIT
:
478 init_msc_irqs(MIPS_MSC01_IC_REG_BASE
,
479 MSC01E_INT_BASE
, msc_eicirqmap
,
482 init_msc_irqs(MIPS_MSC01_IC_REG_BASE
,
483 MSC01C_INT_BASE
, msc_irqmap
,
487 case MIPS_REVISION_SCON_SOCITSC
:
488 case MIPS_REVISION_SCON_SOCITSCP
:
490 init_msc_irqs(MIPS_SOCITSC_IC_REG_BASE
,
491 MSC01E_INT_BASE
, msc_eicirqmap
,
494 init_msc_irqs(MIPS_SOCITSC_IC_REG_BASE
,
495 MSC01C_INT_BASE
, msc_irqmap
,
500 set_vi_handler(MSC01E_INT_I8259A
, malta_hw0_irqdispatch
);
501 set_vi_handler(MSC01E_INT_COREHI
, corehi_irqdispatch
);
502 setup_irq(MSC01E_INT_BASE
+MSC01E_INT_I8259A
, &i8259irq
);
503 setup_irq(MSC01E_INT_BASE
+MSC01E_INT_COREHI
, &corehi_irqaction
);
504 } else if (cpu_has_vint
) {
505 set_vi_handler(MIPSCPU_INT_I8259A
, malta_hw0_irqdispatch
);
506 set_vi_handler(MIPSCPU_INT_COREHI
, corehi_irqdispatch
);
507 #ifdef CONFIG_MIPS_MT_SMTC
508 setup_irq_smtc(MIPS_CPU_IRQ_BASE
+MIPSCPU_INT_I8259A
, &i8259irq
,
509 (0x100 << MIPSCPU_INT_I8259A
));
510 setup_irq_smtc(MIPS_CPU_IRQ_BASE
+MIPSCPU_INT_COREHI
,
511 &corehi_irqaction
, (0x100 << MIPSCPU_INT_COREHI
));
513 * Temporary hack to ensure that the subsidiary device
514 * interrupts coing in via the i8259A, but associated
515 * with low IRQ numbers, will restore the Status.IM
516 * value associated with the i8259A.
521 for (i
= 0; i
< 16; i
++)
522 irq_hwmask
[i
] = (0x100 << MIPSCPU_INT_I8259A
);
525 setup_irq(MIPS_CPU_IRQ_BASE
+MIPSCPU_INT_I8259A
, &i8259irq
);
526 setup_irq(MIPS_CPU_IRQ_BASE
+MIPSCPU_INT_COREHI
,
528 #endif /* CONFIG_MIPS_MT_SMTC */
530 setup_irq(MIPS_CPU_IRQ_BASE
+MIPSCPU_INT_I8259A
, &i8259irq
);
531 setup_irq(MIPS_CPU_IRQ_BASE
+MIPSCPU_INT_COREHI
,
538 #if defined(CONFIG_MIPS_GIC_IPI)
539 gic_call_int_base
= GIC_NUM_INTRS
-
540 (NR_CPUS
- nr_cpu_ids
) * 2 - nr_cpu_ids
;
541 gic_resched_int_base
= gic_call_int_base
- nr_cpu_ids
;
544 gic_init(GIC_BASE_ADDR
, GIC_ADDRSPACE_SZ
, gic_intr_map
,
545 ARRAY_SIZE(gic_intr_map
), MIPS_GIC_IRQ_BASE
);
546 if (!mips_cm_present()) {
548 i
= REG(_msc01_biu_base
, MSC01_SC_CFG
);
549 REG(_msc01_biu_base
, MSC01_SC_CFG
) =
550 (i
| (0x1 << MSC01_SC_CFG_GICENA_SHF
));
551 pr_debug("GIC Enabled\n");
553 #if defined(CONFIG_MIPS_GIC_IPI)
554 /* set up ipi interrupts */
556 set_vi_handler(MIPSCPU_INT_IPI0
, malta_ipi_irqdispatch
);
557 set_vi_handler(MIPSCPU_INT_IPI1
, malta_ipi_irqdispatch
);
559 /* Argh.. this really needs sorting out.. */
560 pr_info("CPU%d: status register was %08x\n",
561 smp_processor_id(), read_c0_status());
562 write_c0_status(read_c0_status() | STATUSF_IP3
| STATUSF_IP4
);
563 pr_info("CPU%d: status register now %08x\n",
564 smp_processor_id(), read_c0_status());
565 write_c0_status(0x1100dc00);
566 pr_info("CPU%d: status register frc %08x\n",
567 smp_processor_id(), read_c0_status());
568 for (i
= 0; i
< nr_cpu_ids
; i
++) {
569 arch_init_ipiirq(MIPS_GIC_IRQ_BASE
+
570 GIC_RESCHED_INT(i
), &irq_resched
);
571 arch_init_ipiirq(MIPS_GIC_IRQ_BASE
+
572 GIC_CALL_INT(i
), &irq_call
);
576 #if defined(CONFIG_MIPS_MT_SMP)
577 /* set up ipi interrupts */
579 set_vi_handler (MSC01E_INT_SW0
, ipi_resched_dispatch
);
580 set_vi_handler (MSC01E_INT_SW1
, ipi_call_dispatch
);
581 cpu_ipi_resched_irq
= MSC01E_INT_SW0
;
582 cpu_ipi_call_irq
= MSC01E_INT_SW1
;
585 set_vi_handler (MIPS_CPU_IPI_RESCHED_IRQ
,
586 ipi_resched_dispatch
);
587 set_vi_handler (MIPS_CPU_IPI_CALL_IRQ
,
590 cpu_ipi_resched_irq
= MIPS_CPU_IRQ_BASE
+
591 MIPS_CPU_IPI_RESCHED_IRQ
;
592 cpu_ipi_call_irq
= MIPS_CPU_IRQ_BASE
+
593 MIPS_CPU_IPI_CALL_IRQ
;
595 arch_init_ipiirq(cpu_ipi_resched_irq
, &irq_resched
);
596 arch_init_ipiirq(cpu_ipi_call_irq
, &irq_call
);
601 void malta_be_init(void)
603 /* Could change CM error mask register. */
607 static char *tr
[8] = {
608 "mem", "gcr", "gic", "mmio",
609 "0x04", "0x05", "0x06", "0x07"
612 static char *mcmd
[32] = {
614 [0x01] = "Legacy Write",
615 [0x02] = "Legacy Read",
621 [0x08] = "Coherent Read Own",
622 [0x09] = "Coherent Read Share",
623 [0x0a] = "Coherent Read Discard",
624 [0x0b] = "Coherent Ready Share Always",
625 [0x0c] = "Coherent Upgrade",
626 [0x0d] = "Coherent Writeback",
629 [0x10] = "Coherent Copyback",
630 [0x11] = "Coherent Copyback Invalidate",
631 [0x12] = "Coherent Invalidate",
632 [0x13] = "Coherent Write Invalidate",
633 [0x14] = "Coherent Completion Sync",
647 static char *core
[8] = {
648 "Invalid/OK", "Invalid/Data",
649 "Shared/OK", "Shared/Data",
650 "Modified/OK", "Modified/Data",
651 "Exclusive/OK", "Exclusive/Data"
654 static char *causes
[32] = {
655 "None", "GC_WR_ERR", "GC_RD_ERR", "COH_WR_ERR",
656 "COH_RD_ERR", "MMIO_WR_ERR", "MMIO_RD_ERR", "0x07",
657 "0x08", "0x09", "0x0a", "0x0b",
658 "0x0c", "0x0d", "0x0e", "0x0f",
659 "0x10", "0x11", "0x12", "0x13",
660 "0x14", "0x15", "0x16", "INTVN_WR_ERR",
661 "INTVN_RD_ERR", "0x19", "0x1a", "0x1b",
662 "0x1c", "0x1d", "0x1e", "0x1f"
665 int malta_be_handler(struct pt_regs
*regs
, int is_fixup
)
667 /* This duplicates the handling in do_be which seems wrong */
668 int retval
= is_fixup
? MIPS_BE_FIXUP
: MIPS_BE_FATAL
;
670 if (mips_cm_present()) {
671 unsigned long cm_error
= read_gcr_error_cause();
672 unsigned long cm_addr
= read_gcr_error_addr();
673 unsigned long cm_other
= read_gcr_error_mult();
674 unsigned long cause
, ocause
;
677 cause
= cm_error
& CM_GCR_ERROR_CAUSE_ERRTYPE_MSK
;
679 cause
>>= CM_GCR_ERROR_CAUSE_ERRTYPE_SHF
;
681 unsigned long cca_bits
= (cm_error
>> 15) & 7;
682 unsigned long tr_bits
= (cm_error
>> 12) & 7;
683 unsigned long cmd_bits
= (cm_error
>> 7) & 0x1f;
684 unsigned long stag_bits
= (cm_error
>> 3) & 15;
685 unsigned long sport_bits
= (cm_error
>> 0) & 7;
687 snprintf(buf
, sizeof(buf
),
688 "CCA=%lu TR=%s MCmd=%s STag=%lu "
690 cca_bits
, tr
[tr_bits
], mcmd
[cmd_bits
],
691 stag_bits
, sport_bits
);
693 /* glob state & sresp together */
694 unsigned long c3_bits
= (cm_error
>> 18) & 7;
695 unsigned long c2_bits
= (cm_error
>> 15) & 7;
696 unsigned long c1_bits
= (cm_error
>> 12) & 7;
697 unsigned long c0_bits
= (cm_error
>> 9) & 7;
698 unsigned long sc_bit
= (cm_error
>> 8) & 1;
699 unsigned long cmd_bits
= (cm_error
>> 3) & 0x1f;
700 unsigned long sport_bits
= (cm_error
>> 0) & 7;
701 snprintf(buf
, sizeof(buf
),
702 "C3=%s C2=%s C1=%s C0=%s SC=%s "
703 "MCmd=%s SPort=%lu\n",
704 core
[c3_bits
], core
[c2_bits
],
705 core
[c1_bits
], core
[c0_bits
],
706 sc_bit
? "True" : "False",
707 mcmd
[cmd_bits
], sport_bits
);
710 ocause
= (cm_other
& CM_GCR_ERROR_MULT_ERR2ND_MSK
) >>
711 CM_GCR_ERROR_MULT_ERR2ND_SHF
;
713 pr_err("CM_ERROR=%08lx %s <%s>\n", cm_error
,
715 pr_err("CM_ADDR =%08lx\n", cm_addr
);
716 pr_err("CM_OTHER=%08lx %s\n", cm_other
, causes
[ocause
]);
718 /* reprime cause register */
719 write_gcr_error_cause(0);
726 void gic_enable_interrupt(int irq_vec
)
728 GIC_SET_INTR_MASK(irq_vec
);
731 void gic_disable_interrupt(int irq_vec
)
733 GIC_CLR_INTR_MASK(irq_vec
);
736 void gic_irq_ack(struct irq_data
*d
)
738 int irq
= (d
->irq
- gic_irq_base
);
740 GIC_CLR_INTR_MASK(irq
);
742 if (gic_irq_flags
[irq
] & GIC_TRIG_EDGE
)
743 GICWRITE(GIC_REG(SHARED
, GIC_SH_WEDGE
), irq
);
746 void gic_finish_irq(struct irq_data
*d
)
748 /* Enable interrupts. */
749 GIC_SET_INTR_MASK(d
->irq
- gic_irq_base
);
752 void __init
gic_platform_init(int irqs
, struct irq_chip
*irq_controller
)
756 for (i
= gic_irq_base
; i
< (gic_irq_base
+ irqs
); i
++)
757 irq_set_chip(i
, irq_controller
);