default ncylinders to 1 for disklabel
[unix-history] / usr / src / sys / hp300 / dev / st.c
index d6f9b85..7ff55ba 100644 (file)
@@ -9,9 +9,9 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- * from: Utah $Hdr: st.c 1.8 90/10/14$
+ * from: Utah $Hdr: st.c 1.11 92/01/21$
  *
  *
- *      @(#)st.c       7.6 (Berkeley) %G%
+ *      @(#)st.c       7.9 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
 #include "st.h"
 #if NST > 0
 
 #include "st.h"
 #if NST > 0
 
-#include "param.h"
-#include "systm.h"
-#include "buf.h"
-#include "scsireg.h"
-#include "file.h"
-#include "proc.h"
-#include "tty.h"
-#include "mtio.h"
-#include "ioctl.h"
-#include "kernel.h"
-#include "tprintf.h"
-
-#include "device.h"
-#include "stvar.h"
-
-#define ADD_DELAY
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/buf.h>
+#include <sys/file.h>
+#include <sys/proc.h>
+#include <sys/ioctl.h>
+#include <sys/tty.h>
+#include <sys/mtio.h>
+#include <sys/kernel.h>
+#include <sys/tprintf.h>
+
+#include <hp/dev/device.h>
+#include <hp300/dev/scsireg.h>
+#include <hp300/dev/stvar.h>
 
 extern int scsi_test_unit_rdy();
 extern int scsi_request_sense();
 
 extern int scsi_test_unit_rdy();
 extern int scsi_request_sense();
@@ -169,7 +167,6 @@ int st_dmaoddretry = 0;
  * In st_open, if minor bit 4 set then 1k records are used.
  * If st_exblken is set to anything other then 0 we are in fixed length mode.
  * Minor bit 5 requests 1K fixed-length, overriding any setting of st_exblklen.
  * In st_open, if minor bit 4 set then 1k records are used.
  * If st_exblken is set to anything other then 0 we are in fixed length mode.
  * Minor bit 5 requests 1K fixed-length, overriding any setting of st_exblklen.
- * 
  */
 int st_exblklen = 0;
 
  */
 int st_exblklen = 0;
 
@@ -201,13 +198,15 @@ stinit(hd)
        register struct hp_device *hd;
 {
        register struct st_softc *sc = &st_softc[hd->hp_unit];
        register struct hp_device *hd;
 {
        register struct st_softc *sc = &st_softc[hd->hp_unit];
+       register struct buf *bp;
 
 
+       for (bp = sttab; bp < &sttab[NST]; bp++)
+               bp->b_actb = &bp->b_actf;
        sc->sc_hd = hd;
        sc->sc_punit = stpunit(hd->hp_flags);
        sc->sc_type = stident(sc, hd);
        if (sc->sc_type < 0)
                return(0);
        sc->sc_hd = hd;
        sc->sc_punit = stpunit(hd->hp_flags);
        sc->sc_type = stident(sc, hd);
        if (sc->sc_type < 0)
                return(0);
-
        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_ctlr = hd->hp_ctlr;
        sc->sc_dq.dq_unit = hd->hp_unit;
        sc->sc_dq.dq_slave = hd->hp_slave;
@@ -225,9 +224,7 @@ stident(sc, hd)
        int ctlr, slave;
        int i, stat, inqlen;
        char idstr[32];
        int ctlr, slave;
        int i, stat, inqlen;
        char idstr[32];
-#ifdef ADD_DELAY
        static int havest = 0;
        static int havest = 0;
-#endif
        struct st_inquiry {
                struct  scsi_inquiry inqbuf;
                struct  exb_inquiry exb_inquiry;
        struct st_inquiry {
                struct  scsi_inquiry inqbuf;
                struct  exb_inquiry exb_inquiry;
@@ -356,13 +353,11 @@ st_inqbuf.inqbuf.qual, st_inqbuf.inqbuf.version);
        stxsense(ctlr, slave, unit, sc);
 
        scsi_delay(0);
        stxsense(ctlr, slave, unit, sc);
 
        scsi_delay(0);
-#ifdef ADD_DELAY
        /* XXX if we have a tape, we must up the delays in the HA driver */
        if (!havest) {
                havest = 1;
                scsi_delay(20000);
        }
        /* XXX if we have a tape, we must up the delays in the HA driver */
        if (!havest) {
                havest = 1;
                scsi_delay(20000);
        }
-#endif
        return(st_inqbuf.inqbuf.type);
 failed:
        scsi_delay(0);
        return(st_inqbuf.inqbuf.type);
 failed:
        scsi_delay(0);
@@ -707,13 +702,11 @@ ststrategy(bp)
 
        unit = UNIT(bp->b_dev);
        dp = &sttab[unit];
 
        unit = UNIT(bp->b_dev);
        dp = &sttab[unit];
-       bp->av_forw = NULL;
+       bp->b_actf = NULL;
        s = splbio();
        s = splbio();
-       if (dp->b_actf == NULL)
-               dp->b_actf = bp;
-       else
-               dp->b_actl->av_forw = bp;
-       dp->b_actl = bp;
+       bp->b_actb = dp->b_actb;
+       *dp->b_actb = bp;
+       dp->b_actb = &bp->b_actf;
        if (dp->b_active == 0) {
                dp->b_active = 1;
                stustart(unit);
        if (dp->b_active == 0) {
                dp->b_active = 1;
                stustart(unit);
@@ -823,8 +816,14 @@ stfinish(unit, sc, bp)
        struct st_softc *sc;
        struct buf *bp;
 {
        struct st_softc *sc;
        struct buf *bp;
 {
+       register struct buf *dp;
+
        sttab[unit].b_errcnt = 0;
        sttab[unit].b_errcnt = 0;
-       sttab[unit].b_actf = bp->b_actf;
+       if (dp = bp->b_actf)
+               dp->b_actb = bp->b_actb;
+       else
+               sttab[unit].b_actb = bp->b_actb;
+       *bp->b_actb = dp;
        iodone(bp);
        scsifree(&sc->sc_dq);
        if (sttab[unit].b_actf)
        iodone(bp);
        scsifree(&sc->sc_dq);
        if (sttab[unit].b_actf)