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
7 * Copyright (C) 2005 Ilya A. Volynets <ilya@total-knowledge.com>
9 #include <linux/types.h>
10 #include <linux/init.h>
11 #include <linux/kernel.h>
12 #include <linux/interrupt.h>
13 #include <linux/module.h>
14 #include <asm/bootinfo.h>
16 #include <asm/mipsregs.h>
17 #include <asm/ptrace.h>
19 #include <asm/ip32/crime.h>
20 #include <asm/ip32/mace.h>
22 struct sgi_crime __iomem *crime;
23 struct sgi_mace __iomem *mace;
25 EXPORT_SYMBOL_GPL(mace);
27 void __init crime_init(void)
30 const int field = 2 * sizeof(unsigned long);
32 set_io_port_base((unsigned long) ioremap(MACEPCI_LOW_IO, 0x2000000));
33 crime = ioremap(CRIME_BASE, sizeof(struct sgi_crime));
34 mace = ioremap(MACE_BASE, sizeof(struct sgi_mace));
37 rev = id & CRIME_ID_REV;
38 id = (id & CRIME_ID_IDBITS) >> 4;
39 printk (KERN_INFO "CRIME id %1x rev %d at 0x%0*lx\n",
40 id, rev, field, (unsigned long) CRIME_BASE);
44 crime_memerr_intr (unsigned int irq, void *dev_id, struct pt_regs *regs)
46 unsigned long stat, addr;
49 stat = crime->mem_error_stat & CRIME_MEM_ERROR_STAT_MASK;
50 addr = crime->mem_error_addr & CRIME_MEM_ERROR_ADDR_MASK;
52 printk("CRIME memory error at 0x%08lx ST 0x%08lx<", addr, stat);
54 if (stat & CRIME_MEM_ERROR_INV)
56 if (stat & CRIME_MEM_ERROR_ECC) {
57 unsigned long ecc_syn =
58 crime->mem_ecc_syn & CRIME_MEM_ERROR_ECC_SYN_MASK;
59 unsigned long ecc_gen =
60 crime->mem_ecc_chk & CRIME_MEM_ERROR_ECC_CHK_MASK;
61 printk("ECC,SYN=0x%08lx,GEN=0x%08lx,", ecc_syn, ecc_gen);
63 if (stat & CRIME_MEM_ERROR_MULTIPLE) {
67 if (stat & CRIME_MEM_ERROR_HARD_ERR) {
71 if (stat & CRIME_MEM_ERROR_SOFT_ERR)
73 if (stat & CRIME_MEM_ERROR_CPU_ACCESS)
75 if (stat & CRIME_MEM_ERROR_VICE_ACCESS)
77 if (stat & CRIME_MEM_ERROR_GBE_ACCESS)
79 if (stat & CRIME_MEM_ERROR_RE_ACCESS)
80 printk("RE,REID=0x%02lx,", (stat & CRIME_MEM_ERROR_RE_ID)>>8);
81 if (stat & CRIME_MEM_ERROR_MACE_ACCESS)
82 printk("MACE,MACEID=0x%02lx,", stat & CRIME_MEM_ERROR_MACE_ID);
84 crime->mem_error_stat = 0;
88 panic("Fatal memory error.");
90 printk("NONFATAL>\n");
96 crime_cpuerr_intr (unsigned int irq, void *dev_id, struct pt_regs *regs)
98 unsigned long stat = crime->cpu_error_stat & CRIME_CPU_ERROR_MASK;
99 unsigned long addr = crime->cpu_error_addr & CRIME_CPU_ERROR_ADDR_MASK;
102 printk ("CRIME CPU error at 0x%09lx status 0x%08lx\n", addr, stat);
103 crime->cpu_error_stat = 0;