0a2e6fb917feb24d308b4317a9de8940f42aec9c
[linux-flexiantxendom0-3.2.10.git] / arch / mips / sgi-ip32 / crime.c
1 /*
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
4  * for more details.
5  *
6  * Copyright (C) 2001 Keith M Wesolowski
7  */
8 #include <linux/types.h>
9 #include <linux/init.h>
10 #include <linux/kernel.h>
11 #include <asm/ip32/crime.h>
12 #include <asm/ptrace.h>
13
14 void __init crime_init (void)
15 {
16         u64 id = crime_read_64 (CRIME_ID);
17         u64 rev = id & CRIME_ID_REV;
18
19         id = (id & CRIME_ID_IDBITS) >> 4;
20
21         printk ("CRIME id %1lx rev %ld detected at %016lx\n", id, rev,
22                 (unsigned long) CRIME_BASE);
23 }
24
25 /* XXX Like on Sun, these give us various useful information to printk. */
26 void crime_memerr_intr (unsigned int irq, void *dev_id, struct pt_regs *regs)
27 {
28         u64 memerr = crime_read_64 (CRIME_MEM_ERROR_STAT);
29         u64 addr = crime_read_64 (CRIME_MEM_ERROR_ADDR);
30         memerr &= CRIME_MEM_ERROR_STAT_MASK;
31
32         printk ("CRIME memory error at physaddr 0x%08lx status %08lx\n",
33                 addr << 2, memerr);
34
35         crime_write_64 (CRIME_MEM_ERROR_STAT, 0);
36 }
37
38 void crime_cpuerr_intr (unsigned int irq, void *dev_id, struct pt_regs *regs)
39 {
40         u64 cpuerr = crime_read_64 (CRIME_CPU_ERROR_STAT);
41         u64 addr = crime_read_64 (CRIME_CPU_ERROR_ADDR);
42         cpuerr &= CRIME_CPU_ERROR_MASK;
43         addr <<= 2UL;
44
45         printk ("CRIME CPU interface error detected at %09lx status %08lx\n",
46                 addr, cpuerr);
47
48         crime_write_64 (CRIME_CPU_ERROR_STAT, 0);
49 }