Module Name: src Committed By: pooka Date: Mon Sep 21 12:14:47 UTC 2009
Modified Files: src/sys/kern: init_main.c subr_autoconf.c src/sys/rump/librump/rumpdev: rump_dev.c src/sys/sys: device.h Log Message: Split config_init() into config_init() and config_init_mi() to help platforms which want to call config_init() very early in the boot. To generate a diff of this commit: cvs rdiff -u -r1.400 -r1.401 src/sys/kern/init_main.c cvs rdiff -u -r1.184 -r1.185 src/sys/kern/subr_autoconf.c cvs rdiff -u -r1.4 -r1.5 src/sys/rump/librump/rumpdev/rump_dev.c cvs rdiff -u -r1.123 -r1.124 src/sys/sys/device.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/init_main.c diff -u src/sys/kern/init_main.c:1.400 src/sys/kern/init_main.c:1.401 --- src/sys/kern/init_main.c:1.400 Wed Sep 16 15:23:04 2009 +++ src/sys/kern/init_main.c Mon Sep 21 12:14:46 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: init_main.c,v 1.400 2009/09/16 15:23:04 pooka Exp $ */ +/* $NetBSD: init_main.c,v 1.401 2009/09/21 12:14:46 pooka Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -97,7 +97,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.400 2009/09/16 15:23:04 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.401 2009/09/21 12:14:46 pooka Exp $"); #include "opt_ddb.h" #include "opt_ipsec.h" @@ -716,7 +716,7 @@ { /* Initialize autoconf data structures. */ - config_init(); + config_init_mi(); /* * XXX * callout_setfunc() requires mutex(9) so it can't be in config_init() Index: src/sys/kern/subr_autoconf.c diff -u src/sys/kern/subr_autoconf.c:1.184 src/sys/kern/subr_autoconf.c:1.185 --- src/sys/kern/subr_autoconf.c:1.184 Wed Sep 16 22:45:24 2009 +++ src/sys/kern/subr_autoconf.c Mon Sep 21 12:14:47 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_autoconf.c,v 1.184 2009/09/16 22:45:24 dyoung Exp $ */ +/* $NetBSD: subr_autoconf.c,v 1.185 2009/09/21 12:14:47 pooka Exp $ */ /* * Copyright (c) 1996, 2000 Christopher G. Demetriou @@ -77,7 +77,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.184 2009/09/16 22:45:24 dyoung Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.185 2009/09/21 12:14:47 pooka Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -219,7 +219,7 @@ #define STREQ(s1, s2) \ (*(s1) == *(s2) && strcmp((s1), (s2)) == 0) -static int config_initialized; /* config_init() has been called. */ +static bool config_initialized = false; /* config_init() has been called. */ static int config_do_twiddle; static callout_t config_twiddle_ch; @@ -237,8 +237,7 @@ const struct cfattachinit *cfai; int i, j; - if (config_initialized) - return; + KASSERT(config_initialized == false); mutex_init(&alldevs_mtx, MUTEX_DEFAULT, IPL_NONE); cv_init(&alldevs_cv, "alldevs"); @@ -268,9 +267,18 @@ initcftable.ct_cfdata = cfdata; TAILQ_INSERT_TAIL(&allcftables, &initcftable, ct_list); - sysctl_detach_setup(NULL); - config_initialized = 1; + config_initialized = true; +} + +void +config_init_mi(void) +{ + + if (!config_initialized) + config_init(); + + sysctl_detach_setup(NULL); } void Index: src/sys/rump/librump/rumpdev/rump_dev.c diff -u src/sys/rump/librump/rumpdev/rump_dev.c:1.4 src/sys/rump/librump/rumpdev/rump_dev.c:1.5 --- src/sys/rump/librump/rumpdev/rump_dev.c:1.4 Sun Sep 20 23:16:09 2009 +++ src/sys/rump/librump/rumpdev/rump_dev.c Mon Sep 21 12:14:47 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: rump_dev.c,v 1.4 2009/09/20 23:16:09 pooka Exp $ */ +/* $NetBSD: rump_dev.c,v 1.5 2009/09/21 12:14:47 pooka Exp $ */ /* * Copyright (c) 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rump_dev.c,v 1.4 2009/09/20 23:16:09 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rump_dev.c,v 1.5 2009/09/21 12:14:47 pooka Exp $"); #include <sys/param.h> #include <sys/device.h> @@ -44,7 +44,7 @@ rump_dev_init(void) { - config_init(); + config_init_mi(); rump_dev_cgd_init(); rump_dev_raidframe_init(); Index: src/sys/sys/device.h diff -u src/sys/sys/device.h:1.123 src/sys/sys/device.h:1.124 --- src/sys/sys/device.h:1.123 Wed Sep 16 22:45:23 2009 +++ src/sys/sys/device.h Mon Sep 21 12:14:47 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: device.h,v 1.123 2009/09/16 22:45:23 dyoung Exp $ */ +/* $NetBSD: device.h,v 1.124 2009/09/21 12:14:47 pooka Exp $ */ /* * Copyright (c) 1996, 2000 Christopher G. Demetriou @@ -422,6 +422,7 @@ int config_handle_wedges(struct device *, int); void config_init(void); +void config_init_mi(void); void drvctl_init(void); int config_cfdriver_attach(struct cfdriver *);