]> pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/mips/sgi-ip32/crime.c
Merge branch 'irq-fixes' of git://git.parisc-linux.org/git/linux-2.6
[linux-2.6-omap-h63xx.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, 2003 Keith M Wesolowski
7  * Copyright (C) 2005 Ilya A. Volynets <ilya@total-knowledge.com>
8  */
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>
15 #include <asm/io.h>
16 #include <asm/mipsregs.h>
17 #include <asm/ptrace.h>
18 #include <asm/page.h>
19 #include <asm/ip32/crime.h>
20 #include <asm/ip32/mace.h>
21
22 struct sgi_crime __iomem *crime;
23 struct sgi_mace __iomem *mace;
24
25 EXPORT_SYMBOL_GPL(mace);
26
27 void __init crime_init(void)
28 {
29         unsigned int id, rev;
30         const int field = 2 * sizeof(unsigned long);
31
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));
35
36         id = crime->id;
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);
41 }
42
43 irqreturn_t crime_memerr_intr(unsigned int irq, void *dev_id)
44 {
45         unsigned long stat, addr;
46         int fatal = 0;
47
48         stat = crime->mem_error_stat & CRIME_MEM_ERROR_STAT_MASK;
49         addr = crime->mem_error_addr & CRIME_MEM_ERROR_ADDR_MASK;
50
51         printk("CRIME memory error at 0x%08lx ST 0x%08lx<", addr, stat);
52
53         if (stat & CRIME_MEM_ERROR_INV)
54                 printk("INV,");
55         if (stat & CRIME_MEM_ERROR_ECC) {
56                 unsigned long ecc_syn =
57                         crime->mem_ecc_syn & CRIME_MEM_ERROR_ECC_SYN_MASK;
58                 unsigned long ecc_gen =
59                         crime->mem_ecc_chk & CRIME_MEM_ERROR_ECC_CHK_MASK;
60                 printk("ECC,SYN=0x%08lx,GEN=0x%08lx,", ecc_syn, ecc_gen);
61         }
62         if (stat & CRIME_MEM_ERROR_MULTIPLE) {
63                 fatal = 1;
64                 printk("MULTIPLE,");
65         }
66         if (stat & CRIME_MEM_ERROR_HARD_ERR) {
67                 fatal = 1;
68                 printk("HARD,");
69         }
70         if (stat & CRIME_MEM_ERROR_SOFT_ERR)
71                 printk("SOFT,");
72         if (stat & CRIME_MEM_ERROR_CPU_ACCESS)
73                 printk("CPU,");
74         if (stat & CRIME_MEM_ERROR_VICE_ACCESS)
75                 printk("VICE,");
76         if (stat & CRIME_MEM_ERROR_GBE_ACCESS)
77                 printk("GBE,");
78         if (stat & CRIME_MEM_ERROR_RE_ACCESS)
79                 printk("RE,REID=0x%02lx,", (stat & CRIME_MEM_ERROR_RE_ID)>>8);
80         if (stat & CRIME_MEM_ERROR_MACE_ACCESS)
81                 printk("MACE,MACEID=0x%02lx,", stat & CRIME_MEM_ERROR_MACE_ID);
82
83         crime->mem_error_stat = 0;
84
85         if (fatal) {
86                 printk("FATAL>\n");
87                 panic("Fatal memory error.");
88         } else
89                 printk("NONFATAL>\n");
90
91         return IRQ_HANDLED;
92 }
93
94 irqreturn_t crime_cpuerr_intr(unsigned int irq, void *dev_id)
95 {
96         unsigned long stat = crime->cpu_error_stat & CRIME_CPU_ERROR_MASK;
97         unsigned long addr = crime->cpu_error_addr & CRIME_CPU_ERROR_ADDR_MASK;
98
99         addr <<= 2;
100         printk ("CRIME CPU error at 0x%09lx status 0x%08lx\n", addr, stat);
101         crime->cpu_error_stat = 0;
102
103         return IRQ_HANDLED;
104 }