From owner-freebsd-scsi@FreeBSD.ORG Mon Apr 30 09:45:21 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 8E38016A402; Mon, 30 Apr 2007 09:45:21 +0000 (UTC) (envelope-from thomas@FreeBSD.ORG) Received: from melamine.cuivre.fr.eu.org (melusine.cuivre.fr.eu.org [82.225.155.84]) by mx1.freebsd.org (Postfix) with ESMTP id 1908313C48C; Mon, 30 Apr 2007 09:45:21 +0000 (UTC) (envelope-from thomas@FreeBSD.ORG) Received: by melamine.cuivre.fr.eu.org (Postfix, from userid 1000) id 0263C5C20F; Mon, 30 Apr 2007 11:45:15 +0200 (CEST) Date: Mon, 30 Apr 2007 11:45:15 +0200 From: Thomas Quinot To: Josh Carroll Message-ID: <20070430094515.GB76467@melamine.cuivre.fr.eu.org> References: <460AA9E3.4030106@samsco.org> <8cb6106e0703281531k4c5bebecp5566c64c8f458a74@mail.gmail.com> <8cb6106e0704030039if46397fvfc993d9c9e19e1fc@mail.gmail.com> <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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8cb6106e0704242119h4a09d7d4v667d64071b3bd053@mail.gmail.com> X-message-flag: WARNING! Using Outlook can damage your computer. User-Agent: Mutt/1.5.11 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 List-Id: SCSI subsystem List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Apr 2007 09:45:21 -0000 * Josh Carroll, 2007-04-25 : > I used the following patch (attached) against a RELENG_6_2 src tree, > and it's working brilliantly. No problems to speak of. I can boot with > atapicam in the kernel without a disk in the drive and there were no > hangs at all. Good! It's relieving that we have finally zeroed in on this one! I have committed the DMA change to HEAD; I'll wait a bit for things to stabilize before merging it into RELENG_6. Now it would be interesting to test whether the scsi_cd and cam_xpt changes are still required in your configuration, or whether they were just working around the real underlying issue. You'll find attached to this message a patch against RELENG_6 atapi-cam.c (which includes the DMA fix and also a related error handling fix from kern/112119). Could you please test whether a kernel with: - just this patch; - this patch + the cam_xpt change (CAM_QUIRK_NOSERIAL) works for you? Thanks! Thomas. Index: atapi-cam.c =================================================================== RCS file: /space/mirror/ncvs/src/sys/dev/ata/atapi-cam.c,v retrieving revision 1.42.2.3 diff -u -r1.42.2.3 atapi-cam.c --- atapi-cam.c 29 Mar 2007 20:08:32 -0000 1.42.2.3 +++ atapi-cam.c 30 Apr 2007 09:39:46 -0000 @@ -513,10 +513,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 */ @@ -525,8 +525,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"); @@ -591,7 +589,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)) { @@ -613,7 +628,7 @@ /* * no retries are to be performed at the ATA level; any retries - * will be done by CAM . + * will be done by CAM. */ request->retries = 0; @@ -726,7 +741,7 @@ * issued a REQUEST SENSE automatically and that operation * returned without error. */ - if (request->u.atapi.saved_cmd != 0 && request->error == 0) { + if (request->u.atapi.sense.key != 0 && request->error == 0) { bcopy (&request->u.atapi.sense, &csio->sense_data, sizeof(struct atapi_sense)); csio->ccb_h.status |= CAM_AUTOSNS_VALID; }