summaryrefslogtreecommitdiff
path: root/sys/scsi/st.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1995-11-20 14:03:30 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1995-11-20 14:03:30 +0000
commite8d90590cf4a8238e3be3843a05816653fd716a6 (patch)
tree9ef81070090ae36f519b068d90c9e23de6169989 /sys/scsi/st.c
parentfd3496a77ef30810799b632f4f492c58a60b5685 (diff)
add erase support and another wangtek tape drive; from rhialto@polder.ubc.kun.nl; netbsd pr#1705
Diffstat (limited to 'sys/scsi/st.c')
-rw-r--r--sys/scsi/st.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/sys/scsi/st.c b/sys/scsi/st.c
index b83092de870..b51e2fa3a2c 100644
--- a/sys/scsi/st.c
+++ b/sys/scsi/st.c
@@ -193,6 +193,13 @@ struct st_quirk_inquiry_pattern st_quirk_patterns[] = {
ST_Q_FORCE_BLKSIZE, 1024, DDS, /* minor 8-11 */
ST_Q_FORCE_BLKSIZE, 0, DDS /* minor 12-15 */
}},
+ {T_SEQUENTIAL, T_REMOV,
+ "WANGTEK ", "5150ES SCSI FA15\0""01 A", "????", 0, 0, {
+ 0, ST_Q_IGNORE_LOADS, 0, /* minor 0-3 */
+ 0, 0, 0, /* minor 4-7 */
+ 0, 0, 0, /* minor 8-11 */
+ 0, 0, 0, /* minor 12-15 */
+ }},
#if 0
{T_SEQUENTIAL, T_REMOV,
"EXABYTE ", "EXB-8200 ", "", 0, 12, {
@@ -1095,6 +1102,9 @@ stioctl(dev, cmd, arg, flag, p)
if (!error)
error = st_space(st, number, SP_BLKS, flags);
break;
+ case MTERASE: /* erase */
+ error = st_erase(st, FALSE, flags);
+ break;
case MTREW: /* rewind */
error = st_rewind(st, 0, flags);
break;
@@ -1599,6 +1609,41 @@ st_rewind(st, immediate, flags)
}
/*
+ * Erase the tape
+ */
+int
+st_erase(st, immediate, flags)
+ struct st_data *st;
+ u_int immediate;
+ int flags;
+{
+ struct scsi_erase scsi_cmd;
+ int error;
+ int nmarks;
+
+ error = st_check_eod(st, FALSE, &nmarks, flags);
+ if (error)
+ return (error);
+ /*
+ * Archive Viper 2525 technical manual 5.7 (ERASE 19h):
+ * tape has to be positioned to BOT first before erase command
+ * is issued or command is rejected. So we rewind the tape first
+ * and exit with an error, if the tape can't be rewinded.
+ */
+ error = st_rewind(st, FALSE, SCSI_SILENT);
+ if (error)
+ return (error);
+ st->flags &= ~ST_PER_ACTION;
+ bzero(&scsi_cmd, sizeof(scsi_cmd));
+ scsi_cmd.op_code = ERASE;
+ scsi_cmd.byte2 = SE_LONG | (immediate ? SE_IMMED : 0);
+ return (scsi_scsi_cmd(st->sc_link, (struct scsi_generic *) &scsi_cmd,
+ sizeof(scsi_cmd), 0, 0, ST_RETRIES,
+ immediate ? 5000 : 300000, /* 5 sec or 5 min */
+ NULL, flags));
+}
+
+/*
* Look at the returned sense and act on the error and detirmine
* The unix error number to pass back... (0 = report no error)
* (-1 = continue processing)