summaryrefslogtreecommitdiff
path: root/sys/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/cd.c13
-rw-r--r--sys/scsi/scsi_base.c16
-rw-r--r--sys/scsi/scsi_ioctl.c2
-rw-r--r--sys/scsi/scsiconf.h3
-rw-r--r--sys/scsi/sd.c20
-rw-r--r--sys/scsi/st.c22
6 files changed, 63 insertions, 13 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index e2c174e84b1a..31c0f48d6fc1 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
- * $Id: cd.c,v 1.16 1994/02/05 09:08:46 swallace Exp $
+ * $Id: cd.c,v 1.18 1994/04/20 07:06:51 davidg Exp $
*/
#define SPLCD splbio
@@ -415,11 +415,22 @@ cdstrategy(bp)
if (bounds_check_with_label(bp, &cd->disklabel, 1) <= 0)
goto done;
/* otherwise, process transfer request */
+ } else {
+ bp->b_pblkno = bp->b_blkno;
+ bp->b_resid = 0;
}
opri = SPLCD();
dp = &cd->buf_queue;
/*
+ * Use a bounce buffer if necessary
+ */
+#ifndef NOBOUNCE
+ if (cd->sc_link->flags & SDEV_BOUNCE)
+ vm_bounce_alloc(bp);
+#endif
+
+ /*
* Place it in the queue of disk activities for this disk
*/
disksort(dp, bp);
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index 53bf097d63bf..fbd02cab57b3 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -8,7 +8,7 @@
* file.
*
* Written by Julian Elischer (julian@dialix.oz.au)
- * $Id: scsi_base.c,v 1.6 1994/02/07 02:15:01 rgrimes Exp $
+ * $Id: scsi_base.c,v 1.8 1994/05/19 22:21:05 jkh Exp $
*/
#define SPLSD splbio
@@ -293,7 +293,7 @@ scsi_start_unit(sc_link, flags)
0,
0,
2,
- 6000,
+ 10000,
NULL,
flags));
}
@@ -321,7 +321,7 @@ scsi_stop_unit(sc_link, eject, flags)
0,
0,
2,
- 6000,
+ 10000,
NULL,
flags));
}
@@ -455,7 +455,11 @@ scsi_scsi_cmd(sc_link, scsi_cmd, cmdlen, data_addr, datalen,
retval = EFAULT;
goto bad;
}
- xs->data = malloc(datalen, M_TEMP, M_WAITOK);
+#ifdef NOBOUNCE
+ xs->data = malloc(datalen, M_TEMP, M_WAITOK);
+#else
+ xs->data = (caddr_t) vm_bounce_kva_alloc( (datalen + PAGE_SIZE - 1)/PAGE_SIZE);
+#endif
/* I think waiting is ok *//*XXX */
switch ((int)(flags & (SCSI_DATA_IN | SCSI_DATA_OUT))) {
case 0:
@@ -538,7 +542,11 @@ retry:
bcopy(xs->data, data_addr, datalen);
break;
}
+#ifdef NOBOUNCE
free(xs->data, M_TEMP);
+#else
+ vm_bounce_kva_alloc_free(xs->data, (datalen + PAGE_SIZE - 1)/PAGE_SIZE, 0);
+#endif
}
/*
* we have finished with the xfer stuct, free it and
diff --git a/sys/scsi/scsi_ioctl.c b/sys/scsi/scsi_ioctl.c
index 08d8a3ab5db3..a52b3a5eebd6 100644
--- a/sys/scsi/scsi_ioctl.c
+++ b/sys/scsi/scsi_ioctl.c
@@ -199,7 +199,7 @@ void scsistrategy(struct buf *bp)
s = splbio();
while(!(bp->b_flags & B_DONE))
{
- sleep(bp,PRIBIO);
+ tsleep((caddr_t)bp, PRIBIO, "scsistrat", 0);
}
splx(s);
SC_DEBUG(sc_link,SDEV_DB3,("back from sleep\n"));
diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h
index ed5a12e9887e..1c3de17b71d8 100644
--- a/sys/scsi/scsiconf.h
+++ b/sys/scsi/scsiconf.h
@@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
- * $Id: scsiconf.h,v 1.8 1993/12/19 00:54:55 wollman Exp $
+ * $Id: scsiconf.h,v 1.9 1994/03/23 09:15:55 davidg Exp $
*/
#ifndef SCSI_SCSICONF_H
#define SCSI_SCSICONF_H 1
@@ -134,6 +134,7 @@ struct scsi_link
#define SDEV_MEDIA_LOADED 0x01 /* device figures are still valid */
#define SDEV_WAITING 0x02 /* a process is waiting for this */
#define SDEV_OPEN 0x04 /* at least 1 open session */
+#define SDEV_BOUNCE 0x08 /* unit requires DMA bounce buffer */
#define SDEV_DBX 0xF0 /* debuging flags (scsi_debug.h) */
/*
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 20d10e376f3e..37eab6f09e28 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992
*
- * $Id: sd.c,v 1.18.2.2 1994/03/16 04:03:48 rgrimes Exp $
+ * $Id: sd.c,v 1.27 1994/06/22 05:52:59 jkh Exp $
*/
#define SPLSD splbio
@@ -415,14 +415,25 @@ sdstrategy(bp)
if (bounds_check_with_label(bp, &sd->disklabel, sd->wlabel) <= 0)
goto done;
/* otherwise, process transfer request */
+ } else {
+ bp->b_pblkno = bp->b_blkno;
+ bp->b_resid = 0;
}
opri = SPLSD();
dp = &sd->buf_queue;
+ /*
+ * Use a bounce buffer if necessary
+ */
+#ifndef NOBOUNCE
+ if (sd->sc_link->flags & SDEV_BOUNCE)
+ vm_bounce_alloc(bp);
+#endif
+
/*
* Place it in the queue of disk activities for this disk
*/
- disksort(dp, bp);
+ cldisksort(dp, bp, 64*1024);
/*
* Tell the device to get going on the transfer if it's
@@ -883,10 +894,13 @@ sd_get_parms(unit, flags)
}
else {
/* set it to something reasonable */
- sectors = 32;
disk_parms->heads = 64;
disk_parms->cyls = sectors / (64 * 32);
+ sectors = 32;
}
+ /* keep secsiz sane too - we may divide by it later */
+ if(disk_parms->secsiz == 0)
+ disk_parms->secsiz = SECSIZE;
disk_parms->sectors = sectors; /* dubious on SCSI *//*XXX */
}
sd->sc_link->flags |= SDEV_MEDIA_LOADED;
diff --git a/sys/scsi/st.c b/sys/scsi/st.c
index 2bc6e494e013..4a6674718bf3 100644
--- a/sys/scsi/st.c
+++ b/sys/scsi/st.c
@@ -21,13 +21,13 @@
* 16 Feb 93 Julian Elischer ADDED for SCSI system
* 1.15 is the last version to support MACH and OSF/1
*/
-/* $Revision: 1.15 $ */
+/* $Revision: 1.17 $ */
/*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
* major changes by Julian Elischer (julian@jules.dialix.oz.au) May 1993
*
- * $Id: st.c,v 1.15 1994/01/29 10:30:41 rgrimes Exp $
+ * $Id: st.c,v 1.17 1994/06/22 05:53:02 jkh Exp $
*/
/*
@@ -307,6 +307,7 @@ stattach(sc_link)
* the drive. We cannot use interrupts yet, so the
* request must specify this.
*/
+ st_rd_blk_lim(unit, SCSI_NOSLEEP | SCSI_NOMASK | SCSI_SILENT);
if (st_mode_sense(unit, SCSI_NOSLEEP | SCSI_NOMASK | SCSI_SILENT)) {
printf("st%d: drive offline\n", unit);
} else {
@@ -315,7 +316,7 @@ stattach(sc_link)
if (st->media_blksiz) {
printf("%d-byte", st->media_blksiz);
} else {
- printf("variable");
+ printf("variable(%d->%d)",st->blkmin,st->blkmax);
}
printf(" blocks, write-%s\n",
(st->flags & ST_READONLY) ? "protected" : "enabled");
@@ -324,6 +325,13 @@ stattach(sc_link)
}
}
/*
+ * Forget if we've loaded the media,
+ * because sometimes things are unstable at boot time.
+ * We'll get it all again at the first open.
+ */
+ sc_link->flags &= ~SDEV_MEDIA_LOADED;
+
+ /*
* Set up the buf queue for this device
*/
st->buf_queue = 0;
@@ -911,6 +919,14 @@ ststrategy(bp)
stminphys(bp);
opri = splbio();
+ /*
+ * Use a bounce buffer if necessary
+ */
+#ifndef NOBOUNCE
+ if (st->sc_link->flags & SDEV_BOUNCE)
+ vm_bounce_alloc(bp);
+#endif
+
/*
* Place it in the queue of activities for this tape
* at the end (a bit silly because we only have on user..