Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 26 Jul 2009 11:40:20 +0300
From:      Alexander Motin <mav@FreeBSD.org>
To:        barbara <barbara.xxx1975@libero.it>
Cc:        freebsd-bugs <freebsd-bugs@freebsd.org>, bug-followup <bug-followup@FreeBSD.org>
Subject:   Re: kern/136438: [ata] discrepancy between 8 and earlier rel. (?) [regression]
Message-ID:  <4A6C1674.2090003@FreeBSD.org>
In-Reply-To: <KNDMYF$880C944DE470D6D5C98CDA80BC1B24C3@libero.it>
References:  <KNDMYF$880C944DE470D6D5C98CDA80BC1B24C3@libero.it>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
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

[-- Attachment #2 --]
--- 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);

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A6C1674.2090003>