Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Feb 2002 14:18: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:   Re: READ_6 patch (Re: RBC support patch) 
Message-ID:  <ybs664qw0um.wl@ett.sat.t.u-tokyo.ac.jp>
In-Reply-To: <200202211901.g1LJ1nI48461@aslan.scsiguy.com>
References:  <ybsg03ux4ny.wl@ett.sat.t.u-tokyo.ac.jp> <200202211901.g1LJ1nI48461@aslan.scsiguy.com>

next in thread | previous in thread | raw e-mail | index | archive | help
At Thu, 21 Feb 2002 12:01:49 -0700,
Justin T. Gibbs <gibbs@scsiguy.com> wrote:
> Close.  Perform the test inside daerror().  Daerror is supposed to filter
> out any errors specific to the da driver prior to calling the generic
> error routine, so this is the place to handle this.  You should also only
> need to do the filtering if the ccb has an error flagged in its ccb
> header.  This should avoid any unecessary work on transactions that
> haven't failed.  Lastly, you need to actually requeue the transaction
> (xpt_action() followed by a release of the device queue if the transaction
> was marked as having frozen the queue).

Thanks for the review. The patch is revised.
I don't know why xpt_action causes panic.
Do you mean xpt_action inside of "if ((ccb->ccb_h.status & CAM_DEV_QFRZN).."?

/\ 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_da.c
===================================================================
RCS file: /pub/FreeBSD-CVS/src/sys/cam/scsi/scsi_da.c,v
retrieving revision 1.42.2.21
diff -u -r1.42.2.21 scsi_da.c
--- scsi_da.c	4 Feb 2002 10:39:57 -0000	1.42.2.21
+++ scsi_da.c	22 Feb 2002 05:16:53 -0000
@@ -1551,14 +1551,68 @@
 	xpt_release_ccb(done_ccb);
 }
 
+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 int
 daerror(union ccb *ccb, u_int32_t cam_flags, u_int32_t sense_flags)
 {
 	struct da_softc	  *softc;
 	struct cam_periph *periph;
+	struct ccb_scsiio *csio;
+	u_int8_t opcode;
 
 	periph = xpt_path_periph(ccb->ccb_h.path);
 	softc = (struct da_softc *)periph->softc;
+
+ 	/*
+	 * XXX 
+	 * Work around for broken direct access device
+ 	 * which doesn't support READ(6)/WRITE(6).
+ 	 */
+	csio = &ccb->csio;
+ 	opcode = ((struct scsi_rw_6 *)csio->cdb_io.cdb_bytes)->opcode; 
+	if (((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_SCSI_STATUS_ERROR)
+			& (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;
+			/* command translation */
+ 			cmd6to10(csio);
+			/* requeue */
+ 			ccb->ccb_h.status = CAM_REQUEUE_REQ;
+#if 0
+			xpt_action(ccb);
+#endif
+			if ((ccb->ccb_h.status & CAM_DEV_QFRZN) != 0)
+				cam_release_devq(ccb->ccb_h.path,
+						 /*relsim_flags*/0,
+						 /*reduction*/0,
+						 /*timeout*/0,
+						 /*getcount_only*/0);
+		}
+ 	}
 
 	/*
 	 * XXX

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?ybs664qw0um.wl>