summaryrefslogtreecommitdiffstats
path: root/freebsd
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2019-07-25 10:20:19 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2019-09-23 10:26:34 +0200
commitaedff4f6e887b8da7e359a28f3c0393a2112087d (patch)
tree86b7e35c4bd069f2485294beea5c124fca6154ca /freebsd
parentnexus: Avoid NULL pointer access (diff)
downloadrtems-libbsd-aedff4f6e887b8da7e359a28f3c0393a2112087d.tar.bz2
CONFIG_INTRHOOK(9): Call handlers after boot
This enables adding drivers on demand which use this service after initialization.
Diffstat (limited to 'freebsd')
-rw-r--r--freebsd/sys/kern/subr_autoconf.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/freebsd/sys/kern/subr_autoconf.c b/freebsd/sys/kern/subr_autoconf.c
index 33087b03..39332214 100644
--- a/freebsd/sys/kern/subr_autoconf.c
+++ b/freebsd/sys/kern/subr_autoconf.c
@@ -63,6 +63,9 @@ static TAILQ_HEAD(, intr_config_hook) intr_config_hook_list =
static struct intr_config_hook *next_to_notify;
static struct mtx intr_config_hook_lock;
MTX_SYSINIT(intr_config_hook, &intr_config_hook_lock, "intr config", MTX_DEF);
+#ifdef __rtems__
+static bool intr_boot_done;
+#endif /* __rtems__ */
/* ARGSUSED */
static void run_interrupt_driven_config_hooks(void);
@@ -174,6 +177,9 @@ boot_run_interrupt_driven_config_hooks(void *dummy)
mtx_lock(&intr_config_hook_lock);
}
}
+#ifdef __rtems__
+ intr_boot_done = true;
+#endif /* __rtems__ */
mtx_unlock(&intr_config_hook_lock);
TSUNWAIT("config hooks");
}
@@ -190,6 +196,9 @@ int
config_intrhook_establish(struct intr_config_hook *hook)
{
struct intr_config_hook *hook_entry;
+#ifdef __rtems__
+ bool run;
+#endif /* __rtems__ */
TSHOLD("config hooks");
mtx_lock(&intr_config_hook_lock);
@@ -205,16 +214,21 @@ config_intrhook_establish(struct intr_config_hook *hook)
TAILQ_INSERT_TAIL(&intr_config_hook_list, hook, ich_links);
if (next_to_notify == NULL)
next_to_notify = hook;
+#ifdef __rtems__
+ run = intr_boot_done;
+#endif /* __rtems__ */
mtx_unlock(&intr_config_hook_lock);
#ifndef __rtems__
if (cold == 0)
+#else /* __rtems__ */
+ if (run)
+#endif /* __rtems__ */
/*
* XXX Call from a task since not all drivers expect
* to be re-entered at the time a hook is established.
*/
/* XXX Sufficient for modules loaded after initial config??? */
run_interrupt_driven_config_hooks();
-#endif /* __rtems__ */
return (0);
}