From owner-svn-src-head@FreeBSD.ORG Sun Jul 26 14:04:48 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 695C1106564A; Sun, 26 Jul 2009 14:04:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 578B08FC1C; Sun, 26 Jul 2009 14:04:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n6QE4mRe072095; Sun, 26 Jul 2009 14:04:48 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n6QE4mw6072093; Sun, 26 Jul 2009 14:04:48 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <200907261404.n6QE4mw6072093@svn.freebsd.org> From: Alexander Motin Date: Sun, 26 Jul 2009 14:04:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r195893 - head/sys/dev/ata X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jul 2009 14:04:48 -0000 Author: mav Date: Sun Jul 26 14:04:48 2009 New Revision: 195893 URL: http://svn.freebsd.org/changeset/base/195893 Log: Restore PATA device probe order, broken by PMP support implementation, requesting IDENTIFY from slave device first. This order is important for proper cable type detection by master device. PR: kern/136438 Approved by: re (kib) Modified: head/sys/dev/ata/ata-all.c Modified: head/sys/dev/ata/ata-all.c ============================================================================== --- head/sys/dev/ata/ata-all.c Sun Jul 26 12:20:07 2009 (r195892) +++ head/sys/dev/ata/ata-all.c Sun Jul 26 14:04:48 2009 (r195893) @@ -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);