PERFORCE change 169892 for review

Alexander Motin mav at FreeBSD.org
Wed Oct 28 16:21:57 UTC 2009


http://p4web.freebsd.org/chv.cgi?CH=169892

Change 169892 by mav at mav_mavtest on 2009/10/28 16:20:57

	Introduce early-attaching type of periph drivers. Initialize them
	before main scan during boot, not after. Use if for probe, aprobe,
	xpt and pmp drivers. It is mostly required for pmp driver, to
	give it ability finish devices probe before FS mounting. The rest
	of drivers left as-is now, because late attach is required for proper
	device numbering, when bus scanned in parallel.

Affected files ...

.. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_pmp.c#16 edit
.. //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#45 edit
.. //depot/projects/scottl-camlock/src/sys/cam/cam_periph.h#18 edit
.. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#109 edit
.. //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_xpt.c#19 edit

Differences ...

==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_pmp.c#16 (text+ko) ====

@@ -136,7 +136,8 @@
 static struct periph_driver pmpdriver =
 {
 	pmpinit, "pmp",
-	TAILQ_HEAD_INITIALIZER(pmpdriver.units), /* generation */ 0
+	TAILQ_HEAD_INITIALIZER(pmpdriver.units), /* generation */ 0,
+	CAM_PERIPH_DRV_EARLY
 };
 
 PERIPHDRIVER_DECLARE(pmp, pmpdriver);

==== //depot/projects/scottl-camlock/src/sys/cam/ata/ata_xpt.c#45 (text+ko) ====

@@ -83,7 +83,8 @@
 static struct periph_driver probe_driver =
 {
 	probe_periph_init, "aprobe",
-	TAILQ_HEAD_INITIALIZER(probe_driver.units)
+	TAILQ_HEAD_INITIALIZER(probe_driver.units), /* generation */ 0,
+	CAM_PERIPH_DRV_EARLY
 };
 
 PERIPHDRIVER_DECLARE(aprobe, probe_driver);

==== //depot/projects/scottl-camlock/src/sys/cam/cam_periph.h#18 (text+ko) ====

@@ -79,6 +79,8 @@
 	char			 *driver_name;
 	TAILQ_HEAD(,cam_periph)	 units;
 	u_int			 generation;
+	u_int			 flags;
+#define CAM_PERIPH_DRV_EARLY		0x01
 };
 
 typedef enum {

==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#109 (text+ko) ====

@@ -161,7 +161,8 @@
 static struct periph_driver xpt_driver =
 {
 	xpt_periph_init, "xpt",
-	TAILQ_HEAD_INITIALIZER(xpt_driver.units)
+	TAILQ_HEAD_INITIALIZER(xpt_driver.units), /* generation */ 0,
+	CAM_PERIPH_DRV_EARLY
 };
 
 PERIPHDRIVER_DECLARE(xpt, xpt_driver);
@@ -4657,6 +4658,9 @@
 static void
 xpt_config(void *arg)
 {
+	struct	periph_driver **p_drv;
+	int	i;
+
 	/*
 	 * Now that interrupts are enabled, go find our devices
 	 */
@@ -4690,6 +4694,13 @@
 #endif /* CAM_DEBUG_BUS */
 #endif /* CAMDEBUG */
 
+	/* Register early peripheral drivers */
+	/* XXX This will have to change when we have loadable modules */
+	p_drv = periph_drivers;
+	for (i = 0; p_drv[i] != NULL; i++) {
+		if ((p_drv[i]->flags & CAM_PERIPH_DRV_EARLY) != 0)
+			(*p_drv[i]->init)();
+	}
 	/*
 	 * Scan all installed busses.
 	 */
@@ -4740,7 +4751,8 @@
 		/* XXX This will have to change when we have loadable modules */
 		p_drv = periph_drivers;
 		for (i = 0; p_drv[i] != NULL; i++) {
-			(*p_drv[i]->init)();
+			if ((p_drv[i]->flags & CAM_PERIPH_DRV_EARLY) == 0)
+				(*p_drv[i]->init)();
 		}
 
 		/*

==== //depot/projects/scottl-camlock/src/sys/cam/scsi/scsi_xpt.c#19 (text+ko) ====

@@ -110,7 +110,8 @@
 static struct periph_driver probe_driver =
 {
 	probe_periph_init, "probe",
-	TAILQ_HEAD_INITIALIZER(probe_driver.units)
+	TAILQ_HEAD_INITIALIZER(probe_driver.units), /* generation */ 0,
+	CAM_PERIPH_DRV_EARLY
 };
 
 PERIPHDRIVER_DECLARE(probe, probe_driver);


More information about the p4-projects mailing list