diff options
Diffstat (limited to 'sys/arch/hp300/dev/ct.c')
-rw-r--r-- | sys/arch/hp300/dev/ct.c | 72 |
1 files changed, 46 insertions, 26 deletions
diff --git a/sys/arch/hp300/dev/ct.c b/sys/arch/hp300/dev/ct.c index dfab8c0f353..e3ad6174909 100644 --- a/sys/arch/hp300/dev/ct.c +++ b/sys/arch/hp300/dev/ct.c @@ -1,4 +1,4 @@ -/* $NetBSD: ct.c,v 1.12 1995/10/09 07:57:43 thorpej Exp $ */ +/* $NetBSD: ct.c,v 1.13 1995/12/02 18:21:52 thorpej Exp $ */ /* * Copyright (c) 1982, 1990, 1993 @@ -64,10 +64,10 @@ /* number of eof marks to remember */ #define EOFS 128 -int ctinit(), ctstart(), ctgo(), ctintr(); -void ctstrategy(), ctdone(); +int ctmatch(), ctstart(), ctgo(), ctintr(); +void ctattach(), ctstrategy(), ctdone(); struct driver ctdriver = { - ctinit, "ct", ctstart, ctgo, ctintr, + ctmatch, ctattach, "ct", ctstart, ctgo, ctintr, }; struct ct_softc { @@ -135,7 +135,8 @@ int ctdebug = 0; #define CT_BSF 0x02 #endif -ctinit(hd) +int +ctmatch(hd) register struct hp_device *hd; { register struct ct_softc *sc = &ct_softc[hd->hp_unit]; @@ -145,20 +146,33 @@ ctinit(hd) bp->b_actb = &bp->b_actf; sc->sc_hd = hd; sc->sc_punit = ctpunit(hd->hp_flags); - if (ctident(sc, hd) < 0) - return(0); + if (ctident(sc, hd, 0) < 0) + return (0); + + return (1); +} + +void +ctattach(hd) + register struct hp_device *hd; +{ + struct ct_softc *sc = &ct_softc[hd->hp_unit]; + + (void)ctident(sc, hd, 1); /* XXX Ick. */ + ctreset(sc, hd); sc->sc_dq.dq_ctlr = hd->hp_ctlr; sc->sc_dq.dq_unit = hd->hp_unit; sc->sc_dq.dq_slave = hd->hp_slave; sc->sc_dq.dq_driver = &ctdriver; sc->sc_flags |= CTF_ALIVE; - return(1); } -ctident(sc, hd) +int +ctident(sc, hd, verbose) register struct ct_softc *sc; register struct hp_device *hd; + int verbose; { struct ct_describe desc; u_char stat, cmd[3]; @@ -216,8 +230,9 @@ ctident(sc, hd) sc->sc_type = CT88140; break; } - printf("ct%d: %s %stape\n", hd->hp_unit, ctinfo[id].desc, - (sc->sc_flags & CTF_CANSTREAM) ? "streaming " : " "); + if (verbose) + printf(": %s %stape\n", ctinfo[id].desc, + (sc->sc_flags & CTF_CANSTREAM) ? "streaming " : " "); return(id); } @@ -318,8 +333,9 @@ ctclose(dev, flag) sc->sc_eofp--; #ifdef DEBUG if(ctdebug & CT_BSF) - printf("ct%d: ctclose backup eofs prt %d blk %d\n", - UNIT(dev), sc->sc_eofp, sc->sc_eofs[sc->sc_eofp]); + printf("%s: ctclose backup eofs prt %d blk %d\n", + sc->sc_hd->hp_xname, sc->sc_eofp, + sc->sc_eofs[sc->sc_eofp]); #endif } if ((minor(dev) & CT_NOREW) == 0) @@ -371,8 +387,8 @@ again: sc->sc_eofp--; #ifdef DEBUG if (ctdebug & CT_BSF) - printf("ct%d: backup eof pos %d blk %d\n", - UNIT(dev), sc->sc_eofp, + printf("%s: backup eof pos %d blk %d\n", + sc->sc_hd->hp_xname, sc->sc_eofp, sc->sc_eofs[sc->sc_eofp]); #endif } @@ -469,7 +485,8 @@ again: sc->sc_blkno = 0; #ifdef DEBUG if(ctdebug & CT_BSF) - printf("ct%d: clearing eofs\n", unit); + printf("%s: clearing eofs\n", + sc->sc_hd->hp_xname); #endif for (i=0; i<EOFS; i++) sc->sc_eofs[i] = 0; @@ -628,7 +645,7 @@ ctintr(unit) bp = cttab[unit].b_actf; if (bp == NULL) { - printf("ct%d: bp == NULL\n", unit); + printf("%s: bp == NULL\n", sc->sc_hd->hp_xname); return; } if (sc->sc_flags & CTF_IO) { @@ -683,17 +700,19 @@ ctintr(unit) if (sc->sc_stat.c_aef & 0x5800) { if (sc->sc_stat.c_aef & 0x4000) tprintf(sc->sc_tpr, - "ct%d: uninitialized media\n", - unit); + "%s: uninitialized media\n", + sc->sc_hd->hp_xname); if (sc->sc_stat.c_aef & 0x1000) tprintf(sc->sc_tpr, - "ct%d: not ready\n", unit); + "%s: not ready\n", + sc->sc_hd->hp_xname); if (sc->sc_stat.c_aef & 0x0800) tprintf(sc->sc_tpr, - "ct%d: write protect\n", unit); + "%s: write protect\n", + sc->sc_hd->hp_xname); } else { - printf("ct%d err: v%d u%d ru%d bn%d, ", - unit, + printf("%s err: v%d u%d ru%d bn%d, ", + sc->sc_hd->hp_xname, (sc->sc_stat.c_vu>>4)&0xF, sc->sc_stat.c_vu&0xF, sc->sc_stat.c_pend, @@ -705,7 +724,8 @@ ctintr(unit) sc->sc_stat.c_ief); } } else - printf("ct%d: request status failed\n", unit); + printf("%s: request status failed\n", + sc->sc_hd->hp_xname); bp->b_flags |= B_ERROR; bp->b_error = EIO; goto done; @@ -867,8 +887,8 @@ ctaddeof(unit) } #ifdef DEBUG if (ctdebug & CT_BSF) - printf("ct%d: add eof pos %d blk %d\n", - unit, sc->sc_eofp, + printf("%s: add eof pos %d blk %d\n", + sc->sc_hd->hp_xname, sc->sc_eofp, sc->sc_eofs[sc->sc_eofp]); #endif } |