diff options
author | mav <mav@FreeBSD.org> | 2009-07-26 14:04:48 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2009-07-26 14:04:48 +0000 |
commit | ac07781492b52f5890f65d92216b26ad33432932 (patch) | |
tree | 5bf6b6c0da18050227865653302a10fa64803b0d | |
parent | 83f14954336214a21ec99ababda1db295709b7b8 (diff) | |
download | FreeBSD-src-ac07781492b52f5890f65d92216b26ad33432932.zip FreeBSD-src-ac07781492b52f5890f65d92216b26ad33432932.tar.gz |
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)
-rw-r--r-- | sys/dev/ata/ata-all.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/sys/dev/ata/ata-all.c b/sys/dev/ata/ata-all.c index 383060c..1460a21 100644 --- a/sys/dev/ata/ata-all.c +++ b/sys/dev/ata/ata-all.c @@ -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); |