Module Name: src Committed By: dyoung Date: Tue May 31 23:28:53 UTC 2011
Modified Files: src/sys/arch/x86/conf: files.x86 src/sys/arch/x86/include: cpu.h src/sys/arch/x86/x86: x86_machdep.c src/sys/kern: init_main.c kern_stub.c subr_userconf.c src/sys/sys: userconf.h Added Files: src/sys/arch/x86/x86: x86_userconf.c Log Message: Don't use the C preprocessor to configure USERCONF. Instead, either do or do not link in subr_userconf.c and x86_userconf.c. Provide no-op stubs for userconf_bootinfo(), userconf_init(), and userconf_prompt(). Delete all occurrences of #include "opt_userconf.h" as well as USERCONF and __HAVE_USERCONF_BOOTINFO #ifdef'age. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/arch/x86/conf/files.x86 cvs rdiff -u -r1.33 -r1.34 src/sys/arch/x86/include/cpu.h cvs rdiff -u -r1.49 -r1.50 src/sys/arch/x86/x86/x86_machdep.c cvs rdiff -u -r0 -r1.1 src/sys/arch/x86/x86/x86_userconf.c cvs rdiff -u -r1.430 -r1.431 src/sys/kern/init_main.c cvs rdiff -u -r1.31 -r1.32 src/sys/kern/kern_stub.c cvs rdiff -u -r1.23 -r1.24 src/sys/kern/subr_userconf.c cvs rdiff -u -r1.6 -r1.7 src/sys/sys/userconf.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/arch/x86/conf/files.x86 diff -u src/sys/arch/x86/conf/files.x86:1.67 src/sys/arch/x86/conf/files.x86:1.68 --- src/sys/arch/x86/conf/files.x86:1.67 Sun Apr 10 20:36:48 2011 +++ src/sys/arch/x86/conf/files.x86 Tue May 31 23:28:52 2011 @@ -1,4 +1,4 @@ -# $NetBSD: files.x86,v 1.67 2011/04/10 20:36:48 christos Exp $ +# $NetBSD: files.x86,v 1.68 2011/05/31 23:28:52 dyoung Exp $ # options for MP configuration through the MP spec defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI @@ -85,6 +85,7 @@ file arch/x86/x86/syscall.c file arch/x86/x86/vm_machdep.c file arch/x86/x86/x86_autoconf.c +file arch/x86/x86/x86_userconf.c userconf file arch/x86/x86/x86_machdep.c define lapic Index: src/sys/arch/x86/include/cpu.h diff -u src/sys/arch/x86/include/cpu.h:1.33 src/sys/arch/x86/include/cpu.h:1.34 --- src/sys/arch/x86/include/cpu.h:1.33 Thu May 26 04:25:28 2011 +++ src/sys/arch/x86/include/cpu.h Tue May 31 23:28:52 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.33 2011/05/26 04:25:28 uebayasi Exp $ */ +/* $NetBSD: cpu.h,v 1.34 2011/05/31 23:28:52 dyoung Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -439,8 +439,6 @@ #include <machine/psl.h> /* Must be after struct cpu_info declaration */ -#define __HAVE_USERCONF_BOOTINFO - #endif /* _KERNEL || __KMEMUSER */ /* Index: src/sys/arch/x86/x86/x86_machdep.c diff -u src/sys/arch/x86/x86/x86_machdep.c:1.49 src/sys/arch/x86/x86/x86_machdep.c:1.50 --- src/sys/arch/x86/x86/x86_machdep.c:1.49 Thu May 26 16:38:57 2011 +++ src/sys/arch/x86/x86/x86_machdep.c Tue May 31 23:28:53 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: x86_machdep.c,v 1.49 2011/05/26 16:38:57 para Exp $ */ +/* $NetBSD: x86_machdep.c,v 1.50 2011/05/31 23:28:53 dyoung Exp $ */ /*- * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi, @@ -31,12 +31,11 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.49 2011/05/26 16:38:57 para Exp $"); +__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.50 2011/05/31 23:28:53 dyoung Exp $"); #include "opt_modular.h" #include "opt_physmem.h" #include "opt_splash.h" -#include "opt_userconf.h" #include <sys/types.h> #include <sys/param.h> @@ -52,10 +51,6 @@ #include <sys/sysctl.h> #include <sys/extent.h> -#if defined(USERCONF) -#include <sys/userconf.h> -#endif /* defined(USERCONF) */ - #include <x86/cpuvar.h> #include <x86/cputypes.h> #include <x86/machdep.h> @@ -182,28 +177,6 @@ } #endif /* MODULAR */ -#if defined(USERCONF) -void -userconf_bootinfo(void) -{ - struct btinfo_userconfcommands *biuc; - struct bi_userconfcommand *bi, *bimax; - - biuc = lookup_bootinfo(BTINFO_USERCONFCOMMANDS); - if (biuc == NULL) { - aprint_debug("No bootinfo commands at boot\n"); - return; - } - - bi = (struct bi_userconfcommand *)((uint8_t *)biuc + sizeof(*biuc)); - bimax = bi + biuc->num; - for (; bi < bimax; bi++) { - aprint_debug("Processing userconf command: %s\n", bi->text); - userconf_parse(bi->text); - } -} -#endif /* defined (USERCONF) */ - void cpu_need_resched(struct cpu_info *ci, int flags) { Index: src/sys/kern/init_main.c diff -u src/sys/kern/init_main.c:1.430 src/sys/kern/init_main.c:1.431 --- src/sys/kern/init_main.c:1.430 Thu May 26 04:25:26 2011 +++ src/sys/kern/init_main.c Tue May 31 23:28:53 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: init_main.c,v 1.430 2011/05/26 04:25:26 uebayasi Exp $ */ +/* $NetBSD: init_main.c,v 1.431 2011/05/31 23:28:53 dyoung 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.430 2011/05/26 04:25:26 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.431 2011/05/31 23:28:53 dyoung Exp $"); #include "opt_ddb.h" #include "opt_ipsec.h" @@ -240,12 +240,7 @@ struct timeval50 boottime50; #endif -#ifdef _KERNEL_OPT -#include "opt_userconf.h" -#endif -#ifdef USERCONF #include <sys/userconf.h> -#endif extern struct lwp lwp0; extern time_t rootfstime; @@ -728,11 +723,9 @@ drvctl_init(); #endif -#ifdef USERCONF userconf_init(); if (boothowto & RB_USERCONF) userconf_prompt(); -#endif if ((boothowto & (AB_SILENT|AB_VERBOSE)) == AB_SILENT) { printf_nolog("Detecting hardware..."); Index: src/sys/kern/kern_stub.c diff -u src/sys/kern/kern_stub.c:1.31 src/sys/kern/kern_stub.c:1.32 --- src/sys/kern/kern_stub.c:1.31 Wed Apr 27 00:00:46 2011 +++ src/sys/kern/kern_stub.c Tue May 31 23:28:53 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_stub.c,v 1.31 2011/04/27 00:00:46 joerg Exp $ */ +/* $NetBSD: kern_stub.c,v 1.32 2011/05/31 23:28:53 dyoung Exp $ */ /*- * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. @@ -62,7 +62,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.31 2011/04/27 00:00:46 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_stub.c,v 1.32 2011/05/31 23:28:53 dyoung Exp $"); #include "opt_ptrace.h" #include "opt_ktrace.h" @@ -79,6 +79,7 @@ #include <sys/cpu.h> #include <sys/module.h> #include <sys/bus.h> +#include <sys/userconf.h> bool default_bus_space_is_equal(bus_space_tag_t, bus_space_tag_t); @@ -130,6 +131,9 @@ __weak_alias(bus_space_tag_create, eopnotsupp); __weak_alias(bus_space_tag_destroy, voidop); __weak_alias(bus_space_is_equal, default_bus_space_is_equal); +__weak_alias(userconf_bootinfo, voidop); +__weak_alias(userconf_init, voidop); +__weak_alias(userconf_prompt, voidop); __weak_alias(kobj_renamespace, nullop); Index: src/sys/kern/subr_userconf.c diff -u src/sys/kern/subr_userconf.c:1.23 src/sys/kern/subr_userconf.c:1.24 --- src/sys/kern/subr_userconf.c:1.23 Thu May 26 04:25:27 2011 +++ src/sys/kern/subr_userconf.c Tue May 31 23:28:53 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_userconf.c,v 1.23 2011/05/26 04:25:27 uebayasi Exp $ */ +/* $NetBSD: subr_userconf.c,v 1.24 2011/05/31 23:28:53 dyoung Exp $ */ /* * Copyright (c) 1996 Mats O Jansson <m...@stacken.kth.se> @@ -29,9 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: subr_userconf.c,v 1.23 2011/05/26 04:25:27 uebayasi Exp $"); - -#include "opt_userconf.h" +__KERNEL_RCSID(0, "$NetBSD: subr_userconf.c,v 1.24 2011/05/31 23:28:53 dyoung Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -95,9 +93,7 @@ userconf_maxdev = i - 1; userconf_totdev = i - 1; -#ifdef __HAVE_USERCONF_BOOTINFO userconf_bootinfo(); -#endif } static int Index: src/sys/sys/userconf.h diff -u src/sys/sys/userconf.h:1.6 src/sys/sys/userconf.h:1.7 --- src/sys/sys/userconf.h:1.6 Thu May 26 04:25:27 2011 +++ src/sys/sys/userconf.h Tue May 31 23:28:53 2011 @@ -1,4 +1,4 @@ -/* $NetBSD: userconf.h,v 1.6 2011/05/26 04:25:27 uebayasi Exp $ */ +/* $NetBSD: userconf.h,v 1.7 2011/05/31 23:28:53 dyoung Exp $ */ /*- * Copyright (c) 2001, 2009 The NetBSD Foundation, Inc. @@ -31,12 +31,9 @@ #include <sys/cpu.h> +void userconf_bootinfo(void); void userconf_init(void); void userconf_prompt(void); int userconf_parse(char *); -#ifdef __HAVE_USERCONF_BOOTINFO -void userconf_bootinfo(void); -#endif - #endif /* !_SYS_USERCONF_H_ */ Added files: Index: src/sys/arch/x86/x86/x86_userconf.c diff -u /dev/null src/sys/arch/x86/x86/x86_userconf.c:1.1 --- /dev/null Tue May 31 23:28:53 2011 +++ src/sys/arch/x86/x86/x86_userconf.c Tue May 31 23:28:53 2011 @@ -0,0 +1,61 @@ +/* $NetBSD: x86_userconf.c,v 1.1 2011/05/31 23:28:53 dyoung Exp $ */ + +/*- + * Copyright (c) 2005, 2008, 2009, 2011 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Julio M. Merino Vidal. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include <sys/cdefs.h> +__KERNEL_RCSID(0, "$NetBSD: x86_userconf.c,v 1.1 2011/05/31 23:28:53 dyoung Exp $"); + +#include <sys/types.h> +#include <sys/param.h> +#include <sys/systm.h> + +#include <sys/userconf.h> + +#include <machine/bootinfo.h> + +void +userconf_bootinfo(void) +{ + struct btinfo_userconfcommands *biuc; + struct bi_userconfcommand *bi, *bimax; + + biuc = lookup_bootinfo(BTINFO_USERCONFCOMMANDS); + if (biuc == NULL) { + aprint_debug("No bootinfo commands at boot\n"); + return; + } + + bi = (struct bi_userconfcommand *)((uint8_t *)biuc + sizeof(*biuc)); + bimax = bi + biuc->num; + for (; bi < bimax; bi++) { + aprint_debug("Processing userconf command: %s\n", bi->text); + userconf_parse(bi->text); + } +}