summaryrefslogtreecommitdiffstats
path: root/sys/scsi
diff options
context:
space:
mode:
authordillon <dillon@FreeBSD.org>1998-09-03 07:01:39 +0000
committerdillon <dillon@FreeBSD.org>1998-09-03 07:01:39 +0000
commit16ae72c2ec5bf64c07463a384889c44439043d92 (patch)
tree4e0a3091e9d3b7b1cc64192bc588daf5e74b3d98 /sys/scsi
parent50ed861cddbca02555f75be64719801242a1cae9 (diff)
downloadFreeBSD-src-16ae72c2ec5bf64c07463a384889c44439043d92.zip
FreeBSD-src-16ae72c2ec5bf64c07463a384889c44439043d92.tar.gz
Reviewed by: J Wunsch <j@uriah.heep.sax.de>
-current commit for st.c, kernel support for /bin/mt's 'comp' option. (tested with exabyte and DAT tape units. Does not apparently work with all SCSI tape's, though).
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/st.c24
1 files changed, 17 insertions, 7 deletions
diff --git a/sys/scsi/st.c b/sys/scsi/st.c
index 8bf2c35..b4feb02 100644
--- a/sys/scsi/st.c
+++ b/sys/scsi/st.c
@@ -12,7 +12,7 @@
* on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances.
*
- * $Id: st.c,v 1.92 1998/07/31 09:00:39 phk Exp $
+ * $Id: st.c,v 1.93 1998/08/18 00:32:49 bde Exp $
*/
/*
@@ -78,7 +78,7 @@ static errval st_touch_tape __P((u_int32_t unit));
static errval st_write_filemarks __P((u_int32_t unit, int32_t number, u_int32_t flags));
static errval st_load __P((u_int32_t unit, u_int32_t type, u_int32_t flags));
static errval st_mode_select __P((u_int32_t unit, u_int32_t flags, \
- struct tape_pages *page, u_int32_t pagelen));
+ struct tape_pages *page, u_int32_t pagelen, u_int32_t byte2));
static errval st_comp __P((u_int32_t unit, u_int32_t mode));
static int32_t st_chkeod __P((u_int32_t unit, boolean position, int32_t *nmarks,
u_int32_t flags));
@@ -580,7 +580,7 @@ st_mount_tape(dev, flags)
return errno;
}
}
- if ( (errno = st_mode_select(unit, 0, NULL, 0)) ) {
+ if ( (errno = st_mode_select(unit, 0, NULL, 0, 0)) ) {
printf("st%lu: Cannot set selected mode", (u_long)unit);
return errno;
}
@@ -1165,7 +1165,10 @@ try_new_value:
* Check that the mode being asked for is aggreeable to the
* drive. If not, put it back the way it was.
*/
- if ( (errcode = st_mode_select(unit, 0, NULL, 0)) ) { /* put back as it was */
+ if ( (errcode = st_mode_select(unit, 0, NULL, 0, 0)) ) {
+ /*
+ * put back as it was
+ */
printf("st%lu: Cannot set selected mode", (u_long)unit);
st->density = hold_density;
st->blksiz = hold_blksiz;
@@ -1389,10 +1392,11 @@ st_mode_sense(unit, flags, page, pagelen, pagecode)
* set it into the desire modes etc.
*/
static errval
-st_mode_select(unit, flags, page, pagelen)
+st_mode_select(unit, flags, page, pagelen, byte2)
u_int32_t unit, flags;
struct tape_pages *page;
u_int32_t pagelen;
+ u_int32_t byte2;
{
u_int32_t dat_len;
struct scsi_mode_select scsi_cmd;
@@ -1425,6 +1429,7 @@ st_mode_select(unit, flags, page, pagelen)
bzero(&scsi_cmd, sizeof(scsi_cmd));
scsi_cmd.op_code = MODE_SELECT;
scsi_cmd.length = dat_len;
+ scsi_cmd.byte2 = (u_char)byte2;
dat.header.blk_desc_len = sizeof(struct blk_desc);
dat.header.dev_spec |= SMH_DSP_BUFF_MODE_ON;
dat.blk_desc.density = st->density;
@@ -1494,7 +1499,12 @@ u_int32_t unit,mode;
printf("st%lu: bad value for compression mode\n", (u_long)unit);
return EINVAL;
}
- if ( (retval = st_mode_select(unit, 0, &page, pagesize)) )
+ /*
+ * send ST_PAGE_CONFIGURATION page as SCSI-II command because it
+ * is a SCSI-II structure. This requires the PF bit (0x10) to be
+ * set for byte2.
+ */
+ if ( (retval = st_mode_select(unit, 0, &page, pagesize, 0x10)) )
{
printf("select returned an error of %d\n",retval);
return retval;
@@ -1958,7 +1968,7 @@ st_touch_tape(unit)
default:
readsiz = 1;
st->flags &= ~ST_FIXEDBLOCKS;
- } if ( (errno = st_mode_select(unit, 0, NULL, 0)) ) {
+ } if ( (errno = st_mode_select(unit, 0, NULL, 0, 0)) ) {
goto bad;
}
st_read(unit, buf, readsiz, SCSI_SILENT);
OpenPOWER on IntegriCloud