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