xref: /original-bsd/sys/sparc/sparc/memreg.c (revision 5debf01e)
1 /*
2  * Copyright (c) 1992 The Regents of the University of California.
3  * 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 Laboratories.
13  *
14  * %sccs.include.redist.c%
15  *
16  *	@(#)memreg.c	7.2 (Berkeley) 07/21/92
17  *
18  * from: $Header: memreg.c,v 1.4 92/06/17 05:22:17 torek Exp $ (LBL)
19  */
20 
21 #include "sys/param.h"
22 #include "sys/device.h"
23 
24 #include "machine/autoconf.h"
25 
26 #include "ctlreg.h"
27 #include "memreg.h"
28 
29 static void memregattach __P((struct device *, struct device *, void *));
30 struct cfdriver memregcd =
31     { NULL, "memory-error", matchbyname, memregattach,
32       DV_DULL, sizeof(struct device) };
33 
34 /* ARGSUSED */
35 static void
36 memregattach(parent, self, aux)
37 	struct device *parent, *self;
38 	void *aux;
39 {
40 	struct romaux *ra = aux;
41 
42 	par_err_reg = ra->ra_vaddr ? (volatile int *)ra->ra_vaddr :
43 	    (volatile int *)mapiodev(ra->ra_paddr, sizeof(int));
44 	printf("\n");
45 }
46 
47 /*
48  * Synchronous and asynchronous memory error handler.
49  * (This is the level 15 interrupt, which is not vectored.)
50  * Should kill the process that got its bits clobbered,
51  * and take the page out of the page pool, but for now...
52  */
53 void
54 memerr(issync, ser, sva, aer, ava)
55 	int issync, ser, sva, aer, ava;
56 {
57 
58 	printf("%ssync mem err: ser=%b sva=%x aer=%b ava=%x\n",
59 	    issync ? "" : "a", ser, SER_BITS, sva, aer & 0xff, AER_BITS, ava);
60 	if (par_err_reg)
61 		printf("parity error register = %b\n", *par_err_reg, PER_BITS);
62 #ifdef DEBUG
63 	callrom();
64 #else
65 	panic("memory error");		/* XXX */
66 #endif
67 }
68