1 /* $NetBSD: memc_3max.c,v 1.13 2002/09/29 15:11:14 wiz Exp $ */ 2 3 /* 4 * Copyright (c) 1998 Jonathan Stone. All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions and the following disclaimer. 11 * 2. Redistributions in binary form must reproduce the above copyright 12 * notice, this list of conditions and the following disclaimer in the 13 * documentation and/or other materials provided with the distribution. 14 * 3. All advertising materials mentioning features or use of this software 15 * must display the following acknowledgement: 16 * This product includes software developed by Jonathan Stone for 17 * the NetBSD Project. 18 * 4. The name of the author may not be used to endorse or promote products 19 * derived from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 22 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 23 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 24 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 25 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 */ 32 33 #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ 34 35 __KERNEL_RCSID(0, "$NetBSD: memc_3max.c,v 1.13 2002/09/29 15:11:14 wiz Exp $"); 36 37 #include <sys/param.h> 38 #include <sys/systm.h> 39 40 #include <machine/locore.h> /* wbflush() */ 41 42 #include <pmax/pmax/kn02.h> /* error-register defs copied into kn03.h */ 43 #include <pmax/pmax/memc.h> 44 45 /* 46 * the 3max and 3maxplus have compatible memory subsystems; 47 * we handle them both here. 48 */ 49 50 51 void 52 dec_mtasic_err(erradr, errsyn, bnk32m) 53 u_int32_t erradr, errsyn, bnk32m; 54 { 55 u_int32_t physadr; 56 int module; 57 58 if (!(erradr & KN02_ERR_VALID)) 59 return; 60 /* extract the physical word address and compensate for pipelining */ 61 physadr = erradr & KN02_ERR_ADDRESS; 62 if (!(erradr & KN02_ERR_WRITE)) 63 physadr = (physadr & ~0xfff) | ((physadr & 0xfff) - 5); 64 physadr <<= 2; 65 printf("%s memory %s %s error at 0x%08x", 66 (erradr & KN02_ERR_CPU) ? "CPU" : "DMA", 67 (erradr & KN02_ERR_WRITE) ? "write" : "read", 68 (erradr & KN02_ERR_ECCERR) ? "ECC" : "timeout", 69 physadr); 70 if (physadr <= ctob(physmem)) { 71 if (bnk32m != 0) /* 32MB modules? */ 72 module = physadr / ( 32 * 1024 * 1024); 73 else 74 module = physadr / ( 8 * 1024 * 1024); 75 printf(" module %d", module); 76 } 77 else { 78 /* ECC error didn't occur in RAM */ 79 printf(" (no RAM)"); 80 } 81 printf("\n"); 82 if (erradr & KN02_ERR_ECCERR) { 83 u_int32_t errsyn_value = *(u_int32_t *)errsyn; 84 *(u_int32_t *)errsyn = 0; 85 wbflush(); 86 printf(" ECC 0x%08x\n", errsyn_value); 87 88 /* check for a corrected, single bit, read error */ 89 if (!(erradr & KN02_ERR_WRITE)) { 90 if (physadr & 0x4) { 91 /* check high word */ 92 if (errsyn_value & KN02_ECC_SNGHI) 93 return; 94 } else { 95 /* check low word */ 96 if (errsyn_value & KN02_ECC_SNGLO) 97 return; 98 } 99 } 100 printf("\n"); 101 } 102 else 103 printf("\n"); 104 panic("Mem error interrupt"); 105 } 106 107 /* 108 * Xxx noncontig memory probing with mixed-sized memory boards 109 * XXX on 3max (kn02) or 3maxplus (kn03) belongs here. 110 */ 111 112 /* 113 * Xxx any support for NVRAM (PrestoServe) modules in 114 * XXX on 3max (kn02) or 3maxplus (kn03) memory slots probably belongs here, 115 * since we need to not probe it as normal RAM. 116 */ 117