From cce90053e9ea1d80307ef949d59e12b9a4540aa6 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sat, 28 Jul 2007 23:24:34 +0000 Subject: [PATCH 1/1] Add an ordering field to the interrupt config hook structure and adjust CAM to place its config last. --- sys/bus/cam/cam_xpt.c | 3 ++- sys/kern/subr_autoconf.c | 14 ++++++++++---- sys/sys/kernel.h | 3 ++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/sys/bus/cam/cam_xpt.c b/sys/bus/cam/cam_xpt.c index 5fdf5c129b..e58c95450c 100644 --- a/sys/bus/cam/cam_xpt.c +++ b/sys/bus/cam/cam_xpt.c @@ -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 #include @@ -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 " diff --git a/sys/kern/subr_autoconf.c b/sys/kern/subr_autoconf.c index ccd0def500..bc5a4a665d 100644 --- a/sys/kern/subr_autoconf.c +++ b/sys/kern/subr_autoconf.c @@ -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 @@ -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); diff --git a/sys/sys/kernel.h b/sys/sys/kernel.h index 8798e552b4..cc82c36414 100644 --- a/sys/sys/kernel.h +++ b/sys/sys/kernel.h @@ -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 *); -- 2.41.0