From owner-freebsd-scsi@FreeBSD.ORG Tue May 1 03:55:02 2007 Return-Path: X-Original-To: freebsd-scsi@freebsd.org Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E622516A409 for ; Tue, 1 May 2007 03:55:02 +0000 (UTC) (envelope-from josh.carroll@gmail.com) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.177]) by mx1.freebsd.org (Postfix) with ESMTP id 5859C13C465 for ; Tue, 1 May 2007 03:55:02 +0000 (UTC) (envelope-from josh.carroll@gmail.com) Received: by py-out-1112.google.com with SMTP id f31so1528925pyh for ; Mon, 30 Apr 2007 20:55:01 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=ZLpjl5IDL3Rnlg/RQpxG0J6jyORzpqVzhW6iWxLmrDoQ3dFyqI4CLxvFResRGWMIwKV43N1mfzHovTpaYUyuS/C8txhp5NoqwtV99YSJ0eEOThRX4LD9430dMazT135Ug0eK/of1jUCVW3eTRio51+0vNWFYQSe2pboCkgtPKrI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=awJYHo31+oAGiANdVa7E/WPQ5igyQ6/ottjuzM41E2jyQCrglu5b2QpTkLIPHf5c9jHmKGhM1/pJO+T0QwYDc6FD6ZSPah3Xc6uR/juc8hUk+hQRuVT6U0IZGQ3OG1XYw43zGewiGALDLjVFKMXz3la0NtnJ+6V1UMbyssI0/Lc= Received: by 10.35.57.2 with SMTP id j2mr12552986pyk.1177991701436; Mon, 30 Apr 2007 20:55:01 -0700 (PDT) Received: by 10.35.83.9 with HTTP; Mon, 30 Apr 2007 20:55:01 -0700 (PDT) Message-ID: <8cb6106e0704302055x4c430b4bode7a0ec2edd590ff@mail.gmail.com> Date: Mon, 30 Apr 2007 20:55:01 -0700 From: "Josh Carroll" To: "Thomas Quinot" In-Reply-To: <8cb6106e0704301827y6aa3125flec12c056061b23a6@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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> 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 X-BeenThere: freebsd-scsi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: josh.carroll@gmail.com List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 May 2007 03:55:03 -0000 > 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;