1 /*
2 * Copyright (c) 1992, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This software was developed by the Computer Systems Engineering group
6 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
7 * contributed to Berkeley.
8 *
9 * All advertising materials mentioning features or use of this software
10 * must display the following acknowledgement:
11 * This product includes software developed by the University of
12 * California, Lawrence Berkeley Laboratory.
13 *
14 * %sccs.include.redist.c%
15 *
16 * @(#)memreg.c 8.1 (Berkeley) 06/11/93
17 *
18 * from: $Header: memreg.c,v 1.7 92/11/26 03:05:04 torek Exp $ (LBL)
19 */
20
21 #include <sys/param.h>
22 #include <sys/device.h>
23
24 #include <machine/autoconf.h>
25 #include <machine/ctlreg.h>
26
27 #include <sparc/sparc/memreg.h>
28
29 static int memregmatch __P((struct device *, struct cfdata *, void *));
30 static void memregattach __P((struct device *, struct device *, void *));
31 struct cfdriver memregcd =
32 { 0, "memreg", memregmatch, memregattach, DV_DULL, sizeof(struct device) };
33
34 /*
35 * The OPENPROM calls this "memory-error".
36 */
37 static int
memregmatch(parent,cf,aux)38 memregmatch(parent, cf, aux)
39 struct device *parent;
40 struct cfdata *cf;
41 void *aux;
42 {
43
44 return (strcmp("memory-error", ((struct romaux *)aux)->ra_name) == 0);
45 }
46
47 /* ARGSUSED */
48 static void
memregattach(parent,self,aux)49 memregattach(parent, self, aux)
50 struct device *parent, *self;
51 void *aux;
52 {
53 struct romaux *ra = aux;
54
55 par_err_reg = ra->ra_vaddr ? (volatile int *)ra->ra_vaddr :
56 (volatile int *)mapiodev(ra->ra_paddr, sizeof(int));
57 printf("\n");
58 }
59
60 /*
61 * Synchronous and asynchronous memory error handler.
62 * (This is the level 15 interrupt, which is not vectored.)
63 * Should kill the process that got its bits clobbered,
64 * and take the page out of the page pool, but for now...
65 */
66 void
memerr(issync,ser,sva,aer,ava)67 memerr(issync, ser, sva, aer, ava)
68 int issync, ser, sva, aer, ava;
69 {
70
71 printf("%ssync mem err: ser=%b sva=%x aer=%b ava=%x\n",
72 issync ? "" : "a", ser, SER_BITS, sva, aer & 0xff, AER_BITS, ava);
73 if (par_err_reg)
74 printf("parity error register = %b\n", *par_err_reg, PER_BITS);
75 #ifdef DEBUG
76 callrom();
77 #else
78 panic("memory error"); /* XXX */
79 #endif
80 }
81