Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Apr 2007 20:55:01 -0700
From:      "Josh Carroll" <josh.carroll@gmail.com>
To:        "Thomas Quinot" <thomas@freebsd.org>
Cc:        freebsd-scsi@freebsd.org, bug-followup@freebsd.org, c47g@gmx.at
Subject:   Re: kern/103602: drive gets wedged on READ CD CAPACITY if no disc is in
Message-ID:  <8cb6106e0704302055x4c430b4bode7a0ec2edd590ff@mail.gmail.com>
In-Reply-To: <8cb6106e0704301827y6aa3125flec12c056061b23a6@mail.gmail.com>
References:  <460AA9E3.4030106@samsco.org> <8cb6106e0704032107w457026b1t1e04ed11008af48a@mail.gmail.com> <20070424162008.GA7087@melamine.cuivre.fr.eu.org> <8cb6106e0704240929j38178df6k1b6391446c69a2ae@mail.gmail.com> <20070424165843.GD7087@melamine.cuivre.fr.eu.org> <8cb6106e0704241132vfa6b312s3b4cbea0c823b796@mail.gmail.com> <8cb6106e0704241845r737dca05p50fc967a61d66677@mail.gmail.com> <8cb6106e0704242119h4a09d7d4v667d64071b3bd053@mail.gmail.com> <20070430094515.GB76467@melamine.cuivre.fr.eu.org> <8cb6106e0704301827y6aa3125flec12c056061b23a6@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> The patch alone works great! There was no need for the cam_xpt change,
> nor the scsi_cd change. I was able to blank and burn a CD-RW with the
> new kernel just fine with cdrecord.

I forgot to mention, I applied the patch against the 6.2-RELEASE-p4
source. Two of the hunks failed, but the first was just a different
between a comment "CAM ." versus "CAM.", so I left that alone. The
second was because of an if not including the second part of the if
condition. So I manually made that change. Below is the patch I used
against RELENG_6_2 src, just in case someone needs it.

Thanks,
Josh


diff -urN sys.old/dev/ata/atapi-cam.c sys/dev/ata/atapi-cam.c
--- sys.old/dev/ata/atapi-cam.c	Mon Apr 30 20:52:07 2007
+++ sys/dev/ata/atapi-cam.c	Mon Apr 30 20:53:15 2007
@@ -505,10 +505,10 @@

 	switch (ccb_h->flags & CAM_DIR_MASK) {
 	case CAM_DIR_IN:
-	     request_flags |= ATA_R_READ|ATA_R_DMA;
+             request_flags |= ATA_R_READ;
 	     break;
 	case CAM_DIR_OUT:
-	     request_flags |= ATA_R_WRITE|ATA_R_DMA;
+             request_flags |= ATA_R_WRITE;
 	     break;
 	case CAM_DIR_NONE:
 	     /* No flags need to be set */
@@ -517,8 +517,6 @@
 	     device_printf(softc->dev, "unknown IO operation\n");
 	     goto action_invalid;
 	}
-	if (softc->atadev[tid]->mode < ATA_DMA)
-	    request_flags &= ~ATA_R_DMA;

 	if ((hcb = allocate_hcb(softc, unit, bus, ccb)) == NULL) {
 	    printf("cannot allocate ATAPI/CAM hcb\n");
@@ -580,7 +578,24 @@
 	    request->u.atapi.ccb[3] = request->u.atapi.ccb[1] & 0x1f;
 	    request->u.atapi.ccb[2] = 0;
 	    request->u.atapi.ccb[1] = 0;
+            /* FALLTHROUGH */
+
+        case READ_10:
+            /* FALLTHROUGH */
+        case WRITE_10:
+            /* FALLTHROUGH */
+        case READ_12:
+            /* FALLTHROUGH */
+        case WRITE_12:
+            /*
+             * Enable DMA (if target supports it) for READ and WRITE commands
+             * only, as some combinations of drive, controller and chipset do
+             * not behave correctly when DMA is enabled for other commands.
+             */
+            if (softc->atadev[tid]->mode >= ATA_DMA)
+                request_flags |= ATA_R_DMA;
 	    break;
+
 	}

 	if ((ccb_h->flags & CAM_DIR_MASK) == CAM_DIR_IN && (len & 1)) {
@@ -702,7 +717,7 @@
 	    return;
 #else
 	    /* The ATA driver has already requested sense for us. */
-	    if (request->error == 0) {
+		if (request->u.atapi.sense.key != 0 && request->error == 0) {
 		/* The ATA autosense suceeded. */
 		bcopy (&request->u.atapi.sense, &csio->sense_data, sizeof(struct
atapi_sense));
 		csio->ccb_h.status |= CAM_AUTOSNS_VALID;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?8cb6106e0704302055x4c430b4bode7a0ec2edd590ff>