PERFORCE change 169097 for review
Scott Long
scottl at FreeBSD.org
Thu Oct 1 18:45:52 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=169097
Change 169097 by scottl at scottl-y1 on 2009/10/01 18:45:12
Prototype work for moving the boot-time CAM scan from
SI_SUB_CONF_INTR_HOOK to its own SYSINIT.
Affected files ...
.. //depot/projects/firewire/sys/cam/cam_xpt.c#2 edit
.. //depot/projects/firewire/sys/sys/kernel.h#2 edit
Differences ...
==== //depot/projects/firewire/sys/cam/cam_xpt.c#2 (text+ko) ====
@@ -107,8 +107,6 @@
TAILQ_HEAD(,cam_eb) xpt_busses;
u_int bus_generation;
- struct intr_config_hook *xpt_config_hook;
-
struct mtx xpt_topo_lock;
struct mtx xpt_lock;
};
@@ -910,35 +908,19 @@
xpt_free_path(path);
mtx_unlock(&xsoftc.xpt_lock);
- /*
- * Register a callback for when interrupts are enabled.
- */
- xsoftc.xpt_config_hook =
- (struct intr_config_hook *)malloc(sizeof(struct intr_config_hook),
- M_CAMXPT, M_NOWAIT | M_ZERO);
- if (xsoftc.xpt_config_hook == NULL) {
- printf("xpt_init: Cannot malloc config hook "
- "- failing attach\n");
- return (ENOMEM);
- }
-
- xsoftc.xpt_config_hook->ich_func = xpt_config;
- if (config_intrhook_establish(xsoftc.xpt_config_hook) != 0) {
- free (xsoftc.xpt_config_hook, M_CAMXPT);
- printf("xpt_init: config_intrhook_establish failed "
- "- failing attach\n");
- }
-
/* fire up rescan thread */
if (kproc_create(xpt_scanner_thread, NULL, NULL, 0, 0, "xpt_thrd")) {
printf("xpt_init: failed to create rescan thread\n");
}
/* Install our software interrupt handlers */
- swi_add(NULL, "cambio", camisr, NULL, SWI_CAMBIO, INTR_MPSAFE, &cambio_ih);
+ swi_add(NULL, "cambio", camisr, NULL, SWI_CAMBIO, INTR_MPSAFE,
+ &cambio_ih);
return (0);
}
+SYSINIT(cam_config, SI_SUB_CONFIG_CAM, SI_ORDER_FIRST, xpt_config, NULL);
+
static cam_status
xptregister(struct cam_periph *periph, void *arg)
{
@@ -4697,6 +4679,13 @@
}
xpt_for_all_busses(xptconfigfunc, NULL);
}
+
+ mtx_lock(&xsoftc.xpt_lock);
+ while (msleep(xpt_config, &xsoftc.xpt_lock, PCONFIG, "camhk",
+ 30 * hz) == EWOULDBLOCK) {
+ printf("Warning\n");
+ }
+ mtx_unlock(&xsoftc.xpt_lock);
}
/*
@@ -4727,6 +4716,7 @@
struct periph_driver **p_drv;
int i;
+ mtx_lock(&xsoftc.xpt_lock);
if (busses_to_config == 0) {
/* Register all the peripheral drivers */
/* XXX This will have to change when we have loadable modules */
@@ -4743,12 +4733,11 @@
xpt_for_all_devices(xptpassannouncefunc, NULL);
/* Release our hook so that the boot can continue. */
- config_intrhook_disestablish(xsoftc.xpt_config_hook);
- free(xsoftc.xpt_config_hook, M_CAMXPT);
- xsoftc.xpt_config_hook = NULL;
+ wakeup(xpt_config);
}
free(context, M_CAMXPT);
+ mtx_unlock(&xsoftc.xpt_lock);
}
static void
==== //depot/projects/firewire/sys/sys/kernel.h#2 (text+ko) ====
@@ -154,6 +154,7 @@
SI_SUB_KPROF = 0x9000000, /* kernel profiling*/
SI_SUB_KICK_SCHEDULER = 0xa000000, /* start the timeout events*/
SI_SUB_INT_CONFIG_HOOKS = 0xa800000, /* Interrupts enabled config */
+ SI_SUB_CONFIG_CAM = 0xa900000, /* Interrupts enabled config */
SI_SUB_ROOT_CONF = 0xb000000, /* Find root devices */
SI_SUB_DUMP_CONF = 0xb200000, /* Find dump devices */
SI_SUB_RAID = 0xb380000, /* Configure GEOM classes */
More information about the p4-projects
mailing list