From owner-freebsd-stable@FreeBSD.ORG Tue Sep 27 06:07:32 2005 Return-Path: X-Original-To: freebsd-stable@freebsd.org Delivered-To: freebsd-stable@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id E34C316A41F for ; Tue, 27 Sep 2005 06:07:31 +0000 (GMT) (envelope-from tim.howe@celebrityresorts.com) Received: from knuth.hurstdog.org (knuth.hurstdog.org [69.55.236.147]) by mx1.FreeBSD.org (Postfix) with SMTP id 4C74043D48 for ; Tue, 27 Sep 2005 06:07:31 +0000 (GMT) (envelope-from tim.howe@celebrityresorts.com) Received: (qmail 88013 invoked from network); 27 Sep 2005 06:07:30 -0000 Received: from knuth.hurstdog.org (HELO fred.colohowes.org) (69.55.236.147) by knuth.hurstdog.org with SMTP; 27 Sep 2005 06:07:30 -0000 Received: from piro.quadium.net (piro.colohowes.org [10.27.56.90]) by fred.colohowes.org (Postfix) with ESMTP id 480FD8FE63 for ; Tue, 27 Sep 2005 00:28:35 -0600 (MDT) Received: from beaker.data-secure.net (localhost [127.0.0.1]) by piro.quadium.net (8.12.6/8.12.6) with ESMTP id j8R64DJl010040 for ; Tue, 27 Sep 2005 02:04:19 -0400 (EDT) (envelope-from tim.howe@celebrityresorts.com) Received: by beaker.data-secure.net (Postfix, from userid 1000) id 8EA2739857; Tue, 27 Sep 2005 02:07:23 -0400 (EDT) To: freebsd-stable@freebsd.org References: <87y85nuqhy.fsf@beaker.data-secure.net> <4335D1D2.9060501@leadhill.net> <87ll1jzqoa.fsf@beaker.data-secure.net> From: Tim Howe Date: Tue, 27 Sep 2005 02:07:23 -0400 In-Reply-To: <87ll1jzqoa.fsf@beaker.data-secure.net> (Tim Howe's message of "Mon, 26 Sep 2005 13:26:13 -0400") Message-ID: <87vf0noxgk.fsf_-_@beaker.data-secure.net> User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Corporate Culture, berkeley-unix) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Subject: [PATCH] option to re-enable aggressive ATA probing (was: 5.3 -> 5.4 breaks ATA (Intel ICH2)) X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2005 06:07:32 -0000 --=-=-= Tim Howe writes: > ata0-master: stat=0xd0 err=0xd0 lsb=0xd0 msb=0xd0 This turned out to be the key. Version 1.51 of ata-lowlevel.c added a check for stat0/1, err, lsb, and msb being identical. If they are, it aborts the probe. The attached patch creates an option ATA_AGGRESSIVE_PROBE which disables this for the old aggressive behavior (which may wait up to the full 31 seconds). I also took the liberty of reworking the still-busy check from 3 equality tests to 2 bitmask tests. It seems simpler to my eye with identical results, but if I missed something or the other style was preferred please let me know. The patch is against 5-STABLE because that's what I have. -- Tim Howe Software Engineer Celebrity Resorts, Inc. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=ata_aggressive_probe.patch --- sys/conf/options.stock Tue Sep 27 00:28:50 2005 +++ sys/conf/options Tue Sep 27 00:55:53 2005 @@ -301,6 +301,7 @@ # Options used in the 'ata' ATA/ATAPI driver ATA_STATIC_ID opt_ata.h ATA_NOPCI opt_ata.h +ATA_AGGRESSIVE_PROBE opt_ata.h DEV_ATADISK opt_ata.h DEV_ATAPICD opt_ata.h DEV_ATAPIST opt_ata.h --- sys/conf/NOTES.stock Tue Sep 27 00:30:28 2005 +++ sys/conf/NOTES Tue Sep 27 00:56:39 2005 @@ -1501,8 +1501,11 @@ # # ATA_STATIC_ID: controller numbering is static ie depends on location # else the device numbers are dynamically allocated. +# ATA_AGGRESSIVE_PROBE: Does not give up on probing when all err, lsb, and + msb are identical. options ATA_STATIC_ID +#options ATA_AGGRESSIVE_PROBE # # Standard floppy disk controllers and floppy tapes, supports --- sys/dev/ata/ata-lowlevel.c.stock Tue Sep 27 00:31:10 2005 +++ sys/dev/ata/ata-lowlevel.c Tue Sep 27 00:59:19 2005 @@ -604,24 +604,21 @@ } } } - if (mask == 0x01) /* wait for master only */ - if (!(stat0 & ATA_S_BUSY) || (stat0 == 0xff && timeout > 5) || - (stat0 == err && lsb == err && msb == err && timeout > 5)) - break; - if (mask == 0x02) /* wait for slave only */ - if (!(stat1 & ATA_S_BUSY) || (stat1 == 0xff && timeout > 5) || - (stat1 == err && lsb == err && msb == err && timeout > 5)) - break; - if (mask == 0x03) { /* wait for both master & slave */ - if (!(stat0 & ATA_S_BUSY) && !(stat1 & ATA_S_BUSY)) - break; - if ((stat0 == 0xff && timeout > 5) || - (stat0 == err && lsb == err && msb == err && timeout > 5)) - mask &= ~0x01; - if ((stat1 == 0xff && timeout > 5) || - (stat1 == err && lsb == err && msb == err && timeout > 5)) - mask &= ~0x02; - } + + if (mask & 0x01) /* waiting for master */ + if (!(stat0 & ATA_S_BUSY) || (stat0 == 0xff && timeout > 5) +#ifndef ATA_AGGRESSIVE_PROBE + || (stat0 == err && lsb == err && msb == err && timeout > 5) +#endif + ) + mask &= ~0x01; + if (mask & 0x02) /* waiting for slave */ + if (!(stat1 & ATA_S_BUSY) || (stat1 = 0xff && timeout > 5) +#ifndef ATA_AGGRESSIVE_PROBE + || (stat1 == err && lsb == err && msb == err && timeout > 5) +#endif + ) + mask &= ~0x02; if (mask == 0 && !(stat0 & ATA_S_BUSY) && !(stat1 & ATA_S_BUSY)) break; --=-=-=--