Date: Thu, 21 Feb 2002 23:58:41 +0900 From: Hidetoshi Shimokawa <simokawa@sat.t.u-tokyo.ac.jp> To: "Justin T. Gibbs" <gibbs@scsiguy.com> Cc: freebsd-scsi@FreeBSD.ORG, joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) Subject: READ_6 patch (Re: RBC support patch) Message-ID: <ybsg03ux4ny.wl@ett.sat.t.u-tokyo.ac.jp> In-Reply-To: <ybsit8rvyj6.wl@ett.sat.t.u-tokyo.ac.jp> References: <200202201936.g1KJaAO07448@uriah.heep.sax.de> <ybs1yfgybmq.wl@ett.sat.t.u-tokyo.ac.jp> <200202202359.g1KNxeI41069@aslan.scsiguy.com> <ybsit8rvyj6.wl@ett.sat.t.u-tokyo.ac.jp>
next in thread | previous in thread | raw e-mail | index | archive | help
At Thu, 21 Feb 2002 20:56:29 +0900, Hidetoshi Shimokawa wrote: > At Wed, 20 Feb 2002 16:59:40 -0700, > Justin T. Gibbs <gibbs@scsiguy.com> wrote: > > > > > What do you mean by "adjust dynamically"? > > > > If a 6 byte command fails with "command not supported", switch to > > 10 byte commands, and retry the current transaction. As far as I > > know, the devices do return a proper response. Those that don't, > > we will still have to black list. > > > > -- > > Justin > > This seems right way to go. How about this? Could you review this patch? /\ Hidetoshi Shimokawa \/ simokawa@sat.t.u-tokyo.ac.jp PGP public key: http://www.sat.t.u-tokyo.ac.jp/~simokawa/pgp.html Index: scsi/scsi_da.c =================================================================== RCS file: /home/ncvs/src/sys/cam/scsi/scsi_da.c,v retrieving revision 1.97 diff -u -r1.97 scsi_da.c --- scsi/scsi_da.c 18 Feb 2002 13:35:30 -0000 1.97 +++ scsi/scsi_da.c 21 Feb 2002 14:47:03 -0000 @@ -1308,6 +1324,22 @@ } } +static void +cmd6to10(struct ccb_scsiio *csio) +{ + struct scsi_rw_6 cmd6; + struct scsi_rw_10 *cmd10; + + bcopy(&csio->cdb_io.cdb_bytes, &cmd6, sizeof(struct scsi_rw_6)); + cmd10 = (struct scsi_rw_10 *) &csio->cdb_io.cdb_bytes; + cmd10->opcode = (cmd6.opcode == READ_6) ? READ_10 : WRITE_10; + cmd10->byte2 = 0; + scsi_ulto4b(scsi_3btoul(cmd6.addr), cmd10->addr); + cmd10->reserved = 0; + scsi_ulto2b(cmd6.length, cmd10->length); + cmd10->control = cmd6.control; + csio->cdb_len = sizeof(*cmd10); +} static void dadone(struct cam_periph *periph, union ccb *done_ccb) @@ -1328,12 +1360,37 @@ int error; int s; int sf; + u_int8_t opcode; if ((csio->ccb_h.ccb_state & DA_CCB_RETRY_UA) != 0) sf = SF_RETRY_UA; else sf = 0; + /* XXX + * Work around for broken direct access device + * which doesn't support READ(6)/WRITE(6). + */ + opcode = ((struct scsi_rw_6 *) + &csio->cdb_io.cdb_bytes)->opcode; + if (opcode == READ_6 || opcode == WRITE_6) { + int sense_key, error_code; + int asc, ascq; + scsi_extract_sense(&csio->sense_data, + &error_code, + &sense_key, + &asc, &ascq); + if (sense_key == SSD_KEY_ILLEGAL_REQUEST) { + printf( + "READ(6)/WRITE(6) failed, " + "minimum_cmd_size is " + "increased to 10.\n"); + softc->minimum_cmd_size = 10; + cmd6to10(csio); + done_ccb->ccb_h.status = + CAM_REQUEUE_REQ; + } + } error = daerror(done_ccb, CAM_RETRY_SELTO, sf); if (error == ERESTART) { /* To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-scsi" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?ybsg03ux4ny.wl>
