Add an ordering field to the interrupt config hook structure and adjust
authorMatthew Dillon <dillon@dragonflybsd.org>
Sat, 28 Jul 2007 23:24:34 +0000 (23:24 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Sat, 28 Jul 2007 23:24:34 +0000 (23:24 +0000)
CAM to place its config last.

sys/bus/cam/cam_xpt.c
sys/kern/subr_autoconf.c
sys/sys/kernel.h

index 5fdf5c1..e58c954 100644 (file)
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/cam/cam_xpt.c,v 1.80.2.18 2002/12/09 17:31:55 gibbs Exp $
- * $DragonFly: src/sys/bus/cam/cam_xpt.c,v 1.34 2006/12/22 23:12:16 swildner Exp $
+ * $DragonFly: src/sys/bus/cam/cam_xpt.c,v 1.35 2007/07/28 23:24:34 dillon Exp $
  */
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1351,6 +1351,7 @@ xpt_init(void *dummy)
                                  M_TEMP, M_INTWAIT | M_ZERO);
        xpt_config_hook->ich_func = xpt_config;
        xpt_config_hook->ich_desc = "xpt";
+       xpt_config_hook->ich_order = 1000;
        if (config_intrhook_establish(xpt_config_hook) != 0) {
                kfree (xpt_config_hook, M_TEMP);
                kprintf("xpt_init: config_intrhook_establish failed "
index ccd0def..bc5a4a6 100644 (file)
@@ -42,7 +42,7 @@
  *     @(#)subr_autoconf.c     8.1 (Berkeley) 6/10/93
  *
  * $FreeBSD: src/sys/kern/subr_autoconf.c,v 1.14 1999/10/05 21:19:41 n_hibma Exp $
- * $DragonFly: src/sys/kern/subr_autoconf.c,v 1.8 2006/12/23 00:35:04 swildner Exp $
+ * $DragonFly: src/sys/kern/subr_autoconf.c,v 1.9 2007/07/28 23:24:33 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -115,15 +115,21 @@ config_intrhook_establish(struct intr_config_hook *hook)
 
        for (hook_entry = TAILQ_FIRST(&intr_config_hook_list);
             hook_entry != NULL;
-            hook_entry = TAILQ_NEXT(hook_entry, ich_links))
+            hook_entry = TAILQ_NEXT(hook_entry, ich_links)) {
                if (hook_entry == hook)
                        break;
-       if (hook_entry != NULL) {
+               if (hook_entry->ich_order > hook->ich_order)
+                       break;
+       }
+       if (hook_entry == hook) {
                kprintf("config_intrhook_establish: establishing an "
                       "already established hook.\n");
                return (1);
        }
-       TAILQ_INSERT_TAIL(&intr_config_hook_list, hook, ich_links);
+       if (hook_entry)
+               TAILQ_INSERT_BEFORE(hook_entry, hook, ich_links);
+       else
+               TAILQ_INSERT_TAIL(&intr_config_hook_list, hook, ich_links);
        if (cold == 0)
                /* XXX Sufficient for modules loaded after initial config??? */
                run_interrupt_driven_config_hooks(NULL);        
index 8798e55..cc82c36 100644 (file)
@@ -40,7 +40,7 @@
  *
  *     @(#)kernel.h    8.3 (Berkeley) 1/21/94
  * $FreeBSD: src/sys/sys/kernel.h,v 1.63.2.9 2002/07/02 23:00:30 archie Exp $
- * $DragonFly: src/sys/sys/kernel.h,v 1.28 2007/05/01 02:29:31 dillon Exp $
+ * $DragonFly: src/sys/sys/kernel.h,v 1.29 2007/07/28 23:24:32 dillon Exp $
  */
 
 #ifndef _SYS_KERNEL_H_
@@ -397,6 +397,7 @@ struct intr_config_hook {
        void    (*ich_func) (void *);
        void    *ich_arg;
        const char *ich_desc;
+       int     ich_order;
 };
 
 int    config_intrhook_establish (struct intr_config_hook *);