Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Nov 2011 20:46:51 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r227635 - head/sys/dev/ahci
Message-ID:  <201111172046.pAHKkpZV028815@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



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