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 * Copyright (C) 2001, 2003 Keith M Wesolowski
8 #include <linux/types.h>
9 #include <linux/init.h>
10 #include <linux/kernel.h>
11 #include <linux/interrupt.h>
12 #include <asm/bootinfo.h>
13 #include <asm/mipsregs.h>
14 #include <asm/ptrace.h>
16 #include <asm/ip32/crime.h>
17 #include <asm/ip32/mace.h>
20 struct sgi_mace *mace;
22 void __init crime_init(void)
25 const int field = 2 * sizeof(unsigned long);
27 sgi_crime = ioremap(CRIME_BASE, 1);
28 mace = ioremap(MACE_BASE, sizeof(struct sgi_mace));
30 id = crime_read(CRIME_ID);
31 rev = id & CRIME_ID_REV;
32 id = (id & CRIME_ID_IDBITS) >> 4;
34 printk (KERN_INFO "CRIME id %1x rev %d at 0x%0*lx\n",
35 id, rev, field, (unsigned long) CRIME_BASE);
39 crime_memerr_intr (unsigned int irq, void *dev_id, struct pt_regs *regs)
41 unsigned long stat, addr;
44 stat = crime_read(CRIME_MEM_ERROR_STAT) & CRIME_MEM_ERROR_STAT_MASK;
45 addr = crime_read(CRIME_MEM_ERROR_ADDR) & CRIME_MEM_ERROR_ADDR_MASK;
47 printk("CRIME memory error at 0x%08lx ST 0x%08lx<", addr, stat);
49 if (stat & CRIME_MEM_ERROR_INV)
51 if (stat & CRIME_MEM_ERROR_ECC) {
52 unsigned long ecc_syn = crime_read(CRIME_MEM_ERROR_ECC_SYN) &
53 CRIME_MEM_ERROR_ECC_SYN_MASK;
54 unsigned long ecc_gen = crime_read(CRIME_MEM_ERROR_ECC_CHK) &
55 CRIME_MEM_ERROR_ECC_CHK_MASK;
57 printk("ECC,SYN=0x%08lx,GEN=0x%08lx,", ecc_syn, ecc_gen);
59 if (stat & CRIME_MEM_ERROR_MULTIPLE) {
63 if (stat & CRIME_MEM_ERROR_HARD_ERR) {
67 if (stat & CRIME_MEM_ERROR_SOFT_ERR)
69 if (stat & CRIME_MEM_ERROR_CPU_ACCESS)
71 if (stat & CRIME_MEM_ERROR_VICE_ACCESS)
73 if (stat & CRIME_MEM_ERROR_GBE_ACCESS)
75 if (stat & CRIME_MEM_ERROR_RE_ACCESS)
76 printk("RE,REID=0x%02lx,", (stat & CRIME_MEM_ERROR_RE_ID)>>8);
77 if (stat & CRIME_MEM_ERROR_MACE_ACCESS)
78 printk("MACE,MACEID=0x%02lx,", stat & CRIME_MEM_ERROR_MACE_ID);
80 crime_write(0, CRIME_MEM_ERROR_STAT);
84 panic("Fatal memory error.");
86 printk("NONFATAL>\n");
92 crime_cpuerr_intr (unsigned int irq, void *dev_id, struct pt_regs *regs)
94 unsigned long stat = crime_read(CRIME_CPU_ERROR_STAT) &
96 uint64_t addr = crime_read(CRIME_CPU_ERROR_ADDR) &
97 CRIME_CPU_ERROR_ADDR_MASK;
100 printk ("CRIME CPU error at 0x%09lx status 0x%08lx\n", addr, stat);
102 crime_write(0, CRIME_CPU_ERROR_STAT);