1 /* 2 * Copyright (c) 1988 Regents of the University of California. 3 * All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Chris Torek. 7 * 8 * %sccs.include.redist.c% 9 * 10 * @(#)bi.c 7.3 (Berkeley) 06/28/90 11 */ 12 13 /* 14 * VAXBI specific routines. 15 */ 16 17 #include "param.h" 18 19 #include "../vax/cpu.h" 20 #include "../vax/mtpr.h" 21 #include "../vax/nexus.h" 22 23 #include "bireg.h" 24 25 bi_reset(bi) 26 register struct biiregs *bi; 27 { 28 29 bi->bi_csr |= BICSR_NRST; 30 DELAY(10000); /* ??? */ 31 } 32 33 /* 34 * Reset with self test. Return true iff reset fails. 35 * BEWARE, THIS RESETS THE BI ARBITRATION LEVEL TO ARB_NONE 36 * does self test ever cause a bi bus error? 37 */ 38 bi_selftest(bi) 39 register struct biiregs *bi; 40 { 41 register int timo; 42 43 bi->bi_csr |= BICSR_ARB_NONE; /* why? */ 44 bi->bi_csr |= BICSR_STS | BICSR_INIT;/* must this be separate? */ 45 DELAY(50); /* why? */ 46 timo = todr() + 1000; 47 while (bi->bi_csr & BICSR_BROKE) { 48 if (todr() > timo) /* reset failed */ 49 return (-1); 50 } 51 return (0); /* reset OK */ 52 } 53 54 /* 55 * THIS SHOULD PROBABLY WORK MORE LIKE ubaerror() 56 * (but then we would need to be able to reset BI nodes) 57 * (we need a per-BI-device driver structure!) 58 */ 59 bi_buserr(binum) 60 int binum; 61 { 62 register struct bi_node *bi; 63 register int node; 64 extern int bi_nodes; 65 extern int cold; 66 67 printf("vaxbi%d: bus error\n", binum); 68 bi = (struct bi_node *) &nexus[binum * NNODEBI];/* XXX */ 69 for (node = 0; node < 16; node++, bi++) { 70 if ((bi_nodes & (1 << node)) == 0) /* XXX crude */ 71 continue; 72 printf("node %x: ber=%b\n", node, bi->biic.bi_ber, BIBER_BITS); 73 } 74 panic("bi_buserr"); 75 } 76