diff options
author | jmz <jmz@FreeBSD.org> | 1997-10-27 21:09:27 +0000 |
---|---|---|
committer | jmz <jmz@FreeBSD.org> | 1997-10-27 21:09:27 +0000 |
commit | 67b46d7b0f684ec9025057bb9004d4760be6593b (patch) | |
tree | 2ce018a99e834e0530c80c93e18559b1c72df031 /sys/scsi/worm.c | |
parent | 16baeb2dba0b34984552a6aab2b55251602e57ad (diff) | |
download | FreeBSD-src-67b46d7b0f684ec9025057bb9004d4760be6593b.zip FreeBSD-src-67b46d7b0f684ec9025057bb9004d4760be6593b.tar.gz |
Use a MODE SELECT command to reset the block size, instead of calling the
prepare_track() function, which caused fixation problems with some drives.
Diffstat (limited to 'sys/scsi/worm.c')
-rw-r--r-- | sys/scsi/worm.c | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/sys/scsi/worm.c b/sys/scsi/worm.c index 6bbeddf..1f299d3 100644 --- a/sys/scsi/worm.c +++ b/sys/scsi/worm.c @@ -43,7 +43,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: worm.c,v 1.45 1997/09/02 20:06:41 bde Exp $ + * $Id: worm.c,v 1.46 1997/09/21 22:03:22 gibbs Exp $ */ #include "opt_bounce.h" @@ -139,6 +139,7 @@ static errval worm_read_toc(struct scsi_link *sc_link, static errval worm_rezero_unit(struct scsi_link *sc_link); static errval worm_read_session_info(struct scsi_link *, struct wormio_session_info *); static int worm_sense_handler(struct scsi_xfer *); +static errval worm_set_blksize(struct scsi_link *sc_link, int size); /* XXX should be moved out to an LKM */ static errval rf4100_prepare_disk(struct scsi_link *, int dummy, int speed); @@ -957,6 +958,31 @@ worm_sense_handler(struct scsi_xfer *xs) return SCSIRET_CONTINUE; } +static errval +worm_set_blksize(struct scsi_link *sc_link, int size) +{ + struct scsi_mode_select scsi_cmd; + struct { + struct scsi_mode_header header; + struct blk_desc desc; + } dat; + bzero(&scsi_cmd, sizeof(scsi_cmd)); + bzero(&dat, sizeof(dat)); + scsi_cmd.op_code = MODE_SELECT; + scsi_cmd.length = sizeof(dat); + dat.header.blk_desc_len = sizeof(struct blk_desc); + scsi_uto3b(size, dat.desc.blklen); + return scsi_scsi_cmd(sc_link, + (struct scsi_generic *) &scsi_cmd, + sizeof(scsi_cmd), + (u_char *) &dat, + sizeof(dat), + /*WORM_RETRIES*/ 4, + 5000, + NULL, + SCSI_DATA_OUT); +} + static void worm_drvinit(void *unused) { @@ -1230,12 +1256,9 @@ rf4100_finalize_track(struct scsi_link *sc_link) 60000, /* this may take a while */ NULL, 0); - if (!error) { - struct wormio_prepare_track t; - bzero (&t, sizeof (t)); - t.track_type = BLOCK_MODE_1; - error = rf4100_prepare_track(sc_link, &t); - } + if (!error) + error = worm_set_blksize(sc_link, 2048); + return error; } @@ -1532,12 +1555,9 @@ hp4020i_finalize_track(struct scsi_link *sc_link) 60000, /* this may take a while */ NULL, 0); - if (!error) { - struct wormio_prepare_track t; - bzero (&t, sizeof (t)); - t.track_type = BLOCK_MODE_1; - error = hp4020i_prepare_track(sc_link, &t); - } + if (!error) + error = worm_set_blksize(sc_link, 2048); + return error; } |