svn commit: r227635 - head/sys/dev/ahci

Alexander Motin mav at FreeBSD.org
Thu Nov 17 20:46:51 UTC 2011


Author: mav
Date: Thu Nov 17 20:46:51 2011
New Revision: 227635
URL: http://svn.freebsd.org/changeset/base/227635

Log:
  Change the way how "not implemented" AHCI channels handled. Instead of
  completely skipping them, create ahcich devices for them to allocate unit
  numbers, but mark them as disabled to prevent driver probe and attach.
  
  Last time some BIOSes tend to report unused channels as "not implemented".
  This change makes ahcichX devices numbering consistent, independently of
  connected disks. It makes per-channel driver hints usable and CAM devices
  wiring possible on such systems.

Modified:
  head/sys/dev/ahci/ahci.c

Modified: head/sys/dev/ahci/ahci.c
==============================================================================
--- head/sys/dev/ahci/ahci.c	Thu Nov 17 18:08:56 2011	(r227634)
+++ head/sys/dev/ahci/ahci.c	Thu Nov 17 20:46:51 2011	(r227635)
@@ -498,13 +498,14 @@ ahci_attach(device_t dev)
 	}
 	/* Attach all channels on this controller */
 	for (unit = 0; unit < ctlr->channels; unit++) {
-		if ((ctlr->ichannels & (1 << unit)) == 0)
-			continue;
 		child = device_add_child(dev, "ahcich", -1);
-		if (child == NULL)
+		if (child == NULL) {
 			device_printf(dev, "failed to add channel device\n");
-		else
-			device_set_ivars(child, (void *)(intptr_t)unit);
+			continue;
+		}
+		device_set_ivars(child, (void *)(intptr_t)unit);
+		if ((ctlr->ichannels & (1 << unit)) == 0)
+			device_disable(child);
 	}
 	bus_generic_attach(dev);
 	return 0;


More information about the svn-src-all mailing list