From owner-freebsd-bugs@FreeBSD.ORG Sun Jul 26 09:40:56 2009 Return-Path: Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5532C106566B for ; Sun, 26 Jul 2009 09:40:56 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from cmail.optima.ua (cmail.optima.ua [195.248.191.121]) by mx1.freebsd.org (Postfix) with ESMTP id CCF268FC17 for ; Sun, 26 Jul 2009 09:40:55 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from [212.86.226.226] (account mav@alkar.net HELO mavbook.mavhome.dp.ua) by cmail.optima.ua (CommuniGate Pro SMTP 5.2.9) with ESMTPSA id 249741079; Sun, 26 Jul 2009 11:40:51 +0300 Message-ID: <4A6C1674.2090003@FreeBSD.org> Date: Sun, 26 Jul 2009 11:40:20 +0300 From: Alexander Motin User-Agent: Thunderbird 2.0.0.21 (X11/20090405) MIME-Version: 1.0 To: barbara References: In-Reply-To: Content-Type: multipart/mixed; boundary="------------040604010003030003000001" Cc: freebsd-bugs , bug-followup Subject: Re: kern/136438: [ata] discrepancy between 8 and earlier rel. (?) [regression] X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2009 09:40:56 -0000 This is a multi-part message in MIME format. --------------040604010003030003000001 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit I am able to reproduce the problem. Bug was introduced by PMP support implementation. PATA specification requires slave to be identified first, to allow master to probe cable type correctly. Try attached patch, it fixes this issue for me. -- Alexander Motin --------------040604010003030003000001 Content-Type: text/plain; name="ata-all.c.cable.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ata-all.c.cable.patch" --- ata-all.c.prev 2009-07-16 21:20:36.000000000 +0300 +++ ata-all.c 2009-07-26 11:24:34.000000000 +0300 @@ -711,7 +711,7 @@ ata_identify(device_t dev) struct ata_channel *ch = device_get_softc(dev); struct ata_device *atadev; device_t *children; - device_t child; + device_t child, master = NULL; int nchildren, i, n = ch->devices; if (bootverbose) @@ -748,6 +748,15 @@ ata_identify(device_t dev) unit = (device_get_unit(dev) << 1) + i; #endif if ((child = ata_add_child(dev, atadev, unit))) { + /* + * PATA slave should be identified first, to allow + * device cable detection on master to work properly. + */ + if (i == 0 && (n & ATA_PORTMULTIPLIER) == 0 && + (n & ((ATA_ATA_MASTER | ATA_ATAPI_MASTER) << 1)) != 0) { + master = child; + continue; + } if (ata_getparam(atadev, 1)) { device_delete_child(dev, child); free(atadev, M_ATA); @@ -757,6 +766,13 @@ ata_identify(device_t dev) free(atadev, M_ATA); } } + if (master) { + atadev = device_get_softc(master); + if (ata_getparam(atadev, 1)) { + device_delete_child(dev, master); + free(atadev, M_ATA); + } + } bus_generic_probe(dev); bus_generic_attach(dev); mtx_unlock(&Giant); --------------040604010003030003000001--