Sun Mar 15 19:43:49 2009 UTC ()
Pull up following revision(s) (requested by christos in ticket #458):
	sys/conf/Makefile.kern.inc: revision 1.121
	sys/conf/files: revision 1.940
	sys/kern/init_main.c: revision 1.381
	sys/kern/kern_ssp.c: revision 1.1
	sys/kern/subr_autoconf.c: revision 1.168
	sys/sys/device.h: revision 1.116
	sys/sys/systm.h: revision 1.233
Unbreak ssp kernels. The issue here that when the ssp_init() call was
deferred, it caused the return from the enclosing function to break, as
well as the ssp return on i386. To fix both issues, split configure in
two pieces the one before calling ssp_init and the one after, and move
the ssp_init() call back in main. Put ssp_init() in its own file, and
compile this new file with -fno-stack-protector. Tested on amd64.
XXX: If we want to have ssp kernels working on 5.0, this change needs to
be pulled up.


(snj)
diff -r1.118 -r1.118.4.1 src/sys/conf/Makefile.kern.inc
diff -r1.924 -r1.924.4.1 src/sys/conf/files
diff -r1.371 -r1.371.2.1 src/sys/kern/init_main.c
diff -r0 -r1.2.4.2 src/sys/kern/kern_ssp.c
diff -r1.163.4.1 -r1.163.4.2 src/sys/kern/subr_autoconf.c
diff -r1.112 -r1.112.6.1 src/sys/sys/device.h
diff -r1.228.4.1 -r1.228.4.2 src/sys/sys/systm.h

cvs diff -r1.118 -r1.118.4.1 src/sys/conf/Makefile.kern.inc (switch to unified diff)

--- src/sys/conf/Makefile.kern.inc 2008/10/25 22:27:38 1.118
+++ src/sys/conf/Makefile.kern.inc 2009/03/15 19:43:48 1.118.4.1
@@ -1,499 +1,500 @@ @@ -1,499 +1,500 @@
1# $NetBSD: Makefile.kern.inc,v 1.118 2008/10/25 22:27:38 apb Exp $ 1# $NetBSD: Makefile.kern.inc,v 1.118.4.1 2009/03/15 19:43:48 snj Exp $
2# 2#
3# This file contains common `MI' targets and definitions and it is included 3# This file contains common `MI' targets and definitions and it is included
4# at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}. 4# at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
5# 5#
6# Each target in this file should be protected with `if !target(target)' 6# Each target in this file should be protected with `if !target(target)'
7# or `if !commands(target)' and each variable should only be conditionally 7# or `if !commands(target)' and each variable should only be conditionally
8# assigned `VAR ?= VALUE', so that everything can be overriden. 8# assigned `VAR ?= VALUE', so that everything can be overriden.
9# 9#
10# DEBUG is set to -g if debugging. 10# DEBUG is set to -g if debugging.
11# PROF is set to -pg if profiling. 11# PROF is set to -pg if profiling.
12# 12#
13# To specify debugging, add the config line: makeoptions DEBUG="-g" 13# To specify debugging, add the config line: makeoptions DEBUG="-g"
14# A better way is to specify -g only for a few files. 14# A better way is to specify -g only for a few files.
15# 15#
16# makeoptions DEBUGLIST="uvm* trap if_*" 16# makeoptions DEBUGLIST="uvm* trap if_*"
17# 17#
18# all ports are expected to include bsd.own.mk for toolchain settings 18# all ports are expected to include bsd.own.mk for toolchain settings
19 19
20## 20##
21## (0) toolchain settings for things that aren't part of the standard 21## (0) toolchain settings for things that aren't part of the standard
22## toolchain 22## toolchain
23## 23##
24HOST_SH?= sh 24HOST_SH?= sh
25DBSYM?= dbsym 25DBSYM?= dbsym
26MKDEP?= mkdep 26MKDEP?= mkdep
27STRIP?= strip 27STRIP?= strip
28OBJCOPY?= objcopy 28OBJCOPY?= objcopy
29OBJDUMP?= objdump 29OBJDUMP?= objdump
30CSCOPE?= cscope 30CSCOPE?= cscope
31MKID?= mkid 31MKID?= mkid
32UUDECODE?= ${TOOL_UUDECODE:Uuudecode} 32UUDECODE?= ${TOOL_UUDECODE:Uuudecode}
33HEXDUMP?= ${TOOL_HEXDUMP:Uhexdump} 33HEXDUMP?= ${TOOL_HEXDUMP:Uhexdump}
34GENASSYM?= ${TOOL_GENASSYM:Ugenassym} 34GENASSYM?= ${TOOL_GENASSYM:Ugenassym}
35.MAKEOVERRIDES+=USETOOLS # make sure proper value is propagated 35.MAKEOVERRIDES+=USETOOLS # make sure proper value is propagated
36 36
37_MKMSG?= @\# 37_MKMSG?= @\#
38_MKSHMSG?= echo 38_MKSHMSG?= echo
39_MKSHECHO?= echo 39_MKSHECHO?= echo
40_MKMSG_CREATE?= : 40_MKMSG_CREATE?= :
41_MKTARGET_COMPILE?= : 41_MKTARGET_COMPILE?= :
42_MKTARGET_CREATE?= : 42_MKTARGET_CREATE?= :
43 43
44## 44##
45## (1) port independent source tree identification 45## (1) port independent source tree identification
46## 46##
47# source tree is located via $S relative to the compilation directory 47# source tree is located via $S relative to the compilation directory
48.ifndef S 48.ifndef S
49S!= cd ../../../..; pwd 49S!= cd ../../../..; pwd
50.endif 50.endif
51 51
52## 52##
53## (2) compile settings 53## (2) compile settings
54## 54##
55## CPPFLAGS, CFLAGS, and AFLAGS must be set in the port's Makefile 55## CPPFLAGS, CFLAGS, and AFLAGS must be set in the port's Makefile
56## 56##
57INCLUDES?= -I. ${EXTRA_INCLUDES} -I${S}/../common/include -I$S/arch \ 57INCLUDES?= -I. ${EXTRA_INCLUDES} -I${S}/../common/include -I$S/arch \
58 -I$S -nostdinc 58 -I$S -nostdinc
59CPPFLAGS+= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT 59CPPFLAGS+= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT
60DEFCOPTS?= -O2 60DEFCOPTS?= -O2
61COPTS?= ${DEFCOPTS} 61COPTS?= ${DEFCOPTS}
62COPTS+= -std=gnu99 62COPTS+= -std=gnu99
63DBG= # might contain unwanted -Ofoo 63DBG= # might contain unwanted -Ofoo
64DEFWARNINGS?= yes 64DEFWARNINGS?= yes
65.if (${DEFWARNINGS} == "yes") 65.if (${DEFWARNINGS} == "yes")
66. if !defined(NOGCCERROR) 66. if !defined(NOGCCERROR)
67CWARNFLAGS+= -Werror 67CWARNFLAGS+= -Werror
68. endif 68. endif
69CWARNFLAGS+= -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith 69CWARNFLAGS+= -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith
70CWARNFLAGS+= -Wmissing-prototypes -Wstrict-prototypes 70CWARNFLAGS+= -Wmissing-prototypes -Wstrict-prototypes
71CWARNFLAGS+= -Wswitch -Wshadow 71CWARNFLAGS+= -Wswitch -Wshadow
72CWARNFLAGS+= -Wcast-qual -Wwrite-strings 72CWARNFLAGS+= -Wcast-qual -Wwrite-strings
73CWARNFLAGS+= -Wno-unreachable-code 73CWARNFLAGS+= -Wno-unreachable-code
74# Add -Wno-sign-compare. -Wsign-compare is included in -Wall as of GCC 3.3, 74# Add -Wno-sign-compare. -Wsign-compare is included in -Wall as of GCC 3.3,
75# but our sources aren't up for it yet. 75# but our sources aren't up for it yet.
76CWARNFLAGS+= -Wno-sign-compare 76CWARNFLAGS+= -Wno-sign-compare
77. if (defined(HAVE_GCC) && ${HAVE_GCC} > 3) || defined(HAVE_PCC) 77. if (defined(HAVE_GCC) && ${HAVE_GCC} > 3) || defined(HAVE_PCC)
78CWARNFLAGS+= -Wno-pointer-sign -Wno-attributes 78CWARNFLAGS+= -Wno-pointer-sign -Wno-attributes
79. if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64" || \ 79. if ${MACHINE} == "i386" || ${MACHINE_ARCH} == "x86_64" || \
80 ${MACHINE_ARCH} == "sparc64" || ${MACHINE} == "prep" 80 ${MACHINE_ARCH} == "sparc64" || ${MACHINE} == "prep"
81CWARNFLAGS+= -Wextra -Wno-unused-parameter 81CWARNFLAGS+= -Wextra -Wno-unused-parameter
82. endif 82. endif
83. endif 83. endif
84.endif 84.endif
85 85
86CFLAGS+= -ffreestanding -fno-zero-initialized-in-bss 86CFLAGS+= -ffreestanding -fno-zero-initialized-in-bss
87CFLAGS+= ${DEBUG} ${COPTS} 87CFLAGS+= ${DEBUG} ${COPTS}
88AFLAGS+= -D_LOCORE -Wa,-fatal-warnings 88AFLAGS+= -D_LOCORE -Wa,-fatal-warnings
89 89
90# XXX 90# XXX
91.if defined(HAVE_GCC) && ${HAVE_GCC} > 3 91.if defined(HAVE_GCC) && ${HAVE_GCC} > 3
92CFLAGS+= -fno-strict-aliasing 92CFLAGS+= -fno-strict-aliasing
93.endif 93.endif
94 94
95.if ${USE_SSP:Uno} == "yes" 95.if ${USE_SSP:Uno} == "yes"
96CFLAGS+=-fstack-protector -Wstack-protector --param ssp-buffer-size=1 96CFLAGS+=-fstack-protector -Wstack-protector --param ssp-buffer-size=1
97LDFLAGS+=-fstack-protector -Wstack-protector --param ssp-buffer-size=1 97LDFLAGS+=-fstack-protector -Wstack-protector --param ssp-buffer-size=1
 98COPTS.kern_ssp.c+= -fno-stack-protector -D__SSP__
98.endif 99.endif
99 100
100# If we want the bpendtsleep: label in kern_synch.c, we need to use 101# If we want the bpendtsleep: label in kern_synch.c, we need to use
101# -fno-reorder-blocks. Don't make this a config(1) defflag without 102# -fno-reorder-blocks. Don't make this a config(1) defflag without
102# making sure this fragment remains valid. 103# making sure this fragment remains valid.
103.if defined(HAVE_GCC) && ${HAVE_GCC} > 3 && \ 104.if defined(HAVE_GCC) && ${HAVE_GCC} > 3 && \
104 !empty(${CFLAGS:M-DKERN_SYNCH_BPENDTSLEEP_LABEL}) 105 !empty(${CFLAGS:M-DKERN_SYNCH_BPENDTSLEEP_LABEL})
105COPTS.kern_synch.c+= -fno-reorder-blocks 106COPTS.kern_synch.c+= -fno-reorder-blocks
106.endif 107.endif
107 108
108# Use the per-source COPTS variables to add -g to just those 109# Use the per-source COPTS variables to add -g to just those
109# files that match the shell patterns given in ${DEBUGLIST} 110# files that match the shell patterns given in ${DEBUGLIST}
110# 111#
111.for i in ${DEBUGLIST} 112.for i in ${DEBUGLIST}
112. for j in ${CFILES:T:M$i.c} 113. for j in ${CFILES:T:M$i.c}
113COPTS.${j}+=-g 114COPTS.${j}+=-g
114. endfor 115. endfor
115.endfor 116.endfor
116 117
117# Always compile subr_debug_info.c with debug informations. 118# Always compile subr_debug_info.c with debug informations.
118# This allows gdb to use type informations. 119# This allows gdb to use type informations.
119# 120#
120COPTS.debugsyms.c+= -g 121COPTS.debugsyms.c+= -g
121 122
122# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 123# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
123# NOPROF and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 124# NOPROF and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
124NORMAL_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"; \ 125NORMAL_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"; \
125 ${_MKSHECHO}\ 126 ${_MKSHECHO}\
126 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<; \ 127 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<; \
127 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 128 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $<
128NOPROF_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"; \ 129NOPROF_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"; \
129 ${_MKSHECHO}\ 130 ${_MKSHECHO}\
130 ${CC} ${CFLAGS} ${CPPFLAGS} -c $<; \ 131 ${CC} ${CFLAGS} ${CPPFLAGS} -c $<; \
131 ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 132 ${CC} ${CFLAGS} ${CPPFLAGS} -c $<
132NORMAL_S?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"; \ 133NORMAL_S?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"; \
133 ${_MKSHECHO}\ 134 ${_MKSHECHO}\
134 ${CC} ${AFLAGS} ${CPPFLAGS} -c $<; \ 135 ${CC} ${AFLAGS} ${CPPFLAGS} -c $<; \
135 ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 136 ${CC} ${AFLAGS} ${CPPFLAGS} -c $<
136 137
137## 138##
138## (3) libkern and compat 139## (3) libkern and compat
139## 140##
140## Set KERN_AS in the port Makefile to "obj" or "library". The 141## Set KERN_AS in the port Makefile to "obj" or "library". The
141## default is "library", as documented in $S/lib/libkern/Makefile.inc. 142## default is "library", as documented in $S/lib/libkern/Makefile.inc.
142## 143##
143 144
144### find out what to use for libkern 145### find out what to use for libkern
145.include "$S/lib/libkern/Makefile.inc" 146.include "$S/lib/libkern/Makefile.inc"
146.ifndef PROF 147.ifndef PROF
147LIBKERN?= ${KERNLIB} 148LIBKERN?= ${KERNLIB}
148.else 149.else
149LIBKERN?= ${KERNLIB_PROF} 150LIBKERN?= ${KERNLIB_PROF}
150.endif 151.endif
151 152
152LIBKERNLN?= ${KERNLIBLN} 153LIBKERNLN?= ${KERNLIBLN}
153 154
154### find out what to use for libcompat 155### find out what to use for libcompat
155.include "$S/compat/common/Makefile.inc" 156.include "$S/compat/common/Makefile.inc"
156.ifndef PROF 157.ifndef PROF
157SYSLIBCOMPAT?= ${COMPATLIB} 158SYSLIBCOMPAT?= ${COMPATLIB}
158.else 159.else
159SYSLIBCOMPAT?= ${COMPATLIB_PROF} 160SYSLIBCOMPAT?= ${COMPATLIB_PROF}
160.endif 161.endif
161 162
162SYSLIBCOMPATLN?= ${COMPATLIBLN} 163SYSLIBCOMPATLN?= ${COMPATLIBLN}
163 164
164## 165##
165## (4) local objects, compile rules, and dependencies 166## (4) local objects, compile rules, and dependencies
166## 167##
167## Each port should have a corresponding section with settings for 168## Each port should have a corresponding section with settings for
168## MD_CFILES, MD_SFILES, and MD_OBJS, along with build rules for same. 169## MD_CFILES, MD_SFILES, and MD_OBJS, along with build rules for same.
169## 170##
170MI_CFILES=devsw.c ioconf.c param.c 171MI_CFILES=devsw.c ioconf.c param.c
171# the need for a MI_SFILES variable is dubitable at best 172# the need for a MI_SFILES variable is dubitable at best
172MI_OBJS=${MI_CFILES:S/.c/.o/} 173MI_OBJS=${MI_CFILES:S/.c/.o/}
173 174
174param.c: $S/conf/param.c 175param.c: $S/conf/param.c
175 ${_MKTARGET_CREATE} 176 ${_MKTARGET_CREATE}
176 rm -f param.c 177 rm -f param.c
177 cp $S/conf/param.c . 178 cp $S/conf/param.c .
178 179
179param.o: Makefile 180param.o: Makefile
180 181
181.for _cfile in ${MI_CFILES} 182.for _cfile in ${MI_CFILES}
182${_cfile:T:R}.o: ${_cfile} 183${_cfile:T:R}.o: ${_cfile}
183 ${NORMAL_C} 184 ${NORMAL_C}
184.endfor 185.endfor
185 186
186## 187##
187## (5) link settings 188## (5) link settings
188## 189##
189## TEXTADDR (or LOADADDRESS), LINKFORMAT, and any EXTRA_LINKFLAGS must 190## TEXTADDR (or LOADADDRESS), LINKFORMAT, and any EXTRA_LINKFLAGS must
190## be set in the port's Makefile. The port specific definitions for 191## be set in the port's Makefile. The port specific definitions for
191## LINKFLAGS_NORMAL and LINKFLAGS_DEBUG will added to the LINKFLAGS 192## LINKFLAGS_NORMAL and LINKFLAGS_DEBUG will added to the LINKFLAGS
192## depending on the value of DEBUG. 193## depending on the value of DEBUG.
193## 194##
194# load lines for config "xxx" will be emitted as: 195# load lines for config "xxx" will be emitted as:
195# xxx: ${SYSTEM_DEP} swapxxx.o 196# xxx: ${SYSTEM_DEP} swapxxx.o
196# ${SYSTEM_LD_HEAD} 197# ${SYSTEM_LD_HEAD}
197# ${SYSTEM_LD} swapxxx.o 198# ${SYSTEM_LD} swapxxx.o
198# ${SYSTEM_LD_TAIL} 199# ${SYSTEM_LD_TAIL}
199SYSTEM_OBJ?= ${MD_OBJS} ${MI_OBJS} ${OBJS} ${SYSLIBCOMPAT} ${LIBKERN} 200SYSTEM_OBJ?= ${MD_OBJS} ${MI_OBJS} ${OBJS} ${SYSLIBCOMPAT} ${LIBKERN}
200SYSTEM_DEP?= Makefile ${SYSTEM_OBJ:O} .gdbinit 201SYSTEM_DEP?= Makefile ${SYSTEM_OBJ:O} .gdbinit
201SYSTEM_LD_HEAD?=@rm -f $@ 202SYSTEM_LD_HEAD?=@rm -f $@
202SYSTEM_LD?= @${_MKSHMSG} " link ${.CURDIR:T}/${.TARGET}"; \ 203SYSTEM_LD?= @${_MKSHMSG} " link ${.CURDIR:T}/${.TARGET}"; \
203 ${_MKSHECHO}\ 204 ${_MKSHECHO}\
204 ${LD} -Map $@.map --cref ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' '$${EXTRA_OBJ}' vers.o; \ 205 ${LD} -Map $@.map --cref ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' '$${EXTRA_OBJ}' vers.o; \
205 ${LD} -Map $@.map --cref ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o 206 ${LD} -Map $@.map --cref ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} ${EXTRA_OBJ} vers.o
206SYSTEM_LD_TAIL?=@${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/\\.*//' vers.c; \ 207SYSTEM_LD_TAIL?=@${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/\\.*//' vers.c; \
207 ${SIZE} $@; chmod 755 $@ 208 ${SIZE} $@; chmod 755 $@
208 209
209TEXTADDR?= ${LOADADDRESS} # backwards compatibility 210TEXTADDR?= ${LOADADDRESS} # backwards compatibility
210LINKTEXT?= ${TEXTADDR:C/.+/-Ttext &/} 211LINKTEXT?= ${TEXTADDR:C/.+/-Ttext &/}
211LINKDATA?= ${DATAADDR:C/.+/-Tdata &/} 212LINKDATA?= ${DATAADDR:C/.+/-Tdata &/}
212ENTRYPOINT?= start 213ENTRYPOINT?= start
213LINKENTRY?= ${ENTRYPOINT:C/.+/-e &/} 214LINKENTRY?= ${ENTRYPOINT:C/.+/-e &/}
214LINKFLAGS?= ${LINKFORMAT} ${LINKTEXT} ${LINKDATA} ${LINKENTRY} \ 215LINKFLAGS?= ${LINKFORMAT} ${LINKTEXT} ${LINKDATA} ${LINKENTRY} \
215 ${EXTRA_LINKFLAGS} 216 ${EXTRA_LINKFLAGS}
216 217
217LINKFLAGS_DEBUG?= -X 218LINKFLAGS_DEBUG?= -X
218SYSTEM_LD_TAIL_DEBUG?=; \ 219SYSTEM_LD_TAIL_DEBUG?=; \
219 echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 220 echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
220 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 221 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
221 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 222 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
222LINKFLAGS_NORMAL?= -S 223LINKFLAGS_NORMAL?= -S
223STRIPFLAGS?= -g 224STRIPFLAGS?= -g
224 225
225DEBUG?= 226DEBUG?=
226.if !empty(DEBUG:M-g*) 227.if !empty(DEBUG:M-g*)
227SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_DEBUG} 228SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_DEBUG}
228LINKFLAGS+= ${LINKFLAGS_DEBUG} 229LINKFLAGS+= ${LINKFLAGS_DEBUG}
229EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gdb@} 230EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gdb@}
230.elifndef PROF 231.elifndef PROF
231LINKFLAGS+= ${LINKFLAGS_NORMAL} 232LINKFLAGS+= ${LINKFLAGS_NORMAL}
232.endif 233.endif
233 234
234SYSTEM_LD_TAIL+=; \ 235SYSTEM_LD_TAIL+=; \
235 if grep -q '^\#define.*SYMTAB_SPACE' opt_ddbparam.h; then \ 236 if grep -q '^\#define.*SYMTAB_SPACE' opt_ddbparam.h; then \
236 echo "${DBSYM} $@"; \ 237 echo "${DBSYM} $@"; \
237 ${DBSYM} $@; \ 238 ${DBSYM} $@; \
238 fi 239 fi
239 240
240SYSTEM_LD_HEAD+=${SYSTEM_LD_HEAD_EXTRA} 241SYSTEM_LD_HEAD+=${SYSTEM_LD_HEAD_EXTRA}
241SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_EXTRA} 242SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_EXTRA}
242 243
243## 244##
244## (6) port independent targets and dependencies: assym.h, vers.o 245## (6) port independent targets and dependencies: assym.h, vers.o
245## 246##
246.if !target(assym.h) 247.if !target(assym.h)
247assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS} 248assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS}
248 ${_MKTARGET_CREATE} 249 ${_MKTARGET_CREATE}
249 cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} | \ 250 cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} | \
250 ${GENASSYM} -- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 251 ${GENASSYM} -- ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
251 > assym.h.tmp && \ 252 > assym.h.tmp && \
252 mv -f assym.h.tmp assym.h 253 mv -f assym.h.tmp assym.h
253${MD_SFILES:C/\.[Ss]/.o/} ${SFILES:C/\.[Ss]/.o/}: assym.h 254${MD_SFILES:C/\.[Ss]/.o/} ${SFILES:C/\.[Ss]/.o/}: assym.h
254.endif 255.endif
255 256
256.if !target(vers.o) 257.if !target(vers.o)
257newvers: vers.o 258newvers: vers.o
258vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} $S/conf/newvers.sh $S/conf/osrelease.sh 259vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} $S/conf/newvers.sh $S/conf/osrelease.sh
259 ${_MKMSG_CREATE} vers.c 260 ${_MKMSG_CREATE} vers.c
260 ${HOST_SH} $S/conf/newvers.sh 261 ${HOST_SH} $S/conf/newvers.sh
261 ${_MKTARGET_COMPILE} 262 ${_MKTARGET_COMPILE}
262 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 263 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
263.endif 264.endif
264 265
265.if !target(config_time.h) 266.if !target(config_time.h)
266BUILDSYMLINKS+= config_time.src config_time.h 267BUILDSYMLINKS+= config_time.src config_time.h
267.endif 268.endif
268 269
269.if defined(MEMORY_DISK_IMAGE) 270.if defined(MEMORY_DISK_IMAGE)
270md_root_image.h: ${MEMORY_DISK_IMAGE} 271md_root_image.h: ${MEMORY_DISK_IMAGE}
271 ${_MKTARGET_CREATE} 272 ${_MKTARGET_CREATE}
272 ${TOOL_HEXDUMP} -v -e '"\t" 8/1 "0x%02x, " "\n"' ${.ALLSRC} > ${.TARGET} 273 ${TOOL_HEXDUMP} -v -e '"\t" 8/1 "0x%02x, " "\n"' ${.ALLSRC} > ${.TARGET}
273 274
274# XXX This is only needed when building md_root.o 275# XXX This is only needed when building md_root.o
275CPPFLAGS+= -DMEMORY_DISK_IMAGE 276CPPFLAGS+= -DMEMORY_DISK_IMAGE
276md_root.o: md_root_image.h 277md_root.o: md_root_image.h
277.endif 278.endif
278 279
279# depend on MEMORY_DISK_IMAGE configuration 280# depend on MEMORY_DISK_IMAGE configuration
280md_root.o: Makefile 281md_root.o: Makefile
281 282
282# depend on root or device configuration 283# depend on root or device configuration
283autoconf.o conf.o: Makefile 284autoconf.o conf.o: Makefile
284 285
285# depend on network or filesystem configuration 286# depend on network or filesystem configuration
286uipc_proto.o vfs_conf.o: Makefile 287uipc_proto.o vfs_conf.o: Makefile
287 288
288# depend on maxusers and CPU configuration 289# depend on maxusers and CPU configuration
289assym.h machdep.o: Makefile 290assym.h machdep.o: Makefile
290 291
291## 292##
292## (7) misc targets: install, clean(dir), depend(all), lint, links, tags, 293## (7) misc targets: install, clean(dir), depend(all), lint, links, tags,
293## cscope, mkid 294## cscope, mkid
294## 295##
295## Any ports that have other stuff to be cleaned up should fill in 296## Any ports that have other stuff to be cleaned up should fill in
296## EXTRA_CLEAN. Some ports may want different settings for 297## EXTRA_CLEAN. Some ports may want different settings for
297## KERNLINTFLAGS, MKDEP_CFLAGS, or MKDEP_AFLAGS. 298## KERNLINTFLAGS, MKDEP_CFLAGS, or MKDEP_AFLAGS.
298## 299##
299.if !target(__CLEANKERNEL) 300.if !target(__CLEANKERNEL)
300__CLEANKERNEL: .USE 301__CLEANKERNEL: .USE
301 ${_MKMSG} "${.TARGET}ing the kernel objects" 302 ${_MKMSG} "${.TARGET}ing the kernel objects"
302 rm -f ${KERNELS} eddep tags *.[io] *.ln [a-z]*.s vers.c \ 303 rm -f ${KERNELS} eddep tags *.[io] *.ln [a-z]*.s vers.c \
303 [Ee]rrs linterrs makelinks assym.h.tmp assym.h \ 304 [Ee]rrs linterrs makelinks assym.h.tmp assym.h \
304 ${EXTRA_KERNELS} ${EXTRA_CLEAN} 305 ${EXTRA_KERNELS} ${EXTRA_CLEAN}
305.endif 306.endif
306 307
307.if !target(kernelnames) 308.if !target(kernelnames)
308kernelnames: 309kernelnames:
309 @echo "${KERNELS} ${EXTRA_KERNELS}" 310 @echo "${KERNELS} ${EXTRA_KERNELS}"
310.endif 311.endif
311 312
312.if !target(__CLEANDEPEND) 313.if !target(__CLEANDEPEND)
313__CLEANDEPEND: .USE 314__CLEANDEPEND: .USE
314 echo .depend ${DEPS} | xargs rm -f -- 315 echo .depend ${DEPS} | xargs rm -f --
315.endif 316.endif
316 317
317# do not !target these, the kern and compat Makefiles augment them 318# do not !target these, the kern and compat Makefiles augment them
318cleandir distclean: __CLEANKERNEL __CLEANDEPEND 319cleandir distclean: __CLEANKERNEL __CLEANDEPEND
319clean: __CLEANKERNEL 320clean: __CLEANKERNEL
320depend: .depend 321depend: .depend
321dependall: depend .WAIT all 322dependall: depend .WAIT all
322 323
323.if !target(.depend) 324.if !target(.depend)
324MKDEP_AFLAGS?= ${AFLAGS} 325MKDEP_AFLAGS?= ${AFLAGS}
325MKDEP_CFLAGS?= ${CFLAGS} 326MKDEP_CFLAGS?= ${CFLAGS}
326SSRCS=${MD_SFILES} ${SFILES} 327SSRCS=${MD_SFILES} ${SFILES}
327CSRCS=${MD_CFILES} ${MI_CFILES} ${CFILES} 328CSRCS=${MD_CFILES} ${MI_CFILES} ${CFILES}
328SRCS=${SSRCS} ${CSRCS} 329SRCS=${SSRCS} ${CSRCS}
329DEPS= ${SRCS:T:O:u:R:S/$/.d/g} 330DEPS= ${SRCS:T:O:u:R:S/$/.d/g}
330 331
331.for _s in ${SSRCS} 332.for _s in ${SSRCS}
332${_s:T:R}.d: ${_s} assym.h 333${_s:T:R}.d: ${_s} assym.h
333 ${_MKTARGET_CREATE} 334 ${_MKTARGET_CREATE}
334 ${MKDEP} -f ${.TARGET} -- ${MKDEP_AFLAGS} \ 335 ${MKDEP} -f ${.TARGET} -- ${MKDEP_AFLAGS} \
335 ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s} 336 ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
336.endfor 337.endfor
337.for _s in ${CSRCS} 338.for _s in ${CSRCS}
338${_s:T:R}.d: ${_s} 339${_s:T:R}.d: ${_s}
339 ${_MKTARGET_CREATE} 340 ${_MKTARGET_CREATE}
340 ${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \ 341 ${MKDEP} -f ${.TARGET} -- ${MKDEP_CFLAGS} \
341 ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s} 342 ${CPPFLAGS} ${CPPFLAGS.${_s:T}} ${_s}
342.endfor 343.endfor
343 344
344assym.d: assym.h 345assym.d: assym.h
345 ${_MKTARGET_CREATE} 346 ${_MKTARGET_CREATE}
346 cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} | \ 347 cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} | \
347 ${GENASSYM} -- ${MKDEP} -f assym.dep -- \ 348 ${GENASSYM} -- ${MKDEP} -f assym.dep -- \
348 ${CFLAGS} ${CPPFLAGS} 349 ${CFLAGS} ${CPPFLAGS}
349 ${TOOL_SED} -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >${.TARGET} 350 ${TOOL_SED} -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >${.TARGET}
350 rm -f assym.dep 351 rm -f assym.dep
351 352
352DEPS+= assym.d 353DEPS+= assym.d
353 354
354.depend: ${DEPS} 355.depend: ${DEPS}
355 ${_MKTARGET_CREATE} 356 ${_MKTARGET_CREATE}
356 echo "${.ALLSRC}" | ${MKDEP} -D 357 echo "${.ALLSRC}" | ${MKDEP} -D
357.endif 358.endif
358 359
359.if !target(lint) 360.if !target(lint)
360ALLSFILES?= ${MD_SFILES} ${SFILES} 361ALLSFILES?= ${MD_SFILES} ${SFILES}
361LINTSTUBS?= ${ALLSFILES:T:R:C/^.*$/LintStub_&.c/g} 362LINTSTUBS?= ${ALLSFILES:T:R:C/^.*$/LintStub_&.c/g}
362KERNLINTFLAGS?= -bcehnxzFS 363KERNLINTFLAGS?= -bcehnxzFS
363NORMAL_LN?= ${LINT} ${KERNLINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i $< 364NORMAL_LN?= ${LINT} ${KERNLINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i $<
364 365
365_lsrc=${CFILES} ${LINTSTUBS} ${MI_CFILES} ${MD_CFILES} 366_lsrc=${CFILES} ${LINTSTUBS} ${MI_CFILES} ${MD_CFILES}
366LOBJS?= ${_lsrc:T:S/.c$/.ln/g} ${LIBKERNLN} ${SYSLIBCOMPATLN} 367LOBJS?= ${_lsrc:T:S/.c$/.ln/g} ${LIBKERNLN} ${SYSLIBCOMPATLN}
367 368
368.for _sfile in ${ALLSFILES} 369.for _sfile in ${ALLSFILES}
369LintStub_${_sfile:T:R}.c: ${_sfile} assym.h 370LintStub_${_sfile:T:R}.c: ${_sfile} assym.h
370 ${_MKTARGET_COMPILE} 371 ${_MKTARGET_COMPILE}
371 ${CC} -E -C ${AFLAGS} ${CPPFLAGS} ${_sfile} | \ 372 ${CC} -E -C ${AFLAGS} ${CPPFLAGS} ${_sfile} | \
372 ${TOOL_AWK} -f $S/kern/genlintstub.awk >${.TARGET} 373 ${TOOL_AWK} -f $S/kern/genlintstub.awk >${.TARGET}
373.endfor 374.endfor
374 375
375.for _cfile in ${CFILES} ${LINTSTUBS} ${MI_CFILES} ${MD_CFILES} 376.for _cfile in ${CFILES} ${LINTSTUBS} ${MI_CFILES} ${MD_CFILES}
376${_cfile:T:R}.ln: ${_cfile} 377${_cfile:T:R}.ln: ${_cfile}
377 ${_MKTARGET_COMPILE} 378 ${_MKTARGET_COMPILE}
378 ${NORMAL_LN} 379 ${NORMAL_LN}
379.endfor 380.endfor
380 381
381lint: ${LOBJS} 382lint: ${LOBJS}
382 ${LINT} ${KERNLINTFLAGS} ${CPPFLAGS:M-[IDU]*} ${LOBJS} 383 ${LINT} ${KERNLINTFLAGS} ${CPPFLAGS:M-[IDU]*} ${LOBJS}
383.endif 384.endif
384 385
385# Attempt to do a syntax-only compile of the entire kernel as one entity. 386# Attempt to do a syntax-only compile of the entire kernel as one entity.
386# Alas, bugs in the GCC C frontend prevent this from completely effective 387# Alas, bugs in the GCC C frontend prevent this from completely effective
387# but information can be gleaned from the output. 388# but information can be gleaned from the output.
388syntax-only: ${CFILES} ${MD_CFILES} 389syntax-only: ${CFILES} ${MD_CFILES}
389 ${CC} -fsyntax-only -combine ${CFLAGS} ${CPPFLAGS} \ 390 ${CC} -fsyntax-only -combine ${CFLAGS} ${CPPFLAGS} \
390 ${CFILES} ${MD_CFILES} 391 ${CFILES} ${MD_CFILES}
391 392
392# List of kernel images that will be installed into the root file system. 393# List of kernel images that will be installed into the root file system.
393# Some platforms may need to install more than one (e.g. a netbsd.aout file 394# Some platforms may need to install more than one (e.g. a netbsd.aout file
394# to be loaded directly by the firmware), so this can be overriden by them. 395# to be loaded directly by the firmware), so this can be overriden by them.
395KERNIMAGES?= netbsd 396KERNIMAGES?= netbsd
396 397
397.if !target(install) 398.if !target(install)
398# The install target can be redefined by putting a 399# The install target can be redefined by putting a
399# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 400# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
400MACHINE_NAME!= uname -n 401MACHINE_NAME!= uname -n
401install: install-kernel-${MACHINE_NAME} 402install: install-kernel-${MACHINE_NAME}
402.if !target(install-kernel-${MACHINE_NAME}) 403.if !target(install-kernel-${MACHINE_NAME})
403install-kernel-${MACHINE_NAME}: 404install-kernel-${MACHINE_NAME}:
404.for _K in ${KERNIMAGES} 405.for _K in ${KERNIMAGES}
405 rm -f ${DESTDIR}/o${_K} 406 rm -f ${DESTDIR}/o${_K}
406 ln ${DESTDIR}/${_K} ${DESTDIR}/o${_K} 407 ln ${DESTDIR}/${_K} ${DESTDIR}/o${_K}
407 cp ${_K} ${DESTDIR}/n${_K} 408 cp ${_K} ${DESTDIR}/n${_K}
408 mv ${DESTDIR}/n${_K} ${DESTDIR}/${_K} 409 mv ${DESTDIR}/n${_K} ${DESTDIR}/${_K}
409.endfor 410.endfor
410.endif 411.endif
411.endif 412.endif
412 413
413.if !target(tags) 414.if !target(tags)
414tags: 415tags:
415 @echo "see $S/kern/Makefile for tags" 416 @echo "see $S/kern/Makefile for tags"
416.endif 417.endif
417 418
418EXTRA_CLEAN+= cscope.out cscope.tmp 419EXTRA_CLEAN+= cscope.out cscope.tmp
419.if !target(cscope.out) 420.if !target(cscope.out)
420cscope.out: Makefile depend 421cscope.out: Makefile depend
421 ${_MKTARGET_CREATE} 422 ${_MKTARGET_CREATE}
422 @${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\ *$$//;' lib/kern/.depend \ 423 @${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\ *$$//;' lib/kern/.depend \
423 | tr -s ' ' '\n' \ 424 | tr -s ' ' '\n' \
424 | ${TOOL_SED} 's|^\([^.\\]\)|lib/kern/\1|;s|^../../||;' \ 425 | ${TOOL_SED} 's|^\([^.\\]\)|lib/kern/\1|;s|^../../||;' \
425 > cscope.tmp 426 > cscope.tmp
426 @${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\ *$$//;' lib/compat/.depend \ 427 @${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\ *$$//;' lib/compat/.depend \
427 | tr -s ' ' '\n' \ 428 | tr -s ' ' '\n' \
428 | ${TOOL_SED} 's|^\([^.\\]\)|lib/compat/\1|;s|^../../||;' \ 429 | ${TOOL_SED} 's|^\([^.\\]\)|lib/compat/\1|;s|^../../||;' \
429 >> cscope.tmp 430 >> cscope.tmp
430 @echo ${SRCS} | cat - cscope.tmp | tr -s ' ' '\n' | sort -u | \ 431 @echo ${SRCS} | cat - cscope.tmp | tr -s ' ' '\n' | sort -u | \
431 ${CSCOPE} -k -i - -b `echo ${INCLUDES} | ${TOOL_SED} s/-nostdinc//` 432 ${CSCOPE} -k -i - -b `echo ${INCLUDES} | ${TOOL_SED} s/-nostdinc//`
432# cscope doesn't write cscope.out if it's uptodate, so ensure 433# cscope doesn't write cscope.out if it's uptodate, so ensure
433# make doesn't keep calling cscope when not needed. 434# make doesn't keep calling cscope when not needed.
434 @rm -f cscope.tmp; touch cscope.out 435 @rm -f cscope.tmp; touch cscope.out
435.endif 436.endif
436 437
437.if !target(cscope) 438.if !target(cscope)
438cscope: cscope.out 439cscope: cscope.out
439 @${CSCOPE} -d 440 @${CSCOPE} -d
440.endif 441.endif
441 442
442EXTRA_CLEAN+= ID 443EXTRA_CLEAN+= ID
443.if !target(mkid) 444.if !target(mkid)
444.PHONY: mkid 445.PHONY: mkid
445mkid: ID 446mkid: ID
446 447
447ID: Makefile depend 448ID: Makefile depend
448 ${_MKTARGET_CREATE} 449 ${_MKTARGET_CREATE}
449 @${MKID} \ 450 @${MKID} \
450 `${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\\\ *$$//;' \ 451 `${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\\\ *$$//;' \
451 lib/kern/.depend lib/compat/.depend \ 452 lib/kern/.depend lib/compat/.depend \
452 | tr ' ' '\n' \ 453 | tr ' ' '\n' \
453 | ${TOOL_SED} "s|^../../||" \ 454 | ${TOOL_SED} "s|^../../||" \
454 | sort -u` \ 455 | sort -u` \
455 `${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\\\ *$$//;' \ 456 `${TOOL_SED} 's/[^:]*://;s/^ *//;s/ *\\\\ *$$//;' \
456 .depend \ 457 .depend \
457 | tr ' ' '\n' \ 458 | tr ' ' '\n' \
458 | sort -u` 459 | sort -u`
459 460
460.endif 461.endif
461 462
462.include "${S}/gdbscripts/Makefile.inc" 463.include "${S}/gdbscripts/Makefile.inc"
463 464
464EXTRA_CLEAN+= .gdbinit 465EXTRA_CLEAN+= .gdbinit
465.gdbinit: Makefile ${S}/gdbscripts/Makefile.inc 466.gdbinit: Makefile ${S}/gdbscripts/Makefile.inc
466 ${_MKTARGET_CREATE} 467 ${_MKTARGET_CREATE}
467 rm -f .gdbinit 468 rm -f .gdbinit
468.for __gdbinit in ${SYS_GDBINIT} 469.for __gdbinit in ${SYS_GDBINIT}
469 echo "source ${S}/gdbscripts/${__gdbinit}" >> .gdbinit 470 echo "source ${S}/gdbscripts/${__gdbinit}" >> .gdbinit
470.endfor 471.endfor
471.if defined(GDBINIT) && !empty(GDBINIT) 472.if defined(GDBINIT) && !empty(GDBINIT)
472.for __gdbinit in ${GDBINIT} 473.for __gdbinit in ${GDBINIT}
473 echo "source ${__gdbinit}" >> .gdbinit 474 echo "source ${__gdbinit}" >> .gdbinit
474.endfor 475.endfor
475.endif 476.endif
476 477
477# The following files use alloca(3) or variable array allocations. 478# The following files use alloca(3) or variable array allocations.
478# Their full name is noted as documentation. 479# Their full name is noted as documentation.
479VARSTACK=dev/cgd.c kern/uipc_socket.c miscfs/genfs/genfs_vnops.c \ 480VARSTACK=dev/cgd.c kern/uipc_socket.c miscfs/genfs/genfs_vnops.c \
480 nfs/nfs_bio.c uvm/uvm_bio.c \ 481 nfs/nfs_bio.c uvm/uvm_bio.c \
481 uvm/uvm_pager.c dev/ic/aic7xxx.c dev/ic/aic79xx.c arch/xen/i386/gdt.c \ 482 uvm/uvm_pager.c dev/ic/aic7xxx.c dev/ic/aic79xx.c arch/xen/i386/gdt.c \
482 dev/ofw/ofw_subr.c 483 dev/ofw/ofw_subr.c
483 484
484. if (defined(HAVE_GCC) && ${HAVE_GCC} > 3) || defined(HAVE_PCC) 485. if (defined(HAVE_GCC) && ${HAVE_GCC} > 3) || defined(HAVE_PCC)
485.for __varstack in ${VARSTACK} 486.for __varstack in ${VARSTACK}
486COPTS.${__varstack:T} += -Wno-stack-protector 487COPTS.${__varstack:T} += -Wno-stack-protector
487.endfor 488.endfor
488.endif 489.endif
489 490
490AFLAGS+= ${AOPTS.${.IMPSRC:T}} 491AFLAGS+= ${AOPTS.${.IMPSRC:T}}
491CFLAGS+= ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} 492CFLAGS+= ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}}
492CPPFLAGS+= ${CPPFLAGS.${.IMPSRC:T}} 493CPPFLAGS+= ${CPPFLAGS.${.IMPSRC:T}}
493CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} 494CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}}
494 495
495.include <bsd.files.mk> 496.include <bsd.files.mk>
496 497
497## 498##
498## the end 499## the end
499## 500##

cvs diff -r1.924 -r1.924.4.1 src/sys/conf/files (switch to unified diff)

--- src/sys/conf/files 2008/10/15 06:51:20 1.924
+++ src/sys/conf/files 2009/03/15 19:43:48 1.924.4.1
@@ -1,1636 +1,1637 @@ @@ -1,1636 +1,1637 @@
1# $NetBSD: files,v 1.924 2008/10/15 06:51:20 wrstuden Exp $ 1# $NetBSD: files,v 1.924.4.1 2009/03/15 19:43:48 snj Exp $
2 2
3# @(#)files.newconf 7.5 (Berkeley) 5/10/93 3# @(#)files.newconf 7.5 (Berkeley) 5/10/93
4 4
5version 20080610 5version 20080610
6 6
7# 7#
8# device classes 8# device classes
9# 9#
10devclass disk 10devclass disk
11devclass tape 11devclass tape
12devclass ifnet 12devclass ifnet
13devclass tty 13devclass tty
14devclass audiodev 14devclass audiodev
15devclass displaydev 15devclass displaydev
16devclass bus 16devclass bus
17 17
18# options understood by the machine-independent part of the kernel 18# options understood by the machine-independent part of the kernel
19# (note, these are case-sensitive) 19# (note, these are case-sensitive)
20# 20#
21defflag INSECURE 21defflag INSECURE
22defflag KMEMSTATS 22defflag KMEMSTATS
23defflag KTRACE 23defflag KTRACE
24defflag MBUFTRACE 24defflag MBUFTRACE
25defflag PTRACE 25defflag PTRACE
26defflag COREDUMP 26defflag COREDUMP
27defflag opt_modular.h MODULAR 27defflag opt_modular.h MODULAR
28 28
29defparam DEFCORENAME 29defparam DEFCORENAME
30defparam HZ 30defparam HZ
31defparam MAXUPRC 31defparam MAXUPRC
32defparam RTC_OFFSET 32defparam RTC_OFFSET
33defflag opt_pipe.h PIPE_SOCKETPAIR PIPE_NODIRECT 33defflag opt_pipe.h PIPE_SOCKETPAIR PIPE_NODIRECT
34 34
35defflag BUFQ_DISKSORT 35defflag BUFQ_DISKSORT
36defflag BUFQ_FCFS 36defflag BUFQ_FCFS
37defflag BUFQ_PRIOCSCAN 37defflag BUFQ_PRIOCSCAN
38defflag BUFQ_READPRIO 38defflag BUFQ_READPRIO
39defflag NEW_BUFQ_STRATEGY # same as BUFQ_READPRIO 39defflag NEW_BUFQ_STRATEGY # same as BUFQ_READPRIO
40 40
41defflag opt_sched.h SCHED_4BSD 41defflag opt_sched.h SCHED_4BSD
42defflag opt_sched.h SCHED_M2 42defflag opt_sched.h SCHED_M2
43 43
44defparam SOMAXKVA 44defparam SOMAXKVA
45defflag opt_sock_counters.h SOSEND_COUNTERS 45defflag opt_sock_counters.h SOSEND_COUNTERS
46defflag opt_sosend_loan.h SOSEND_NO_LOAN 46defflag opt_sosend_loan.h SOSEND_NO_LOAN
47defflag opt_route.h RTCACHE_DEBUG RTFLUSH_DEBUG 47defflag opt_route.h RTCACHE_DEBUG RTFLUSH_DEBUG
48 48
49defflag MULTIPROCESSOR 49defflag MULTIPROCESSOR
50 50
51defflag opt_config.h INCLUDE_CONFIG_FILE INCLUDE_JUST_CONFIG 51defflag opt_config.h INCLUDE_CONFIG_FILE INCLUDE_JUST_CONFIG
52 52
53defparam opt_dump.h DUMP_ON_PANIC 53defparam opt_dump.h DUMP_ON_PANIC
54 54
55defflag opt_callout.h CALLWHEEL_STATS 55defflag opt_callout.h CALLWHEEL_STATS
56 56
57defflag CPU_IN_CKSUM 57defflag CPU_IN_CKSUM
58 58
59defflag opt_posix.h P1003_1B_SEMAPHORE 59defflag opt_posix.h P1003_1B_SEMAPHORE
60defflag opt_sysv.h SYSVMSG SYSVSEM SYSVSHM 60defflag opt_sysv.h SYSVMSG SYSVSEM SYSVSHM
61defparam opt_sysvparam.h SHMMAXPGS SEMMNI SEMMNS SEMUME SEMMNU 61defparam opt_sysvparam.h SHMMAXPGS SEMMNI SEMMNS SEMUME SEMMNU
62 62
63defflag opt_ntp.h PPS_SYNC NTP 63defflag opt_ntp.h PPS_SYNC NTP
64 64
65defflag opt_ptm.h NO_DEV_PTM COMPAT_BSDPTY 65defflag opt_ptm.h NO_DEV_PTM COMPAT_BSDPTY
66 66
67defparam opt_kmempages.h NKMEMPAGES NKMEMPAGES_MIN NKMEMPAGES_MAX 67defparam opt_kmempages.h NKMEMPAGES NKMEMPAGES_MIN NKMEMPAGES_MAX
68defflag opt_malloclog.h MALLOCLOG 68defflag opt_malloclog.h MALLOCLOG
69defparam opt_malloclog.h MALLOCLOGSIZE 69defparam opt_malloclog.h MALLOCLOGSIZE
70defflag opt_malloc_debug.h MALLOC_DEBUG 70defflag opt_malloc_debug.h MALLOC_DEBUG
71defflag opt_pool.h POOL_DIAGNOSTIC 71defflag opt_pool.h POOL_DIAGNOSTIC
72defparam opt_poollog.h POOL_LOGSIZE 72defparam opt_poollog.h POOL_LOGSIZE
73defflag opt_powerhook.h POWERHOOK_DEBUG 73defflag opt_powerhook.h POWERHOOK_DEBUG
74 74
75defflag opt_revcache.h NAMECACHE_ENTER_REVERSE 75defflag opt_revcache.h NAMECACHE_ENTER_REVERSE
76 76
77defflag opt_execfmt.h EXEC_AOUT EXEC_COFF EXEC_ECOFF EXEC_ELF32 77defflag opt_execfmt.h EXEC_AOUT EXEC_COFF EXEC_ECOFF EXEC_ELF32
78 EXEC_ELF64 EXEC_MACHO EXEC_SCRIPT 78 EXEC_ELF64 EXEC_MACHO EXEC_SCRIPT
79 EXEC_ELF_NOTELESS 79 EXEC_ELF_NOTELESS
80 80
81defflag opt_dkwedge.h DKWEDGE_AUTODISCOVER 81defflag opt_dkwedge.h DKWEDGE_AUTODISCOVER
82 DKWEDGE_METHOD_BSDLABEL 82 DKWEDGE_METHOD_BSDLABEL
83 DKWEDGE_METHOD_GPT 83 DKWEDGE_METHOD_GPT
84 DKWEDGE_METHOD_MBR 84 DKWEDGE_METHOD_MBR
85 85
86defflag opt_veriexec.h VERIFIED_EXEC_FP_SHA1 86defflag opt_veriexec.h VERIFIED_EXEC_FP_SHA1
87 VERIFIED_EXEC_FP_SHA256 87 VERIFIED_EXEC_FP_SHA256
88 VERIFIED_EXEC_FP_SHA384 88 VERIFIED_EXEC_FP_SHA384
89 VERIFIED_EXEC_FP_SHA512 89 VERIFIED_EXEC_FP_SHA512
90 VERIFIED_EXEC_FP_MD5 90 VERIFIED_EXEC_FP_MD5
91 VERIFIED_EXEC_FP_RMD160 91 VERIFIED_EXEC_FP_RMD160
92 92
93# Per system call number counts and times 93# Per system call number counts and times
94defflag opt_syscall_stats.h SYSCALL_STATS 94defflag opt_syscall_stats.h SYSCALL_STATS
95defflag opt_syscall_stats.h SYSCALL_TIMES: SYSCALL_STATS  95defflag opt_syscall_stats.h SYSCALL_TIMES: SYSCALL_STATS
96# Assume cpu_hascounter() returns true - to use disabled rdtsc() (for soekris) 96# Assume cpu_hascounter() returns true - to use disabled rdtsc() (for soekris)
97defflag opt_syscall_stats.h SYSCALL_TIMES_HASCOUNTER: SYSCALL_TIMES  97defflag opt_syscall_stats.h SYSCALL_TIMES_HASCOUNTER: SYSCALL_TIMES
98file kern/subr_syscall_stats.c syscall_stats 98file kern/subr_syscall_stats.c syscall_stats
99 99
100defparam opt_pax.h PAX_MPROTECT 100defparam opt_pax.h PAX_MPROTECT
101 PAX_SEGVGUARD 101 PAX_SEGVGUARD
102 PAX_ASLR 102 PAX_ASLR
103 PAX_ASLR_DELTA_MMAP_LSB 103 PAX_ASLR_DELTA_MMAP_LSB
104 PAX_ASLR_DELTA_MMAP_LEN 104 PAX_ASLR_DELTA_MMAP_LEN
105 PAX_ASLR_DELTA_STACK_LSB 105 PAX_ASLR_DELTA_STACK_LSB
106 PAX_ASLR_DELTA_STACK_LEN 106 PAX_ASLR_DELTA_STACK_LEN
107 PAX_ASLR_DELTA_PROG_LEN 107 PAX_ASLR_DELTA_PROG_LEN
108 108
109defflag opt_fileassoc.h FILEASSOC 109defflag opt_fileassoc.h FILEASSOC
110 110
111defflag opt_gre.h GRE_DEBUG 111defflag opt_gre.h GRE_DEBUG
112 112
113# Write Ahead Physical Block Logging 113# Write Ahead Physical Block Logging
114defflag opt_wapbl.h WAPBL WAPBL_DEBUG 114defflag opt_wapbl.h WAPBL WAPBL_DEBUG
115defparam opt_wapbl.h WAPBL_DEBUG_PRINT 115defparam opt_wapbl.h WAPBL_DEBUG_PRINT
116 116
117# compatibility options 117# compatibility options
118# 118#
119defflag opt_sa.h KERN_SA 119defflag opt_sa.h KERN_SA
120defflag opt_compat_netbsd.h COMPAT_40: KERN_SA 120defflag opt_compat_netbsd.h COMPAT_40: KERN_SA
121defflag opt_compat_netbsd.h COMPAT_30: COMPAT_40 121defflag opt_compat_netbsd.h COMPAT_30: COMPAT_40
122defflag opt_compat_netbsd.h COMPAT_20: COMPAT_30 122defflag opt_compat_netbsd.h COMPAT_20: COMPAT_30
123defflag opt_compat_netbsd.h COMPAT_16: COMPAT_20 123defflag opt_compat_netbsd.h COMPAT_16: COMPAT_20
124defflag opt_compat_netbsd.h COMPAT_15: COMPAT_16 124defflag opt_compat_netbsd.h COMPAT_15: COMPAT_16
125defflag opt_compat_netbsd.h COMPAT_14: COMPAT_15 125defflag opt_compat_netbsd.h COMPAT_14: COMPAT_15
126defflag opt_compat_netbsd.h COMPAT_13: COMPAT_14 126defflag opt_compat_netbsd.h COMPAT_13: COMPAT_14
127defflag opt_compat_netbsd.h COMPAT_12: COMPAT_13 127defflag opt_compat_netbsd.h COMPAT_12: COMPAT_13
128defflag opt_compat_netbsd.h COMPAT_11: COMPAT_12 128defflag opt_compat_netbsd.h COMPAT_11: COMPAT_12
129defflag opt_compat_netbsd.h COMPAT_10: COMPAT_11 129defflag opt_compat_netbsd.h COMPAT_10: COMPAT_11
130defflag opt_compat_netbsd.h COMPAT_09: COMPAT_10 130defflag opt_compat_netbsd.h COMPAT_09: COMPAT_10
131defflag COMPAT_OSSAUDIO 131defflag COMPAT_OSSAUDIO
132defflag COMPAT_FREEBSD: COMPAT_30 132defflag COMPAT_FREEBSD: COMPAT_30
133defflag COMPAT_IBCS2 133defflag COMPAT_IBCS2
134defflag COMPAT_IRIX 134defflag COMPAT_IRIX
135defflag COMPAT_LINUX 135defflag COMPAT_LINUX
136defflag COMPAT_LINUX32 136defflag COMPAT_LINUX32
137defflag COMPAT_OSF1 137defflag COMPAT_OSF1
138defflag COMPAT_SUNOS: COMPAT_30 138defflag COMPAT_SUNOS: COMPAT_30
139defflag opt_compat_svr4.h COMPAT_SVR4 COMPAT_SVR4_32 SVR4_COMPAT_SOLARIS2 139defflag opt_compat_svr4.h COMPAT_SVR4 COMPAT_SVR4_32 SVR4_COMPAT_SOLARIS2
140defflag COMPAT_ULTRIX 140defflag COMPAT_ULTRIX
141defflag COMPAT_NETBSD32 141defflag COMPAT_NETBSD32
142defflag COMPAT_AOUT_M68K: COMPAT_40 142defflag COMPAT_AOUT_M68K: COMPAT_40
143defflag COMPAT_M68K4K 143defflag COMPAT_M68K4K
144defflag COMPAT_MACH 144defflag COMPAT_MACH
145defflag COMPAT_DARWIN 145defflag COMPAT_DARWIN
146defflag COMPAT_VAX1K 146defflag COMPAT_VAX1K
147defflag COMPAT_43 147defflag COMPAT_43
148defflag COMPAT_PECOFF 148defflag COMPAT_PECOFF
149defflag opt_compat_netbsd.h COMPAT_NOMID 149defflag opt_compat_netbsd.h COMPAT_NOMID
150 150
151# 151#
152# Cryptography support. Include this early, since several things 152# Cryptography support. Include this early, since several things
153# use it. 153# use it.
154 154
155# Individual crypto transforms 155# Individual crypto transforms
156include "crypto/arc4/files.arc4" 156include "crypto/arc4/files.arc4"
157include "crypto/des/files.des" 157include "crypto/des/files.des"
158include "crypto/blowfish/files.blowfish" 158include "crypto/blowfish/files.blowfish"
159include "crypto/cast128/files.cast128" 159include "crypto/cast128/files.cast128"
160include "crypto/rijndael/files.rijndael" 160include "crypto/rijndael/files.rijndael"
161include "crypto/skipjack/files.skipjack" 161include "crypto/skipjack/files.skipjack"
162 162
163# General-purpose crypto processing framework. 163# General-purpose crypto processing framework.
164include "opencrypto/files.opencrypto" 164include "opencrypto/files.opencrypto"
165 165
166# 166#
167# System monitoring framework 167# System monitoring framework
168# 168#
169include "dev/sysmon/files.sysmon" 169include "dev/sysmon/files.sysmon"
170 170
171# 171#
172# Networking protocols 172# Networking protocols
173# 173#
174include "net80211/files.net80211" 174include "net80211/files.net80211"
175include "netatalk/files.netatalk" 175include "netatalk/files.netatalk"
176include "netbt/files.netbt" 176include "netbt/files.netbt"
177include "netinet/files.netinet" 177include "netinet/files.netinet"
178include "netinet/files.ipfilter" 178include "netinet/files.ipfilter"
179include "netinet6/files.netinet6" 179include "netinet6/files.netinet6"
180include "netinet6/files.ipsec" 180include "netinet6/files.ipsec"
181include "netipsec/files.netipsec" 181include "netipsec/files.netipsec"
182include "netiso/files.netiso" 182include "netiso/files.netiso"
183include "netnatm/files.netnatm" 183include "netnatm/files.netnatm"
184include "netsmb/files.netsmb" 184include "netsmb/files.netsmb"
185include "net/files.pf" 185include "net/files.pf"
186 186
187obsolete defflag CCITT # obsolete 187obsolete defflag CCITT # obsolete
188obsolete defflag HDLC # obsolete 188obsolete defflag HDLC # obsolete
189obsolete defflag LLC # obsolete 189obsolete defflag LLC # obsolete
190obsolete defflag opt_ns.h NS NSIP # obsolete 190obsolete defflag opt_ns.h NS NSIP # obsolete
191obsolete defflag IPX # obsolete 191obsolete defflag IPX # obsolete
192obsolete defflag opt_iso.h TPCONS 192obsolete defflag opt_iso.h TPCONS
193defflag PFIL_HOOKS # pfil(9) 193defflag PFIL_HOOKS # pfil(9)
194defflag opt_bridge_ipf.h BRIDGE_IPF # bridge(4) use inet_pfil_hooks 194defflag opt_bridge_ipf.h BRIDGE_IPF # bridge(4) use inet_pfil_hooks
195defflag opt_ppp.h PPP_DEFLATE PPP_BSDCOMP PPP_FILTER 195defflag opt_ppp.h PPP_DEFLATE PPP_BSDCOMP PPP_FILTER
196 # Include deflate or bsd 196 # Include deflate or bsd
197 # compression, enable pppd 197 # compression, enable pppd
198 # packet filtering support 198 # packet filtering support
199defflag opt_pppoe.h PPPOE_SERVER PPPOE_TERM_UNKNOWN_SESSIONS 199defflag opt_pppoe.h PPPOE_SERVER PPPOE_TERM_UNKNOWN_SESSIONS
200 200
201# networking options 201# networking options
202# 202#
203defflag GATEWAY 203defflag GATEWAY
204defparam opt_nmbclusters.h NMBCLUSTERS 204defparam opt_nmbclusters.h NMBCLUSTERS
205defparam SB_MAX 205defparam SB_MAX
206 206
207# file system options 207# file system options
208# 208#
209defflag SOFTDEP # XXX files.ufs? 209defflag SOFTDEP # XXX files.ufs?
210defflag QUOTA # XXX files.ufs? 210defflag QUOTA # XXX files.ufs?
211defflag VNODE_LOCKDEBUG 211defflag VNODE_LOCKDEBUG
212defflag MAGICLINKS 212defflag MAGICLINKS
213 213
214# buffer cache size options 214# buffer cache size options
215# 215#
216defparam opt_bufcache.h BUFCACHE BUFPAGES 216defparam opt_bufcache.h BUFCACHE BUFPAGES
217 217
218# userconf 218# userconf
219# 219#
220defflag USERCONF 220defflag USERCONF
221 221
222# sysctl related 222# sysctl related
223# 223#
224defflag opt_sysctl.h SYSCTL_DISALLOW_CREATE SYSCTL_DISALLOW_KWRITE 224defflag opt_sysctl.h SYSCTL_DISALLOW_CREATE SYSCTL_DISALLOW_KWRITE
225 SYSCTL_DEBUG_SETUP SYSCTL_DEBUG_CREATE 225 SYSCTL_DEBUG_SETUP SYSCTL_DEBUG_CREATE
226 SYSCTL_INCLUDE_DESCR 226 SYSCTL_INCLUDE_DESCR
227 227
228# 228#
229# Not entirely MI, but present on multiple arch's 229# Not entirely MI, but present on multiple arch's
230# 230#
231 231
232# PC-style MBR handling 232# PC-style MBR handling
233# 233#
234defflag opt_mbr.h COMPAT_386BSD_MBRPART 234defflag opt_mbr.h COMPAT_386BSD_MBRPART
235 235
236# 236#
237# debugging options 237# debugging options
238# 238#
239include "ddb/files.ddb" # in-kernel dynamic debugger 239include "ddb/files.ddb" # in-kernel dynamic debugger
240 240
241defflag opt_kgdb.h KGDB 241defflag opt_kgdb.h KGDB
242defparam opt_kgdb.h KGDB_DEV KGDB_DEVNAME KGDB_DEVPORT 242defparam opt_kgdb.h KGDB_DEV KGDB_DEVNAME KGDB_DEVPORT
243 KGDB_DEVADDR KGDB_DEVRATE KGDB_DEVMODE 243 KGDB_DEVADDR KGDB_DEVRATE KGDB_DEVMODE
244defflag LOCKDEBUG 244defflag LOCKDEBUG
245defflag SYSCALL_DEBUG 245defflag SYSCALL_DEBUG
246defflag opt_kstack.h KSTACK_CHECK_MAGIC 246defflag opt_kstack.h KSTACK_CHECK_MAGIC
247 247
248# memory (ram) disk options 248# memory (ram) disk options
249# 249#
250defflag opt_md.h MEMORY_DISK_HOOKS MEMORY_DISK_IS_ROOT 250defflag opt_md.h MEMORY_DISK_HOOKS MEMORY_DISK_IS_ROOT
251 MEMORY_DISK_DYNAMIC 251 MEMORY_DISK_DYNAMIC
252defparam opt_md.h MEMORY_DISK_SERVER=1 MEMORY_DISK_ROOT_SIZE 252defparam opt_md.h MEMORY_DISK_SERVER=1 MEMORY_DISK_ROOT_SIZE
253 MEMORY_RBFLAGS 253 MEMORY_RBFLAGS
254 254
255defflag opt_tftproot.h TFTPROOT TFTPROOT_DEBUG 255defflag opt_tftproot.h TFTPROOT TFTPROOT_DEBUG
256 256
257# Support for hardware performance monitoring counters 257# Support for hardware performance monitoring counters
258# 258#
259defflag opt_perfctrs.h PERFCTRS 259defflag opt_perfctrs.h PERFCTRS
260 260
261# Machine-independent device majors assignements 261# Machine-independent device majors assignements
262include "conf/majors" 262include "conf/majors"
263 263
264# generic attributes 264# generic attributes
265# 265#
266define audiobus { } 266define audiobus { }
267define midibus { } 267define midibus { }
268define midisyn 268define midisyn
269define videobus { } 269define videobus { }
270define ata {[channel = -1]} 270define ata {[channel = -1]}
271define sata 271define sata
272define scsi_core 272define scsi_core
273define scsi {[channel = -1]}: scsi_core 273define scsi {[channel = -1]}: scsi_core
274define ata_hl {[drive = -1]} 274define ata_hl {[drive = -1]}
275define atapi { } 275define atapi { }
276define radiodev { } 276define radiodev { }
277define gpibdev {[address = -1]} 277define gpibdev {[address = -1]}
278define gpiobus { } 278define gpiobus { }
279define onewirebus { } 279define onewirebus { }
280define pckbport {[slot = -1]} 280define pckbport {[slot = -1]}
281define pckbport_machdep_cnattach 281define pckbport_machdep_cnattach
282define firmload 282define firmload
283 283
284# audio device attributes 284# audio device attributes
285# 285#
286define mulaw 286define mulaw
287define auconv 287define auconv
288define aurateconv 288define aurateconv
289 289
290# audio and midi devices, attaches to audio hardware driver 290# audio and midi devices, attaches to audio hardware driver
291# 291#
292device audio: audiodev 292device audio: audiodev
293attach audio at audiobus 293attach audio at audiobus
294device midi 294device midi
295attach midi at midibus 295attach midi at midibus
296 296
297# console bell via audio device 297# console bell via audio device
298# 298#
299define audiobell 299define audiobell
300 300
301# video devices, attaches to video hardware driver 301# video devices, attaches to video hardware driver
302# 302#
303device video 303device video
304attach video at videobus 304attach video at videobus
305 305
306# National Semiconductor LM7[89] 306# National Semiconductor LM7[89]
307# 307#
308# (included here so files.i2c can define an attachment) 308# (included here so files.i2c can define an attachment)
309 309
310device lm: sysmon_envsys 310device lm: sysmon_envsys
311file dev/ic/nslm7x.c lm needs-flag 311file dev/ic/nslm7x.c lm needs-flag
312 312
313# I2C device support 313# I2C device support
314include "dev/i2c/files.i2c" 314include "dev/i2c/files.i2c"
315 315
316# SPI device support 316# SPI device support
317include "dev/spi/files.spi" 317include "dev/spi/files.spi"
318 318
319# IR device support 319# IR device support
320include "dev/ir/files.ir" 320include "dev/ir/files.ir"
321 321
322# Parallel Port Bus support 322# Parallel Port Bus support
323include "dev/ppbus/files.ppbus" 323include "dev/ppbus/files.ppbus"
324 324
325# raster operations attributes 325# raster operations attributes
326# 326#
327define rasops1 327define rasops1
328define rasops2 328define rasops2
329define rasops4 329define rasops4
330define rasops8 330define rasops8
331define rasops15 331define rasops15
332define rasops16 332define rasops16
333define rasops24 333define rasops24
334define rasops32 334define rasops32
335define rasops_rotation 335define rasops_rotation
336 336
337# splash screen support 337# splash screen support
338include "dev/splash/files.splash" 338include "dev/splash/files.splash"
339 339
340# videomode support 340# videomode support
341include "dev/videomode/files.videomode" 341include "dev/videomode/files.videomode"
342 342
343# net device attributes - we have generic code for arc(net), ether(net), 343# net device attributes - we have generic code for arc(net), ether(net),
344# fddi, token ring, atm and eco(net). 344# fddi, token ring, atm and eco(net).
345# 345#
346define arcnet 346define arcnet
347define atm 347define atm
348define eco 348define eco
349define ether 349define ether
350define fddi 350define fddi
351define hippi 351define hippi
352define ieee1394 352define ieee1394
353define token 353define token
354define sppp 354define sppp
355define wlan: arc4, rijndael 355define wlan: arc4, rijndael
356define crypto 356define crypto
357 357
358# devices ARPing IPv4 pull this in: 358# devices ARPing IPv4 pull this in:
359# 359#
360define arp 360define arp
361 361
362# 362#
363# ALTQ network traffic shaping subsystem 363# ALTQ network traffic shaping subsystem
364# 364#
365include "altq/files.altq" 365include "altq/files.altq"
366 366
367# 367#
368# IPKDB kernel debugger 368# IPKDB kernel debugger
369# 369#
370include "ipkdb/files.ipkdb" 370include "ipkdb/files.ipkdb"
371 371
372# Logical disk 372# Logical disk
373# 373#
374device ld: disk 374device ld: disk
375file dev/ld.c ld needs-flag 375file dev/ld.c ld needs-flag
376 376
377# 377#
378# MII/PHY support for network devices 378# MII/PHY support for network devices
379# 379#
380include "dev/mii/files.mii" 380include "dev/mii/files.mii"
381 381
382# 382#
383# RAIDframe 383# RAIDframe
384# 384#
385include "dev/raidframe/files.raidframe" 385include "dev/raidframe/files.raidframe"
386 386
387# 387#
388# Hardware-assisted data mover API 388# Hardware-assisted data mover API
389# 389#
390include "dev/dmover/files.dmover" 390include "dev/dmover/files.dmover"
391 391
392# 392#
393# "Chipset" drivers. These are the bus-independent routines which 393# "Chipset" drivers. These are the bus-independent routines which
394# contain the cfdrivers. Attachments are provided by files.<bus> 394# contain the cfdrivers. Attachments are provided by files.<bus>
395# 395#
396 396
397# Adaptec AIC-6[32]60 ICs 397# Adaptec AIC-6[32]60 ICs
398# 398#
399device aic: scsi 399device aic: scsi
400file dev/ic/aic6360.c aic 400file dev/ic/aic6360.c aic
401 401
402# SMC 93Cx6 Serial EEPROM devices 402# SMC 93Cx6 Serial EEPROM devices
403# 403#
404define smc93cx6 404define smc93cx6
405file dev/ic/smc93cx6.c smc93cx6 405file dev/ic/smc93cx6.c smc93cx6
406 406
407# Adaptec 2[789]4X, 394X, aic7770 and aic78[5678]0 SCSI controllers 407# Adaptec 2[789]4X, 394X, aic7770 and aic78[5678]0 SCSI controllers
408# 408#
409defparam opt_ahc.h AHC_DEBUG 409defparam opt_ahc.h AHC_DEBUG
410defflag opt_ahc.h AHC_NO_TAGS 410defflag opt_ahc.h AHC_NO_TAGS
411device ahc: scsi 411device ahc: scsi
412define ahc_seeprom 412define ahc_seeprom
413define ahc_aic77xx 413define ahc_aic77xx
414file dev/ic/aic7xxx.c ahc 414file dev/ic/aic7xxx.c ahc
415file dev/ic/aic7xxx_osm.c ahc 415file dev/ic/aic7xxx_osm.c ahc
416file dev/ic/aic7xxx_seeprom.c ahc_seeprom 416file dev/ic/aic7xxx_seeprom.c ahc_seeprom
417file dev/ic/aic77xx.c ahc_aic77xx 417file dev/ic/aic77xx.c ahc_aic77xx
418 418
419# Adaptec aic79xx SCSI controllers 419# Adaptec aic79xx SCSI controllers
420defflag opt_ahd.h AHD_DEBUG 420defflag opt_ahd.h AHD_DEBUG
421device ahd: scsi 421device ahd: scsi
422file dev/ic/aic79xx.c ahd 422file dev/ic/aic79xx.c ahd
423file dev/ic/aic79xx_osm.c ahd 423file dev/ic/aic79xx_osm.c ahd
424 424
425# DPT EATA SCSI controllers 425# DPT EATA SCSI controllers
426# 426#
427device dpt: scsi 427device dpt: scsi
428file dev/ic/dpt.c dpt 428file dev/ic/dpt.c dpt
429 429
430# Compaq Smart ARRAY controllers 430# Compaq Smart ARRAY controllers
431# 431#
432device cac {unit = -1} 432device cac {unit = -1}
433file dev/ic/cac.c cac 433file dev/ic/cac.c cac
434 434
435attach ld at cac with ld_cac 435attach ld at cac with ld_cac
436file dev/ic/ld_cac.c ld_cac 436file dev/ic/ld_cac.c ld_cac
437 437
438# HP/Compaq Command Interface for SCSI-3 Support 438# HP/Compaq Command Interface for SCSI-3 Support
439# 439#
440device ciss: scsi 440device ciss: scsi
441file dev/ic/ciss.c ciss 441file dev/ic/ciss.c ciss
442 442
443# Mylex DAC960 RAID controllers 443# Mylex DAC960 RAID controllers
444# 444#
445device mlx {unit = -1} 445device mlx {unit = -1}
446file dev/ic/mlx.c mlx needs-flag 446file dev/ic/mlx.c mlx needs-flag
447 447
448attach ld at mlx with ld_mlx 448attach ld at mlx with ld_mlx
449file dev/ic/ld_mlx.c ld_mlx 449file dev/ic/ld_mlx.c ld_mlx
450 450
451# ICP-Vortex/Intel RAID controllers 451# ICP-Vortex/Intel RAID controllers
452# 452#
453device icp {unit = -1} 453device icp {unit = -1}
454file dev/ic/icp.c icp needs-flag 454file dev/ic/icp.c icp needs-flag
455file dev/ic/icp_ioctl.c icp 455file dev/ic/icp_ioctl.c icp
456 456
457attach ld at icp with ld_icp 457attach ld at icp with ld_icp
458file dev/ic/ld_icp.c ld_icp 458file dev/ic/ld_icp.c ld_icp
459 459
460device icpsp: scsi 460device icpsp: scsi
461file dev/ic/icpsp.c icpsp 461file dev/ic/icpsp.c icpsp
462attach icpsp at icp 462attach icpsp at icp
463 463
464# Adaptec FSA RAID controllers 464# Adaptec FSA RAID controllers
465# 465#
466device aac {unit = -1} 466device aac {unit = -1}
467file dev/ic/aac.c aac 467file dev/ic/aac.c aac
468 468
469attach ld at aac with ld_aac 469attach ld at aac with ld_aac
470file dev/ic/ld_aac.c ld_aac 470file dev/ic/ld_aac.c ld_aac
471 471
472# AdvanSys 1200A, 1200B and ULTRA SCSI controllers 472# AdvanSys 1200A, 1200B and ULTRA SCSI controllers
473# 473#
474device adv: scsi 474device adv: scsi
475file dev/ic/adv.c adv 475file dev/ic/adv.c adv
476file dev/ic/advlib.c adv 476file dev/ic/advlib.c adv
477file dev/ic/advmcode.c adv 477file dev/ic/advmcode.c adv
478 478
479# AdvanSys ULTRA WIDE SCSI controllers 479# AdvanSys ULTRA WIDE SCSI controllers
480# 480#
481device adw: scsi 481device adw: scsi
482file dev/ic/adw.c adw 482file dev/ic/adw.c adw
483 483
484# BusLogic MultiMaster and MultiMaster Ultra SCSI controllers 484# BusLogic MultiMaster and MultiMaster Ultra SCSI controllers
485# (Must be declared before AHA to ensure bha probes before aha. 485# (Must be declared before AHA to ensure bha probes before aha.
486# Probing AHA first configures bhas as aha, via their AHA 486# Probing AHA first configures bhas as aha, via their AHA
487# hardware-compatibility mode.) 487# hardware-compatibility mode.)
488# 488#
489device bha: scsi 489device bha: scsi
490file dev/ic/bha.c bha 490file dev/ic/bha.c bha
491 491
492# Adaptec AHA-154x and AHA-164x controllers 492# Adaptec AHA-154x and AHA-164x controllers
493# (must be after bha, see above) 493# (must be after bha, see above)
494# 494#
495device aha: scsi 495device aha: scsi
496file dev/ic/aha.c aha 496file dev/ic/aha.c aha
497 497
498# Initio INIC-940/950 SCSI controllers 498# Initio INIC-940/950 SCSI controllers
499# 499#
500device iha: scsi 500device iha: scsi
501file dev/ic/iha.c iha 501file dev/ic/iha.c iha
502 502
503# Qlogic ISP 10x0 SCSI Controllers 503# Qlogic ISP 10x0 SCSI Controllers
504# 504#
505defflag opt_isp.h ISP_DISABLE_1020_SUPPORT 505defflag opt_isp.h ISP_DISABLE_1020_SUPPORT
506 ISP_DISABLE_1080_SUPPORT 506 ISP_DISABLE_1080_SUPPORT
507 ISP_DISABLE_2100_SUPPORT 507 ISP_DISABLE_2100_SUPPORT
508 ISP_DISABLE_2200_SUPPORT 508 ISP_DISABLE_2200_SUPPORT
509 ISP_DISABLE_2300_SUPPORT 509 ISP_DISABLE_2300_SUPPORT
510 ISP_DISABLE_2322_SUPPORT 510 ISP_DISABLE_2322_SUPPORT
511 ISP_DISABLE_2400_SUPPORT 511 ISP_DISABLE_2400_SUPPORT
512 ISP_DISABLE_FW 512 ISP_DISABLE_FW
513 ISP_TARGET_MODE 513 ISP_TARGET_MODE
514defparam opt_isp.h ISP_LOGDEFAULT 514defparam opt_isp.h ISP_LOGDEFAULT
515 ISP_VPORTS 515 ISP_VPORTS
516device isp: scsi 516device isp: scsi
517file dev/ic/isp.c isp 517file dev/ic/isp.c isp
518file dev/ic/isp_library.c isp 518file dev/ic/isp_library.c isp
519file dev/ic/isp_netbsd.c isp 519file dev/ic/isp_netbsd.c isp
520file dev/ic/isp_target.c isp & isp_target_mode 520file dev/ic/isp_target.c isp & isp_target_mode
521# LSILogic MegaRAID SAS 521# LSILogic MegaRAID SAS
522# 522#
523device mfi: scsi 523device mfi: scsi
524file dev/ic/mfi.c mfi 524file dev/ic/mfi.c mfi
525 525
526# LSILogic Fusion-MPT I/O Processor SCSI/FC Controllers 526# LSILogic Fusion-MPT I/O Processor SCSI/FC Controllers
527# 527#
528device mpt: scsi 528device mpt: scsi
529file dev/ic/mpt.c mpt 529file dev/ic/mpt.c mpt
530file dev/ic/mpt_debug.c mpt 530file dev/ic/mpt_debug.c mpt
531file dev/ic/mpt_netbsd.c mpt 531file dev/ic/mpt_netbsd.c mpt
532 532
533# Workbit NinjaSCSI-32 controllers 533# Workbit NinjaSCSI-32 controllers
534device njs: scsi 534device njs: scsi
535file dev/ic/ninjascsi32.c njs 535file dev/ic/ninjascsi32.c njs
536 536
537# Symbios/NCR 53c700 SCSI controllers 537# Symbios/NCR 53c700 SCSI controllers
538device oosiop: scsi 538device oosiop: scsi
539file dev/ic/oosiop.c oosiop 539file dev/ic/oosiop.c oosiop
540 540
541# Symbios/NCR 53c710 SCSI controllers 541# Symbios/NCR 53c710 SCSI controllers
542# 542#
543device osiop: scsi 543device osiop: scsi
544file dev/ic/osiop.c osiop 544file dev/ic/osiop.c osiop
545 545
546# common stuff for siop and esiop 546# common stuff for siop and esiop
547# 547#
548define siop_common 548define siop_common
549file dev/ic/siop_common.c siop_common 549file dev/ic/siop_common.c siop_common
550 550
551# Symbios/NCR 53c720/53c8xx SCSI controllers 551# Symbios/NCR 53c720/53c8xx SCSI controllers
552# 552#
553device siop: scsi,siop_common 553device siop: scsi,siop_common
554file dev/ic/siop.c siop & (siop_pci | siop_gedoens) 554file dev/ic/siop.c siop & (siop_pci | siop_gedoens)
555defflag opt_siop.h SIOP_SYMLED 555defflag opt_siop.h SIOP_SYMLED
556 556
557device esiop: scsi,siop_common 557device esiop: scsi,siop_common
558file dev/ic/esiop.c esiop 558file dev/ic/esiop.c esiop
559 559
560# UltraStor SCSI controllers 560# UltraStor SCSI controllers
561# 561#
562device uha: scsi 562device uha: scsi
563file dev/ic/uha.c uha 563file dev/ic/uha.c uha
564 564
565# 3Com common probe code 565# 3Com common probe code
566define elink 566define elink
567file dev/isa/elink.c elink 567file dev/isa/elink.c elink
568 568
569# Aironet PC4500/PC4800 569# Aironet PC4500/PC4800
570# 570#
571device an: arp, wlan, ifnet 571device an: arp, wlan, ifnet
572file dev/ic/an.c an 572file dev/ic/an.c an
573 573
574# AMD 79c930-based 802.11 cards 574# AMD 79c930-based 802.11 cards
575# 575#
576device awi: arp, wlan, ifnet 576device awi: arp, wlan, ifnet
577file dev/ic/awi.c awi 577file dev/ic/awi.c awi
578file dev/ic/am79c930.c awi 578file dev/ic/am79c930.c awi
579 579
580# Lucent & Intersil WaveLan IEEE (802.11) 580# Lucent & Intersil WaveLan IEEE (802.11)
581# 581#
582device wi: arp, wlan, ifnet 582device wi: arp, wlan, ifnet
583file dev/ic/wi.c wi 583file dev/ic/wi.c wi
584 584
585# Atheros 5210/5211/5212 multi-mode 802.11 585# Atheros 5210/5211/5212 multi-mode 802.11
586# 586#
587defflag opt_athhal.h ATHHAL_ASSERT ATHHAL_DEBUG ATHHAL_DEBUG_ALQ 587defflag opt_athhal.h ATHHAL_ASSERT ATHHAL_DEBUG ATHHAL_DEBUG_ALQ
588device ath: arp, wlan, ifnet 588device ath: arp, wlan, ifnet
589file dev/ic/ath.c ath 589file dev/ic/ath.c ath
590file dev/ic/ath_netbsd.c ath 590file dev/ic/ath_netbsd.c ath
591file dev/ic/athrate-sample.c ath 591file dev/ic/athrate-sample.c ath
592file contrib/dev/ath/netbsd/ah_osdep.c ath 592file contrib/dev/ath/netbsd/ah_osdep.c ath
593object /athhal.o ath 593object /athhal.o ath
594 594
595# ADMtek ADM8211 802.11 595# ADMtek ADM8211 802.11
596# 596#
597device atw: arp, wlan, ifnet, smc93cx6 597device atw: arp, wlan, ifnet, smc93cx6
598file dev/ic/atw.c atw 598file dev/ic/atw.c atw
599 599
600# Realtek RTL8180 802.11 600# Realtek RTL8180 802.11
601# 601#
602device rtw: arp, wlan, ifnet, smc93cx6 602device rtw: arp, wlan, ifnet, smc93cx6
603file dev/ic/rtw.c rtw 603file dev/ic/rtw.c rtw
604file dev/ic/rtwphy.c rtw 604file dev/ic/rtwphy.c rtw
605file dev/ic/rtwphyio.c rtw 605file dev/ic/rtwphyio.c rtw
606 606
607# Ralink RT2500/RT2600 802.11 607# Ralink RT2500/RT2600 802.11
608device ral: arp, ether, ifnet, wlan, firmload 608device ral: arp, ether, ifnet, wlan, firmload
609file dev/ic/rt2560.c ral 609file dev/ic/rt2560.c ral
610file dev/ic/rt2661.c ral 610file dev/ic/rt2661.c ral
611 611
612# 3Com Etherlink-III Ethernet controller 612# 3Com Etherlink-III Ethernet controller
613# 613#
614device ep: arp, ether, ifnet, mii, mii_bitbang 614device ep: arp, ether, ifnet, mii, mii_bitbang
615file dev/ic/elink3.c ep 615file dev/ic/elink3.c ep
616 616
617# 3Com EtherLink XL Controller 617# 3Com EtherLink XL Controller
618# 618#
619device ex: arp, ether, ifnet, mii, mii_bitbang 619device ex: arp, ether, ifnet, mii, mii_bitbang
620file dev/ic/elinkxl.c ex 620file dev/ic/elinkxl.c ex
621 621
622# DEC EtherWORKS III (LEMAC) Ethernet controllers 622# DEC EtherWORKS III (LEMAC) Ethernet controllers
623# 623#
624device lc: arp, ether, ifnet 624device lc: arp, ether, ifnet
625file dev/ic/lemac.c lc 625file dev/ic/lemac.c lc
626 626
627# LANCE and PCnet Ethernet controllers 627# LANCE and PCnet Ethernet controllers
628# 628#
629device le: arp, ether, ifnet 629device le: arp, ether, ifnet
630define le24 630define le24
631define le32 631define le32
632file dev/ic/am7990.c le24 632file dev/ic/am7990.c le24
633file dev/ic/am79900.c le32 633file dev/ic/am79900.c le32
634file dev/ic/lance.c le24 | le32 634file dev/ic/lance.c le24 | le32
635 635
636# DEC DEPCA-family of LANCE Ethernet controllers 636# DEC DEPCA-family of LANCE Ethernet controllers
637# 637#
638device depca { }: le24 638device depca { }: le24
639file dev/ic/depca.c depca 639file dev/ic/depca.c depca
640attach le at depca with le_depca 640attach le at depca with le_depca
641 641
642# Sun HME Ethernet controllers 642# Sun HME Ethernet controllers
643# 643#
644device hme: arp, ether, ifnet, mii 644device hme: arp, ether, ifnet, mii
645file dev/ic/hme.c hme 645file dev/ic/hme.c hme
646 646
647# Sun GEM Ethernet controllers 647# Sun GEM Ethernet controllers
648# 648#
649device gem: arp, ether, ifnet, mii 649device gem: arp, ether, ifnet, mii
650file dev/ic/gem.c gem 650file dev/ic/gem.c gem
651 651
652# 8390-family Ethernet controllers 652# 8390-family Ethernet controllers
653# 653#
654defflag opt_ipkdb.h IPKDB_DP8390 654defflag opt_ipkdb.h IPKDB_DP8390
655define dp8390nic 655define dp8390nic
656file dev/ic/dp8390.c dp8390nic | ipkdb_dp8390 656file dev/ic/dp8390.c dp8390nic | ipkdb_dp8390
657 657
658# National Semiconductor DP83905 AT/LANTIC Ethernet media support 658# National Semiconductor DP83905 AT/LANTIC Ethernet media support
659# 659#
660define dp83905 660define dp83905
661file dev/ic/dp83905.c dp83905 661file dev/ic/dp83905.c dp83905
662 662
663# Macronix MX98905 Ethernet controller 663# Macronix MX98905 Ethernet controller
664# (use as an attribute for an "ne" bus attachment) 664# (use as an attribute for an "ne" bus attachment)
665# 665#
666define mx98905 666define mx98905
667file dev/ic/mx98905.c mx98905 667file dev/ic/mx98905.c mx98905
668 668
669# TROPIC Token-Ring controller 669# TROPIC Token-Ring controller
670# 670#
671device tr: arp, token, ifnet 671device tr: arp, token, ifnet
672file dev/ic/tropic.c tr 672file dev/ic/tropic.c tr
673 673
674# NCR 5380 SCSI Bus Controller 674# NCR 5380 SCSI Bus Controller
675# 675#
676define ncr5380sbc 676define ncr5380sbc
677file dev/ic/ncr5380sbc.c ncr5380sbc 677file dev/ic/ncr5380sbc.c ncr5380sbc
678device nca: scsi, ncr5380sbc 678device nca: scsi, ncr5380sbc
679 679
680# Sun sc PAL SCSI Bus Controller 680# Sun sc PAL SCSI Bus Controller
681# 681#
682define sunscpal 682define sunscpal
683file dev/ic/sunscpal.c sunscpal 683file dev/ic/sunscpal.c sunscpal
684device ssc: scsi, sunscpal 684device ssc: scsi, sunscpal
685 685
686# DEC FDDI Chipset 686# DEC FDDI Chipset
687# 687#
688define pdq 688define pdq
689file dev/ic/pdq.c pdq 689file dev/ic/pdq.c pdq
690file dev/ic/pdq_ifsubr.c pdq 690file dev/ic/pdq_ifsubr.c pdq
691 691
692# Cyclades Cyclom-8/16/32 692# Cyclades Cyclom-8/16/32
693# 693#
694device cy: tty 694device cy: tty
695file dev/ic/cy.c cy needs-flag 695file dev/ic/cy.c cy needs-flag
696 696
697# Efficient Networks, Inc. ATM interface 697# Efficient Networks, Inc. ATM interface
698# 698#
699device en: atm, ifnet 699device en: atm, ifnet
700file dev/ic/midway.c en 700file dev/ic/midway.c en
701 701
702# NCR 53x9x or Emulex ESP SCSI Controller 702# NCR 53x9x or Emulex ESP SCSI Controller
703# 703#
704define ncr53c9x 704define ncr53c9x
705device esp: scsi, ncr53c9x 705device esp: scsi, ncr53c9x
706file dev/ic/ncr53c9x.c ncr53c9x 706file dev/ic/ncr53c9x.c ncr53c9x
707 707
708# Fujitsu MB87030/MB89352 SCSI Protocol Controller 708# Fujitsu MB87030/MB89352 SCSI Protocol Controller
709device spc: scsi 709device spc: scsi
710file dev/ic/mb89352.c spc 710file dev/ic/mb89352.c spc
711 711
712# Western Digital WD33C93/WD33C93A SCSI Bus Interface Controller 712# Western Digital WD33C93/WD33C93A SCSI Bus Interface Controller
713define wd33c93 713define wd33c93
714file dev/ic/wd33c93.c wd33c93 714file dev/ic/wd33c93.c wd33c93
715 715
716# Hitachi HD44780 LCD panel controller 716# Hitachi HD44780 LCD panel controller
717define hd44780 717define hd44780
718file dev/ic/hd44780_subr.c hd44780 718file dev/ic/hd44780_subr.c hd44780
719file dev/ic/lcdkp_subr.c hd44780 719file dev/ic/lcdkp_subr.c hd44780
720 720
721# Matrix keypad 721# Matrix keypad
722define matrixkp 722define matrixkp
723file dev/ic/matrixkp_subr.c matrixkp 723file dev/ic/matrixkp_subr.c matrixkp
724 724
725# Hitachi HD64570 serial controller 725# Hitachi HD64570 serial controller
726# 726#
727define hd64570 727define hd64570
728file dev/ic/hd64570.c hd64570 728file dev/ic/hd64570.c hd64570
729 729
730# Riscom/N2 ISA/PCI Sync Serial Controller 730# Riscom/N2 ISA/PCI Sync Serial Controller
731# 731#
732device ntwoc: ifnet, hd64570 732device ntwoc: ifnet, hd64570
733 733
734# Intel 82586 Ethernet Controller 734# Intel 82586 Ethernet Controller
735# 735#
736define i82586 736define i82586
737file dev/ic/i82586.c i82586 737file dev/ic/i82586.c i82586
738 738
739# Intel 82596 Ethernet Controller 739# Intel 82596 Ethernet Controller
740# 740#
741define i82596 741define i82596
742file dev/ic/i82596.c i82596 742file dev/ic/i82596.c i82596
743 743
744# Intel 82557/82558/82559 Ethernet Controller 744# Intel 82557/82558/82559 Ethernet Controller
745# 745#
746device fxp: ether, ifnet, arp, mii 746device fxp: ether, ifnet, arp, mii
747file dev/ic/i82557.c fxp 747file dev/ic/i82557.c fxp
748 748
749# SEEQ 8005 Advanced Ethernet Data Link Controller 749# SEEQ 8005 Advanced Ethernet Data Link Controller
750# 750#
751define seeq8005 751define seeq8005
752file dev/ic/seeq8005.c seeq8005 752file dev/ic/seeq8005.c seeq8005
753 753
754# SMC 91Cxx Ethernet Controller 754# SMC 91Cxx Ethernet Controller
755# 755#
756device sm: arp, ether, ifnet, mii, mii_bitbang 756device sm: arp, ether, ifnet, mii, mii_bitbang
757file dev/ic/smc91cxx.c sm 757file dev/ic/smc91cxx.c sm
758 758
759# SMC 83C170 EPIC/100 Fast Ethernet Controller 759# SMC 83C170 EPIC/100 Fast Ethernet Controller
760# 760#
761device epic: arp, ether, ifnet, mii 761device epic: arp, ether, ifnet, mii
762file dev/ic/smc83c170.c epic 762file dev/ic/smc83c170.c epic
763 763
764# DEC SGEC Second Generation Ethernet Controller 764# DEC SGEC Second Generation Ethernet Controller
765# 765#
766define sgec 766define sgec
767file dev/ic/sgec.c sgec 767file dev/ic/sgec.c sgec
768 768
769# MB86950 Ethernet Controller 769# MB86950 Ethernet Controller
770# 770#
771define mb86950 771define mb86950
772file dev/ic/mb86950.c mb86950 772file dev/ic/mb86950.c mb86950
773 773
774# MB8696x Ethernet Controller 774# MB8696x Ethernet Controller
775# 775#
776define mb86960 776define mb86960
777file dev/ic/mb86960.c mb86960 777file dev/ic/mb86960.c mb86960
778 778
779# Generic MB8696x Ethernet Controller driver 779# Generic MB8696x Ethernet Controller driver
780# 780#
781device mbe: arp, ether, ifnet, mb86960 781device mbe: arp, ether, ifnet, mb86960
782 782
783# Interwave Am78C201 audio driver 783# Interwave Am78C201 audio driver
784# 784#
785define interwave 785define interwave
786file dev/ic/interwave.c interwave 786file dev/ic/interwave.c interwave
787 787
788# TMS 320av110 MPEG2/audio driver 788# TMS 320av110 MPEG2/audio driver
789# 789#
790define tms320av110 790define tms320av110
791file dev/ic/tms320av110.c tms320av110 791file dev/ic/tms320av110.c tms320av110
792 792
793# Novell NE2000-compatible Ethernet cards, based on the 793# Novell NE2000-compatible Ethernet cards, based on the
794# National Semiconductor DS8390. 794# National Semiconductor DS8390.
795# 795#
796defflag opt_ipkdb.h IPKDB_NE : IPKDB_DP8390 796defflag opt_ipkdb.h IPKDB_NE : IPKDB_DP8390
797device ne: ether, ifnet, arp, dp8390nic, mii 797device ne: ether, ifnet, arp, dp8390nic, mii
798file dev/ic/ne2000.c ne | ipkdb_ne 798file dev/ic/ne2000.c ne | ipkdb_ne
799 799
800# 8250/16[45]50-based "com" ports 800# 8250/16[45]50-based "com" ports
801# 801#
802defflag opt_com.h COM_DEBUG 802defflag opt_com.h COM_DEBUG
803# XXX In a perfect world, this would be done with attributes 803# XXX In a perfect world, this would be done with attributes
804defflag opt_com.h COM_16650 COM_HAYESP COM_PXA2X0 COM_AU1X00 804defflag opt_com.h COM_16650 COM_HAYESP COM_PXA2X0 COM_AU1X00
805 COM_REGMAP 805 COM_REGMAP
806device com { } : tty 806device com { } : tty
807file dev/ic/com.c com needs-flag 807file dev/ic/com.c com needs-flag
808 808
809# PC-like keyboard controller 809# PC-like keyboard controller
810# 810#
811device pckbc: pckbport 811device pckbc: pckbport
812file dev/ic/pckbc.c pckbc needs-flag 812file dev/ic/pckbc.c pckbc needs-flag
813 813
814device attimer 814device attimer
815file dev/ic/attimer.c attimer needs-flag 815file dev/ic/attimer.c attimer needs-flag
816 816
817# Cirrus Logic CD240[01] 4-port Multi-Protocol Communications Controller 817# Cirrus Logic CD240[01] 4-port Multi-Protocol Communications Controller
818# 818#
819device clmpcc: tty 819device clmpcc: tty
820file dev/ic/clmpcc.c clmpcc needs-flag 820file dev/ic/clmpcc.c clmpcc needs-flag
821 821
822# Abit uGuru 822# Abit uGuru
823# 823#
824device ug: sysmon_envsys 824device ug: sysmon_envsys
825file dev/ic/ug.c ug needs-flag 825file dev/ic/ug.c ug needs-flag
826 826
827# Essential Communications Corp. HIPPI Interface 827# Essential Communications Corp. HIPPI Interface
828# 828#
829device esh: hippi, ifnet 829device esh: hippi, ifnet
830file dev/ic/rrunner.c esh needs-flag 830file dev/ic/rrunner.c esh needs-flag
831 831
832# SMC 90c26, SMC 90C56 (and 90C66 if in compat mode) chip driver 832# SMC 90c26, SMC 90C56 (and 90C66 if in compat mode) chip driver
833# 833#
834device bah: ifnet, arcnet, arp 834device bah: ifnet, arcnet, arp
835file dev/ic/smc90cx6.c bah 835file dev/ic/smc90cx6.c bah
836 836
837# OPL2/OPL3 FM synth driver 837# OPL2/OPL3 FM synth driver
838# 838#
839device opl: midibus, midisyn 839device opl: midibus, midisyn
840file dev/ic/opl.c opl 840file dev/ic/opl.c opl
841file dev/ic/oplinstrs.c opl 841file dev/ic/oplinstrs.c opl
842 842
843# MPU401 MIDI UART compatibles 843# MPU401 MIDI UART compatibles
844# 844#
845device mpu: midibus 845device mpu: midibus
846file dev/ic/mpu.c mpu needs-flag 846file dev/ic/mpu.c mpu needs-flag
847 847
848# AD1848 (CS4248, CS4231, AD1845) audio codec support; used by other drivers 848# AD1848 (CS4248, CS4231, AD1845) audio codec support; used by other drivers
849# 849#
850define ad1848 850define ad1848
851file dev/ic/ad1848.c ad1848 851file dev/ic/ad1848.c ad1848
852 852
853# AMD 7930 audio/ISDN codec 853# AMD 7930 audio/ISDN codec
854# 854#
855define am7930 855define am7930
856file dev/ic/am7930.c am7930 856file dev/ic/am7930.c am7930
857 857
858# SPARC `SUNW,audiocs' 858# SPARC `SUNW,audiocs'
859# 859#
860device audiocs: audiobus, auconv, ad1848 860device audiocs: audiobus, auconv, ad1848
861file dev/ic/cs4231.c audiocs 861file dev/ic/cs4231.c audiocs
862 862
863# AC-97 CODECs 863# AC-97 CODECs
864# 864#
865define ac97 865define ac97
866file dev/ic/ac97.c ac97 866file dev/ic/ac97.c ac97
867 867
868# Oki MSM6258 support code 868# Oki MSM6258 support code
869# 869#
870define msm6258 870define msm6258
871file dev/ic/msm6258.c msm6258 871file dev/ic/msm6258.c msm6258
872 872
873# LSI64854 DMA controller back-end 873# LSI64854 DMA controller back-end
874# 874#
875define lsi64854 875define lsi64854
876file dev/ic/lsi64854.c lsi64854 876file dev/ic/lsi64854.c lsi64854
877 877
878# Cirrus Logic CL-CD180/1864/1865 multi port serial controller back-end 878# Cirrus Logic CL-CD180/1864/1865 multi port serial controller back-end
879# 879#
880define cd18xx 880define cd18xx
881file dev/ic/cd18xx.c cd18xx 881file dev/ic/cd18xx.c cd18xx
882 882
883# Realtek 8019/8029 NE2000-compatible network interface subroutines 883# Realtek 8019/8029 NE2000-compatible network interface subroutines
884# 884#
885define rtl80x9 885define rtl80x9
886file dev/ic/rtl80x9.c rtl80x9 886file dev/ic/rtl80x9.c rtl80x9
887 887
888# Realtek 8129/8139 Ethernet controllers 888# Realtek 8129/8139 Ethernet controllers
889# 889#
890device rtk: ether, ifnet, arp, mii 890device rtk: ether, ifnet, arp, mii
891file dev/ic/rtl81x9.c rtk | re 891file dev/ic/rtl81x9.c rtk | re
892 892
893# Realtek 8169 Ethernet controllers 893# Realtek 8169 Ethernet controllers
894# 894#
895device re: ether, ifnet, arp, mii 895device re: ether, ifnet, arp, mii
896file dev/ic/rtl8169.c re 896file dev/ic/rtl8169.c re
897 897
898# Common code for ESDI/IDE/etc. controllers 898# Common code for ESDI/IDE/etc. controllers
899# 899#
900define wdc_common 900define wdc_common
901define ata_dma 901define ata_dma
902define ata_udma 902define ata_udma
903define ata_piobm 903define ata_piobm
904device wdc: ata, wdc_common 904device wdc: ata, wdc_common
905 905
906defflag opt_ata.h ATADEBUG 906defflag opt_ata.h ATADEBUG
907 907
908device atabus: atapi,ata_hl 908device atabus: atapi,ata_hl
909attach atabus at ata 909attach atabus at ata
910# The strange expression is to dump ata_* definitions to ata_dma.h. 910# The strange expression is to dump ata_* definitions to ata_dma.h.
911file dev/ic/wdc.c (ata_dma | ata_udma | ata_piobm | atabus) & atabus & wdc_common needs-flag 911file dev/ic/wdc.c (ata_dma | ata_udma | ata_piobm | atabus) & atabus & wdc_common needs-flag
912 912
913# Workbit NinjaATA-32 IDE controllers 913# Workbit NinjaATA-32 IDE controllers
914device njata: ata, ata_piobm, wdc_common 914device njata: ata, ata_piobm, wdc_common
915file dev/ic/ninjaata32.c njata 915file dev/ic/ninjaata32.c njata
916 916
917# CHIPS and Technologies 82C7[12][01] Universal Peripheral Controller 917# CHIPS and Technologies 82C7[12][01] Universal Peripheral Controller
918# 918#
919device upc { [offset = -1] } 919device upc { [offset = -1] }
920attach wdc at upc with wdc_upc 920attach wdc at upc with wdc_upc
921attach com at upc with com_upc 921attach com at upc with com_upc
922attach lpt at upc with lpt_upc 922attach lpt at upc with lpt_upc
923file dev/ic/upc.c upc 923file dev/ic/upc.c upc
924file dev/ic/wdc_upc.c wdc_upc 924file dev/ic/wdc_upc.c wdc_upc
925file dev/ic/com_upc.c com_upc 925file dev/ic/com_upc.c com_upc
926file dev/ic/lpt_upc.c lpt_upc 926file dev/ic/lpt_upc.c lpt_upc
927 927
928# AHCI-compatible SATA controllers 928# AHCI-compatible SATA controllers
929define ahcisata_core 929define ahcisata_core
930file dev/ic/ahcisata_core.c ahcisata_core 930file dev/ic/ahcisata_core.c ahcisata_core
931device ahcisata: ata, ata_dma, ata_udma, sata, ahcisata_core 931device ahcisata: ata, ata_dma, ata_udma, sata, ahcisata_core
932 932
933# DECchip 21x4x Ethernet controller family, and assorted clones. 933# DECchip 21x4x Ethernet controller family, and assorted clones.
934# 934#
935device tlp: arp, ether, ifnet, mii, mii_bitbang 935device tlp: arp, ether, ifnet, mii, mii_bitbang
936file dev/ic/tulip.c tlp 936file dev/ic/tulip.c tlp
937 937
938# Adaptec AIC-6915 Ethernet interface 938# Adaptec AIC-6915 Ethernet interface
939# 939#
940device sf: arp, ether, ifnet, mii 940device sf: arp, ether, ifnet, mii
941file dev/ic/aic6915.c sf 941file dev/ic/aic6915.c sf
942 942
943# Mostek time-of-day clock and NVRAM 943# Mostek time-of-day clock and NVRAM
944# 944#
945define mk48txx 945define mk48txx
946file dev/ic/mk48txx.c mk48txx 946file dev/ic/mk48txx.c mk48txx
947 947
948# Intersil 7170 time-of-day clock 948# Intersil 7170 time-of-day clock
949# 949#
950define intersil7170 950define intersil7170
951file dev/ic/intersil7170.c intersil7170 951file dev/ic/intersil7170.c intersil7170
952 952
953# National Semiconductor MM58167 time-of-day clock 953# National Semiconductor MM58167 time-of-day clock
954# 954#
955define mm58167 955define mm58167
956file dev/ic/mm58167.c mm58167 956file dev/ic/mm58167.c mm58167
957 957
958# Motorola mc146818 (and compatible) time-of-day clock 958# Motorola mc146818 (and compatible) time-of-day clock
959# 959#
960define mc146818 960define mc146818
961file dev/ic/mc146818.c mc146818 961file dev/ic/mc146818.c mc146818
962 962
963# Ricoh RS5C313 time of-day-clock 963# Ricoh RS5C313 time of-day-clock
964# 964#
965define rs5c313 965define rs5c313
966file dev/ic/rs5c313.c rs5c313 966file dev/ic/rs5c313.c rs5c313
967 967
968# D-Link DL10019/10022 NE2000-compatible network interface subroutines 968# D-Link DL10019/10022 NE2000-compatible network interface subroutines
969# 969#
970define dl10019 970define dl10019
971file dev/ic/dl10019.c dl10019 971file dev/ic/dl10019.c dl10019
972 972
973# ASIX AX88190 NE2000-compatible network interface subroutines 973# ASIX AX88190 NE2000-compatible network interface subroutines
974# 974#
975define ax88190 975define ax88190
976file dev/ic/ax88190.c ax88190 976file dev/ic/ax88190.c ax88190
977 977
978# WD/SMC 80x3 family, SMC Elite Ultra [8216], SMC EtherEZ 978# WD/SMC 80x3 family, SMC Elite Ultra [8216], SMC EtherEZ
979# 979#
980device we: ether, ifnet, arp, dp8390nic 980device we: ether, ifnet, arp, dp8390nic
981file dev/ic/we.c we 981file dev/ic/we.c we
982 982
983# Allied-Telesis Ethernet driver based on Fujitsu MB8696xA controllers 983# Allied-Telesis Ethernet driver based on Fujitsu MB8696xA controllers
984# 984#
985device ate: arp, ether, ifnet, mb86960 985device ate: arp, ether, ifnet, mb86960
986 986
987# Fujitsu FMV-18x Ethernet driver based on Fujitsu MB8696xA controllers 987# Fujitsu FMV-18x Ethernet driver based on Fujitsu MB8696xA controllers
988# 988#
989device fmv: arp, ether, ifnet, mb86960 989device fmv: arp, ether, ifnet, mb86960
990file dev/ic/fmv.c fmv 990file dev/ic/fmv.c fmv
991 991
992# Crystal Semiconductor CS8900, CS8920, and CS8920M Ethernet 992# Crystal Semiconductor CS8900, CS8920, and CS8920M Ethernet
993# 993#
994device cs: arp, ether, ifnet 994device cs: arp, ether, ifnet
995device tscs: arp, ether, ifnet 995device tscs: arp, ether, ifnet
996file dev/ic/cs89x0.c cs | tscs 996file dev/ic/cs89x0.c cs | tscs
997 997
998# Radio device attributes 998# Radio device attributes
999# 999#
1000define tea5757 1000define tea5757
1001file dev/ic/tea5757.c tea5757 1001file dev/ic/tea5757.c tea5757
1002define lm700x 1002define lm700x
1003file dev/ic/lm700x.c lm700x 1003file dev/ic/lm700x.c lm700x
1004 1004
1005# Philips PCF8584 i2c controller 1005# Philips PCF8584 i2c controller
1006define pcf8584 1006define pcf8584
1007file dev/ic/pcf8584.c pcf8584 1007file dev/ic/pcf8584.c pcf8584
1008 1008
1009# ACPI power management timer (hardware access, independent of ACPI) 1009# ACPI power management timer (hardware access, independent of ACPI)
1010# 1010#
1011define acpipmtimer 1011define acpipmtimer
1012file dev/ic/acpipmtimer.c acpipmtimer 1012file dev/ic/acpipmtimer.c acpipmtimer
1013 1013
1014device hpet 1014device hpet
1015file dev/ic/hpet.c hpet needs-flag 1015file dev/ic/hpet.c hpet needs-flag
1016 1016
1017# DRM - Direct Rendering Infrastructure: dev/drm 1017# DRM - Direct Rendering Infrastructure: dev/drm
1018define drm {} 1018define drm {}
1019include dev/drm/files.drm 1019include dev/drm/files.drm
1020 1020
1021# Definitions for wscons 1021# Definitions for wscons
1022# device attributes: display, display with emulator, keyboard, and mouse 1022# device attributes: display, display with emulator, keyboard, and mouse
1023# 1023#
1024define wsdisplaydev {[kbdmux = 1]} 1024define wsdisplaydev {[kbdmux = 1]}
1025define wsemuldisplaydev {[console = -1], [kbdmux = 1]} 1025define wsemuldisplaydev {[console = -1], [kbdmux = 1]}
1026define wskbddev {[console = -1], [mux = 1]} 1026define wskbddev {[console = -1], [mux = 1]}
1027define wsmousedev {[mux = 0]} 1027define wsmousedev {[mux = 0]}
1028define vcons 1028define vcons
1029# attribute to pull in raster support 1029# attribute to pull in raster support
1030# 1030#
1031define wsrasteremulops 1031define wsrasteremulops
1032# common PC display functions 1032# common PC display functions
1033# 1033#
1034defflag opt_pcdisplay.h PCDISPLAY_SOFTCURSOR 1034defflag opt_pcdisplay.h PCDISPLAY_SOFTCURSOR
1035define pcdisplayops 1035define pcdisplayops
1036file dev/ic/pcdisplay_subr.c pcdisplayops 1036file dev/ic/pcdisplay_subr.c pcdisplayops
1037file dev/ic/pcdisplay_chars.c pcdisplayops 1037file dev/ic/pcdisplay_chars.c pcdisplayops
1038# an attribute used by arch specific config files to include /dev/fb* (or 1038# an attribute used by arch specific config files to include /dev/fb* (or
1039# equivalent) support - on most archs this is just a NOP (untill, maybe 1039# equivalent) support - on most archs this is just a NOP (untill, maybe
1040# someday when we might make /dev/fb* support MI) 1040# someday when we might make /dev/fb* support MI)
1041define fb 1041define fb
1042# VGA graphics 1042# VGA graphics
1043# 1043#
1044defparam opt_vga.h VGA_CONSOLE_SCREENTYPE 1044defparam opt_vga.h VGA_CONSOLE_SCREENTYPE
1045defflag opt_vga.h VGA_CONSOLE_ATI_BROKEN_FONTSEL 1045defflag opt_vga.h VGA_CONSOLE_ATI_BROKEN_FONTSEL
1046defflag opt_vga.h VGA_RASTERCONSOLE 1046defflag opt_vga.h VGA_RASTERCONSOLE
1047defflag opt_vga.h VGA_RESET 1047defflag opt_vga.h VGA_RESET
1048device vga: displaydev, wsemuldisplaydev, pcdisplayops, drm 1048device vga: displaydev, wsemuldisplaydev, pcdisplayops, drm
1049file dev/ic/vga.c vga & !vga_rasterconsole needs-flag 1049file dev/ic/vga.c vga & !vga_rasterconsole needs-flag
1050file dev/ic/vga_raster.c vga_rasterconsole needs-flag 1050file dev/ic/vga_raster.c vga_rasterconsole needs-flag
1051file dev/ic/vga_subr.c vga | vga_rasterconsole 1051file dev/ic/vga_subr.c vga | vga_rasterconsole
1052file dev/ic/vga_common.c vga | vga_rasterconsole 1052file dev/ic/vga_common.c vga | vga_rasterconsole
1053# Integraphics Systems IGA168x and CyberPro framebuffers (linear non-VGA mode) 1053# Integraphics Systems IGA168x and CyberPro framebuffers (linear non-VGA mode)
1054# 1054#
1055device igsfb: wsemuldisplaydev, wsrasteremulops, rasops8, vcons 1055device igsfb: wsemuldisplaydev, wsrasteremulops, rasops8, vcons
1056file dev/ic/igsfb.c igsfb needs-flag 1056file dev/ic/igsfb.c igsfb needs-flag
1057file dev/ic/igsfb_subr.c igsfb 1057file dev/ic/igsfb_subr.c igsfb
1058 1058
1059# STI (hp graphics) 1059# STI (hp graphics)
1060device sti: wsemuldisplaydev 1060device sti: wsemuldisplaydev
1061file dev/ic/sti.c sti & (sti_pci | sti_gedoens) 1061file dev/ic/sti.c sti & (sti_pci | sti_gedoens)
1062 1062
1063include "dev/wscons/files.wscons" 1063include "dev/wscons/files.wscons"
1064include "dev/rasops/files.rasops" 1064include "dev/rasops/files.rasops"
1065include "dev/wsfont/files.wsfont" 1065include "dev/wsfont/files.wsfont"
1066include "dev/wsfb/files.wsfb" 1066include "dev/wsfb/files.wsfb"
1067 1067
1068# Attributes which machine-independent bus support can be attached to. 1068# Attributes which machine-independent bus support can be attached to.
1069# These should be defined here, because some of these busses can have 1069# These should be defined here, because some of these busses can have
1070# devices which provide these attributes, and we'd like to avoid hairy 1070# devices which provide these attributes, and we'd like to avoid hairy
1071# ordering constraints on inclusion of the busses' "files" files. 1071# ordering constraints on inclusion of the busses' "files" files.
1072# 1072#
1073define isabus { } # ISA attachment 1073define isabus { } # ISA attachment
1074define eisabus { } # EISA attachment 1074define eisabus { } # EISA attachment
1075define pcibus {[bus = -1]} # PCI attachment 1075define pcibus {[bus = -1]} # PCI attachment
1076define tcbus { } # TurboChannel attachment 1076define tcbus { } # TurboChannel attachment
1077define mcabus { } # MicroChannel attachment 1077define mcabus { } # MicroChannel attachment
1078define usbus { } # USB attachment 1078define usbus { } # USB attachment
1079define fwbus { } # IEEE 1394 attachment 1079define fwbus { } # IEEE 1394 attachment
1080define vmebus { } # VME bus attachment 1080define vmebus { } # VME bus attachment
1081define acpibus { } # ACPI "bus" attachment 1081define acpibus { } # ACPI "bus" attachment
1082define pcmciabus { [controller = -1], [socket = -1]} # PCMCIA bus attachment 1082define pcmciabus { [controller = -1], [socket = -1]} # PCMCIA bus attachment
1083define cbbus { } # CardBus attachment 1083define cbbus { } # CardBus attachment
1084define pcmciaslot { } # PCMCIA slot itself 1084define pcmciaslot { } # PCMCIA slot itself
1085 1085
1086# We need the USB bus controllers here so different busses can 1086# We need the USB bus controllers here so different busses can
1087# use them in an 'attach-with'. 1087# use them in an 'attach-with'.
1088# UHCI USB controller 1088# UHCI USB controller
1089# 1089#
1090 1090
1091defparam USB_MEM_RESERVE 1091defparam USB_MEM_RESERVE
1092 1092
1093define usbroothub 1093define usbroothub
1094file dev/usb/usbroothub_subr.c usbroothub 1094file dev/usb/usbroothub_subr.c usbroothub
1095 1095
1096device uhci: usbus, usbroothub 1096device uhci: usbus, usbroothub
1097file dev/usb/uhci.c uhci needs-flag 1097file dev/usb/uhci.c uhci needs-flag
1098 1098
1099# OHCI USB controller 1099# OHCI USB controller
1100# 1100#
1101device ohci: usbus, usbroothub 1101device ohci: usbus, usbroothub
1102file dev/usb/ohci.c ohci needs-flag 1102file dev/usb/ohci.c ohci needs-flag
1103 1103
1104# EHCI USB controller 1104# EHCI USB controller
1105# 1105#
1106device ehci: usbus, usbroothub 1106device ehci: usbus, usbroothub
1107file dev/usb/ehci.c ehci needs-flag 1107file dev/usb/ehci.c ehci needs-flag
1108 1108
1109# SL811HS/T USB controller 1109# SL811HS/T USB controller
1110defflag opt_slhci.h SLHCI_DEBUG SLHCI_TRY_LSVH SLHCI_PROFILE_TRANSFER 1110defflag opt_slhci.h SLHCI_DEBUG SLHCI_TRY_LSVH SLHCI_PROFILE_TRANSFER
1111device slhci: usbus, usbroothub 1111device slhci: usbus, usbroothub
1112file dev/ic/sl811hs.c slhci needs-flag 1112file dev/ic/sl811hs.c slhci needs-flag
1113 1113
1114# USB HID processing (as used by bluetooth and usb code) 1114# USB HID processing (as used by bluetooth and usb code)
1115define hid 1115define hid
1116file dev/usb/hid.c hid 1116file dev/usb/hid.c hid
1117 1117
1118# Myson MTD803 3-in-1 Fast Ethernet Controller 1118# Myson MTD803 3-in-1 Fast Ethernet Controller
1119device mtd: arp, ether, ifnet, mii 1119device mtd: arp, ether, ifnet, mii
1120file dev/ic/mtd803.c mtd 1120file dev/ic/mtd803.c mtd
1121 1121
1122# radio devices, attaches to radio hardware driver 1122# radio devices, attaches to radio hardware driver
1123device radio 1123device radio
1124attach radio at radiodev 1124attach radio at radiodev
1125 1125
1126# IEEE 1394 controllers 1126# IEEE 1394 controllers
1127# (These need to be here since it will have both PCI and CardBus attachments) 1127# (These need to be here since it will have both PCI and CardBus attachments)
1128# 1128#
1129device fwohci: fwbus 1129device fwohci: fwbus
1130 1130
1131# Sony Programmable I/O Controller 1131# Sony Programmable I/O Controller
1132device spic: wsmousedev 1132device spic: wsmousedev
1133file dev/ic/spic.c spic 1133file dev/ic/spic.c spic
1134 1134
1135# IBM CPC700 PowerPC bridge 1135# IBM CPC700 PowerPC bridge
1136define cpcbus { addr, [irq=-1] } 1136define cpcbus { addr, [irq=-1] }
1137device cpc: cpcbus, pcibus 1137device cpc: cpcbus, pcibus
1138file dev/ic/cpc700.c cpc 1138file dev/ic/cpc700.c cpc
1139 1139
1140attach com at cpcbus with com_cpcbus 1140attach com at cpcbus with com_cpcbus
1141file dev/ic/com_cpcbus.c com_cpcbus 1141file dev/ic/com_cpcbus.c com_cpcbus
1142 1142
1143device cpctim 1143device cpctim
1144attach cpctim at cpcbus 1144attach cpctim at cpcbus
1145file dev/ic/timer_cpcbus.c cpctim 1145file dev/ic/timer_cpcbus.c cpctim
1146 1146
1147device cpciic 1147device cpciic
1148attach cpciic at cpcbus with iic_cpcbus 1148attach cpciic at cpcbus with iic_cpcbus
1149file dev/ic/iic_cpcbus.c iic_cpcbus 1149file dev/ic/iic_cpcbus.c iic_cpcbus
1150 1150
1151 1151
1152# Attribute used by various things that need BPF's virtual machine 1152# Attribute used by various things that need BPF's virtual machine
1153# 1153#
1154define bpf_filter 1154define bpf_filter
1155defparam opt_bpf.h BPF_BUFSIZE 1155defparam opt_bpf.h BPF_BUFSIZE
1156 1156
1157# Attributes used by the ISDN subsystem 1157# Attributes used by the ISDN subsystem
1158# 1158#
1159define isdndev # the ISDN subsystem 1159define isdndev # the ISDN subsystem
1160define passive_isdn # files needed by passive cards (XXX - protocol 1160define passive_isdn # files needed by passive cards (XXX - protocol
1161 # specific) 1161 # specific)
1162define isdncapi # ISDN CAPI (http://www.capi.org/) 1162define isdncapi # ISDN CAPI (http://www.capi.org/)
1163 1163
1164# The isac found on the Fritz V2.0 Card. 1164# The isac found on the Fritz V2.0 Card.
1165define nisacsx 1165define nisacsx
1166file dev/ic/isacsx.c nisacsx needs-flag 1166file dev/ic/isacsx.c nisacsx needs-flag
1167 1167
1168# The 'standard' isac 1168# The 'standard' isac
1169define nisac 1169define nisac
1170file dev/ic/isac.c nisac needs-flag 1170file dev/ic/isac.c nisac needs-flag
1171 1171
1172# ISDN cards based on the Siemens ISAC/HSCX chipset (or lookalikes) 1172# ISDN cards based on the Siemens ISAC/HSCX chipset (or lookalikes)
1173# 1173#
1174device isic: isdndev, passive_isdn, nisac 1174device isic: isdndev, passive_isdn, nisac
1175 1175
1176file dev/ic/isic.c isic 1176file dev/ic/isic.c isic
1177file dev/ic/isic_l1.c isic|ifpci|ifritz 1177file dev/ic/isic_l1.c isic|ifpci|ifritz
1178file dev/ic/isic_l1fsm.c isic|ifpci|ifritz 1178file dev/ic/isic_l1fsm.c isic|ifpci|ifritz
1179file dev/ic/hscx.c isic 1179file dev/ic/hscx.c isic
1180file dev/ic/isic_bchan.c isic 1180file dev/ic/isic_bchan.c isic
1181 1181
1182# (old) Diehl active ISDN cards 1182# (old) Diehl active ISDN cards
1183# 1183#
1184#device daic: isdndev 1184#device daic: isdndev
1185#file dev/ic/daic.c daic 1185#file dev/ic/daic.c daic
1186 1186
1187# AWM B1/T1 1187# AWM B1/T1
1188# XXX: passive_isdn 1188# XXX: passive_isdn
1189device iavc: isdndev, isdncapi, passive_isdn 1189device iavc: isdndev, isdncapi, passive_isdn
1190file dev/ic/iavc.c iavc 1190file dev/ic/iavc.c iavc
1191 1191
1192# legitimate pseudo-devices 1192# legitimate pseudo-devices
1193# 1193#
1194defpseudodev vnd: disk 1194defpseudodev vnd: disk
1195defflag opt_vnd.h VND_COMPRESSION 1195defflag opt_vnd.h VND_COMPRESSION
1196defpseudo ccd: disk 1196defpseudo ccd: disk
1197defpseudo cgd: disk, des, blowfish, cast128, rijndael 1197defpseudo cgd: disk, des, blowfish, cast128, rijndael
1198defpseudodev md: disk 1198defpseudodev md: disk
1199defpseudodev fss: disk 1199defpseudodev fss: disk
1200 1200
1201defpseudo pty: tty 1201defpseudo pty: tty
1202defpseudo rnd 1202defpseudo rnd
1203defpseudo ksyms 1203defpseudo ksyms
1204defpseudo nullcons 1204defpseudo nullcons
1205defpseudo lockstat 1205defpseudo lockstat
1206defpseudo bio: sysmon_envsys 1206defpseudo bio: sysmon_envsys
1207 1207
1208defpseudo loop: ifnet 1208defpseudo loop: ifnet
1209defpseudo sl: ifnet 1209defpseudo sl: ifnet
1210defpseudo ppp: ifnet, bpf_filter 1210defpseudo ppp: ifnet, bpf_filter
1211defpseudo pppoe: ifnet, ether, sppp 1211defpseudo pppoe: ifnet, ether, sppp
1212defpseudo sppp: ifnet 1212defpseudo sppp: ifnet
1213defpseudo tun: ifnet 1213defpseudo tun: ifnet
1214defpseudo vlan: ifnet, ether 1214defpseudo vlan: ifnet, ether
1215defpseudo bridge: ifnet, ether 1215defpseudo bridge: ifnet, ether
1216defpseudo bpfilter: ifnet, bpf_filter 1216defpseudo bpfilter: ifnet, bpf_filter
1217defpseudo strip: ifnet 1217defpseudo strip: ifnet
1218defpseudo gre: ifnet 1218defpseudo gre: ifnet
1219defpseudo gif: ifnet 1219defpseudo gif: ifnet
1220defpseudo faith: ifnet 1220defpseudo faith: ifnet
1221defpseudo srt: ifnet 1221defpseudo srt: ifnet
1222defpseudo stf: ifnet 1222defpseudo stf: ifnet
1223defpseudodev tap: ifnet, ether, arp, bpf_filter 1223defpseudodev tap: ifnet, ether, arp, bpf_filter
1224defpseudo carp: ifnet, ether, arp, bpf_filter 1224defpseudo carp: ifnet, ether, arp, bpf_filter
1225defpseudodev etherip: ifnet, ether, arp, bpf_filter 1225defpseudodev etherip: ifnet, ether, arp, bpf_filter
1226 1226
1227defpseudo sequencer 1227defpseudo sequencer
1228defpseudo clockctl 1228defpseudo clockctl
1229defpseudo irix_kmem 1229defpseudo irix_kmem
1230defpseudo irix_usema 1230defpseudo irix_usema
1231 1231
1232# 1232#
1233# Accept filters. XXX should use another registration/initialization method. 1233# Accept filters. XXX should use another registration/initialization method.
1234# 1234#
1235defpseudo accf_data 1235defpseudo accf_data
1236defpseudo accf_http 1236defpseudo accf_http
1237 1237
1238# ISDN userland pseudo devices 1238# ISDN userland pseudo devices
1239# 1239#
1240defpseudo isdntrc: isdndev, tty 1240defpseudo isdntrc: isdndev, tty
1241defpseudo isdnbchan: isdndev, tty 1241defpseudo isdnbchan: isdndev, tty
1242defpseudo isdntel: isdndev, tty 1242defpseudo isdntel: isdndev, tty
1243defpseudo isdnctl: isdndev, tty 1243defpseudo isdnctl: isdndev, tty
1244defpseudo isdn: isdndev, tty 1244defpseudo isdn: isdndev, tty
1245 1245
1246# ISDN network interfaces 1246# ISDN network interfaces
1247defpseudo irip: isdndev, ifnet 1247defpseudo irip: isdndev, ifnet
1248defflag opt_irip.h IRIP_VJ 1248defflag opt_irip.h IRIP_VJ
1249defpseudo ippp: isdndev, sppp, ifnet 1249defpseudo ippp: isdndev, sppp, ifnet
1250 1250
1251# KTTCP network throughput testing pseudo-device 1251# KTTCP network throughput testing pseudo-device
1252defpseudo kttcp 1252defpseudo kttcp
1253file dev/kttcp.c kttcp needs-flag 1253file dev/kttcp.c kttcp needs-flag
1254 1254
1255# Veriexec 1255# Veriexec
1256defpseudo veriexec 1256defpseudo veriexec
1257file kern/kern_verifiedexec.c veriexec 1257file kern/kern_verifiedexec.c veriexec
1258file dev/verified_exec.c veriexec needs-flag 1258file dev/verified_exec.c veriexec needs-flag
1259 1259
1260# isochronous pseudo device for IEEE 1394, i.LINK or FireWire 1260# isochronous pseudo device for IEEE 1394, i.LINK or FireWire
1261defpseudo fwiso: ieee1394 1261defpseudo fwiso: ieee1394
1262 1262
1263# driver attach / detach user interface 1263# driver attach / detach user interface
1264defpseudo drvctl 1264defpseudo drvctl
1265file kern/kern_drvctl.c drvctl needs-flag 1265file kern/kern_drvctl.c drvctl needs-flag
1266 1266
1267# cpu control 1267# cpu control
1268defpseudo cpuctl 1268defpseudo cpuctl
1269 1269
1270# pass-to-userspace transporter 1270# pass-to-userspace transporter
1271defpseudo putter 1271defpseudo putter
1272file dev/putter/putter.c putter 1272file dev/putter/putter.c putter
1273 1273
1274# userspace block/char device drivers 1274# userspace block/char device drivers
1275defpseudo pud 1275defpseudo pud
1276file dev/pud/pud.c pud 1276file dev/pud/pud.c pud
1277file dev/pud/pud_dev.c pud 1277file dev/pud/pud_dev.c pud
1278 1278
1279# 1279#
1280# File systems 1280# File systems
1281# 1281#
1282include "coda/files.coda" 1282include "coda/files.coda"
1283include "fs/adosfs/files.adosfs" 1283include "fs/adosfs/files.adosfs"
1284include "fs/cd9660/files.cd9660" 1284include "fs/cd9660/files.cd9660"
1285include "fs/efs/files.efs" 1285include "fs/efs/files.efs"
1286include "fs/filecorefs/files.filecorefs" 1286include "fs/filecorefs/files.filecorefs"
1287include "fs/hfs/files.hfs" 1287include "fs/hfs/files.hfs"
1288include "fs/msdosfs/files.msdosfs" 1288include "fs/msdosfs/files.msdosfs"
1289include "fs/ntfs/files.ntfs" 1289include "fs/ntfs/files.ntfs"
1290include "fs/ptyfs/files.ptyfs" 1290include "fs/ptyfs/files.ptyfs"
1291include "fs/puffs/files.puffs" 1291include "fs/puffs/files.puffs"
1292include "fs/udf/files.udf" 1292include "fs/udf/files.udf"
1293include "fs/smbfs/files.smbfs" 1293include "fs/smbfs/files.smbfs"
1294include "fs/sysvbfs/files.sysvbfs" 1294include "fs/sysvbfs/files.sysvbfs"
1295include "fs/tmpfs/files.tmpfs" 1295include "fs/tmpfs/files.tmpfs"
1296include "fs/union/files.union" 1296include "fs/union/files.union"
1297include "miscfs/fdesc/files.fdesc" 1297include "miscfs/fdesc/files.fdesc"
1298include "miscfs/kernfs/files.kernfs" 1298include "miscfs/kernfs/files.kernfs"
1299include "miscfs/nullfs/files.nullfs" 1299include "miscfs/nullfs/files.nullfs"
1300include "miscfs/overlay/files.overlay" 1300include "miscfs/overlay/files.overlay"
1301include "miscfs/portal/files.portal" 1301include "miscfs/portal/files.portal"
1302include "miscfs/procfs/files.procfs" 1302include "miscfs/procfs/files.procfs"
1303include "miscfs/umapfs/files.umapfs" 1303include "miscfs/umapfs/files.umapfs"
1304include "nfs/files.nfs" 1304include "nfs/files.nfs"
1305include "ufs/files.ufs" 1305include "ufs/files.ufs"
1306 1306
1307# 1307#
1308# UVM (virtual memory) 1308# UVM (virtual memory)
1309# 1309#
1310include "uvm/files.uvm" 1310include "uvm/files.uvm"
1311 1311
1312# 1312#
1313# Security models 1313# Security models
1314# 1314#
1315include "secmodel/files.secmodel" 1315include "secmodel/files.secmodel"
1316 1316
1317# 1317#
1318# kernel sources 1318# kernel sources
1319# 1319#
1320file compat/sa/compat_sa.c 1320file compat/sa/compat_sa.c
1321file conf/debugsyms.c 1321file conf/debugsyms.c
1322file dev/auconv.c auconv | mulaw 1322file dev/auconv.c auconv | mulaw
1323file dev/audio.c audio | midi | midibus needs-flag 1323file dev/audio.c audio | midi | midibus needs-flag
1324file dev/audiobell.c audiobell 1324file dev/audiobell.c audiobell
1325file dev/aurateconv.c aurateconv needs-flag 1325file dev/aurateconv.c aurateconv needs-flag
1326file dev/bio.c bio needs-flag 1326file dev/bio.c bio needs-flag
1327file dev/ccd.c ccd needs-flag 1327file dev/ccd.c ccd needs-flag
1328file dev/cgd.c cgd needs-flag 1328file dev/cgd.c cgd needs-flag
1329file dev/cgd_crypto.c cgd 1329file dev/cgd_crypto.c cgd
1330file dev/clock_subr.c 1330file dev/clock_subr.c
1331file dev/clockctl.c clockctl needs-flag 1331file dev/clockctl.c clockctl needs-flag
1332file dev/dksubr.c cgd | xbd | ccd | raid 1332file dev/dksubr.c cgd | xbd | ccd | raid
1333file dev/dkwedge/dk.c 1333file dev/dkwedge/dk.c
1334file dev/dkwedge/dkwedge_bsdlabel.c dkwedge_method_bsdlabel 1334file dev/dkwedge/dkwedge_bsdlabel.c dkwedge_method_bsdlabel
1335file dev/dkwedge/dkwedge_gpt.c dkwedge_method_gpt 1335file dev/dkwedge/dkwedge_gpt.c dkwedge_method_gpt
1336file dev/dkwedge/dkwedge_mbr.c dkwedge_method_mbr 1336file dev/dkwedge/dkwedge_mbr.c dkwedge_method_mbr
1337file dev/firmload.c firmload 1337file dev/firmload.c firmload
1338file dev/fss.c fss needs-count 1338file dev/fss.c fss needs-count
1339file dev/lockstat.c lockstat needs-flag 1339file dev/lockstat.c lockstat needs-flag
1340file dev/md.c md needs-count 1340file dev/md.c md needs-count
1341file dev/midi.c midi | midibus needs-flag 1341file dev/midi.c midi | midibus needs-flag
1342file dev/midictl.c midisyn 1342file dev/midictl.c midisyn
1343file dev/midisyn.c midisyn 1343file dev/midisyn.c midisyn
1344file dev/mm.c 1344file dev/mm.c
1345file dev/mulaw.c mulaw needs-flag 1345file dev/mulaw.c mulaw needs-flag
1346file dev/nullcons_subr.c nullcons needs-flag 1346file dev/nullcons_subr.c nullcons needs-flag
1347file dev/radio.c radio needs-flag 1347file dev/radio.c radio needs-flag
1348file dev/rnd.c rnd needs-flag 1348file dev/rnd.c rnd needs-flag
1349file dev/rndpool.c rnd needs-flag 1349file dev/rndpool.c rnd needs-flag
1350file dev/sequencer.c sequencer needs-flag 1350file dev/sequencer.c sequencer needs-flag
1351file dev/video.c video needs-flag 1351file dev/video.c video needs-flag
1352file dev/vnd.c vnd needs-flag 1352file dev/vnd.c vnd needs-flag
1353file kern/bufq_disksort.c bufq_disksort 1353file kern/bufq_disksort.c bufq_disksort
1354file kern/bufq_fcfs.c bufq_fcfs 1354file kern/bufq_fcfs.c bufq_fcfs
1355file kern/bufq_priocscan.c bufq_priocscan 1355file kern/bufq_priocscan.c bufq_priocscan
1356file kern/bufq_readprio.c bufq_readprio | new_bufq_strategy 1356file kern/bufq_readprio.c bufq_readprio | new_bufq_strategy
1357file kern/core_elf32.c coredump & exec_elf32 1357file kern/core_elf32.c coredump & exec_elf32
1358file kern/core_elf64.c coredump & exec_elf64 1358file kern/core_elf64.c coredump & exec_elf64
1359file kern/core_netbsd.c coredump & (exec_aout | exec_coff | 1359file kern/core_netbsd.c coredump & (exec_aout | exec_coff |
1360 exec_ecoff | exec_macho | lkm) 1360 exec_ecoff | exec_macho | lkm)
1361file kern/cnmagic.c 1361file kern/cnmagic.c
1362file kern/exec_aout.c exec_aout 1362file kern/exec_aout.c exec_aout
1363file kern/exec_conf.c 1363file kern/exec_conf.c
1364file kern/exec_ecoff.c exec_ecoff 1364file kern/exec_ecoff.c exec_ecoff
1365file kern/exec_elf32.c exec_elf32 1365file kern/exec_elf32.c exec_elf32
1366file kern/exec_elf64.c exec_elf64 1366file kern/exec_elf64.c exec_elf64
1367file kern/exec_macho.c exec_macho 1367file kern/exec_macho.c exec_macho
1368file kern/exec_script.c exec_script 1368file kern/exec_script.c exec_script
1369file kern/exec_subr.c 1369file kern/exec_subr.c
1370file kern/init_main.c 1370file kern/init_main.c
1371file kern/init_sysctl.c 1371file kern/init_sysctl.c
1372file kern/init_sysent.c 1372file kern/init_sysent.c
1373file kern/kern_acct.c 1373file kern/kern_acct.c
1374file kern/kern_auth.c 1374file kern/kern_auth.c
1375file kern/kern_clock.c 1375file kern/kern_clock.c
1376file kern/kern_condvar.c 1376file kern/kern_condvar.c
1377file kern/kern_core.c 1377file kern/kern_core.c
1378file kern/kern_cpu.c 1378file kern/kern_cpu.c
1379file kern/kern_descrip.c 1379file kern/kern_descrip.c
1380file kern/kern_event.c 1380file kern/kern_event.c
1381file kern/kern_exec.c 1381file kern/kern_exec.c
1382file kern/kern_exit.c 1382file kern/kern_exit.c
1383file kern/kern_fork.c 1383file kern/kern_fork.c
1384file kern/kern_idle.c 1384file kern/kern_idle.c
1385file kern/kern_kthread.c 1385file kern/kern_kthread.c
1386file kern/kern_ktrace.c ktrace 1386file kern/kern_ktrace.c ktrace
1387file kern/kern_ksyms.c ksyms | ddb | lkm needs-flag 1387file kern/kern_ksyms.c ksyms | ddb | lkm needs-flag
1388file kern/kern_lkm.c lkm 1388file kern/kern_lkm.c lkm
1389file kern/kern_lock.c 1389file kern/kern_lock.c
1390file kern/kern_lwp.c 1390file kern/kern_lwp.c
1391file kern/kern_malloc.c 1391file kern/kern_malloc.c
1392file kern/kern_malloc_stdtype.c 1392file kern/kern_malloc_stdtype.c
1393file kern/kern_malloc_debug.c malloc_debug 1393file kern/kern_malloc_debug.c malloc_debug
1394file kern/kern_module.c 1394file kern/kern_module.c
1395file kern/kern_mutex.c 1395file kern/kern_mutex.c
1396file kern/kern_fileassoc.c fileassoc 1396file kern/kern_fileassoc.c fileassoc
1397file kern/kern_ntptime.c 1397file kern/kern_ntptime.c
1398file kern/kern_pax.c pax_mprotect | pax_segvguard 1398file kern/kern_pax.c pax_mprotect | pax_segvguard
1399file kern/kern_physio.c 1399file kern/kern_physio.c
1400file kern/kern_pmf.c 1400file kern/kern_pmf.c
1401file kern/kern_proc.c 1401file kern/kern_proc.c
1402file kern/kern_prot.c 1402file kern/kern_prot.c
1403file kern/kern_ras.c 1403file kern/kern_ras.c
1404file kern/kern_rate.c 1404file kern/kern_rate.c
1405file kern/kern_resource.c 1405file kern/kern_resource.c
1406file kern/kern_runq.c 1406file kern/kern_runq.c
1407file kern/kern_rwlock.c 1407file kern/kern_rwlock.c
1408file kern/kern_sig.c 1408file kern/kern_sig.c
1409file kern/kern_sleepq.c 1409file kern/kern_sleepq.c
1410file kern/kern_softint.c 1410file kern/kern_softint.c
 1411file kern/kern_ssp.c
1411file kern/kern_stub.c 1412file kern/kern_stub.c
1412file kern/kern_subr.c 1413file kern/kern_subr.c
1413file kern/kern_synch.c 1414file kern/kern_synch.c
1414file kern/kern_sysctl.c 1415file kern/kern_sysctl.c
1415file kern/kern_tc.c 1416file kern/kern_tc.c
1416file kern/kern_time.c 1417file kern/kern_time.c
1417file kern/kern_timeout.c 1418file kern/kern_timeout.c
1418file kern/kern_turnstile.c 1419file kern/kern_turnstile.c
1419file kern/kern_todr.c 1420file kern/kern_todr.c
1420file kern/kern_uidinfo.c 1421file kern/kern_uidinfo.c
1421file kern/kern_uuid.c 1422file kern/kern_uuid.c
1422file kern/kern_xxx.c 1423file kern/kern_xxx.c
1423file kern/kgdb_stub.c kgdb 1424file kern/kgdb_stub.c kgdb
1424file kern/sched_4bsd.c sched_4bsd 1425file kern/sched_4bsd.c sched_4bsd
1425file kern/sched_m2.c sched_m2 1426file kern/sched_m2.c sched_m2
1426file kern/subr_autoconf.c 1427file kern/subr_autoconf.c
1427file kern/subr_blist.c vmswap 1428file kern/subr_blist.c vmswap
1428file kern/subr_bufq.c 1429file kern/subr_bufq.c
1429file kern/subr_callback.c 1430file kern/subr_callback.c
1430file kern/subr_debug.c debug 1431file kern/subr_debug.c debug
1431file kern/subr_devsw.c 1432file kern/subr_devsw.c
1432file kern/subr_disk.c 1433file kern/subr_disk.c
1433file kern/subr_iostat.c 1434file kern/subr_iostat.c
1434file kern/subr_evcnt.c 1435file kern/subr_evcnt.c
1435file kern/subr_extent.c 1436file kern/subr_extent.c
1436file kern/subr_hash.c 1437file kern/subr_hash.c
1437file kern/subr_kmem.c 1438file kern/subr_kmem.c
1438file kern/subr_kobj.c 1439file kern/subr_kobj.c
1439file kern/subr_lockdebug.c 1440file kern/subr_lockdebug.c
1440file kern/subr_log.c 1441file kern/subr_log.c
1441file kern/subr_percpu.c 1442file kern/subr_percpu.c
1442file kern/subr_pool.c 1443file kern/subr_pool.c
1443file kern/subr_prf.c 1444file kern/subr_prf.c
1444file kern/subr_prf2.c 1445file kern/subr_prf2.c
1445file kern/subr_prof.c 1446file kern/subr_prof.c
1446file kern/subr_once.c 1447file kern/subr_once.c
1447file kern/subr_optstr.c 1448file kern/subr_optstr.c
1448file kern/subr_specificdata.c 1449file kern/subr_specificdata.c
1449file kern/subr_tftproot.c tftproot 1450file kern/subr_tftproot.c tftproot
1450file kern/subr_time.c 1451file kern/subr_time.c
1451file kern/subr_userconf.c userconf 1452file kern/subr_userconf.c userconf
1452file kern/subr_vmem.c 1453file kern/subr_vmem.c
1453file kern/subr_workqueue.c 1454file kern/subr_workqueue.c
1454file kern/subr_xcall.c 1455file kern/subr_xcall.c
1455file kern/sys_aio.c 1456file kern/sys_aio.c
1456file kern/sys_descrip.c 1457file kern/sys_descrip.c
1457file kern/sys_generic.c 1458file kern/sys_generic.c
1458file kern/sys_module.c 1459file kern/sys_module.c
1459file kern/sys_mqueue.c 1460file kern/sys_mqueue.c
1460file kern/sys_lwp.c 1461file kern/sys_lwp.c
1461file kern/sys_pipe.c !pipe_socketpair 1462file kern/sys_pipe.c !pipe_socketpair
1462file kern/sys_pmc.c 1463file kern/sys_pmc.c
1463file kern/sys_process.c ptrace | ktrace 1464file kern/sys_process.c ptrace | ktrace
1464file kern/sys_pset.c 1465file kern/sys_pset.c
1465file kern/sys_select.c 1466file kern/sys_select.c
1466file kern/sys_sig.c 1467file kern/sys_sig.c
1467file kern/sys_sched.c 1468file kern/sys_sched.c
1468file kern/sys_socket.c 1469file kern/sys_socket.c
1469file kern/syscalls.c syscall_debug 1470file kern/syscalls.c syscall_debug
1470file kern/sysv_ipc.c sysvshm | sysvsem | sysvmsg 1471file kern/sysv_ipc.c sysvshm | sysvsem | sysvmsg
1471file kern/sysv_msg.c sysvmsg 1472file kern/sysv_msg.c sysvmsg
1472file kern/sysv_sem.c sysvsem 1473file kern/sysv_sem.c sysvsem
1473file kern/sysv_shm.c sysvshm 1474file kern/sysv_shm.c sysvshm
1474file kern/tty.c 1475file kern/tty.c
1475file kern/tty_conf.c 1476file kern/tty_conf.c
1476file kern/tty_bsdpty.c compat_bsdpty 1477file kern/tty_bsdpty.c compat_bsdpty
1477file kern/tty_pty.c pty needs-flag 1478file kern/tty_pty.c pty needs-flag
1478file kern/tty_ptm.c pty 1479file kern/tty_ptm.c pty
1479file kern/tty_subr.c 1480file kern/tty_subr.c
1480file kern/tty_tty.c 1481file kern/tty_tty.c
1481file kern/uipc_accf.c 1482file kern/uipc_accf.c
1482file kern/uipc_domain.c 1483file kern/uipc_domain.c
1483file kern/uipc_mbuf.c 1484file kern/uipc_mbuf.c
1484file kern/uipc_mbuf2.c 1485file kern/uipc_mbuf2.c
1485file net/link_proto.c 1486file net/link_proto.c
1486file kern/uipc_proto.c 1487file kern/uipc_proto.c
1487file kern/uipc_sem.c p1003_1b_semaphore 1488file kern/uipc_sem.c p1003_1b_semaphore
1488file kern/uipc_socket.c 1489file kern/uipc_socket.c
1489file kern/uipc_socket2.c 1490file kern/uipc_socket2.c
1490file kern/uipc_syscalls.c 1491file kern/uipc_syscalls.c
1491file kern/uipc_usrreq.c 1492file kern/uipc_usrreq.c
1492file kern/vfs_bio.c 1493file kern/vfs_bio.c
1493file kern/vfs_cache.c 1494file kern/vfs_cache.c
1494file kern/vfs_dirhash.c 1495file kern/vfs_dirhash.c
1495file kern/vfs_getcwd.c 1496file kern/vfs_getcwd.c
1496file kern/vfs_hooks.c 1497file kern/vfs_hooks.c
1497file kern/vfs_init.c 1498file kern/vfs_init.c
1498file kern/vfs_lockf.c 1499file kern/vfs_lockf.c
1499file kern/vfs_lookup.c 1500file kern/vfs_lookup.c
1500file kern/vfs_subr.c 1501file kern/vfs_subr.c
1501file kern/vfs_syscalls.c 1502file kern/vfs_syscalls.c
1502file kern/vfs_trans.c 1503file kern/vfs_trans.c
1503file kern/vfs_vnops.c 1504file kern/vfs_vnops.c
1504file kern/vfs_wapbl.c wapbl 1505file kern/vfs_wapbl.c wapbl
1505file kern/vfs_xattr.c 1506file kern/vfs_xattr.c
1506file kern/vnode_if.c 1507file kern/vnode_if.c
1507file miscfs/deadfs/dead_vnops.c 1508file miscfs/deadfs/dead_vnops.c
1508file miscfs/fifofs/fifo_vnops.c 1509file miscfs/fifofs/fifo_vnops.c
1509file miscfs/genfs/genfs_io.c 1510file miscfs/genfs/genfs_io.c
1510file miscfs/genfs/genfs_vfsops.c 1511file miscfs/genfs/genfs_vfsops.c
1511file miscfs/genfs/genfs_vnops.c 1512file miscfs/genfs/genfs_vnops.c
1512file miscfs/genfs/layer_subr.c nullfs | overlay | umapfs | lkm 1513file miscfs/genfs/layer_subr.c nullfs | overlay | umapfs | lkm
1513file miscfs/genfs/layer_vfsops.c nullfs | overlay | umapfs | lkm 1514file miscfs/genfs/layer_vfsops.c nullfs | overlay | umapfs | lkm
1514file miscfs/genfs/layer_vnops.c nullfs | overlay | umapfs | lkm 1515file miscfs/genfs/layer_vnops.c nullfs | overlay | umapfs | lkm
1515file miscfs/specfs/spec_vnops.c 1516file miscfs/specfs/spec_vnops.c
1516file miscfs/syncfs/sync_subr.c 1517file miscfs/syncfs/sync_subr.c
1517file miscfs/syncfs/sync_vnops.c 1518file miscfs/syncfs/sync_vnops.c
1518file net/bpf.c bpfilter needs-flag 1519file net/bpf.c bpfilter needs-flag
1519file net/bpf_filter.c bpf_filter 1520file net/bpf_filter.c bpf_filter
1520file net/bsd-comp.c ppp & ppp_bsdcomp 1521file net/bsd-comp.c ppp & ppp_bsdcomp
1521file net/if.c 1522file net/if.c
1522file net/if_arcsubr.c arcnet needs-flag 1523file net/if_arcsubr.c arcnet needs-flag
1523file net/if_atmsubr.c atm 1524file net/if_atmsubr.c atm
1524file net/if_bridge.c bridge needs-flag 1525file net/if_bridge.c bridge needs-flag
1525file net/bridgestp.c bridge 1526file net/bridgestp.c bridge
1526file net/if_ecosubr.c eco 1527file net/if_ecosubr.c eco
1527file net/if_etherip.c etherip needs-flag 1528file net/if_etherip.c etherip needs-flag
1528file net/if_ethersubr.c ether | fddi | netatalk | token | 1529file net/if_ethersubr.c ether | fddi | netatalk | token |
1529 wlan 1530 wlan
1530file net/if_faith.c faith & inet & inet6 needs-flag 1531file net/if_faith.c faith & inet & inet6 needs-flag
1531file net/if_fddisubr.c fddi needs-flag 1532file net/if_fddisubr.c fddi needs-flag
1532file net/if_gif.c gif needs-flag 1533file net/if_gif.c gif needs-flag
1533file net/if_gre.c gre needs-flag 1534file net/if_gre.c gre needs-flag
1534file net/if_hippisubr.c hippi needs-flag 1535file net/if_hippisubr.c hippi needs-flag
1535file net/if_ieee1394subr.c ieee1394 1536file net/if_ieee1394subr.c ieee1394
1536file net/if_loop.c loop needs-flag 1537file net/if_loop.c loop needs-flag
1537file net/if_media.c 1538file net/if_media.c
1538file net/if_ppp.c ppp needs-flag 1539file net/if_ppp.c ppp needs-flag
1539file net/if_srt.c srt 1540file net/if_srt.c srt
1540file net/if_stf.c stf & inet & inet6 needs-flag 1541file net/if_stf.c stf & inet & inet6 needs-flag
1541file net/if_sl.c sl needs-flag 1542file net/if_sl.c sl needs-flag
1542file net/if_spppsubr.c sppp 1543file net/if_spppsubr.c sppp
1543file net/if_strip.c strip needs-flag 1544file net/if_strip.c strip needs-flag
1544file net/if_tokensubr.c token needs-flag 1545file net/if_tokensubr.c token needs-flag
1545file net/if_tap.c tap needs-flag 1546file net/if_tap.c tap needs-flag
1546file net/if_tun.c tun needs-flag 1547file net/if_tun.c tun needs-flag
1547file net/if_vlan.c vlan needs-flag 1548file net/if_vlan.c vlan needs-flag
1548file net/if_pppoe.c pppoe needs-flag 1549file net/if_pppoe.c pppoe needs-flag
1549file net/pfil.c pfil_hooks | ipfilter | pf 1550file net/pfil.c pfil_hooks | ipfilter | pf
1550file net/ppp-deflate.c ppp & ppp_deflate 1551file net/ppp-deflate.c ppp & ppp_deflate
1551file net/ppp_tty.c ppp 1552file net/ppp_tty.c ppp
1552file net/net_stats.c 1553file net/net_stats.c
1553file net/radix.c 1554file net/radix.c
1554file net/raw_cb.c 1555file net/raw_cb.c
1555file net/raw_usrreq.c 1556file net/raw_usrreq.c
1556file net/route.c 1557file net/route.c
1557file net/rtsock.c 1558file net/rtsock.c
1558file net/slcompress.c sl | ppp | strip | (irip & irip_vj) 1559file net/slcompress.c sl | ppp | strip | (irip & irip_vj)
1559file net/zlib.c (ppp & ppp_deflate) | ipsec | opencrypto | vnd_compression 1560file net/zlib.c (ppp & ppp_deflate) | ipsec | opencrypto | vnd_compression
1560file netinet/accf_data.c accf_data 1561file netinet/accf_data.c accf_data
1561file netinet/accf_http.c accf_http 1562file netinet/accf_http.c accf_http
1562file netinet/cpu_in_cksum.c (inet | inet6) & !cpu_in_cksum 1563file netinet/cpu_in_cksum.c (inet | inet6) & !cpu_in_cksum
1563file netinet/if_arp.c arp | netatalk needs-flag 1564file netinet/if_arp.c arp | netatalk needs-flag
1564file netinet/if_atm.c atm 1565file netinet/if_atm.c atm
1565file netinet/in4_cksum.c inet 1566file netinet/in4_cksum.c inet
1566file netinet/in_cksum.c inet 1567file netinet/in_cksum.c inet
1567file netinet/in_gif.c gif & inet 1568file netinet/in_gif.c gif & inet
1568file netinet/ip_carp.c carp & (inet | inet6) needs-flag 1569file netinet/ip_carp.c carp & (inet | inet6) needs-flag
1569file netinet/ip_ecn.c ipsec | fast_ipsec | gif | stf 1570file netinet/ip_ecn.c ipsec | fast_ipsec | gif | stf
1570file netinet/ip_encap.c inet | inet6 1571file netinet/ip_encap.c inet | inet6
1571file netinet/ip_etherip.c etherip & inet 1572file netinet/ip_etherip.c etherip & inet
1572file netinet6/ip6_etherip.c etherip & inet6 1573file netinet6/ip6_etherip.c etherip & inet6
1573file netinet6/in6_gif.c gif & inet6 1574file netinet6/in6_gif.c gif & inet6
1574 1575
1575file netisdn/i4b_ctl.c isdnctl needs-flag 1576file netisdn/i4b_ctl.c isdnctl needs-flag
1576file netisdn/i4b_isppp.c ippp needs-count 1577file netisdn/i4b_isppp.c ippp needs-count
1577file netisdn/i4b_ipr.c irip needs-count 1578file netisdn/i4b_ipr.c irip needs-count
1578file netisdn/i4b_rbch.c isdnbchan needs-count 1579file netisdn/i4b_rbch.c isdnbchan needs-count
1579file netisdn/i4b_tel.c isdntel needs-count 1580file netisdn/i4b_tel.c isdntel needs-count
1580file netisdn/i4b_trace.c isdntrc needs-count 1581file netisdn/i4b_trace.c isdntrc needs-count
1581 1582
1582file netisdn/i4b_mbuf.c passive_isdn 1583file netisdn/i4b_mbuf.c passive_isdn
1583file netisdn/i4b_l2.c passive_isdn 1584file netisdn/i4b_l2.c passive_isdn
1584file netisdn/i4b_l2fsm.c passive_isdn 1585file netisdn/i4b_l2fsm.c passive_isdn
1585file netisdn/i4b_uframe.c passive_isdn 1586file netisdn/i4b_uframe.c passive_isdn
1586file netisdn/i4b_tei.c passive_isdn 1587file netisdn/i4b_tei.c passive_isdn
1587file netisdn/i4b_sframe.c passive_isdn 1588file netisdn/i4b_sframe.c passive_isdn
1588file netisdn/i4b_iframe.c passive_isdn 1589file netisdn/i4b_iframe.c passive_isdn
1589file netisdn/i4b_l2timer.c passive_isdn 1590file netisdn/i4b_l2timer.c passive_isdn
1590file netisdn/i4b_util.c passive_isdn 1591file netisdn/i4b_util.c passive_isdn
1591file netisdn/i4b_lme.c passive_isdn 1592file netisdn/i4b_lme.c passive_isdn
1592# Q.931 handler 1593# Q.931 handler
1593file netisdn/i4b_q931.c passive_isdn 1594file netisdn/i4b_q931.c passive_isdn
1594file netisdn/i4b_q932fac.c passive_isdn 1595file netisdn/i4b_q932fac.c passive_isdn
1595file netisdn/i4b_l3fsm.c passive_isdn 1596file netisdn/i4b_l3fsm.c passive_isdn
1596file netisdn/i4b_l3timer.c passive_isdn 1597file netisdn/i4b_l3timer.c passive_isdn
1597file netisdn/i4b_l2if.c passive_isdn 1598file netisdn/i4b_l2if.c passive_isdn
1598file netisdn/i4b_l4if.c passive_isdn 1599file netisdn/i4b_l4if.c passive_isdn
1599# isdn device driver, interface to isdnd 1600# isdn device driver, interface to isdnd
1600file netisdn/i4b_i4bdrv.c isdn needs-flag 1601file netisdn/i4b_i4bdrv.c isdn needs-flag
1601file netisdn/i4b_l4.c isdndev needs-flag 1602file netisdn/i4b_l4.c isdndev needs-flag
1602file netisdn/i4b_l4mgmt.c isdndev needs-flag 1603file netisdn/i4b_l4mgmt.c isdndev needs-flag
1603file netisdn/i4b_l4timer.c isdndev needs-flag 1604file netisdn/i4b_l4timer.c isdndev needs-flag
1604# capi 1605# capi
1605file netisdn/i4b_capi_l4if.c isdncapi 1606file netisdn/i4b_capi_l4if.c isdncapi
1606file netisdn/i4b_capi_llif.c isdncapi 1607file netisdn/i4b_capi_llif.c isdncapi
1607file netisdn/i4b_capi_msgs.c isdncapi 1608file netisdn/i4b_capi_msgs.c isdncapi
1608 1609
1609# Game adapter (joystick) 1610# Game adapter (joystick)
1610device joy 1611device joy
1611file dev/ic/joy.c joy needs-flag 1612file dev/ic/joy.c joy needs-flag
1612 1613
1613include "net/agr/files.agr" 1614include "net/agr/files.agr"
1614 1615
1615# 1616#
1616# General Purpose Input/Output framework 1617# General Purpose Input/Output framework
1617# 1618#
1618define onewire_bitbang 1619define onewire_bitbang
1619include "dev/gpio/files.gpio" 1620include "dev/gpio/files.gpio"
1620 1621
1621include "dev/onewire/files.onewire" 1622include "dev/onewire/files.onewire"
1622 1623
1623# 1624#
1624# Pseudo audio device 1625# Pseudo audio device
1625# 1626#
1626include "dev/pad/files.pad" 1627include "dev/pad/files.pad"
1627 1628
1628# 1629#
1629# Intel 386 Real Mode emulator 1630# Intel 386 Real Mode emulator
1630# 1631#
1631include "lib/libx86emu/files.x86emu" 1632include "lib/libx86emu/files.x86emu"
1632 1633
1633# 1634#
1634# "tprof" profiler. 1635# "tprof" profiler.
1635# 1636#
1636include "dev/tprof/files.tprof" 1637include "dev/tprof/files.tprof"

cvs diff -r1.371 -r1.371.2.1 src/sys/kern/init_main.c (switch to unified diff)

--- src/sys/kern/init_main.c 2008/10/28 15:33:10 1.371
+++ src/sys/kern/init_main.c 2009/03/15 19:43:48 1.371.2.1
@@ -1,941 +1,899 @@ @@ -1,941 +1,899 @@
1/* $NetBSD: init_main.c,v 1.371 2008/10/28 15:33:10 tsutsui Exp $ */ 1/* $NetBSD: init_main.c,v 1.371.2.1 2009/03/15 19:43:48 snj Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
15 * 15 *
16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE. 26 * POSSIBILITY OF SUCH DAMAGE.
27 */ 27 */
28 28
29/* 29/*
30 * Copyright (c) 1982, 1986, 1989, 1991, 1992, 1993 30 * Copyright (c) 1982, 1986, 1989, 1991, 1992, 1993
31 * The Regents of the University of California. All rights reserved. 31 * The Regents of the University of California. All rights reserved.
32 * (c) UNIX System Laboratories, Inc. 32 * (c) UNIX System Laboratories, Inc.
33 * All or some portions of this file are derived from material licensed 33 * All or some portions of this file are derived from material licensed
34 * to the University of California by American Telephone and Telegraph 34 * to the University of California by American Telephone and Telegraph
35 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 35 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
36 * the permission of UNIX System Laboratories, Inc. 36 * the permission of UNIX System Laboratories, Inc.
37 * 37 *
38 * Redistribution and use in source and binary forms, with or without 38 * Redistribution and use in source and binary forms, with or without
39 * modification, are permitted provided that the following conditions 39 * modification, are permitted provided that the following conditions
40 * are met: 40 * are met:
41 * 1. Redistributions of source code must retain the above copyright 41 * 1. Redistributions of source code must retain the above copyright
42 * notice, this list of conditions and the following disclaimer. 42 * notice, this list of conditions and the following disclaimer.
43 * 2. Redistributions in binary form must reproduce the above copyright 43 * 2. Redistributions in binary form must reproduce the above copyright
44 * notice, this list of conditions and the following disclaimer in the 44 * notice, this list of conditions and the following disclaimer in the
45 * documentation and/or other materials provided with the distribution. 45 * documentation and/or other materials provided with the distribution.
46 * 3. Neither the name of the University nor the names of its contributors 46 * 3. Neither the name of the University nor the names of its contributors
47 * may be used to endorse or promote products derived from this software 47 * may be used to endorse or promote products derived from this software
48 * without specific prior written permission. 48 * without specific prior written permission.
49 * 49 *
50 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 50 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
51 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 51 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
60 * SUCH DAMAGE. 60 * SUCH DAMAGE.
61 * 61 *
62 * @(#)init_main.c 8.16 (Berkeley) 5/14/95 62 * @(#)init_main.c 8.16 (Berkeley) 5/14/95
63 */ 63 */
64 64
65/* 65/*
66 * Copyright (c) 1995 Christopher G. Demetriou. All rights reserved. 66 * Copyright (c) 1995 Christopher G. Demetriou. All rights reserved.
67 * 67 *
68 * Redistribution and use in source and binary forms, with or without 68 * Redistribution and use in source and binary forms, with or without
69 * modification, are permitted provided that the following conditions 69 * modification, are permitted provided that the following conditions
70 * are met: 70 * are met:
71 * 1. Redistributions of source code must retain the above copyright 71 * 1. Redistributions of source code must retain the above copyright
72 * notice, this list of conditions and the following disclaimer. 72 * notice, this list of conditions and the following disclaimer.
73 * 2. Redistributions in binary form must reproduce the above copyright 73 * 2. Redistributions in binary form must reproduce the above copyright
74 * notice, this list of conditions and the following disclaimer in the 74 * notice, this list of conditions and the following disclaimer in the
75 * documentation and/or other materials provided with the distribution. 75 * documentation and/or other materials provided with the distribution.
76 * 3. All advertising materials mentioning features or use of this software 76 * 3. All advertising materials mentioning features or use of this software
77 * must display the following acknowledgement: 77 * must display the following acknowledgement:
78 * This product includes software developed by the University of 78 * This product includes software developed by the University of
79 * California, Berkeley and its contributors. 79 * California, Berkeley and its contributors.
80 * 4. Neither the name of the University nor the names of its contributors 80 * 4. Neither the name of the University nor the names of its contributors
81 * may be used to endorse or promote products derived from this software 81 * may be used to endorse or promote products derived from this software
82 * without specific prior written permission. 82 * without specific prior written permission.
83 * 83 *
84 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 84 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
85 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 85 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
86 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 86 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
87 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 87 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
88 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 88 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
89 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 89 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
90 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 90 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
91 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 91 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
92 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 92 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
93 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 93 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
94 * SUCH DAMAGE. 94 * SUCH DAMAGE.
95 * 95 *
96 * @(#)init_main.c 8.16 (Berkeley) 5/14/95 96 * @(#)init_main.c 8.16 (Berkeley) 5/14/95
97 */ 97 */
98 98
99#include <sys/cdefs.h> 99#include <sys/cdefs.h>
100__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.371 2008/10/28 15:33:10 tsutsui Exp $"); 100__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.371.2.1 2009/03/15 19:43:48 snj Exp $");
101 101
102#include "opt_ddb.h" 102#include "opt_ddb.h"
103#include "opt_ipsec.h" 103#include "opt_ipsec.h"
104#include "opt_ntp.h" 104#include "opt_ntp.h"
105#include "opt_pipe.h" 105#include "opt_pipe.h"
106#include "opt_posix.h" 106#include "opt_posix.h"
107#include "opt_syscall_debug.h" 107#include "opt_syscall_debug.h"
108#include "opt_sysv.h" 108#include "opt_sysv.h"
109#include "opt_fileassoc.h" 109#include "opt_fileassoc.h"
110#include "opt_ktrace.h" 110#include "opt_ktrace.h"
111#include "opt_pax.h" 111#include "opt_pax.h"
112#include "opt_wapbl.h" 112#include "opt_wapbl.h"
113 113
114#include "rnd.h" 114#include "rnd.h"
115#include "sysmon_envsys.h" 115#include "sysmon_envsys.h"
116#include "sysmon_power.h" 116#include "sysmon_power.h"
117#include "sysmon_taskq.h" 117#include "sysmon_taskq.h"
118#include "sysmon_wdog.h" 118#include "sysmon_wdog.h"
119#include "veriexec.h" 119#include "veriexec.h"
120 120
121#include <sys/param.h> 121#include <sys/param.h>
122#include <sys/acct.h> 122#include <sys/acct.h>
123#include <sys/filedesc.h> 123#include <sys/filedesc.h>
124#include <sys/file.h> 124#include <sys/file.h>
125#include <sys/errno.h> 125#include <sys/errno.h>
126#include <sys/callout.h> 126#include <sys/callout.h>
127#include <sys/cpu.h> 127#include <sys/cpu.h>
128#include <sys/kernel.h> 128#include <sys/kernel.h>
129#include <sys/mount.h> 129#include <sys/mount.h>
130#include <sys/proc.h> 130#include <sys/proc.h>
131#include <sys/kthread.h> 131#include <sys/kthread.h>
132#include <sys/resourcevar.h> 132#include <sys/resourcevar.h>
133#include <sys/signalvar.h> 133#include <sys/signalvar.h>
134#include <sys/systm.h> 134#include <sys/systm.h>
135#include <sys/vnode.h> 135#include <sys/vnode.h>
136#include <sys/fstrans.h> 136#include <sys/fstrans.h>
137#include <sys/tty.h> 137#include <sys/tty.h>
138#include <sys/conf.h> 138#include <sys/conf.h>
139#include <sys/disklabel.h> 139#include <sys/disklabel.h>
140#include <sys/buf.h> 140#include <sys/buf.h>
141#include <sys/device.h> 141#include <sys/device.h>
142#include <sys/exec.h> 142#include <sys/exec.h>
143#include <sys/socketvar.h> 143#include <sys/socketvar.h>
144#include <sys/protosw.h> 144#include <sys/protosw.h>
145#include <sys/percpu.h> 145#include <sys/percpu.h>
146#include <sys/pset.h> 146#include <sys/pset.h>
147#include <sys/sysctl.h> 147#include <sys/sysctl.h>
148#include <sys/reboot.h> 148#include <sys/reboot.h>
149#include <sys/user.h> 149#include <sys/user.h>
150#include <sys/sysctl.h> 150#include <sys/sysctl.h>
151#include <sys/event.h> 151#include <sys/event.h>
152#include <sys/mbuf.h> 152#include <sys/mbuf.h>
153#include <sys/sched.h> 153#include <sys/sched.h>
154#include <sys/sleepq.h> 154#include <sys/sleepq.h>
155#include <sys/iostat.h> 155#include <sys/iostat.h>
156#include <sys/vmem.h> 156#include <sys/vmem.h>
157#include <sys/uuid.h> 157#include <sys/uuid.h>
158#include <sys/extent.h> 158#include <sys/extent.h>
159#include <sys/disk.h> 159#include <sys/disk.h>
160#include <sys/mqueue.h> 160#include <sys/mqueue.h>
161#include <sys/msgbuf.h> 161#include <sys/msgbuf.h>
162#include <sys/module.h> 162#include <sys/module.h>
163#include <sys/event.h> 163#include <sys/event.h>
164#include <sys/lockf.h> 164#include <sys/lockf.h>
165#include <sys/once.h> 165#include <sys/once.h>
166#include <sys/ksyms.h> 166#include <sys/ksyms.h>
167#include <sys/uidinfo.h> 167#include <sys/uidinfo.h>
168#ifdef FAST_IPSEC 168#ifdef FAST_IPSEC
169#include <netipsec/ipsec.h> 169#include <netipsec/ipsec.h>
170#endif 170#endif
171#ifdef SYSVSHM 171#ifdef SYSVSHM
172#include <sys/shm.h> 172#include <sys/shm.h>
173#endif 173#endif
174#ifdef SYSVSEM 174#ifdef SYSVSEM
175#include <sys/sem.h> 175#include <sys/sem.h>
176#endif 176#endif
177#ifdef SYSVMSG 177#ifdef SYSVMSG
178#include <sys/msg.h> 178#include <sys/msg.h>
179#endif 179#endif
180#ifdef P1003_1B_SEMAPHORE 180#ifdef P1003_1B_SEMAPHORE
181#include <sys/ksem.h> 181#include <sys/ksem.h>
182#endif 182#endif
183#include <sys/domain.h> 183#include <sys/domain.h>
184#include <sys/namei.h> 184#include <sys/namei.h>
185#if NRND > 0 185#if NRND > 0
186#include <sys/rnd.h> 186#include <sys/rnd.h>
187#endif 187#endif
188#include <sys/pipe.h> 188#include <sys/pipe.h>
189#ifdef LKM 189#ifdef LKM
190#include <sys/lkm.h> 190#include <sys/lkm.h>
191#endif 191#endif
192#if NVERIEXEC > 0 192#if NVERIEXEC > 0
193#include <sys/verified_exec.h> 193#include <sys/verified_exec.h>
194#endif /* NVERIEXEC > 0 */ 194#endif /* NVERIEXEC > 0 */
195#ifdef KTRACE 195#ifdef KTRACE
196#include <sys/ktrace.h> 196#include <sys/ktrace.h>
197#endif 197#endif
198#include <sys/kauth.h> 198#include <sys/kauth.h>
199#ifdef WAPBL 199#ifdef WAPBL
200#include <sys/wapbl.h> 200#include <sys/wapbl.h>
201#endif 201#endif
202#include <net80211/ieee80211_netbsd.h> 202#include <net80211/ieee80211_netbsd.h>
203 203
204#include <sys/syscall.h> 204#include <sys/syscall.h>
205#include <sys/syscallargs.h> 205#include <sys/syscallargs.h>
206 206
207#if defined(PAX_MPROTECT) || defined(PAX_SEGVGUARD) || defined(PAX_ASLR) 207#if defined(PAX_MPROTECT) || defined(PAX_SEGVGUARD) || defined(PAX_ASLR)
208#include <sys/pax.h> 208#include <sys/pax.h>
209#endif /* PAX_MPROTECT || PAX_SEGVGUARD || PAX_ASLR */ 209#endif /* PAX_MPROTECT || PAX_SEGVGUARD || PAX_ASLR */
210 210
211#include <ufs/ufs/quota.h> 211#include <ufs/ufs/quota.h>
212 212
213#include <miscfs/genfs/genfs.h> 213#include <miscfs/genfs/genfs.h>
214#include <miscfs/syncfs/syncfs.h> 214#include <miscfs/syncfs/syncfs.h>
215 215
216#include <sys/cpu.h> 216#include <sys/cpu.h>
217 217
218#include <uvm/uvm.h> 218#include <uvm/uvm.h>
219 219
220#if NSYSMON_TASKQ > 0 220#if NSYSMON_TASKQ > 0
221#include <dev/sysmon/sysmon_taskq.h> 221#include <dev/sysmon/sysmon_taskq.h>
222#endif 222#endif
223 223
224#include <dev/cons.h> 224#include <dev/cons.h>
225 225
226#if NSYSMON_ENVSYS > 0 || NSYSMON_POWER > 0 || NSYSMON_WDOG > 0 226#if NSYSMON_ENVSYS > 0 || NSYSMON_POWER > 0 || NSYSMON_WDOG > 0
227#include <dev/sysmon/sysmonvar.h> 227#include <dev/sysmon/sysmonvar.h>
228#endif 228#endif
229 229
230#include <net/if.h> 230#include <net/if.h>
231#include <net/raw_cb.h> 231#include <net/raw_cb.h>
232 232
233#include <secmodel/secmodel.h> 233#include <secmodel/secmodel.h>
234 234
235extern struct proc proc0; 235extern struct proc proc0;
236extern struct lwp lwp0; 236extern struct lwp lwp0;
237extern struct cwdinfo cwdi0; 237extern struct cwdinfo cwdi0;
238extern time_t rootfstime; 238extern time_t rootfstime;
239 239
240#ifndef curlwp 240#ifndef curlwp
241struct lwp *curlwp = &lwp0; 241struct lwp *curlwp = &lwp0;
242#endif 242#endif
243struct proc *initproc; 243struct proc *initproc;
244 244
245struct vnode *rootvp, *swapdev_vp; 245struct vnode *rootvp, *swapdev_vp;
246int boothowto; 246int boothowto;
247int cold = 1; /* still working on startup */ 247int cold = 1; /* still working on startup */
248struct timeval boottime; /* time at system startup - will only follow settime deltas */ 248struct timeval boottime; /* time at system startup - will only follow settime deltas */
249 249
250int start_init_exec; /* semaphore for start_init() */ 250int start_init_exec; /* semaphore for start_init() */
251 251
252static void check_console(struct lwp *l); 252static void check_console(struct lwp *l);
253static void start_init(void *); 253static void start_init(void *);
254void main(void); 254void main(void);
255void ssp_init(void); 
256 
257#if defined(__SSP__) || defined(__SSP_ALL__) 
258long __stack_chk_guard[8] = {0, 0, 0, 0, 0, 0, 0, 0}; 
259void __stack_chk_fail(void); 
260 
261void 
262__stack_chk_fail(void) 
263{ 
264 panic("stack overflow detected; terminated"); 
265} 
266 
267void 
268ssp_init(void) 
269{ 
270 int s; 
271 
272#ifdef DIAGNOSTIC 
273 printf("Initializing SSP:"); 
274#endif 
275 /* 
276 * We initialize ssp here carefully: 
277 * 1. after we got some entropy 
278 * 2. without calling a function 
279 */ 
280 size_t i; 
281 long guard[__arraycount(__stack_chk_guard)]; 
282 
283 arc4randbytes(guard, sizeof(guard)); 
284 s = splhigh(); 
285 for (i = 0; i < __arraycount(guard); i++) 
286 __stack_chk_guard[i] = guard[i]; 
287 splx(s); 
288#ifdef DIAGNOSTIC 
289 for (i = 0; i < __arraycount(guard); i++) 
290 printf("%lx ", guard[i]); 
291 printf("\n"); 
292#endif 
293} 
294#else 
295void 
296ssp_init(void) 
297{ 
298 
299} 
300#endif 
301 255
302void __secmodel_none(void); 256void __secmodel_none(void);
303__weak_alias(secmodel_start,__secmodel_none); 257__weak_alias(secmodel_start,__secmodel_none);
304void 258void
305__secmodel_none(void) 259__secmodel_none(void)
306{ 260{
307 return; 261 return;
308} 262}
309 263
310/* 264/*
311 * System startup; initialize the world, create process 0, mount root 265 * System startup; initialize the world, create process 0, mount root
312 * filesystem, and fork to create init and pagedaemon. Most of the 266 * filesystem, and fork to create init and pagedaemon. Most of the
313 * hard work is done in the lower-level initialization routines including 267 * hard work is done in the lower-level initialization routines including
314 * startup(), which does memory initialization and autoconfiguration. 268 * startup(), which does memory initialization and autoconfiguration.
315 */ 269 */
316void 270void
317main(void) 271main(void)
318{ 272{
319 struct timeval time; 273 struct timeval time;
320 struct lwp *l; 274 struct lwp *l;
321 struct proc *p; 275 struct proc *p;
322 int s, error; 276 int s, error;
323#ifdef NVNODE_IMPLICIT 277#ifdef NVNODE_IMPLICIT
324 int usevnodes; 278 int usevnodes;
325#endif 279#endif
326 CPU_INFO_ITERATOR cii; 280 CPU_INFO_ITERATOR cii;
327 struct cpu_info *ci; 281 struct cpu_info *ci;
328 282
329 l = &lwp0; 283 l = &lwp0;
330#ifndef LWP0_CPU_INFO 284#ifndef LWP0_CPU_INFO
331 l->l_cpu = curcpu(); 285 l->l_cpu = curcpu();
332#endif 286#endif
333 287
334 /* 288 /*
335 * Attempt to find console and initialize 289 * Attempt to find console and initialize
336 * in case of early panic or other messages. 290 * in case of early panic or other messages.
337 */ 291 */
338 consinit(); 292 consinit();
339 293
340 kernel_lock_init(); 294 kernel_lock_init();
341 once_init(); 295 once_init();
342 296
343 uvm_init(); 297 uvm_init();
344 298
345 percpu_init(); 299 percpu_init();
346 300
347 /* Initialize lock caches. */ 301 /* Initialize lock caches. */
348 mutex_obj_init(); 302 mutex_obj_init();
349 303
350 /* Initialize the extent manager. */ 304 /* Initialize the extent manager. */
351 extent_init(); 305 extent_init();
352 306
353 /* Do machine-dependent initialization. */ 307 /* Do machine-dependent initialization. */
354 cpu_startup(); 308 cpu_startup();
355 309
356 /* Initialize callouts, part 1. */ 310 /* Initialize callouts, part 1. */
357 callout_startup(); 311 callout_startup();
358 312
359 /* 313 /*
360 * Initialize the kernel authorization subsystem and start the 314 * Initialize the kernel authorization subsystem and start the
361 * default security model, if any. We need to do this early 315 * default security model, if any. We need to do this early
362 * enough so that subsystems relying on any of the aforementioned 316 * enough so that subsystems relying on any of the aforementioned
363 * can work properly. Since the security model may dictate the 317 * can work properly. Since the security model may dictate the
364 * credential inheritance policy, it is needed at least before 318 * credential inheritance policy, it is needed at least before
365 * any process is created, specifically proc0. 319 * any process is created, specifically proc0.
366 */ 320 */
367 kauth_init(); 321 kauth_init();
368 secmodel_start(); 322 secmodel_start();
369 323
370 /* Initialize the buffer cache */ 324 /* Initialize the buffer cache */
371 bufinit(); 325 bufinit();
372 326
373 /* Initialize sockets. */ 327 /* Initialize sockets. */
374 soinit(); 328 soinit();
375 329
376 /* 330 /*
377 * The following things must be done before autoconfiguration. 331 * The following things must be done before autoconfiguration.
378 */ 332 */
379 evcnt_init(); /* initialize event counters */ 333 evcnt_init(); /* initialize event counters */
380#if NRND > 0 334#if NRND > 0
381 rnd_init(); /* initialize random number generator */ 335 rnd_init(); /* initialize random number generator */
382#endif 336#endif
383 337
384 /* Initialize process and pgrp structures. */ 338 /* Initialize process and pgrp structures. */
385 procinit(); 339 procinit();
386 lwpinit(); 340 lwpinit();
387 341
388 /* Initialize signal-related data structures. */ 342 /* Initialize signal-related data structures. */
389 signal_init(); 343 signal_init();
390 344
391 /* Initialize resource management. */ 345 /* Initialize resource management. */
392 resource_init(); 346 resource_init();
393 347
394 /* Create process 0 (the swapper). */ 348 /* Create process 0 (the swapper). */
395 proc0_init(); 349 proc0_init();
396 350
397 /* Initialize the UID hash table. */ 351 /* Initialize the UID hash table. */
398 uid_init(); 352 uid_init();
399 353
400 /* Charge root for one process. */ 354 /* Charge root for one process. */
401 (void)chgproccnt(0, 1); 355 (void)chgproccnt(0, 1);
402 356
403 /* Initialize timekeeping. */ 357 /* Initialize timekeeping. */
404 time_init(); 358 time_init();
405 359
406 /* Initialize the run queues, turnstiles and sleep queues. */ 360 /* Initialize the run queues, turnstiles and sleep queues. */
407 mutex_init(&cpu_lock, MUTEX_DEFAULT, IPL_NONE); 361 mutex_init(&cpu_lock, MUTEX_DEFAULT, IPL_NONE);
408 sched_rqinit(); 362 sched_rqinit();
409 turnstile_init(); 363 turnstile_init();
410 sleeptab_init(&sleeptab); 364 sleeptab_init(&sleeptab);
411 365
412 /* Initialize processor-sets */ 366 /* Initialize processor-sets */
413 psets_init(); 367 psets_init();
414 368
415 /* MI initialization of the boot cpu */ 369 /* MI initialization of the boot cpu */
416 error = mi_cpu_attach(curcpu()); 370 error = mi_cpu_attach(curcpu());
417 KASSERT(error == 0); 371 KASSERT(error == 0);
418 372
419 /* Initialize timekeeping, part 2. */ 373 /* Initialize timekeeping, part 2. */
420 time_init2(); 374 time_init2();
421 375
422 /* 376 /*
423 * Initialize mbuf's. Do this now because we might attempt to 377 * Initialize mbuf's. Do this now because we might attempt to
424 * allocate mbufs or mbuf clusters during autoconfiguration. 378 * allocate mbufs or mbuf clusters during autoconfiguration.
425 */ 379 */
426 mbinit(); 380 mbinit();
427 381
428 /* Initialize the sysctl subsystem. */ 382 /* Initialize the sysctl subsystem. */
429 sysctl_init(); 383 sysctl_init();
430 384
431 /* Initialize I/O statistics. */ 385 /* Initialize I/O statistics. */
432 iostat_init(); 386 iostat_init();
433 387
434 /* Initialize the log device. */ 388 /* Initialize the log device. */
435 loginit(); 389 loginit();
436 390
437 /* Start module system. */ 391 /* Start module system. */
438 module_init(); 392 module_init();
439 393
440 /* Initialize the file systems. */ 394 /* Initialize the file systems. */
441#ifdef NVNODE_IMPLICIT 395#ifdef NVNODE_IMPLICIT
442 /* 396 /*
443 * If maximum number of vnodes in namei vnode cache is not explicitly 397 * If maximum number of vnodes in namei vnode cache is not explicitly
444 * defined in kernel config, adjust the number such as we use roughly 398 * defined in kernel config, adjust the number such as we use roughly
445 * 10% of memory for vnodes and associated data structures in the 399 * 10% of memory for vnodes and associated data structures in the
446 * assumed worst case. Do not provide fewer than NVNODE vnodes. 400 * assumed worst case. Do not provide fewer than NVNODE vnodes.
447 */ 401 */
448 usevnodes = 402 usevnodes =
449 calc_cache_size(kernel_map, 10, VNODE_VA_MAXPCT) / VNODE_COST; 403 calc_cache_size(kernel_map, 10, VNODE_VA_MAXPCT) / VNODE_COST;
450 if (usevnodes > desiredvnodes) 404 if (usevnodes > desiredvnodes)
451 desiredvnodes = usevnodes; 405 desiredvnodes = usevnodes;
452#endif 406#endif
453 vfsinit(); 407 vfsinit();
454 lf_init(); 408 lf_init();
455 409
456 /* Initialize fstrans. */ 410 /* Initialize fstrans. */
457 fstrans_init(); 411 fstrans_init();
458 412
459 /* Initialize the file descriptor system. */ 413 /* Initialize the file descriptor system. */
460 fd_sys_init(); 414 fd_sys_init();
461 415
462 /* Initialize kqueue. */ 416 /* Initialize kqueue. */
463 kqueue_init(); 417 kqueue_init();
464 418
465 /* Initialize asynchronous I/O. */ 419 /* Initialize asynchronous I/O. */
466 aio_sysinit(); 420 aio_sysinit();
467 421
468 /* Initialize message queues. */ 422 /* Initialize message queues. */
469 mqueue_sysinit(); 423 mqueue_sysinit();
470 424
471 /* Initialize the system monitor subsystems. */ 425 /* Initialize the system monitor subsystems. */
472#if NSYSMON_TASKQ > 0 426#if NSYSMON_TASKQ > 0
473 sysmon_task_queue_preinit(); 427 sysmon_task_queue_preinit();
474#endif 428#endif
475 429
476#if NSYSMON_ENVSYS > 0 430#if NSYSMON_ENVSYS > 0
477 sysmon_envsys_init(); 431 sysmon_envsys_init();
478#endif 432#endif
479 433
480#if NSYSMON_POWER > 0 434#if NSYSMON_POWER > 0
481 sysmon_power_init(); 435 sysmon_power_init();
482#endif 436#endif
483 437
484#if NSYSMON_WDOG > 0 438#if NSYSMON_WDOG > 0
485 sysmon_wdog_init(); 439 sysmon_wdog_init();
486#endif 440#endif
487 441
488 inittimecounter(); 442 inittimecounter();
489 ntp_init(); 443 ntp_init();
490 444
491 /* Initialize the device switch tables. */ 445 /* Initialize the device switch tables. */
492 devsw_init(); 446 devsw_init();
493 447
494 /* Initialize tty subsystem. */ 448 /* Initialize tty subsystem. */
495 tty_init(); 449 tty_init();
496 ttyldisc_init(); 450 ttyldisc_init();
497 451
498 /* Initialize the buffer cache, part 2. */ 452 /* Initialize the buffer cache, part 2. */
499 bufinit2(); 453 bufinit2();
500 454
501 /* Initialize the disk wedge subsystem. */ 455 /* Initialize the disk wedge subsystem. */
502 dkwedge_init(); 456 dkwedge_init();
503 457
504 /* Initialize interfaces. */ 458 /* Initialize interfaces. */
505 ifinit1(); 459 ifinit1();
506 460
507 /* Configure the system hardware. This will enable interrupts. */ 461 /* Configure the system hardware. This will enable interrupts. */
508 configure(); 462 configure();
509 463
 464 ssp_init();
 465
 466 configure2();
 467
510 ubc_init(); /* must be after autoconfig */ 468 ubc_init(); /* must be after autoconfig */
511 469
512#ifdef SYSVSHM 470#ifdef SYSVSHM
513 /* Initialize System V style shared memory. */ 471 /* Initialize System V style shared memory. */
514 shminit(); 472 shminit();
515#endif 473#endif
516 474
517#ifdef SYSVSEM 475#ifdef SYSVSEM
518 /* Initialize System V style semaphores. */ 476 /* Initialize System V style semaphores. */
519 seminit(); 477 seminit();
520#endif 478#endif
521 479
522#ifdef SYSVMSG 480#ifdef SYSVMSG
523 /* Initialize System V style message queues. */ 481 /* Initialize System V style message queues. */
524 msginit(); 482 msginit();
525#endif 483#endif
526 484
527#ifdef P1003_1B_SEMAPHORE 485#ifdef P1003_1B_SEMAPHORE
528 /* Initialize posix semaphores */ 486 /* Initialize posix semaphores */
529 ksem_init(); 487 ksem_init();
530#endif 488#endif
531 489
532#if NVERIEXEC > 0 490#if NVERIEXEC > 0
533 /* 491 /*
534 * Initialise the Veriexec subsystem. 492 * Initialise the Veriexec subsystem.
535 */ 493 */
536 veriexec_init(); 494 veriexec_init();
537#endif /* NVERIEXEC > 0 */ 495#endif /* NVERIEXEC > 0 */
538 496
539#if defined(PAX_MPROTECT) || defined(PAX_SEGVGUARD) || defined(PAX_ASLR) 497#if defined(PAX_MPROTECT) || defined(PAX_SEGVGUARD) || defined(PAX_ASLR)
540 pax_init(); 498 pax_init();
541#endif /* PAX_MPROTECT || PAX_SEGVGUARD || PAX_ASLR */ 499#endif /* PAX_MPROTECT || PAX_SEGVGUARD || PAX_ASLR */
542 500
543#ifdef FAST_IPSEC 501#ifdef FAST_IPSEC
544 /* Attach network crypto subsystem */ 502 /* Attach network crypto subsystem */
545 ipsec_attach(); 503 ipsec_attach();
546#endif 504#endif
547 505
548 /* 506 /*
549 * Initialize protocols. Block reception of incoming packets 507 * Initialize protocols. Block reception of incoming packets
550 * until everything is ready. 508 * until everything is ready.
551 */ 509 */
552 s = splnet(); 510 s = splnet();
553 ifinit(); 511 ifinit();
554 domaininit(); 512 domaininit();
555 if_attachdomain(); 513 if_attachdomain();
556 splx(s); 514 splx(s);
557 515
558#ifdef GPROF 516#ifdef GPROF
559 /* Initialize kernel profiling. */ 517 /* Initialize kernel profiling. */
560 kmstartup(); 518 kmstartup();
561#endif 519#endif
562 520
563 /* Initialize system accounting. */ 521 /* Initialize system accounting. */
564 acct_init(); 522 acct_init();
565 523
566#ifndef PIPE_SOCKETPAIR 524#ifndef PIPE_SOCKETPAIR
567 /* Initialize pipes. */ 525 /* Initialize pipes. */
568 pipe_init(); 526 pipe_init();
569#endif 527#endif
570 528
571#ifdef KTRACE 529#ifdef KTRACE
572 /* Initialize ktrace. */ 530 /* Initialize ktrace. */
573 ktrinit(); 531 ktrinit();
574#endif 532#endif
575 533
576 /* Initialize the UUID system calls. */ 534 /* Initialize the UUID system calls. */
577 uuid_init(); 535 uuid_init();
578 536
579#ifdef WAPBL 537#ifdef WAPBL
580 /* Initialize write-ahead physical block logging. */ 538 /* Initialize write-ahead physical block logging. */
581 wapbl_init(); 539 wapbl_init();
582#endif 540#endif
583 541
584 /* 542 /*
585 * Create process 1 (init(8)). We do this now, as Unix has 543 * Create process 1 (init(8)). We do this now, as Unix has
586 * historically had init be process 1, and changing this would 544 * historically had init be process 1, and changing this would
587 * probably upset a lot of people. 545 * probably upset a lot of people.
588 * 546 *
589 * Note that process 1 won't immediately exec init(8), but will 547 * Note that process 1 won't immediately exec init(8), but will
590 * wait for us to inform it that the root file system has been 548 * wait for us to inform it that the root file system has been
591 * mounted. 549 * mounted.
592 */ 550 */
593 if (fork1(l, 0, SIGCHLD, NULL, 0, start_init, NULL, NULL, &initproc)) 551 if (fork1(l, 0, SIGCHLD, NULL, 0, start_init, NULL, NULL, &initproc))
594 panic("fork init"); 552 panic("fork init");
595 553
596 /* 554 /*
597 * Load any remaining builtin modules, and hand back temporary 555 * Load any remaining builtin modules, and hand back temporary
598 * storage to the VM system. 556 * storage to the VM system.
599 */ 557 */
600 module_init_class(MODULE_CLASS_ANY); 558 module_init_class(MODULE_CLASS_ANY);
601 559
602 /* 560 /*
603 * Finalize configuration now that all real devices have been 561 * Finalize configuration now that all real devices have been
604 * found. This needs to be done before the root device is 562 * found. This needs to be done before the root device is
605 * selected, since finalization may create the root device. 563 * selected, since finalization may create the root device.
606 */ 564 */
607 config_finalize(); 565 config_finalize();
608 566
609 /* 567 /*
610 * Now that autoconfiguration has completed, we can determine 568 * Now that autoconfiguration has completed, we can determine
611 * the root and dump devices. 569 * the root and dump devices.
612 */ 570 */
613 cpu_rootconf(); 571 cpu_rootconf();
614 cpu_dumpconf(); 572 cpu_dumpconf();
615 573
616 /* Mount the root file system. */ 574 /* Mount the root file system. */
617 do { 575 do {
618 domountroothook(); 576 domountroothook();
619 if ((error = vfs_mountroot())) { 577 if ((error = vfs_mountroot())) {
620 printf("cannot mount root, error = %d\n", error); 578 printf("cannot mount root, error = %d\n", error);
621 boothowto |= RB_ASKNAME; 579 boothowto |= RB_ASKNAME;
622 setroot(root_device, 580 setroot(root_device,
623 (rootdev != NODEV) ? DISKPART(rootdev) : 0); 581 (rootdev != NODEV) ? DISKPART(rootdev) : 0);
624 } 582 }
625 } while (error != 0); 583 } while (error != 0);
626 mountroothook_destroy(); 584 mountroothook_destroy();
627 585
628 /* 586 /*
629 * Initialise the time-of-day clock, passing the time recorded 587 * Initialise the time-of-day clock, passing the time recorded
630 * in the root filesystem (if any) for use by systems that 588 * in the root filesystem (if any) for use by systems that
631 * don't have a non-volatile time-of-day device. 589 * don't have a non-volatile time-of-day device.
632 */ 590 */
633 inittodr(rootfstime); 591 inittodr(rootfstime);
634 592
635 CIRCLEQ_FIRST(&mountlist)->mnt_flag |= MNT_ROOTFS; 593 CIRCLEQ_FIRST(&mountlist)->mnt_flag |= MNT_ROOTFS;
636 CIRCLEQ_FIRST(&mountlist)->mnt_op->vfs_refcount++; 594 CIRCLEQ_FIRST(&mountlist)->mnt_op->vfs_refcount++;
637 595
638 /* 596 /*
639 * Get the vnode for '/'. Set filedesc0.fd_fd.fd_cdir to 597 * Get the vnode for '/'. Set filedesc0.fd_fd.fd_cdir to
640 * reference it. 598 * reference it.
641 */ 599 */
642 error = VFS_ROOT(CIRCLEQ_FIRST(&mountlist), &rootvnode); 600 error = VFS_ROOT(CIRCLEQ_FIRST(&mountlist), &rootvnode);
643 if (error) 601 if (error)
644 panic("cannot find root vnode, error=%d", error); 602 panic("cannot find root vnode, error=%d", error);
645 cwdi0.cwdi_cdir = rootvnode; 603 cwdi0.cwdi_cdir = rootvnode;
646 VREF(cwdi0.cwdi_cdir); 604 VREF(cwdi0.cwdi_cdir);
647 VOP_UNLOCK(rootvnode, 0); 605 VOP_UNLOCK(rootvnode, 0);
648 cwdi0.cwdi_rdir = NULL; 606 cwdi0.cwdi_rdir = NULL;
649 607
650 /* 608 /*
651 * Now that root is mounted, we can fixup initproc's CWD 609 * Now that root is mounted, we can fixup initproc's CWD
652 * info. All other processes are kthreads, which merely 610 * info. All other processes are kthreads, which merely
653 * share proc0's CWD info. 611 * share proc0's CWD info.
654 */ 612 */
655 initproc->p_cwdi->cwdi_cdir = rootvnode; 613 initproc->p_cwdi->cwdi_cdir = rootvnode;
656 VREF(initproc->p_cwdi->cwdi_cdir); 614 VREF(initproc->p_cwdi->cwdi_cdir);
657 initproc->p_cwdi->cwdi_rdir = NULL; 615 initproc->p_cwdi->cwdi_rdir = NULL;
658 616
659 /* 617 /*
660 * Now can look at time, having had a chance to verify the time 618 * Now can look at time, having had a chance to verify the time
661 * from the file system. Reset l->l_rtime as it may have been 619 * from the file system. Reset l->l_rtime as it may have been
662 * munched in mi_switch() after the time got set. 620 * munched in mi_switch() after the time got set.
663 */ 621 */
664 getmicrotime(&time); 622 getmicrotime(&time);
665 boottime = time; 623 boottime = time;
666 mutex_enter(proc_lock); 624 mutex_enter(proc_lock);
667 LIST_FOREACH(p, &allproc, p_list) { 625 LIST_FOREACH(p, &allproc, p_list) {
668 KASSERT((p->p_flag & PK_MARKER) == 0); 626 KASSERT((p->p_flag & PK_MARKER) == 0);
669 mutex_enter(p->p_lock); 627 mutex_enter(p->p_lock);
670 p->p_stats->p_start = time; 628 p->p_stats->p_start = time;
671 LIST_FOREACH(l, &p->p_lwps, l_sibling) { 629 LIST_FOREACH(l, &p->p_lwps, l_sibling) {
672 lwp_lock(l); 630 lwp_lock(l);
673 memset(&l->l_rtime, 0, sizeof(l->l_rtime)); 631 memset(&l->l_rtime, 0, sizeof(l->l_rtime));
674 lwp_unlock(l); 632 lwp_unlock(l);
675 } 633 }
676 mutex_exit(p->p_lock); 634 mutex_exit(p->p_lock);
677 } 635 }
678 mutex_exit(proc_lock); 636 mutex_exit(proc_lock);
679 binuptime(&curlwp->l_stime); 637 binuptime(&curlwp->l_stime);
680 638
681 for (CPU_INFO_FOREACH(cii, ci)) { 639 for (CPU_INFO_FOREACH(cii, ci)) {
682 ci->ci_schedstate.spc_lastmod = time_second; 640 ci->ci_schedstate.spc_lastmod = time_second;
683 } 641 }
684 642
685 /* Create the pageout daemon kernel thread. */ 643 /* Create the pageout daemon kernel thread. */
686 uvm_swap_init(); 644 uvm_swap_init();
687 if (kthread_create(PRI_PGDAEMON, KTHREAD_MPSAFE, NULL, uvm_pageout, 645 if (kthread_create(PRI_PGDAEMON, KTHREAD_MPSAFE, NULL, uvm_pageout,
688 NULL, NULL, "pgdaemon")) 646 NULL, NULL, "pgdaemon"))
689 panic("fork pagedaemon"); 647 panic("fork pagedaemon");
690 648
691 /* Create the filesystem syncer kernel thread. */ 649 /* Create the filesystem syncer kernel thread. */
692 if (kthread_create(PRI_IOFLUSH, KTHREAD_MPSAFE, NULL, sched_sync, 650 if (kthread_create(PRI_IOFLUSH, KTHREAD_MPSAFE, NULL, sched_sync,
693 NULL, NULL, "ioflush")) 651 NULL, NULL, "ioflush"))
694 panic("fork syncer"); 652 panic("fork syncer");
695 653
696 /* Create the aiodone daemon kernel thread. */ 654 /* Create the aiodone daemon kernel thread. */
697 if (workqueue_create(&uvm.aiodone_queue, "aiodoned", 655 if (workqueue_create(&uvm.aiodone_queue, "aiodoned",
698 uvm_aiodone_worker, NULL, PRI_VM, IPL_NONE, WQ_MPSAFE)) 656 uvm_aiodone_worker, NULL, PRI_VM, IPL_NONE, WQ_MPSAFE))
699 panic("fork aiodoned"); 657 panic("fork aiodoned");
700 658
701 vmem_rehash_start(); 659 vmem_rehash_start();
702 660
703 /* Initialize exec structures */ 661 /* Initialize exec structures */
704 exec_init(1); 662 exec_init(1);
705 663
706 /* 664 /*
707 * Okay, now we can let init(8) exec! It's off to userland! 665 * Okay, now we can let init(8) exec! It's off to userland!
708 */ 666 */
709 mutex_enter(proc_lock); 667 mutex_enter(proc_lock);
710 start_init_exec = 1; 668 start_init_exec = 1;
711 cv_broadcast(&lbolt); 669 cv_broadcast(&lbolt);
712 mutex_exit(proc_lock); 670 mutex_exit(proc_lock);
713 671
714 /* The scheduler is an infinite loop. */ 672 /* The scheduler is an infinite loop. */
715 uvm_scheduler(); 673 uvm_scheduler();
716 /* NOTREACHED */ 674 /* NOTREACHED */
717} 675}
718 676
719static void 677static void
720check_console(struct lwp *l) 678check_console(struct lwp *l)
721{ 679{
722 struct nameidata nd; 680 struct nameidata nd;
723 int error; 681 int error;
724 682
725 NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, "/dev/console"); 683 NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, "/dev/console");
726 error = namei(&nd); 684 error = namei(&nd);
727 if (error == 0) 685 if (error == 0)
728 vrele(nd.ni_vp); 686 vrele(nd.ni_vp);
729 else if (error == ENOENT) 687 else if (error == ENOENT)
730 printf("warning: no /dev/console\n"); 688 printf("warning: no /dev/console\n");
731 else 689 else
732 printf("warning: lookup /dev/console: error %d\n", error); 690 printf("warning: lookup /dev/console: error %d\n", error);
733} 691}
734 692
735/* 693/*
736 * List of paths to try when searching for "init". 694 * List of paths to try when searching for "init".
737 */ 695 */
738static const char * const initpaths[] = { 696static const char * const initpaths[] = {
739 "/sbin/init", 697 "/sbin/init",
740 "/sbin/oinit", 698 "/sbin/oinit",
741 "/sbin/init.bak", 699 "/sbin/init.bak",
742 NULL, 700 NULL,
743}; 701};
744 702
745/* 703/*
746 * Start the initial user process; try exec'ing each pathname in "initpaths". 704 * Start the initial user process; try exec'ing each pathname in "initpaths".
747 * The program is invoked with one argument containing the boot flags. 705 * The program is invoked with one argument containing the boot flags.
748 */ 706 */
749static void 707static void
750start_init(void *arg) 708start_init(void *arg)
751{ 709{
752 struct lwp *l = arg; 710 struct lwp *l = arg;
753 struct proc *p = l->l_proc; 711 struct proc *p = l->l_proc;
754 vaddr_t addr; 712 vaddr_t addr;
755 struct sys_execve_args /* { 713 struct sys_execve_args /* {
756 syscallarg(const char *) path; 714 syscallarg(const char *) path;
757 syscallarg(char * const *) argp; 715 syscallarg(char * const *) argp;
758 syscallarg(char * const *) envp; 716 syscallarg(char * const *) envp;
759 } */ args; 717 } */ args;
760 int options, i, error; 718 int options, i, error;
761 register_t retval[2]; 719 register_t retval[2];
762 char flags[4], *flagsp; 720 char flags[4], *flagsp;
763 const char *path, *slash; 721 const char *path, *slash;
764 char *ucp, **uap, *arg0, *arg1 = NULL; 722 char *ucp, **uap, *arg0, *arg1 = NULL;
765 char ipath[129]; 723 char ipath[129];
766 int ipx, len; 724 int ipx, len;
767 725
768 /* 726 /*
769 * Now in process 1. 727 * Now in process 1.
770 */ 728 */
771 strncpy(p->p_comm, "init", MAXCOMLEN); 729 strncpy(p->p_comm, "init", MAXCOMLEN);
772 730
773 /* 731 /*
774 * Wait for main() to tell us that it's safe to exec. 732 * Wait for main() to tell us that it's safe to exec.
775 */ 733 */
776 mutex_enter(proc_lock); 734 mutex_enter(proc_lock);
777 while (start_init_exec == 0) 735 while (start_init_exec == 0)
778 cv_wait(&lbolt, proc_lock); 736 cv_wait(&lbolt, proc_lock);
779 mutex_exit(proc_lock); 737 mutex_exit(proc_lock);
780 738
781 /* 739 /*
782 * This is not the right way to do this. We really should 740 * This is not the right way to do this. We really should
783 * hand-craft a descriptor onto /dev/console to hand to init, 741 * hand-craft a descriptor onto /dev/console to hand to init,
784 * but that's a _lot_ more work, and the benefit from this easy 742 * but that's a _lot_ more work, and the benefit from this easy
785 * hack makes up for the "good is the enemy of the best" effect. 743 * hack makes up for the "good is the enemy of the best" effect.
786 */ 744 */
787 check_console(l); 745 check_console(l);
788 746
789 /* 747 /*
790 * Need just enough stack to hold the faked-up "execve()" arguments. 748 * Need just enough stack to hold the faked-up "execve()" arguments.
791 */ 749 */
792 addr = (vaddr_t)STACK_ALLOC(USRSTACK, PAGE_SIZE); 750 addr = (vaddr_t)STACK_ALLOC(USRSTACK, PAGE_SIZE);
793 if (uvm_map(&p->p_vmspace->vm_map, &addr, PAGE_SIZE, 751 if (uvm_map(&p->p_vmspace->vm_map, &addr, PAGE_SIZE,
794 NULL, UVM_UNKNOWN_OFFSET, 0, 752 NULL, UVM_UNKNOWN_OFFSET, 0,
795 UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY, 753 UVM_MAPFLAG(UVM_PROT_ALL, UVM_PROT_ALL, UVM_INH_COPY,
796 UVM_ADV_NORMAL, 754 UVM_ADV_NORMAL,
797 UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW)) != 0) 755 UVM_FLAG_FIXED|UVM_FLAG_OVERLAY|UVM_FLAG_COPYONW)) != 0)
798 panic("init: couldn't allocate argument space"); 756 panic("init: couldn't allocate argument space");
799 p->p_vmspace->vm_maxsaddr = (void *)STACK_MAX(addr, PAGE_SIZE); 757 p->p_vmspace->vm_maxsaddr = (void *)STACK_MAX(addr, PAGE_SIZE);
800 758
801 ipx = 0; 759 ipx = 0;
802 while (1) { 760 while (1) {
803 if (boothowto & RB_ASKNAME) { 761 if (boothowto & RB_ASKNAME) {
804 printf("init path"); 762 printf("init path");
805 if (initpaths[ipx]) 763 if (initpaths[ipx])
806 printf(" (default %s)", initpaths[ipx]); 764 printf(" (default %s)", initpaths[ipx]);
807 printf(": "); 765 printf(": ");
808 len = cngetsn(ipath, sizeof(ipath)-1); 766 len = cngetsn(ipath, sizeof(ipath)-1);
809 if (len == 4 && strcmp(ipath, "halt") == 0) { 767 if (len == 4 && strcmp(ipath, "halt") == 0) {
810 cpu_reboot(RB_HALT, NULL); 768 cpu_reboot(RB_HALT, NULL);
811 } else if (len == 6 && strcmp(ipath, "reboot") == 0) { 769 } else if (len == 6 && strcmp(ipath, "reboot") == 0) {
812 cpu_reboot(0, NULL); 770 cpu_reboot(0, NULL);
813#if defined(DDB) 771#if defined(DDB)
814 } else if (len == 3 && strcmp(ipath, "ddb") == 0) { 772 } else if (len == 3 && strcmp(ipath, "ddb") == 0) {
815 console_debugger(); 773 console_debugger();
816 continue; 774 continue;
817#endif 775#endif
818 } else if (len > 0 && ipath[0] == '/') { 776 } else if (len > 0 && ipath[0] == '/') {
819 ipath[len] = '\0'; 777 ipath[len] = '\0';
820 path = ipath; 778 path = ipath;
821 } else if (len == 0 && initpaths[ipx] != NULL) { 779 } else if (len == 0 && initpaths[ipx] != NULL) {
822 path = initpaths[ipx++]; 780 path = initpaths[ipx++];
823 } else { 781 } else {
824 printf("use absolute path, "); 782 printf("use absolute path, ");
825#if defined(DDB) 783#if defined(DDB)
826 printf("\"ddb\", "); 784 printf("\"ddb\", ");
827#endif 785#endif
828 printf("\"halt\", or \"reboot\"\n"); 786 printf("\"halt\", or \"reboot\"\n");
829 continue; 787 continue;
830 } 788 }
831 } else { 789 } else {
832 if ((path = initpaths[ipx++]) == NULL) { 790 if ((path = initpaths[ipx++]) == NULL) {
833 ipx = 0; 791 ipx = 0;
834 boothowto |= RB_ASKNAME; 792 boothowto |= RB_ASKNAME;
835 continue; 793 continue;
836 } 794 }
837 } 795 }
838 796
839 ucp = (char *)USRSTACK; 797 ucp = (char *)USRSTACK;
840 798
841 /* 799 /*
842 * Construct the boot flag argument. 800 * Construct the boot flag argument.
843 */ 801 */
844 flagsp = flags; 802 flagsp = flags;
845 *flagsp++ = '-'; 803 *flagsp++ = '-';
846 options = 0; 804 options = 0;
847 805
848 if (boothowto & RB_SINGLE) { 806 if (boothowto & RB_SINGLE) {
849 *flagsp++ = 's'; 807 *flagsp++ = 's';
850 options = 1; 808 options = 1;
851 } 809 }
852#ifdef notyet 810#ifdef notyet
853 if (boothowto & RB_FASTBOOT) { 811 if (boothowto & RB_FASTBOOT) {
854 *flagsp++ = 'f'; 812 *flagsp++ = 'f';
855 options = 1; 813 options = 1;
856 } 814 }
857#endif 815#endif
858 816
859 /* 817 /*
860 * Move out the flags (arg 1), if necessary. 818 * Move out the flags (arg 1), if necessary.
861 */ 819 */
862 if (options != 0) { 820 if (options != 0) {
863 *flagsp++ = '\0'; 821 *flagsp++ = '\0';
864 i = flagsp - flags; 822 i = flagsp - flags;
865#ifdef DEBUG 823#ifdef DEBUG
866 printf("init: copying out flags `%s' %d\n", flags, i); 824 printf("init: copying out flags `%s' %d\n", flags, i);
867#endif 825#endif
868 arg1 = STACK_ALLOC(ucp, i); 826 arg1 = STACK_ALLOC(ucp, i);
869 ucp = STACK_MAX(arg1, i); 827 ucp = STACK_MAX(arg1, i);
870 (void)copyout((void *)flags, arg1, i); 828 (void)copyout((void *)flags, arg1, i);
871 } 829 }
872 830
873 /* 831 /*
874 * Move out the file name (also arg 0). 832 * Move out the file name (also arg 0).
875 */ 833 */
876 i = strlen(path) + 1; 834 i = strlen(path) + 1;
877#ifdef DEBUG 835#ifdef DEBUG
878 printf("init: copying out path `%s' %d\n", path, i); 836 printf("init: copying out path `%s' %d\n", path, i);
879#else 837#else
880 if (boothowto & RB_ASKNAME || path != initpaths[0]) 838 if (boothowto & RB_ASKNAME || path != initpaths[0])
881 printf("init: trying %s\n", path); 839 printf("init: trying %s\n", path);
882#endif 840#endif
883 arg0 = STACK_ALLOC(ucp, i); 841 arg0 = STACK_ALLOC(ucp, i);
884 ucp = STACK_MAX(arg0, i); 842 ucp = STACK_MAX(arg0, i);
885 (void)copyout(path, arg0, i); 843 (void)copyout(path, arg0, i);
886 844
887 /* 845 /*
888 * Move out the arg pointers. 846 * Move out the arg pointers.
889 */ 847 */
890 ucp = (void *)STACK_ALIGN(ucp, ALIGNBYTES); 848 ucp = (void *)STACK_ALIGN(ucp, ALIGNBYTES);
891 uap = (char **)STACK_ALLOC(ucp, sizeof(char *) * 3); 849 uap = (char **)STACK_ALLOC(ucp, sizeof(char *) * 3);
892 SCARG(&args, path) = arg0; 850 SCARG(&args, path) = arg0;
893 SCARG(&args, argp) = uap; 851 SCARG(&args, argp) = uap;
894 SCARG(&args, envp) = NULL; 852 SCARG(&args, envp) = NULL;
895 slash = strrchr(path, '/'); 853 slash = strrchr(path, '/');
896 if (slash) 854 if (slash)
897 (void)suword((void *)uap++, 855 (void)suword((void *)uap++,
898 (long)arg0 + (slash + 1 - path)); 856 (long)arg0 + (slash + 1 - path));
899 else 857 else
900 (void)suword((void *)uap++, (long)arg0); 858 (void)suword((void *)uap++, (long)arg0);
901 if (options != 0) 859 if (options != 0)
902 (void)suword((void *)uap++, (long)arg1); 860 (void)suword((void *)uap++, (long)arg1);
903 (void)suword((void *)uap++, 0); /* terminator */ 861 (void)suword((void *)uap++, 0); /* terminator */
904 862
905 /* 863 /*
906 * Now try to exec the program. If can't for any reason 864 * Now try to exec the program. If can't for any reason
907 * other than it doesn't exist, complain. 865 * other than it doesn't exist, complain.
908 */ 866 */
909 error = sys_execve(l, &args, retval); 867 error = sys_execve(l, &args, retval);
910 if (error == 0 || error == EJUSTRETURN) { 868 if (error == 0 || error == EJUSTRETURN) {
911 KERNEL_UNLOCK_LAST(l); 869 KERNEL_UNLOCK_LAST(l);
912 return; 870 return;
913 } 871 }
914 printf("exec %s: error %d\n", path, error); 872 printf("exec %s: error %d\n", path, error);
915 } 873 }
916 printf("init: not found\n"); 874 printf("init: not found\n");
917 panic("no init"); 875 panic("no init");
918} 876}
919 877
920/* 878/*
921 * calculate cache size from physmem and vm_map size. 879 * calculate cache size from physmem and vm_map size.
922 */ 880 */
923vaddr_t 881vaddr_t
924calc_cache_size(struct vm_map *map, int pct, int va_pct) 882calc_cache_size(struct vm_map *map, int pct, int va_pct)
925{ 883{
926 paddr_t t; 884 paddr_t t;
927 885
928 /* XXX should consider competing cache if any */ 886 /* XXX should consider competing cache if any */
929 /* XXX should consider submaps */ 887 /* XXX should consider submaps */
930 t = (uintmax_t)physmem * pct / 100 * PAGE_SIZE; 888 t = (uintmax_t)physmem * pct / 100 * PAGE_SIZE;
931 if (map != NULL) { 889 if (map != NULL) {
932 vsize_t vsize; 890 vsize_t vsize;
933 891
934 vsize = vm_map_max(map) - vm_map_min(map); 892 vsize = vm_map_max(map) - vm_map_min(map);
935 vsize = (uintmax_t)vsize * va_pct / 100; 893 vsize = (uintmax_t)vsize * va_pct / 100;
936 if (t > vsize) { 894 if (t > vsize) {
937 t = vsize; 895 t = vsize;
938 } 896 }
939 } 897 }
940 return t; 898 return t;
941} 899}

File Added: src/sys/kern/kern_ssp.c
/*	$NetBSD: kern_ssp.c,v 1.2.4.2 2009/03/15 19:43:48 snj Exp $	*/

/*-
 * Copyright (c) 2008 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * 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: kern_ssp.c,v 1.2.4.2 2009/03/15 19:43:48 snj Exp $");

#include <sys/systm.h>
#include <sys/intr.h>

#if defined(__SSP__) || defined(__SSP_ALL__)
long __stack_chk_guard[8] = {0, 0, 0, 0, 0, 0, 0, 0};
void __stack_chk_fail(void);

void
__stack_chk_fail(void)
{
	panic("stack overflow detected; terminated");
}

void
ssp_init(void)
{
	int s;

#ifdef DIAGNOSTIC
	printf("Initializing SSP:");
#endif
	/*
	 * We initialize ssp here carefully:
	 *	1. after we got some entropy
	 *	2. without calling a function
	 */
	size_t i;
	long guard[__arraycount(__stack_chk_guard)];

	arc4randbytes(guard, sizeof(guard));
	s = splhigh();
	for (i = 0; i < __arraycount(guard); i++)
		__stack_chk_guard[i] = guard[i];
	splx(s);
#ifdef DIAGNOSTIC
	for (i = 0; i < __arraycount(guard); i++)
		printf("%lx ", guard[i]);
	printf("\n");
#endif
}
#else
void
ssp_init(void)
{
}
#endif

cvs diff -r1.163.4.1 -r1.163.4.2 src/sys/kern/subr_autoconf.c (switch to unified diff)

--- src/sys/kern/subr_autoconf.c 2009/02/02 02:38:32 1.163.4.1
+++ src/sys/kern/subr_autoconf.c 2009/03/15 19:43:48 1.163.4.2
@@ -1,1444 +1,1444 @@ @@ -1,1444 +1,1444 @@
1/* $NetBSD: subr_autoconf.c,v 1.163.4.1 2009/02/02 02:38:32 snj Exp $ */ 1/* $NetBSD: subr_autoconf.c,v 1.163.4.2 2009/03/15 19:43:48 snj Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996, 2000 Christopher G. Demetriou 4 * Copyright (c) 1996, 2000 Christopher G. Demetriou
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software 15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement: 16 * must display the following acknowledgement:
17 * This product includes software developed for the 17 * This product includes software developed for the
18 * NetBSD Project. See http://www.NetBSD.org/ for 18 * NetBSD Project. See http://www.NetBSD.org/ for
19 * information about NetBSD. 19 * information about NetBSD.
20 * 4. The name of the author may not be used to endorse or promote products 20 * 4. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission. 21 * derived from this software without specific prior written permission.
22 * 22 *
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 * 33 *
34 * --(license Id: LICENSE.proto,v 1.1 2000/06/13 21:40:26 cgd Exp )-- 34 * --(license Id: LICENSE.proto,v 1.1 2000/06/13 21:40:26 cgd Exp )--
35 */ 35 */
36 36
37/* 37/*
38 * Copyright (c) 1992, 1993 38 * Copyright (c) 1992, 1993
39 * The Regents of the University of California. All rights reserved. 39 * The Regents of the University of California. All rights reserved.
40 * 40 *
41 * This software was developed by the Computer Systems Engineering group 41 * This software was developed by the Computer Systems Engineering group
42 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 42 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
43 * contributed to Berkeley. 43 * contributed to Berkeley.
44 * 44 *
45 * All advertising materials mentioning features or use of this software 45 * All advertising materials mentioning features or use of this software
46 * must display the following acknowledgement: 46 * must display the following acknowledgement:
47 * This product includes software developed by the University of 47 * This product includes software developed by the University of
48 * California, Lawrence Berkeley Laboratories. 48 * California, Lawrence Berkeley Laboratories.
49 * 49 *
50 * Redistribution and use in source and binary forms, with or without 50 * Redistribution and use in source and binary forms, with or without
51 * modification, are permitted provided that the following conditions 51 * modification, are permitted provided that the following conditions
52 * are met: 52 * are met:
53 * 1. Redistributions of source code must retain the above copyright 53 * 1. Redistributions of source code must retain the above copyright
54 * notice, this list of conditions and the following disclaimer. 54 * notice, this list of conditions and the following disclaimer.
55 * 2. Redistributions in binary form must reproduce the above copyright 55 * 2. Redistributions in binary form must reproduce the above copyright
56 * notice, this list of conditions and the following disclaimer in the 56 * notice, this list of conditions and the following disclaimer in the
57 * documentation and/or other materials provided with the distribution. 57 * documentation and/or other materials provided with the distribution.
58 * 3. Neither the name of the University nor the names of its contributors 58 * 3. Neither the name of the University nor the names of its contributors
59 * may be used to endorse or promote products derived from this software 59 * may be used to endorse or promote products derived from this software
60 * without specific prior written permission. 60 * without specific prior written permission.
61 * 61 *
62 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 62 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
63 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 63 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
64 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 64 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
65 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 65 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
66 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 66 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
67 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 67 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
68 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 68 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
69 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 69 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
70 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 70 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
71 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 71 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
72 * SUCH DAMAGE. 72 * SUCH DAMAGE.
73 * 73 *
74 * from: Header: subr_autoconf.c,v 1.12 93/02/01 19:31:48 torek Exp (LBL) 74 * from: Header: subr_autoconf.c,v 1.12 93/02/01 19:31:48 torek Exp (LBL)
75 * 75 *
76 * @(#)subr_autoconf.c 8.3 (Berkeley) 5/17/94 76 * @(#)subr_autoconf.c 8.3 (Berkeley) 5/17/94
77 */ 77 */
78 78
79#include <sys/cdefs.h> 79#include <sys/cdefs.h>
80__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.163.4.1 2009/02/02 02:38:32 snj Exp $"); 80__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.163.4.2 2009/03/15 19:43:48 snj Exp $");
81 81
82#include "opt_ddb.h" 82#include "opt_ddb.h"
83#include "drvctl.h" 83#include "drvctl.h"
84 84
85#include <sys/param.h> 85#include <sys/param.h>
86#include <sys/device.h> 86#include <sys/device.h>
87#include <sys/disklabel.h> 87#include <sys/disklabel.h>
88#include <sys/conf.h> 88#include <sys/conf.h>
89#include <sys/kauth.h> 89#include <sys/kauth.h>
90#include <sys/malloc.h> 90#include <sys/malloc.h>
91#include <sys/kmem.h> 91#include <sys/kmem.h>
92#include <sys/systm.h> 92#include <sys/systm.h>
93#include <sys/kernel.h> 93#include <sys/kernel.h>
94#include <sys/errno.h> 94#include <sys/errno.h>
95#include <sys/proc.h> 95#include <sys/proc.h>
96#include <sys/reboot.h> 96#include <sys/reboot.h>
97#include <sys/kthread.h> 97#include <sys/kthread.h>
98#include <sys/buf.h> 98#include <sys/buf.h>
99#include <sys/dirent.h> 99#include <sys/dirent.h>
100#include <sys/vnode.h> 100#include <sys/vnode.h>
101#include <sys/mount.h> 101#include <sys/mount.h>
102#include <sys/namei.h> 102#include <sys/namei.h>
103#include <sys/unistd.h> 103#include <sys/unistd.h>
104#include <sys/fcntl.h> 104#include <sys/fcntl.h>
105#include <sys/lockf.h> 105#include <sys/lockf.h>
106#include <sys/callout.h> 106#include <sys/callout.h>
107#include <sys/mutex.h> 107#include <sys/mutex.h>
108#include <sys/condvar.h> 108#include <sys/condvar.h>
109#include <sys/devmon.h> 109#include <sys/devmon.h>
110#include <sys/cpu.h> 110#include <sys/cpu.h>
111 111
112#include <sys/disk.h> 112#include <sys/disk.h>
113 113
114#include <machine/limits.h> 114#include <machine/limits.h>
115 115
116#include "opt_userconf.h" 116#include "opt_userconf.h"
117#ifdef USERCONF 117#ifdef USERCONF
118#include <sys/userconf.h> 118#include <sys/userconf.h>
119#endif 119#endif
120 120
121#ifdef __i386__ 121#ifdef __i386__
122#include "opt_splash.h" 122#include "opt_splash.h"
123#if defined(SPLASHSCREEN) && defined(SPLASHSCREEN_PROGRESS) 123#if defined(SPLASHSCREEN) && defined(SPLASHSCREEN_PROGRESS)
124#include <dev/splash/splash.h> 124#include <dev/splash/splash.h>
125extern struct splash_progress *splash_progress_state; 125extern struct splash_progress *splash_progress_state;
126#endif 126#endif
127#endif 127#endif
128 128
129/* 129/*
130 * Autoconfiguration subroutines. 130 * Autoconfiguration subroutines.
131 */ 131 */
132 132
133typedef struct pmf_private { 133typedef struct pmf_private {
134 int pp_nwait; 134 int pp_nwait;
135 int pp_nlock; 135 int pp_nlock;
136 lwp_t *pp_holder; 136 lwp_t *pp_holder;
137 kmutex_t pp_mtx; 137 kmutex_t pp_mtx;
138 kcondvar_t pp_cv; 138 kcondvar_t pp_cv;
139} pmf_private_t; 139} pmf_private_t;
140 140
141/* 141/*
142 * ioconf.c exports exactly two names: cfdata and cfroots. All system 142 * ioconf.c exports exactly two names: cfdata and cfroots. All system
143 * devices and drivers are found via these tables. 143 * devices and drivers are found via these tables.
144 */ 144 */
145extern struct cfdata cfdata[]; 145extern struct cfdata cfdata[];
146extern const short cfroots[]; 146extern const short cfroots[];
147 147
148/* 148/*
149 * List of all cfdriver structures. We use this to detect duplicates 149 * List of all cfdriver structures. We use this to detect duplicates
150 * when other cfdrivers are loaded. 150 * when other cfdrivers are loaded.
151 */ 151 */
152struct cfdriverlist allcfdrivers = LIST_HEAD_INITIALIZER(&allcfdrivers); 152struct cfdriverlist allcfdrivers = LIST_HEAD_INITIALIZER(&allcfdrivers);
153extern struct cfdriver * const cfdriver_list_initial[]; 153extern struct cfdriver * const cfdriver_list_initial[];
154 154
155/* 155/*
156 * Initial list of cfattach's. 156 * Initial list of cfattach's.
157 */ 157 */
158extern const struct cfattachinit cfattachinit[]; 158extern const struct cfattachinit cfattachinit[];
159 159
160/* 160/*
161 * List of cfdata tables. We always have one such list -- the one 161 * List of cfdata tables. We always have one such list -- the one
162 * built statically when the kernel was configured. 162 * built statically when the kernel was configured.
163 */ 163 */
164struct cftablelist allcftables = TAILQ_HEAD_INITIALIZER(allcftables); 164struct cftablelist allcftables = TAILQ_HEAD_INITIALIZER(allcftables);
165static struct cftable initcftable; 165static struct cftable initcftable;
166 166
167#define ROOT ((device_t)NULL) 167#define ROOT ((device_t)NULL)
168 168
169struct matchinfo { 169struct matchinfo {
170 cfsubmatch_t fn; 170 cfsubmatch_t fn;
171 struct device *parent; 171 struct device *parent;
172 const int *locs; 172 const int *locs;
173 void *aux; 173 void *aux;
174 struct cfdata *match; 174 struct cfdata *match;
175 int pri; 175 int pri;
176}; 176};
177 177
178static char *number(char *, int); 178static char *number(char *, int);
179static void mapply(struct matchinfo *, cfdata_t); 179static void mapply(struct matchinfo *, cfdata_t);
180static device_t config_devalloc(const device_t, const cfdata_t, const int *); 180static device_t config_devalloc(const device_t, const cfdata_t, const int *);
181static void config_devdealloc(device_t); 181static void config_devdealloc(device_t);
182static void config_makeroom(int, struct cfdriver *); 182static void config_makeroom(int, struct cfdriver *);
183static void config_devlink(device_t); 183static void config_devlink(device_t);
184static void config_devunlink(device_t); 184static void config_devunlink(device_t);
185 185
186static void pmflock_debug(device_t, const char *, int); 186static void pmflock_debug(device_t, const char *, int);
187static void pmflock_debug_with_flags(device_t, const char *, int PMF_FN_PROTO); 187static void pmflock_debug_with_flags(device_t, const char *, int PMF_FN_PROTO);
188 188
189static device_t deviter_next1(deviter_t *); 189static device_t deviter_next1(deviter_t *);
190static void deviter_reinit(deviter_t *); 190static void deviter_reinit(deviter_t *);
191 191
192struct deferred_config { 192struct deferred_config {
193 TAILQ_ENTRY(deferred_config) dc_queue; 193 TAILQ_ENTRY(deferred_config) dc_queue;
194 device_t dc_dev; 194 device_t dc_dev;
195 void (*dc_func)(device_t); 195 void (*dc_func)(device_t);
196}; 196};
197 197
198TAILQ_HEAD(deferred_config_head, deferred_config); 198TAILQ_HEAD(deferred_config_head, deferred_config);
199 199
200struct deferred_config_head deferred_config_queue = 200struct deferred_config_head deferred_config_queue =
201 TAILQ_HEAD_INITIALIZER(deferred_config_queue); 201 TAILQ_HEAD_INITIALIZER(deferred_config_queue);
202struct deferred_config_head interrupt_config_queue = 202struct deferred_config_head interrupt_config_queue =
203 TAILQ_HEAD_INITIALIZER(interrupt_config_queue); 203 TAILQ_HEAD_INITIALIZER(interrupt_config_queue);
204int interrupt_config_threads = 8; 204int interrupt_config_threads = 8;
205 205
206static void config_process_deferred(struct deferred_config_head *, device_t); 206static void config_process_deferred(struct deferred_config_head *, device_t);
207 207
208/* Hooks to finalize configuration once all real devices have been found. */ 208/* Hooks to finalize configuration once all real devices have been found. */
209struct finalize_hook { 209struct finalize_hook {
210 TAILQ_ENTRY(finalize_hook) f_list; 210 TAILQ_ENTRY(finalize_hook) f_list;
211 int (*f_func)(device_t); 211 int (*f_func)(device_t);
212 device_t f_dev; 212 device_t f_dev;
213}; 213};
214static TAILQ_HEAD(, finalize_hook) config_finalize_list = 214static TAILQ_HEAD(, finalize_hook) config_finalize_list =
215 TAILQ_HEAD_INITIALIZER(config_finalize_list); 215 TAILQ_HEAD_INITIALIZER(config_finalize_list);
216static int config_finalize_done; 216static int config_finalize_done;
217 217
218/* list of all devices */ 218/* list of all devices */
219struct devicelist alldevs = TAILQ_HEAD_INITIALIZER(alldevs); 219struct devicelist alldevs = TAILQ_HEAD_INITIALIZER(alldevs);
220kcondvar_t alldevs_cv; 220kcondvar_t alldevs_cv;
221kmutex_t alldevs_mtx; 221kmutex_t alldevs_mtx;
222static int alldevs_nread = 0; 222static int alldevs_nread = 0;
223static int alldevs_nwrite = 0; 223static int alldevs_nwrite = 0;
224static lwp_t *alldevs_writer = NULL; 224static lwp_t *alldevs_writer = NULL;
225 225
226static int config_pending; /* semaphore for mountroot */ 226static int config_pending; /* semaphore for mountroot */
227static kmutex_t config_misc_lock; 227static kmutex_t config_misc_lock;
228static kcondvar_t config_misc_cv; 228static kcondvar_t config_misc_cv;
229 229
230#define STREQ(s1, s2) \ 230#define STREQ(s1, s2) \
231 (*(s1) == *(s2) && strcmp((s1), (s2)) == 0) 231 (*(s1) == *(s2) && strcmp((s1), (s2)) == 0)
232 232
233static int config_initialized; /* config_init() has been called. */ 233static int config_initialized; /* config_init() has been called. */
234 234
235static int config_do_twiddle; 235static int config_do_twiddle;
236 236
237struct vnode * 237struct vnode *
238opendisk(struct device *dv) 238opendisk(struct device *dv)
239{ 239{
240 int bmajor, bminor; 240 int bmajor, bminor;
241 struct vnode *tmpvn; 241 struct vnode *tmpvn;
242 int error; 242 int error;
243 dev_t dev; 243 dev_t dev;
244  244
245 /* 245 /*
246 * Lookup major number for disk block device. 246 * Lookup major number for disk block device.
247 */ 247 */
248 bmajor = devsw_name2blk(device_xname(dv), NULL, 0); 248 bmajor = devsw_name2blk(device_xname(dv), NULL, 0);
249 if (bmajor == -1) 249 if (bmajor == -1)
250 return NULL; 250 return NULL;
251  251
252 bminor = minor(device_unit(dv)); 252 bminor = minor(device_unit(dv));
253 /* 253 /*
254 * Fake a temporary vnode for the disk, open it, and read 254 * Fake a temporary vnode for the disk, open it, and read
255 * and hash the sectors. 255 * and hash the sectors.
256 */ 256 */
257 dev = device_is_a(dv, "dk") ? makedev(bmajor, bminor) : 257 dev = device_is_a(dv, "dk") ? makedev(bmajor, bminor) :
258 MAKEDISKDEV(bmajor, bminor, RAW_PART); 258 MAKEDISKDEV(bmajor, bminor, RAW_PART);
259 if (bdevvp(dev, &tmpvn)) 259 if (bdevvp(dev, &tmpvn))
260 panic("%s: can't alloc vnode for %s", __func__, 260 panic("%s: can't alloc vnode for %s", __func__,
261 device_xname(dv)); 261 device_xname(dv));
262 error = VOP_OPEN(tmpvn, FREAD, NOCRED); 262 error = VOP_OPEN(tmpvn, FREAD, NOCRED);
263 if (error) { 263 if (error) {
264#ifndef DEBUG 264#ifndef DEBUG
265 /* 265 /*
266 * Ignore errors caused by missing device, partition, 266 * Ignore errors caused by missing device, partition,
267 * or medium. 267 * or medium.
268 */ 268 */
269 if (error != ENXIO && error != ENODEV) 269 if (error != ENXIO && error != ENODEV)
270#endif 270#endif
271 printf("%s: can't open dev %s (%d)\n", 271 printf("%s: can't open dev %s (%d)\n",
272 __func__, device_xname(dv), error); 272 __func__, device_xname(dv), error);
273 vput(tmpvn); 273 vput(tmpvn);
274 return NULL; 274 return NULL;
275 } 275 }
276 276
277 return tmpvn; 277 return tmpvn;
278} 278}
279 279
280int 280int
281config_handle_wedges(struct device *dv, int par) 281config_handle_wedges(struct device *dv, int par)
282{ 282{
283 struct dkwedge_list wl; 283 struct dkwedge_list wl;
284 struct dkwedge_info *wi; 284 struct dkwedge_info *wi;
285 struct vnode *vn; 285 struct vnode *vn;
286 char diskname[16]; 286 char diskname[16];
287 int i, error; 287 int i, error;
288 288
289 if ((vn = opendisk(dv)) == NULL) 289 if ((vn = opendisk(dv)) == NULL)
290 return -1; 290 return -1;
291 291
292 wl.dkwl_bufsize = sizeof(*wi) * 16; 292 wl.dkwl_bufsize = sizeof(*wi) * 16;
293 wl.dkwl_buf = wi = malloc(wl.dkwl_bufsize, M_TEMP, M_WAITOK); 293 wl.dkwl_buf = wi = malloc(wl.dkwl_bufsize, M_TEMP, M_WAITOK);
294 294
295 error = VOP_IOCTL(vn, DIOCLWEDGES, &wl, FREAD, NOCRED); 295 error = VOP_IOCTL(vn, DIOCLWEDGES, &wl, FREAD, NOCRED);
296 VOP_CLOSE(vn, FREAD, NOCRED); 296 VOP_CLOSE(vn, FREAD, NOCRED);
297 vput(vn); 297 vput(vn);
298 if (error) { 298 if (error) {
299#ifdef DEBUG_WEDGE 299#ifdef DEBUG_WEDGE
300 printf("%s: List wedges returned %d\n", 300 printf("%s: List wedges returned %d\n",
301 device_xname(dv), error); 301 device_xname(dv), error);
302#endif 302#endif
303 free(wi, M_TEMP); 303 free(wi, M_TEMP);
304 return -1; 304 return -1;
305 } 305 }
306 306
307#ifdef DEBUG_WEDGE 307#ifdef DEBUG_WEDGE
308 printf("%s: Returned %u(%u) wedges\n", device_xname(dv), 308 printf("%s: Returned %u(%u) wedges\n", device_xname(dv),
309 wl.dkwl_nwedges, wl.dkwl_ncopied); 309 wl.dkwl_nwedges, wl.dkwl_ncopied);
310#endif 310#endif
311 snprintf(diskname, sizeof(diskname), "%s%c", device_xname(dv), 311 snprintf(diskname, sizeof(diskname), "%s%c", device_xname(dv),
312 par + 'a'); 312 par + 'a');
313 313
314 for (i = 0; i < wl.dkwl_ncopied; i++) { 314 for (i = 0; i < wl.dkwl_ncopied; i++) {
315#ifdef DEBUG_WEDGE 315#ifdef DEBUG_WEDGE
316 printf("%s: Looking for %s in %s\n",  316 printf("%s: Looking for %s in %s\n",
317 device_xname(dv), diskname, wi[i].dkw_wname); 317 device_xname(dv), diskname, wi[i].dkw_wname);
318#endif 318#endif
319 if (strcmp(wi[i].dkw_wname, diskname) == 0) 319 if (strcmp(wi[i].dkw_wname, diskname) == 0)
320 break; 320 break;
321 } 321 }
322 322
323 if (i == wl.dkwl_ncopied) { 323 if (i == wl.dkwl_ncopied) {
324#ifdef DEBUG_WEDGE 324#ifdef DEBUG_WEDGE
325 printf("%s: Cannot find wedge with parent %s\n", 325 printf("%s: Cannot find wedge with parent %s\n",
326 device_xname(dv), diskname); 326 device_xname(dv), diskname);
327#endif 327#endif
328 free(wi, M_TEMP); 328 free(wi, M_TEMP);
329 return -1; 329 return -1;
330 } 330 }
331 331
332#ifdef DEBUG_WEDGE 332#ifdef DEBUG_WEDGE
333 printf("%s: Setting boot wedge %s (%s) at %llu %llu\n",  333 printf("%s: Setting boot wedge %s (%s) at %llu %llu\n",
334 device_xname(dv), wi[i].dkw_devname, wi[i].dkw_wname, 334 device_xname(dv), wi[i].dkw_devname, wi[i].dkw_wname,
335 (unsigned long long)wi[i].dkw_offset, 335 (unsigned long long)wi[i].dkw_offset,
336 (unsigned long long)wi[i].dkw_size); 336 (unsigned long long)wi[i].dkw_size);
337#endif 337#endif
338 dkwedge_set_bootwedge(dv, wi[i].dkw_offset, wi[i].dkw_size); 338 dkwedge_set_bootwedge(dv, wi[i].dkw_offset, wi[i].dkw_size);
339 free(wi, M_TEMP); 339 free(wi, M_TEMP);
340 return 0; 340 return 0;
341} 341}
342 342
343/* 343/*
344 * Initialize the autoconfiguration data structures. Normally this 344 * Initialize the autoconfiguration data structures. Normally this
345 * is done by configure(), but some platforms need to do this very 345 * is done by configure(), but some platforms need to do this very
346 * early (to e.g. initialize the console). 346 * early (to e.g. initialize the console).
347 */ 347 */
348void 348void
349config_init(void) 349config_init(void)
350{ 350{
351 const struct cfattachinit *cfai; 351 const struct cfattachinit *cfai;
352 int i, j; 352 int i, j;
353 353
354 if (config_initialized) 354 if (config_initialized)
355 return; 355 return;
356 356
357 mutex_init(&alldevs_mtx, MUTEX_DEFAULT, IPL_NONE); 357 mutex_init(&alldevs_mtx, MUTEX_DEFAULT, IPL_NONE);
358 cv_init(&alldevs_cv, "alldevs"); 358 cv_init(&alldevs_cv, "alldevs");
359 359
360 mutex_init(&config_misc_lock, MUTEX_DEFAULT, IPL_NONE); 360 mutex_init(&config_misc_lock, MUTEX_DEFAULT, IPL_NONE);
361 cv_init(&config_misc_cv, "cfgmisc"); 361 cv_init(&config_misc_cv, "cfgmisc");
362 362
363 /* allcfdrivers is statically initialized. */ 363 /* allcfdrivers is statically initialized. */
364 for (i = 0; cfdriver_list_initial[i] != NULL; i++) { 364 for (i = 0; cfdriver_list_initial[i] != NULL; i++) {
365 if (config_cfdriver_attach(cfdriver_list_initial[i]) != 0) 365 if (config_cfdriver_attach(cfdriver_list_initial[i]) != 0)
366 panic("configure: duplicate `%s' drivers", 366 panic("configure: duplicate `%s' drivers",
367 cfdriver_list_initial[i]->cd_name); 367 cfdriver_list_initial[i]->cd_name);
368 } 368 }
369 369
370 for (cfai = &cfattachinit[0]; cfai->cfai_name != NULL; cfai++) { 370 for (cfai = &cfattachinit[0]; cfai->cfai_name != NULL; cfai++) {
371 for (j = 0; cfai->cfai_list[j] != NULL; j++) { 371 for (j = 0; cfai->cfai_list[j] != NULL; j++) {
372 if (config_cfattach_attach(cfai->cfai_name, 372 if (config_cfattach_attach(cfai->cfai_name,
373 cfai->cfai_list[j]) != 0) 373 cfai->cfai_list[j]) != 0)
374 panic("configure: duplicate `%s' attachment " 374 panic("configure: duplicate `%s' attachment "
375 "of `%s' driver", 375 "of `%s' driver",
376 cfai->cfai_list[j]->ca_name, 376 cfai->cfai_list[j]->ca_name,
377 cfai->cfai_name); 377 cfai->cfai_name);
378 } 378 }
379 } 379 }
380 380
381 initcftable.ct_cfdata = cfdata; 381 initcftable.ct_cfdata = cfdata;
382 TAILQ_INSERT_TAIL(&allcftables, &initcftable, ct_list); 382 TAILQ_INSERT_TAIL(&allcftables, &initcftable, ct_list);
383 383
384 config_initialized = 1; 384 config_initialized = 1;
385} 385}
386 386
387void 387void
388config_deferred(device_t dev) 388config_deferred(device_t dev)
389{ 389{
390 config_process_deferred(&deferred_config_queue, dev); 390 config_process_deferred(&deferred_config_queue, dev);
391 config_process_deferred(&interrupt_config_queue, dev); 391 config_process_deferred(&interrupt_config_queue, dev);
392} 392}
393 393
394static void 394static void
395config_interrupts_thread(void *cookie) 395config_interrupts_thread(void *cookie)
396{ 396{
397 struct deferred_config *dc; 397 struct deferred_config *dc;
398 398
399 while ((dc = TAILQ_FIRST(&interrupt_config_queue)) != NULL) { 399 while ((dc = TAILQ_FIRST(&interrupt_config_queue)) != NULL) {
400 TAILQ_REMOVE(&interrupt_config_queue, dc, dc_queue); 400 TAILQ_REMOVE(&interrupt_config_queue, dc, dc_queue);
401 (*dc->dc_func)(dc->dc_dev); 401 (*dc->dc_func)(dc->dc_dev);
402 kmem_free(dc, sizeof(*dc)); 402 kmem_free(dc, sizeof(*dc));
403 config_pending_decr(); 403 config_pending_decr();
404 } 404 }
405 kthread_exit(0); 405 kthread_exit(0);
406} 406}
407 407
408/* 408/*
409 * Configure the system's hardware. 409 * Configure the system's hardware.
410 */ 410 */
411void 411void
412configure(void) 412configure(void)
413{ 413{
414 extern void ssp_init(void); 
415 CPU_INFO_ITERATOR cii; 
416 struct cpu_info *ci; 
417 int i, s; 
418 
419 /* Initialize data structures. */ 414 /* Initialize data structures. */
420 config_init(); 415 config_init();
421 pmf_init(); 416 pmf_init();
422#if NDRVCTL > 0 417#if NDRVCTL > 0
423 drvctl_init(); 418 drvctl_init();
424#endif 419#endif
425 420
426#ifdef USERCONF 421#ifdef USERCONF
427 if (boothowto & RB_USERCONF) 422 if (boothowto & RB_USERCONF)
428 user_config(); 423 user_config();
429#endif 424#endif
430 425
431 if ((boothowto & (AB_SILENT|AB_VERBOSE)) == AB_SILENT) { 426 if ((boothowto & (AB_SILENT|AB_VERBOSE)) == AB_SILENT) {
432 config_do_twiddle = 1; 427 config_do_twiddle = 1;
433 printf_nolog("Detecting hardware..."); 428 printf_nolog("Detecting hardware...");
434 } 429 }
435 430
436 /* 431 /*
437 * Do the machine-dependent portion of autoconfiguration. This 432 * Do the machine-dependent portion of autoconfiguration. This
438 * sets the configuration machinery here in motion by "finding" 433 * sets the configuration machinery here in motion by "finding"
439 * the root bus. When this function returns, we expect interrupts 434 * the root bus. When this function returns, we expect interrupts
440 * to be enabled. 435 * to be enabled.
441 */ 436 */
442 cpu_configure(); 437 cpu_configure();
 438}
443 439
444 /* Initialize SSP. */ 440void
445 ssp_init(); 441configure2(void)
 442{
 443 CPU_INFO_ITERATOR cii;
 444 struct cpu_info *ci;
 445 int i, s;
446 446
447 /* 447 /*
448 * Now that we've found all the hardware, start the real time 448 * Now that we've found all the hardware, start the real time
449 * and statistics clocks. 449 * and statistics clocks.
450 */ 450 */
451 initclocks(); 451 initclocks();
452 452
453 cold = 0; /* clocks are running, we're warm now! */ 453 cold = 0; /* clocks are running, we're warm now! */
454 s = splsched(); 454 s = splsched();
455 curcpu()->ci_schedstate.spc_flags |= SPCF_RUNNING; 455 curcpu()->ci_schedstate.spc_flags |= SPCF_RUNNING;
456 splx(s); 456 splx(s);
457 457
458 /* Boot the secondary processors. */ 458 /* Boot the secondary processors. */
459 for (CPU_INFO_FOREACH(cii, ci)) { 459 for (CPU_INFO_FOREACH(cii, ci)) {
460 uvm_cpu_attach(ci); 460 uvm_cpu_attach(ci);
461 } 461 }
462 mp_online = true; 462 mp_online = true;
463#if defined(MULTIPROCESSOR) 463#if defined(MULTIPROCESSOR)
464 cpu_boot_secondary_processors(); 464 cpu_boot_secondary_processors();
465#endif 465#endif
466 466
467 /* Setup the runqueues and scheduler. */ 467 /* Setup the runqueues and scheduler. */
468 runq_init(); 468 runq_init();
469 sched_init(); 469 sched_init();
470 470
471 /* 471 /*
472 * Create threads to call back and finish configuration for 472 * Create threads to call back and finish configuration for
473 * devices that want interrupts enabled. 473 * devices that want interrupts enabled.
474 */ 474 */
475 for (i = 0; i < interrupt_config_threads; i++) { 475 for (i = 0; i < interrupt_config_threads; i++) {
476 (void)kthread_create(PRI_NONE, 0, NULL, 476 (void)kthread_create(PRI_NONE, 0, NULL,
477 config_interrupts_thread, NULL, NULL, "config"); 477 config_interrupts_thread, NULL, NULL, "config");
478 } 478 }
479 479
480 /* Get the threads going and into any sleeps before continuing. */ 480 /* Get the threads going and into any sleeps before continuing. */
481 yield(); 481 yield();
482} 482}
483 483
484/* 484/*
485 * Announce device attach/detach to userland listeners. 485 * Announce device attach/detach to userland listeners.
486 */ 486 */
487static void 487static void
488devmon_report_device(device_t dev, bool isattach) 488devmon_report_device(device_t dev, bool isattach)
489{ 489{
490#if NDRVCTL > 0 490#if NDRVCTL > 0
491 prop_dictionary_t ev; 491 prop_dictionary_t ev;
492 const char *parent; 492 const char *parent;
493 const char *what; 493 const char *what;
494 device_t pdev = device_parent(dev); 494 device_t pdev = device_parent(dev);
495 495
496 ev = prop_dictionary_create(); 496 ev = prop_dictionary_create();
497 if (ev == NULL) 497 if (ev == NULL)
498 return; 498 return;
499 499
500 what = (isattach ? "device-attach" : "device-detach"); 500 what = (isattach ? "device-attach" : "device-detach");
501 parent = (pdev == NULL ? "root" : device_xname(pdev)); 501 parent = (pdev == NULL ? "root" : device_xname(pdev));
502 if (!prop_dictionary_set_cstring(ev, "device", device_xname(dev)) || 502 if (!prop_dictionary_set_cstring(ev, "device", device_xname(dev)) ||
503 !prop_dictionary_set_cstring(ev, "parent", parent)) { 503 !prop_dictionary_set_cstring(ev, "parent", parent)) {
504 prop_object_release(ev); 504 prop_object_release(ev);
505 return; 505 return;
506 } 506 }
507 507
508 devmon_insert(what, ev); 508 devmon_insert(what, ev);
509#endif 509#endif
510} 510}
511 511
512/* 512/*
513 * Add a cfdriver to the system. 513 * Add a cfdriver to the system.
514 */ 514 */
515int 515int
516config_cfdriver_attach(struct cfdriver *cd) 516config_cfdriver_attach(struct cfdriver *cd)
517{ 517{
518 struct cfdriver *lcd; 518 struct cfdriver *lcd;
519 519
520 /* Make sure this driver isn't already in the system. */ 520 /* Make sure this driver isn't already in the system. */
521 LIST_FOREACH(lcd, &allcfdrivers, cd_list) { 521 LIST_FOREACH(lcd, &allcfdrivers, cd_list) {
522 if (STREQ(lcd->cd_name, cd->cd_name)) 522 if (STREQ(lcd->cd_name, cd->cd_name))
523 return (EEXIST); 523 return (EEXIST);
524 } 524 }
525 525
526 LIST_INIT(&cd->cd_attach); 526 LIST_INIT(&cd->cd_attach);
527 LIST_INSERT_HEAD(&allcfdrivers, cd, cd_list); 527 LIST_INSERT_HEAD(&allcfdrivers, cd, cd_list);
528 528
529 return (0); 529 return (0);
530} 530}
531 531
532/* 532/*
533 * Remove a cfdriver from the system. 533 * Remove a cfdriver from the system.
534 */ 534 */
535int 535int
536config_cfdriver_detach(struct cfdriver *cd) 536config_cfdriver_detach(struct cfdriver *cd)
537{ 537{
538 int i; 538 int i;
539 539
540 /* Make sure there are no active instances. */ 540 /* Make sure there are no active instances. */
541 for (i = 0; i < cd->cd_ndevs; i++) { 541 for (i = 0; i < cd->cd_ndevs; i++) {
542 if (cd->cd_devs[i] != NULL) 542 if (cd->cd_devs[i] != NULL)
543 return (EBUSY); 543 return (EBUSY);
544 } 544 }
545 545
546 /* ...and no attachments loaded. */ 546 /* ...and no attachments loaded. */
547 if (LIST_EMPTY(&cd->cd_attach) == 0) 547 if (LIST_EMPTY(&cd->cd_attach) == 0)
548 return (EBUSY); 548 return (EBUSY);
549 549
550 LIST_REMOVE(cd, cd_list); 550 LIST_REMOVE(cd, cd_list);
551 551
552 KASSERT(cd->cd_devs == NULL); 552 KASSERT(cd->cd_devs == NULL);
553 553
554 return (0); 554 return (0);
555} 555}
556 556
557/* 557/*
558 * Look up a cfdriver by name. 558 * Look up a cfdriver by name.
559 */ 559 */
560struct cfdriver * 560struct cfdriver *
561config_cfdriver_lookup(const char *name) 561config_cfdriver_lookup(const char *name)
562{ 562{
563 struct cfdriver *cd; 563 struct cfdriver *cd;
564 564
565 LIST_FOREACH(cd, &allcfdrivers, cd_list) { 565 LIST_FOREACH(cd, &allcfdrivers, cd_list) {
566 if (STREQ(cd->cd_name, name)) 566 if (STREQ(cd->cd_name, name))
567 return (cd); 567 return (cd);
568 } 568 }
569 569
570 return (NULL); 570 return (NULL);
571} 571}
572 572
573/* 573/*
574 * Add a cfattach to the specified driver. 574 * Add a cfattach to the specified driver.
575 */ 575 */
576int 576int
577config_cfattach_attach(const char *driver, struct cfattach *ca) 577config_cfattach_attach(const char *driver, struct cfattach *ca)
578{ 578{
579 struct cfattach *lca; 579 struct cfattach *lca;
580 struct cfdriver *cd; 580 struct cfdriver *cd;
581 581
582 cd = config_cfdriver_lookup(driver); 582 cd = config_cfdriver_lookup(driver);
583 if (cd == NULL) 583 if (cd == NULL)
584 return (ESRCH); 584 return (ESRCH);
585 585
586 /* Make sure this attachment isn't already on this driver. */ 586 /* Make sure this attachment isn't already on this driver. */
587 LIST_FOREACH(lca, &cd->cd_attach, ca_list) { 587 LIST_FOREACH(lca, &cd->cd_attach, ca_list) {
588 if (STREQ(lca->ca_name, ca->ca_name)) 588 if (STREQ(lca->ca_name, ca->ca_name))
589 return (EEXIST); 589 return (EEXIST);
590 } 590 }
591 591
592 LIST_INSERT_HEAD(&cd->cd_attach, ca, ca_list); 592 LIST_INSERT_HEAD(&cd->cd_attach, ca, ca_list);
593 593
594 return (0); 594 return (0);
595} 595}
596 596
597/* 597/*
598 * Remove a cfattach from the specified driver. 598 * Remove a cfattach from the specified driver.
599 */ 599 */
600int 600int
601config_cfattach_detach(const char *driver, struct cfattach *ca) 601config_cfattach_detach(const char *driver, struct cfattach *ca)
602{ 602{
603 struct cfdriver *cd; 603 struct cfdriver *cd;
604 device_t dev; 604 device_t dev;
605 int i; 605 int i;
606 606
607 cd = config_cfdriver_lookup(driver); 607 cd = config_cfdriver_lookup(driver);
608 if (cd == NULL) 608 if (cd == NULL)
609 return (ESRCH); 609 return (ESRCH);
610 610
611 /* Make sure there are no active instances. */ 611 /* Make sure there are no active instances. */
612 for (i = 0; i < cd->cd_ndevs; i++) { 612 for (i = 0; i < cd->cd_ndevs; i++) {
613 if ((dev = cd->cd_devs[i]) == NULL) 613 if ((dev = cd->cd_devs[i]) == NULL)
614 continue; 614 continue;
615 if (dev->dv_cfattach == ca) 615 if (dev->dv_cfattach == ca)
616 return (EBUSY); 616 return (EBUSY);
617 } 617 }
618 618
619 LIST_REMOVE(ca, ca_list); 619 LIST_REMOVE(ca, ca_list);
620 620
621 return (0); 621 return (0);
622} 622}
623 623
624/* 624/*
625 * Look up a cfattach by name. 625 * Look up a cfattach by name.
626 */ 626 */
627static struct cfattach * 627static struct cfattach *
628config_cfattach_lookup_cd(struct cfdriver *cd, const char *atname) 628config_cfattach_lookup_cd(struct cfdriver *cd, const char *atname)
629{ 629{
630 struct cfattach *ca; 630 struct cfattach *ca;
631 631
632 LIST_FOREACH(ca, &cd->cd_attach, ca_list) { 632 LIST_FOREACH(ca, &cd->cd_attach, ca_list) {
633 if (STREQ(ca->ca_name, atname)) 633 if (STREQ(ca->ca_name, atname))
634 return (ca); 634 return (ca);
635 } 635 }
636 636
637 return (NULL); 637 return (NULL);
638} 638}
639 639
640/* 640/*
641 * Look up a cfattach by driver/attachment name. 641 * Look up a cfattach by driver/attachment name.
642 */ 642 */
643struct cfattach * 643struct cfattach *
644config_cfattach_lookup(const char *name, const char *atname) 644config_cfattach_lookup(const char *name, const char *atname)
645{ 645{
646 struct cfdriver *cd; 646 struct cfdriver *cd;
647 647
648 cd = config_cfdriver_lookup(name); 648 cd = config_cfdriver_lookup(name);
649 if (cd == NULL) 649 if (cd == NULL)
650 return (NULL); 650 return (NULL);
651 651
652 return (config_cfattach_lookup_cd(cd, atname)); 652 return (config_cfattach_lookup_cd(cd, atname));
653} 653}
654 654
655/* 655/*
656 * Apply the matching function and choose the best. This is used 656 * Apply the matching function and choose the best. This is used
657 * a few times and we want to keep the code small. 657 * a few times and we want to keep the code small.
658 */ 658 */
659static void 659static void
660mapply(struct matchinfo *m, cfdata_t cf) 660mapply(struct matchinfo *m, cfdata_t cf)
661{ 661{
662 int pri; 662 int pri;
663 663
664 if (m->fn != NULL) { 664 if (m->fn != NULL) {
665 pri = (*m->fn)(m->parent, cf, m->locs, m->aux); 665 pri = (*m->fn)(m->parent, cf, m->locs, m->aux);
666 } else { 666 } else {
667 pri = config_match(m->parent, cf, m->aux); 667 pri = config_match(m->parent, cf, m->aux);
668 } 668 }
669 if (pri > m->pri) { 669 if (pri > m->pri) {
670 m->match = cf; 670 m->match = cf;
671 m->pri = pri; 671 m->pri = pri;
672 } 672 }
673} 673}
674 674
675int 675int
676config_stdsubmatch(device_t parent, cfdata_t cf, const int *locs, void *aux) 676config_stdsubmatch(device_t parent, cfdata_t cf, const int *locs, void *aux)
677{ 677{
678 const struct cfiattrdata *ci; 678 const struct cfiattrdata *ci;
679 const struct cflocdesc *cl; 679 const struct cflocdesc *cl;
680 int nlocs, i; 680 int nlocs, i;
681 681
682 ci = cfiattr_lookup(cf->cf_pspec->cfp_iattr, parent->dv_cfdriver); 682 ci = cfiattr_lookup(cf->cf_pspec->cfp_iattr, parent->dv_cfdriver);
683 KASSERT(ci); 683 KASSERT(ci);
684 nlocs = ci->ci_loclen; 684 nlocs = ci->ci_loclen;
685 KASSERT(!nlocs || locs); 685 KASSERT(!nlocs || locs);
686 for (i = 0; i < nlocs; i++) { 686 for (i = 0; i < nlocs; i++) {
687 cl = &ci->ci_locdesc[i]; 687 cl = &ci->ci_locdesc[i];
688 /* !cld_defaultstr means no default value */ 688 /* !cld_defaultstr means no default value */
689 if ((!(cl->cld_defaultstr) 689 if ((!(cl->cld_defaultstr)
690 || (cf->cf_loc[i] != cl->cld_default)) 690 || (cf->cf_loc[i] != cl->cld_default))
691 && cf->cf_loc[i] != locs[i]) 691 && cf->cf_loc[i] != locs[i])
692 return (0); 692 return (0);
693 } 693 }
694 694
695 return (config_match(parent, cf, aux)); 695 return (config_match(parent, cf, aux));
696} 696}
697 697
698/* 698/*
699 * Helper function: check whether the driver supports the interface attribute 699 * Helper function: check whether the driver supports the interface attribute
700 * and return its descriptor structure. 700 * and return its descriptor structure.
701 */ 701 */
702static const struct cfiattrdata * 702static const struct cfiattrdata *
703cfdriver_get_iattr(const struct cfdriver *cd, const char *ia) 703cfdriver_get_iattr(const struct cfdriver *cd, const char *ia)
704{ 704{
705 const struct cfiattrdata * const *cpp; 705 const struct cfiattrdata * const *cpp;
706 706
707 if (cd->cd_attrs == NULL) 707 if (cd->cd_attrs == NULL)
708 return (0); 708 return (0);
709 709
710 for (cpp = cd->cd_attrs; *cpp; cpp++) { 710 for (cpp = cd->cd_attrs; *cpp; cpp++) {
711 if (STREQ((*cpp)->ci_name, ia)) { 711 if (STREQ((*cpp)->ci_name, ia)) {
712 /* Match. */ 712 /* Match. */
713 return (*cpp); 713 return (*cpp);
714 } 714 }
715 } 715 }
716 return (0); 716 return (0);
717} 717}
718 718
719/* 719/*
720 * Lookup an interface attribute description by name. 720 * Lookup an interface attribute description by name.
721 * If the driver is given, consider only its supported attributes. 721 * If the driver is given, consider only its supported attributes.
722 */ 722 */
723const struct cfiattrdata * 723const struct cfiattrdata *
724cfiattr_lookup(const char *name, const struct cfdriver *cd) 724cfiattr_lookup(const char *name, const struct cfdriver *cd)
725{ 725{
726 const struct cfdriver *d; 726 const struct cfdriver *d;
727 const struct cfiattrdata *ia; 727 const struct cfiattrdata *ia;
728 728
729 if (cd) 729 if (cd)
730 return (cfdriver_get_iattr(cd, name)); 730 return (cfdriver_get_iattr(cd, name));
731 731
732 LIST_FOREACH(d, &allcfdrivers, cd_list) { 732 LIST_FOREACH(d, &allcfdrivers, cd_list) {
733 ia = cfdriver_get_iattr(d, name); 733 ia = cfdriver_get_iattr(d, name);
734 if (ia) 734 if (ia)
735 return (ia); 735 return (ia);
736 } 736 }
737 return (0); 737 return (0);
738} 738}
739 739
740/* 740/*
741 * Determine if `parent' is a potential parent for a device spec based 741 * Determine if `parent' is a potential parent for a device spec based
742 * on `cfp'. 742 * on `cfp'.
743 */ 743 */
744static int 744static int
745cfparent_match(const device_t parent, const struct cfparent *cfp) 745cfparent_match(const device_t parent, const struct cfparent *cfp)
746{ 746{
747 struct cfdriver *pcd; 747 struct cfdriver *pcd;
748 748
749 /* We don't match root nodes here. */ 749 /* We don't match root nodes here. */
750 if (cfp == NULL) 750 if (cfp == NULL)
751 return (0); 751 return (0);
752 752
753 pcd = parent->dv_cfdriver; 753 pcd = parent->dv_cfdriver;
754 KASSERT(pcd != NULL); 754 KASSERT(pcd != NULL);
755 755
756 /* 756 /*
757 * First, ensure this parent has the correct interface 757 * First, ensure this parent has the correct interface
758 * attribute. 758 * attribute.
759 */ 759 */
760 if (!cfdriver_get_iattr(pcd, cfp->cfp_iattr)) 760 if (!cfdriver_get_iattr(pcd, cfp->cfp_iattr))
761 return (0); 761 return (0);
762 762
763 /* 763 /*
764 * If no specific parent device instance was specified (i.e. 764 * If no specific parent device instance was specified (i.e.
765 * we're attaching to the attribute only), we're done! 765 * we're attaching to the attribute only), we're done!
766 */ 766 */
767 if (cfp->cfp_parent == NULL) 767 if (cfp->cfp_parent == NULL)
768 return (1); 768 return (1);
769 769
770 /* 770 /*
771 * Check the parent device's name. 771 * Check the parent device's name.
772 */ 772 */
773 if (STREQ(pcd->cd_name, cfp->cfp_parent) == 0) 773 if (STREQ(pcd->cd_name, cfp->cfp_parent) == 0)
774 return (0); /* not the same parent */ 774 return (0); /* not the same parent */
775 775
776 /* 776 /*
777 * Make sure the unit number matches. 777 * Make sure the unit number matches.
778 */ 778 */
779 if (cfp->cfp_unit == DVUNIT_ANY || /* wildcard */ 779 if (cfp->cfp_unit == DVUNIT_ANY || /* wildcard */
780 cfp->cfp_unit == parent->dv_unit) 780 cfp->cfp_unit == parent->dv_unit)
781 return (1); 781 return (1);
782 782
783 /* Unit numbers don't match. */ 783 /* Unit numbers don't match. */
784 return (0); 784 return (0);
785} 785}
786 786
787/* 787/*
788 * Helper for config_cfdata_attach(): check all devices whether it could be 788 * Helper for config_cfdata_attach(): check all devices whether it could be
789 * parent any attachment in the config data table passed, and rescan. 789 * parent any attachment in the config data table passed, and rescan.
790 */ 790 */
791static void 791static void
792rescan_with_cfdata(const struct cfdata *cf) 792rescan_with_cfdata(const struct cfdata *cf)
793{ 793{
794 device_t d; 794 device_t d;
795 const struct cfdata *cf1; 795 const struct cfdata *cf1;
796 deviter_t di; 796 deviter_t di;
797  797
798 798
799 /* 799 /*
800 * "alldevs" is likely longer than an LKM's cfdata, so make it 800 * "alldevs" is likely longer than an LKM's cfdata, so make it
801 * the outer loop. 801 * the outer loop.
802 */ 802 */
803 for (d = deviter_first(&di, 0); d != NULL; d = deviter_next(&di)) { 803 for (d = deviter_first(&di, 0); d != NULL; d = deviter_next(&di)) {
804 804
805 if (!(d->dv_cfattach->ca_rescan)) 805 if (!(d->dv_cfattach->ca_rescan))
806 continue; 806 continue;
807 807
808 for (cf1 = cf; cf1->cf_name; cf1++) { 808 for (cf1 = cf; cf1->cf_name; cf1++) {
809 809
810 if (!cfparent_match(d, cf1->cf_pspec)) 810 if (!cfparent_match(d, cf1->cf_pspec))
811 continue; 811 continue;
812 812
813 (*d->dv_cfattach->ca_rescan)(d, 813 (*d->dv_cfattach->ca_rescan)(d,
814 cf1->cf_pspec->cfp_iattr, cf1->cf_loc); 814 cf1->cf_pspec->cfp_iattr, cf1->cf_loc);
815 } 815 }
816 } 816 }
817 deviter_release(&di); 817 deviter_release(&di);
818} 818}
819 819
820/* 820/*
821 * Attach a supplemental config data table and rescan potential 821 * Attach a supplemental config data table and rescan potential
822 * parent devices if required. 822 * parent devices if required.
823 */ 823 */
824int 824int
825config_cfdata_attach(cfdata_t cf, int scannow) 825config_cfdata_attach(cfdata_t cf, int scannow)
826{ 826{
827 struct cftable *ct; 827 struct cftable *ct;
828 828
829 ct = kmem_alloc(sizeof(*ct), KM_SLEEP); 829 ct = kmem_alloc(sizeof(*ct), KM_SLEEP);
830 ct->ct_cfdata = cf; 830 ct->ct_cfdata = cf;
831 TAILQ_INSERT_TAIL(&allcftables, ct, ct_list); 831 TAILQ_INSERT_TAIL(&allcftables, ct, ct_list);
832 832
833 if (scannow) 833 if (scannow)
834 rescan_with_cfdata(cf); 834 rescan_with_cfdata(cf);
835 835
836 return (0); 836 return (0);
837} 837}
838 838
839/* 839/*
840 * Helper for config_cfdata_detach: check whether a device is 840 * Helper for config_cfdata_detach: check whether a device is
841 * found through any attachment in the config data table. 841 * found through any attachment in the config data table.
842 */ 842 */
843static int 843static int
844dev_in_cfdata(const struct device *d, const struct cfdata *cf) 844dev_in_cfdata(const struct device *d, const struct cfdata *cf)
845{ 845{
846 const struct cfdata *cf1; 846 const struct cfdata *cf1;
847 847
848 for (cf1 = cf; cf1->cf_name; cf1++) 848 for (cf1 = cf; cf1->cf_name; cf1++)
849 if (d->dv_cfdata == cf1) 849 if (d->dv_cfdata == cf1)
850 return (1); 850 return (1);
851 851
852 return (0); 852 return (0);
853} 853}
854 854
855/* 855/*
856 * Detach a supplemental config data table. Detach all devices found 856 * Detach a supplemental config data table. Detach all devices found
857 * through that table (and thus keeping references to it) before. 857 * through that table (and thus keeping references to it) before.
858 */ 858 */
859int 859int
860config_cfdata_detach(cfdata_t cf) 860config_cfdata_detach(cfdata_t cf)
861{ 861{
862 device_t d; 862 device_t d;
863 int error = 0; 863 int error = 0;
864 struct cftable *ct; 864 struct cftable *ct;
865 deviter_t di; 865 deviter_t di;
866 866
867 for (d = deviter_first(&di, DEVITER_F_RW); d != NULL; 867 for (d = deviter_first(&di, DEVITER_F_RW); d != NULL;
868 d = deviter_next(&di)) { 868 d = deviter_next(&di)) {
869 if (!dev_in_cfdata(d, cf)) 869 if (!dev_in_cfdata(d, cf))
870 continue; 870 continue;
871 if ((error = config_detach(d, 0)) != 0) 871 if ((error = config_detach(d, 0)) != 0)
872 break; 872 break;
873 } 873 }
874 deviter_release(&di); 874 deviter_release(&di);
875 if (error) { 875 if (error) {
876 aprint_error_dev(d, "unable to detach instance\n"); 876 aprint_error_dev(d, "unable to detach instance\n");
877 return error; 877 return error;
878 } 878 }
879 879
880 TAILQ_FOREACH(ct, &allcftables, ct_list) { 880 TAILQ_FOREACH(ct, &allcftables, ct_list) {
881 if (ct->ct_cfdata == cf) { 881 if (ct->ct_cfdata == cf) {
882 TAILQ_REMOVE(&allcftables, ct, ct_list); 882 TAILQ_REMOVE(&allcftables, ct, ct_list);
883 kmem_free(ct, sizeof(*ct)); 883 kmem_free(ct, sizeof(*ct));
884 return (0); 884 return (0);
885 } 885 }
886 } 886 }
887 887
888 /* not found -- shouldn't happen */ 888 /* not found -- shouldn't happen */
889 return (EINVAL); 889 return (EINVAL);
890} 890}
891 891
892/* 892/*
893 * Invoke the "match" routine for a cfdata entry on behalf of 893 * Invoke the "match" routine for a cfdata entry on behalf of
894 * an external caller, usually a "submatch" routine. 894 * an external caller, usually a "submatch" routine.
895 */ 895 */
896int 896int
897config_match(device_t parent, cfdata_t cf, void *aux) 897config_match(device_t parent, cfdata_t cf, void *aux)
898{ 898{
899 struct cfattach *ca; 899 struct cfattach *ca;
900 900
901 ca = config_cfattach_lookup(cf->cf_name, cf->cf_atname); 901 ca = config_cfattach_lookup(cf->cf_name, cf->cf_atname);
902 if (ca == NULL) { 902 if (ca == NULL) {
903 /* No attachment for this entry, oh well. */ 903 /* No attachment for this entry, oh well. */
904 return (0); 904 return (0);
905 } 905 }
906 906
907 return ((*ca->ca_match)(parent, cf, aux)); 907 return ((*ca->ca_match)(parent, cf, aux));
908} 908}
909 909
910/* 910/*
911 * Iterate over all potential children of some device, calling the given 911 * Iterate over all potential children of some device, calling the given
912 * function (default being the child's match function) for each one. 912 * function (default being the child's match function) for each one.
913 * Nonzero returns are matches; the highest value returned is considered 913 * Nonzero returns are matches; the highest value returned is considered
914 * the best match. Return the `found child' if we got a match, or NULL 914 * the best match. Return the `found child' if we got a match, or NULL
915 * otherwise. The `aux' pointer is simply passed on through. 915 * otherwise. The `aux' pointer is simply passed on through.
916 * 916 *
917 * Note that this function is designed so that it can be used to apply 917 * Note that this function is designed so that it can be used to apply
918 * an arbitrary function to all potential children (its return value 918 * an arbitrary function to all potential children (its return value
919 * can be ignored). 919 * can be ignored).
920 */ 920 */
921cfdata_t 921cfdata_t
922config_search_loc(cfsubmatch_t fn, device_t parent, 922config_search_loc(cfsubmatch_t fn, device_t parent,
923 const char *ifattr, const int *locs, void *aux) 923 const char *ifattr, const int *locs, void *aux)
924{ 924{
925 struct cftable *ct; 925 struct cftable *ct;
926 cfdata_t cf; 926 cfdata_t cf;
927 struct matchinfo m; 927 struct matchinfo m;
928 928
929 KASSERT(config_initialized); 929 KASSERT(config_initialized);
930 KASSERT(!ifattr || cfdriver_get_iattr(parent->dv_cfdriver, ifattr)); 930 KASSERT(!ifattr || cfdriver_get_iattr(parent->dv_cfdriver, ifattr));
931 931
932 m.fn = fn; 932 m.fn = fn;
933 m.parent = parent; 933 m.parent = parent;
934 m.locs = locs; 934 m.locs = locs;
935 m.aux = aux; 935 m.aux = aux;
936 m.match = NULL; 936 m.match = NULL;
937 m.pri = 0; 937 m.pri = 0;
938 938
939 TAILQ_FOREACH(ct, &allcftables, ct_list) { 939 TAILQ_FOREACH(ct, &allcftables, ct_list) {
940 for (cf = ct->ct_cfdata; cf->cf_name; cf++) { 940 for (cf = ct->ct_cfdata; cf->cf_name; cf++) {
941 941
942 /* We don't match root nodes here. */ 942 /* We don't match root nodes here. */
943 if (!cf->cf_pspec) 943 if (!cf->cf_pspec)
944 continue; 944 continue;
945 945
946 /* 946 /*
947 * Skip cf if no longer eligible, otherwise scan 947 * Skip cf if no longer eligible, otherwise scan
948 * through parents for one matching `parent', and 948 * through parents for one matching `parent', and
949 * try match function. 949 * try match function.
950 */ 950 */
951 if (cf->cf_fstate == FSTATE_FOUND) 951 if (cf->cf_fstate == FSTATE_FOUND)
952 continue; 952 continue;
953 if (cf->cf_fstate == FSTATE_DNOTFOUND || 953 if (cf->cf_fstate == FSTATE_DNOTFOUND ||
954 cf->cf_fstate == FSTATE_DSTAR) 954 cf->cf_fstate == FSTATE_DSTAR)
955 continue; 955 continue;
956 956
957 /* 957 /*
958 * If an interface attribute was specified, 958 * If an interface attribute was specified,
959 * consider only children which attach to 959 * consider only children which attach to
960 * that attribute. 960 * that attribute.
961 */ 961 */
962 if (ifattr && !STREQ(ifattr, cf->cf_pspec->cfp_iattr)) 962 if (ifattr && !STREQ(ifattr, cf->cf_pspec->cfp_iattr))
963 continue; 963 continue;
964 964
965 if (cfparent_match(parent, cf->cf_pspec)) 965 if (cfparent_match(parent, cf->cf_pspec))
966 mapply(&m, cf); 966 mapply(&m, cf);
967 } 967 }
968 } 968 }
969 return (m.match); 969 return (m.match);
970} 970}
971 971
972cfdata_t 972cfdata_t
973config_search_ia(cfsubmatch_t fn, device_t parent, const char *ifattr, 973config_search_ia(cfsubmatch_t fn, device_t parent, const char *ifattr,
974 void *aux) 974 void *aux)
975{ 975{
976 976
977 return (config_search_loc(fn, parent, ifattr, NULL, aux)); 977 return (config_search_loc(fn, parent, ifattr, NULL, aux));
978} 978}
979 979
980/* 980/*
981 * Find the given root device. 981 * Find the given root device.
982 * This is much like config_search, but there is no parent. 982 * This is much like config_search, but there is no parent.
983 * Don't bother with multiple cfdata tables; the root node 983 * Don't bother with multiple cfdata tables; the root node
984 * must always be in the initial table. 984 * must always be in the initial table.
985 */ 985 */
986cfdata_t 986cfdata_t
987config_rootsearch(cfsubmatch_t fn, const char *rootname, void *aux) 987config_rootsearch(cfsubmatch_t fn, const char *rootname, void *aux)
988{ 988{
989 cfdata_t cf; 989 cfdata_t cf;
990 const short *p; 990 const short *p;
991 struct matchinfo m; 991 struct matchinfo m;
992 992
993 m.fn = fn; 993 m.fn = fn;
994 m.parent = ROOT; 994 m.parent = ROOT;
995 m.aux = aux; 995 m.aux = aux;
996 m.match = NULL; 996 m.match = NULL;
997 m.pri = 0; 997 m.pri = 0;
998 m.locs = 0; 998 m.locs = 0;
999 /* 999 /*
1000 * Look at root entries for matching name. We do not bother 1000 * Look at root entries for matching name. We do not bother
1001 * with found-state here since only one root should ever be 1001 * with found-state here since only one root should ever be
1002 * searched (and it must be done first). 1002 * searched (and it must be done first).
1003 */ 1003 */
1004 for (p = cfroots; *p >= 0; p++) { 1004 for (p = cfroots; *p >= 0; p++) {
1005 cf = &cfdata[*p]; 1005 cf = &cfdata[*p];
1006 if (strcmp(cf->cf_name, rootname) == 0) 1006 if (strcmp(cf->cf_name, rootname) == 0)
1007 mapply(&m, cf); 1007 mapply(&m, cf);
1008 } 1008 }
1009 return (m.match); 1009 return (m.match);
1010} 1010}
1011 1011
1012static const char * const msgs[3] = { "", " not configured\n", " unsupported\n" }; 1012static const char * const msgs[3] = { "", " not configured\n", " unsupported\n" };
1013 1013
1014/* 1014/*
1015 * The given `aux' argument describes a device that has been found 1015 * The given `aux' argument describes a device that has been found
1016 * on the given parent, but not necessarily configured. Locate the 1016 * on the given parent, but not necessarily configured. Locate the
1017 * configuration data for that device (using the submatch function 1017 * configuration data for that device (using the submatch function
1018 * provided, or using candidates' cd_match configuration driver 1018 * provided, or using candidates' cd_match configuration driver
1019 * functions) and attach it, and return true. If the device was 1019 * functions) and attach it, and return true. If the device was
1020 * not configured, call the given `print' function and return 0. 1020 * not configured, call the given `print' function and return 0.
1021 */ 1021 */
1022device_t 1022device_t
1023config_found_sm_loc(device_t parent, 1023config_found_sm_loc(device_t parent,
1024 const char *ifattr, const int *locs, void *aux, 1024 const char *ifattr, const int *locs, void *aux,
1025 cfprint_t print, cfsubmatch_t submatch) 1025 cfprint_t print, cfsubmatch_t submatch)
1026{ 1026{
1027 cfdata_t cf; 1027 cfdata_t cf;
1028 1028
1029#if defined(SPLASHSCREEN) && defined(SPLASHSCREEN_PROGRESS) 1029#if defined(SPLASHSCREEN) && defined(SPLASHSCREEN_PROGRESS)
1030 if (splash_progress_state) 1030 if (splash_progress_state)
1031 splash_progress_update(splash_progress_state); 1031 splash_progress_update(splash_progress_state);
1032#endif 1032#endif
1033 1033
1034 if ((cf = config_search_loc(submatch, parent, ifattr, locs, aux))) 1034 if ((cf = config_search_loc(submatch, parent, ifattr, locs, aux)))
1035 return(config_attach_loc(parent, cf, locs, aux, print)); 1035 return(config_attach_loc(parent, cf, locs, aux, print));
1036 if (print) { 1036 if (print) {
1037 if (config_do_twiddle) 1037 if (config_do_twiddle)
1038 twiddle(); 1038 twiddle();
1039 aprint_normal("%s", msgs[(*print)(aux, device_xname(parent))]); 1039 aprint_normal("%s", msgs[(*print)(aux, device_xname(parent))]);
1040 } 1040 }
1041 1041
1042#if defined(SPLASHSCREEN) && defined(SPLASHSCREEN_PROGRESS) 1042#if defined(SPLASHSCREEN) && defined(SPLASHSCREEN_PROGRESS)
1043 if (splash_progress_state) 1043 if (splash_progress_state)
1044 splash_progress_update(splash_progress_state); 1044 splash_progress_update(splash_progress_state);
1045#endif 1045#endif
1046 1046
1047 return (NULL); 1047 return (NULL);
1048} 1048}
1049 1049
1050device_t 1050device_t
1051config_found_ia(device_t parent, const char *ifattr, void *aux, 1051config_found_ia(device_t parent, const char *ifattr, void *aux,
1052 cfprint_t print) 1052 cfprint_t print)
1053{ 1053{
1054 1054
1055 return (config_found_sm_loc(parent, ifattr, NULL, aux, print, NULL)); 1055 return (config_found_sm_loc(parent, ifattr, NULL, aux, print, NULL));
1056} 1056}
1057 1057
1058device_t 1058device_t
1059config_found(device_t parent, void *aux, cfprint_t print) 1059config_found(device_t parent, void *aux, cfprint_t print)
1060{ 1060{
1061 1061
1062 return (config_found_sm_loc(parent, NULL, NULL, aux, print, NULL)); 1062 return (config_found_sm_loc(parent, NULL, NULL, aux, print, NULL));
1063} 1063}
1064 1064
1065/* 1065/*
1066 * As above, but for root devices. 1066 * As above, but for root devices.
1067 */ 1067 */
1068device_t 1068device_t
1069config_rootfound(const char *rootname, void *aux) 1069config_rootfound(const char *rootname, void *aux)
1070{ 1070{
1071 cfdata_t cf; 1071 cfdata_t cf;
1072 1072
1073 if ((cf = config_rootsearch((cfsubmatch_t)NULL, rootname, aux)) != NULL) 1073 if ((cf = config_rootsearch((cfsubmatch_t)NULL, rootname, aux)) != NULL)
1074 return (config_attach(ROOT, cf, aux, (cfprint_t)NULL)); 1074 return (config_attach(ROOT, cf, aux, (cfprint_t)NULL));
1075 aprint_error("root device %s not configured\n", rootname); 1075 aprint_error("root device %s not configured\n", rootname);
1076 return (NULL); 1076 return (NULL);
1077} 1077}
1078 1078
1079/* just like sprintf(buf, "%d") except that it works from the end */ 1079/* just like sprintf(buf, "%d") except that it works from the end */
1080static char * 1080static char *
1081number(char *ep, int n) 1081number(char *ep, int n)
1082{ 1082{
1083 1083
1084 *--ep = 0; 1084 *--ep = 0;
1085 while (n >= 10) { 1085 while (n >= 10) {
1086 *--ep = (n % 10) + '0'; 1086 *--ep = (n % 10) + '0';
1087 n /= 10; 1087 n /= 10;
1088 } 1088 }
1089 *--ep = n + '0'; 1089 *--ep = n + '0';
1090 return (ep); 1090 return (ep);
1091} 1091}
1092 1092
1093/* 1093/*
1094 * Expand the size of the cd_devs array if necessary. 1094 * Expand the size of the cd_devs array if necessary.
1095 */ 1095 */
1096static void 1096static void
1097config_makeroom(int n, struct cfdriver *cd) 1097config_makeroom(int n, struct cfdriver *cd)
1098{ 1098{
1099 const km_flag_t kmflags = (cold ? KM_NOSLEEP : KM_SLEEP); 1099 const km_flag_t kmflags = (cold ? KM_NOSLEEP : KM_SLEEP);
1100 int old, new; 1100 int old, new;
1101 device_t *nsp; 1101 device_t *nsp;
1102 1102
1103 if (n < cd->cd_ndevs) 1103 if (n < cd->cd_ndevs)
1104 return; 1104 return;
1105 1105
1106 /* 1106 /*
1107 * Need to expand the array. 1107 * Need to expand the array.
1108 */ 1108 */
1109 old = cd->cd_ndevs; 1109 old = cd->cd_ndevs;
1110 if (old == 0) 1110 if (old == 0)
1111 new = 4; 1111 new = 4;
1112 else 1112 else
1113 new = old * 2; 1113 new = old * 2;
1114 while (new <= n) 1114 while (new <= n)
1115 new *= 2; 1115 new *= 2;
1116 cd->cd_ndevs = new; 1116 cd->cd_ndevs = new;
1117 nsp = kmem_alloc(sizeof(device_t [new]), kmflags); 1117 nsp = kmem_alloc(sizeof(device_t [new]), kmflags);
1118 if (nsp == NULL) 1118 if (nsp == NULL)
1119 panic("config_attach: %sing dev array", 1119 panic("config_attach: %sing dev array",
1120 old != 0 ? "expand" : "creat"); 1120 old != 0 ? "expand" : "creat");
1121 memset(nsp + old, 0, sizeof(device_t [new - old])); 1121 memset(nsp + old, 0, sizeof(device_t [new - old]));
1122 if (old != 0) { 1122 if (old != 0) {
1123 memcpy(nsp, cd->cd_devs, sizeof(device_t [old])); 1123 memcpy(nsp, cd->cd_devs, sizeof(device_t [old]));
1124 kmem_free(cd->cd_devs, sizeof(device_t [old])); 1124 kmem_free(cd->cd_devs, sizeof(device_t [old]));
1125 } 1125 }
1126 cd->cd_devs = nsp; 1126 cd->cd_devs = nsp;
1127} 1127}
1128 1128
1129static void 1129static void
1130config_devlink(device_t dev) 1130config_devlink(device_t dev)
1131{ 1131{
1132 struct cfdriver *cd = dev->dv_cfdriver; 1132 struct cfdriver *cd = dev->dv_cfdriver;
1133 1133
1134 /* put this device in the devices array */ 1134 /* put this device in the devices array */
1135 config_makeroom(dev->dv_unit, cd); 1135 config_makeroom(dev->dv_unit, cd);
1136 if (cd->cd_devs[dev->dv_unit]) 1136 if (cd->cd_devs[dev->dv_unit])
1137 panic("config_attach: duplicate %s", device_xname(dev)); 1137 panic("config_attach: duplicate %s", device_xname(dev));
1138 cd->cd_devs[dev->dv_unit] = dev; 1138 cd->cd_devs[dev->dv_unit] = dev;
1139 1139
1140 /* It is safe to add a device to the tail of the list while 1140 /* It is safe to add a device to the tail of the list while
1141 * readers are in the list, but not while a writer is in 1141 * readers are in the list, but not while a writer is in
1142 * the list. Wait for any writer to complete. 1142 * the list. Wait for any writer to complete.
1143 */ 1143 */
1144 mutex_enter(&alldevs_mtx); 1144 mutex_enter(&alldevs_mtx);
1145 while (alldevs_nwrite != 0 && alldevs_writer != curlwp) 1145 while (alldevs_nwrite != 0 && alldevs_writer != curlwp)
1146 cv_wait(&alldevs_cv, &alldevs_mtx); 1146 cv_wait(&alldevs_cv, &alldevs_mtx);
1147 TAILQ_INSERT_TAIL(&alldevs, dev, dv_list); /* link up */ 1147 TAILQ_INSERT_TAIL(&alldevs, dev, dv_list); /* link up */
1148 cv_signal(&alldevs_cv); 1148 cv_signal(&alldevs_cv);
1149 mutex_exit(&alldevs_mtx); 1149 mutex_exit(&alldevs_mtx);
1150} 1150}
1151 1151
1152static void 1152static void
1153config_devunlink(device_t dev) 1153config_devunlink(device_t dev)
1154{ 1154{
1155 struct cfdriver *cd = dev->dv_cfdriver; 1155 struct cfdriver *cd = dev->dv_cfdriver;
1156 int i; 1156 int i;
1157 1157
1158 /* Unlink from device list. */ 1158 /* Unlink from device list. */
1159 TAILQ_REMOVE(&alldevs, dev, dv_list); 1159 TAILQ_REMOVE(&alldevs, dev, dv_list);
1160 1160
1161 /* Remove from cfdriver's array. */ 1161 /* Remove from cfdriver's array. */
1162 cd->cd_devs[dev->dv_unit] = NULL; 1162 cd->cd_devs[dev->dv_unit] = NULL;
1163 1163
1164 /* 1164 /*
1165 * If the device now has no units in use, deallocate its softc array. 1165 * If the device now has no units in use, deallocate its softc array.
1166 */ 1166 */
1167 for (i = 0; i < cd->cd_ndevs; i++) { 1167 for (i = 0; i < cd->cd_ndevs; i++) {
1168 if (cd->cd_devs[i] != NULL) 1168 if (cd->cd_devs[i] != NULL)
1169 return; 1169 return;
1170 } 1170 }
1171 /* nothing found; deallocate */ 1171 /* nothing found; deallocate */
1172 kmem_free(cd->cd_devs, sizeof(device_t [cd->cd_ndevs])); 1172 kmem_free(cd->cd_devs, sizeof(device_t [cd->cd_ndevs]));
1173 cd->cd_devs = NULL; 1173 cd->cd_devs = NULL;
1174 cd->cd_ndevs = 0; 1174 cd->cd_ndevs = 0;
1175} 1175}
1176  1176
1177static device_t 1177static device_t
1178config_devalloc(const device_t parent, const cfdata_t cf, const int *locs) 1178config_devalloc(const device_t parent, const cfdata_t cf, const int *locs)
1179{ 1179{
1180 struct cfdriver *cd; 1180 struct cfdriver *cd;
1181 struct cfattach *ca; 1181 struct cfattach *ca;
1182 size_t lname, lunit; 1182 size_t lname, lunit;
1183 const char *xunit; 1183 const char *xunit;
1184 int myunit; 1184 int myunit;
1185 char num[10]; 1185 char num[10];
1186 device_t dev; 1186 device_t dev;
1187 void *dev_private; 1187 void *dev_private;
1188 const struct cfiattrdata *ia; 1188 const struct cfiattrdata *ia;
1189 const km_flag_t kmflags = (cold ? KM_NOSLEEP : KM_SLEEP); 1189 const km_flag_t kmflags = (cold ? KM_NOSLEEP : KM_SLEEP);
1190 1190
1191 cd = config_cfdriver_lookup(cf->cf_name); 1191 cd = config_cfdriver_lookup(cf->cf_name);
1192 if (cd == NULL) 1192 if (cd == NULL)
1193 return (NULL); 1193 return (NULL);
1194 1194
1195 ca = config_cfattach_lookup_cd(cd, cf->cf_atname); 1195 ca = config_cfattach_lookup_cd(cd, cf->cf_atname);
1196 if (ca == NULL) 1196 if (ca == NULL)
1197 return (NULL); 1197 return (NULL);
1198 1198
1199 if ((ca->ca_flags & DVF_PRIV_ALLOC) == 0 && 1199 if ((ca->ca_flags & DVF_PRIV_ALLOC) == 0 &&
1200 ca->ca_devsize < sizeof(struct device)) 1200 ca->ca_devsize < sizeof(struct device))
1201 panic("config_devalloc: %s", cf->cf_atname); 1201 panic("config_devalloc: %s", cf->cf_atname);
1202 1202
1203#ifndef __BROKEN_CONFIG_UNIT_USAGE 1203#ifndef __BROKEN_CONFIG_UNIT_USAGE
1204 if (cf->cf_fstate == FSTATE_STAR) { 1204 if (cf->cf_fstate == FSTATE_STAR) {
1205 for (myunit = cf->cf_unit; myunit < cd->cd_ndevs; myunit++) 1205 for (myunit = cf->cf_unit; myunit < cd->cd_ndevs; myunit++)
1206 if (cd->cd_devs[myunit] == NULL) 1206 if (cd->cd_devs[myunit] == NULL)
1207 break; 1207 break;
1208 /* 1208 /*
1209 * myunit is now the unit of the first NULL device pointer, 1209 * myunit is now the unit of the first NULL device pointer,
1210 * or max(cd->cd_ndevs,cf->cf_unit). 1210 * or max(cd->cd_ndevs,cf->cf_unit).
1211 */ 1211 */
1212 } else { 1212 } else {
1213 myunit = cf->cf_unit; 1213 myunit = cf->cf_unit;
1214 if (myunit < cd->cd_ndevs && cd->cd_devs[myunit] != NULL) 1214 if (myunit < cd->cd_ndevs && cd->cd_devs[myunit] != NULL)
1215 return (NULL); 1215 return (NULL);
1216 }  1216 }
1217#else 1217#else
1218 myunit = cf->cf_unit; 1218 myunit = cf->cf_unit;
1219#endif /* ! __BROKEN_CONFIG_UNIT_USAGE */ 1219#endif /* ! __BROKEN_CONFIG_UNIT_USAGE */
1220 1220
1221 /* compute length of name and decimal expansion of unit number */ 1221 /* compute length of name and decimal expansion of unit number */
1222 lname = strlen(cd->cd_name); 1222 lname = strlen(cd->cd_name);
1223 xunit = number(&num[sizeof(num)], myunit); 1223 xunit = number(&num[sizeof(num)], myunit);
1224 lunit = &num[sizeof(num)] - xunit; 1224 lunit = &num[sizeof(num)] - xunit;
1225 if (lname + lunit > sizeof(dev->dv_xname)) 1225 if (lname + lunit > sizeof(dev->dv_xname))
1226 panic("config_devalloc: device name too long"); 1226 panic("config_devalloc: device name too long");
1227 1227
1228 /* get memory for all device vars */ 1228 /* get memory for all device vars */
1229 KASSERT((ca->ca_flags & DVF_PRIV_ALLOC) || ca->ca_devsize >= sizeof(struct device)); 1229 KASSERT((ca->ca_flags & DVF_PRIV_ALLOC) || ca->ca_devsize >= sizeof(struct device));
1230 if (ca->ca_devsize > 0) { 1230 if (ca->ca_devsize > 0) {
1231 dev_private = kmem_zalloc(ca->ca_devsize, kmflags); 1231 dev_private = kmem_zalloc(ca->ca_devsize, kmflags);
1232 if (dev_private == NULL) 1232 if (dev_private == NULL)
1233 panic("config_devalloc: memory allocation for device softc failed"); 1233 panic("config_devalloc: memory allocation for device softc failed");
1234 } else { 1234 } else {
1235 KASSERT(ca->ca_flags & DVF_PRIV_ALLOC); 1235 KASSERT(ca->ca_flags & DVF_PRIV_ALLOC);
1236 dev_private = NULL; 1236 dev_private = NULL;
1237 } 1237 }
1238 1238
1239 if ((ca->ca_flags & DVF_PRIV_ALLOC) != 0) { 1239 if ((ca->ca_flags & DVF_PRIV_ALLOC) != 0) {
1240 dev = kmem_zalloc(sizeof(*dev), kmflags); 1240 dev = kmem_zalloc(sizeof(*dev), kmflags);
1241 } else { 1241 } else {
1242 dev = dev_private; 1242 dev = dev_private;
1243 } 1243 }
1244 if (dev == NULL) 1244 if (dev == NULL)
1245 panic("config_devalloc: memory allocation for device_t failed"); 1245 panic("config_devalloc: memory allocation for device_t failed");
1246 1246
1247 dev->dv_class = cd->cd_class; 1247 dev->dv_class = cd->cd_class;
1248 dev->dv_cfdata = cf; 1248 dev->dv_cfdata = cf;
1249 dev->dv_cfdriver = cd; 1249 dev->dv_cfdriver = cd;
1250 dev->dv_cfattach = ca; 1250 dev->dv_cfattach = ca;
1251 dev->dv_unit = myunit; 1251 dev->dv_unit = myunit;
1252 dev->dv_activity_count = 0; 1252 dev->dv_activity_count = 0;
1253 dev->dv_activity_handlers = NULL; 1253 dev->dv_activity_handlers = NULL;
1254 dev->dv_private = dev_private; 1254 dev->dv_private = dev_private;
1255 memcpy(dev->dv_xname, cd->cd_name, lname); 1255 memcpy(dev->dv_xname, cd->cd_name, lname);
1256 memcpy(dev->dv_xname + lname, xunit, lunit); 1256 memcpy(dev->dv_xname + lname, xunit, lunit);
1257 dev->dv_parent = parent; 1257 dev->dv_parent = parent;
1258 if (parent != NULL) 1258 if (parent != NULL)
1259 dev->dv_depth = parent->dv_depth + 1; 1259 dev->dv_depth = parent->dv_depth + 1;
1260 else 1260 else
1261 dev->dv_depth = 0; 1261 dev->dv_depth = 0;
1262 dev->dv_flags = DVF_ACTIVE; /* always initially active */ 1262 dev->dv_flags = DVF_ACTIVE; /* always initially active */
1263 dev->dv_flags |= ca->ca_flags; /* inherit flags from class */ 1263 dev->dv_flags |= ca->ca_flags; /* inherit flags from class */
1264 if (locs) { 1264 if (locs) {
1265 KASSERT(parent); /* no locators at root */ 1265 KASSERT(parent); /* no locators at root */
1266 ia = cfiattr_lookup(cf->cf_pspec->cfp_iattr, 1266 ia = cfiattr_lookup(cf->cf_pspec->cfp_iattr,
1267 parent->dv_cfdriver); 1267 parent->dv_cfdriver);
1268 dev->dv_locators = 1268 dev->dv_locators =
1269 kmem_alloc(sizeof(int [ia->ci_loclen + 1]), kmflags); 1269 kmem_alloc(sizeof(int [ia->ci_loclen + 1]), kmflags);
1270 *dev->dv_locators++ = sizeof(int [ia->ci_loclen + 1]); 1270 *dev->dv_locators++ = sizeof(int [ia->ci_loclen + 1]);
1271 memcpy(dev->dv_locators, locs, sizeof(int [ia->ci_loclen])); 1271 memcpy(dev->dv_locators, locs, sizeof(int [ia->ci_loclen]));
1272 } 1272 }
1273 dev->dv_properties = prop_dictionary_create(); 1273 dev->dv_properties = prop_dictionary_create();
1274 KASSERT(dev->dv_properties != NULL); 1274 KASSERT(dev->dv_properties != NULL);
1275 1275
1276 prop_dictionary_set_cstring_nocopy(dev->dv_properties, 1276 prop_dictionary_set_cstring_nocopy(dev->dv_properties,
1277 "device-driver", dev->dv_cfdriver->cd_name); 1277 "device-driver", dev->dv_cfdriver->cd_name);
1278 prop_dictionary_set_uint16(dev->dv_properties, 1278 prop_dictionary_set_uint16(dev->dv_properties,
1279 "device-unit", dev->dv_unit); 1279 "device-unit", dev->dv_unit);
1280 1280
1281 return (dev); 1281 return (dev);
1282} 1282}
1283 1283
1284static void 1284static void
1285config_devdealloc(device_t dev) 1285config_devdealloc(device_t dev)
1286{ 1286{
1287 int priv = (dev->dv_flags & DVF_PRIV_ALLOC); 1287 int priv = (dev->dv_flags & DVF_PRIV_ALLOC);
1288 1288
1289 KASSERT(dev->dv_properties != NULL); 1289 KASSERT(dev->dv_properties != NULL);
1290 prop_object_release(dev->dv_properties); 1290 prop_object_release(dev->dv_properties);
1291 1291
1292 if (dev->dv_activity_handlers) 1292 if (dev->dv_activity_handlers)
1293 panic("config_devdealloc with registered handlers"); 1293 panic("config_devdealloc with registered handlers");
1294 1294
1295 if (dev->dv_locators) { 1295 if (dev->dv_locators) {
1296 size_t amount = *--dev->dv_locators; 1296 size_t amount = *--dev->dv_locators;
1297 kmem_free(dev->dv_locators, amount); 1297 kmem_free(dev->dv_locators, amount);
1298 } 1298 }
1299 1299
1300 if (dev->dv_cfattach->ca_devsize > 0) 1300 if (dev->dv_cfattach->ca_devsize > 0)
1301 kmem_free(dev->dv_private, dev->dv_cfattach->ca_devsize); 1301 kmem_free(dev->dv_private, dev->dv_cfattach->ca_devsize);
1302 if (priv) 1302 if (priv)
1303 kmem_free(dev, sizeof(*dev)); 1303 kmem_free(dev, sizeof(*dev));
1304} 1304}
1305 1305
1306/* 1306/*
1307 * Attach a found device. 1307 * Attach a found device.
1308 */ 1308 */
1309device_t 1309device_t
1310config_attach_loc(device_t parent, cfdata_t cf, 1310config_attach_loc(device_t parent, cfdata_t cf,
1311 const int *locs, void *aux, cfprint_t print) 1311 const int *locs, void *aux, cfprint_t print)
1312{ 1312{
1313 device_t dev; 1313 device_t dev;
1314 struct cftable *ct; 1314 struct cftable *ct;
1315 const char *drvname; 1315 const char *drvname;
1316 1316
1317#if defined(SPLASHSCREEN) && defined(SPLASHSCREEN_PROGRESS) 1317#if defined(SPLASHSCREEN) && defined(SPLASHSCREEN_PROGRESS)
1318 if (splash_progress_state) 1318 if (splash_progress_state)
1319 splash_progress_update(splash_progress_state); 1319 splash_progress_update(splash_progress_state);
1320#endif 1320#endif
1321 1321
1322 dev = config_devalloc(parent, cf, locs); 1322 dev = config_devalloc(parent, cf, locs);
1323 if (!dev) 1323 if (!dev)
1324 panic("config_attach: allocation of device softc failed"); 1324 panic("config_attach: allocation of device softc failed");
1325 1325
1326 /* XXX redundant - see below? */ 1326 /* XXX redundant - see below? */
1327 if (cf->cf_fstate != FSTATE_STAR) { 1327 if (cf->cf_fstate != FSTATE_STAR) {
1328 KASSERT(cf->cf_fstate == FSTATE_NOTFOUND); 1328 KASSERT(cf->cf_fstate == FSTATE_NOTFOUND);
1329 cf->cf_fstate = FSTATE_FOUND; 1329 cf->cf_fstate = FSTATE_FOUND;
1330 } 1330 }
1331#ifdef __BROKEN_CONFIG_UNIT_USAGE 1331#ifdef __BROKEN_CONFIG_UNIT_USAGE
1332 else 1332 else
1333 cf->cf_unit++; 1333 cf->cf_unit++;
1334#endif 1334#endif
1335 1335
1336 config_devlink(dev); 1336 config_devlink(dev);
1337 1337
1338 if (config_do_twiddle) 1338 if (config_do_twiddle)
1339 twiddle(); 1339 twiddle();
1340 else 1340 else
1341 aprint_naive("Found "); 1341 aprint_naive("Found ");
1342 /* 1342 /*
1343 * We want the next two printfs for normal, verbose, and quiet, 1343 * We want the next two printfs for normal, verbose, and quiet,
1344 * but not silent (in which case, we're twiddling, instead). 1344 * but not silent (in which case, we're twiddling, instead).
1345 */ 1345 */
1346 if (parent == ROOT) { 1346 if (parent == ROOT) {
1347 aprint_naive("%s (root)", device_xname(dev)); 1347 aprint_naive("%s (root)", device_xname(dev));
1348 aprint_normal("%s (root)", device_xname(dev)); 1348 aprint_normal("%s (root)", device_xname(dev));
1349 } else { 1349 } else {
1350 aprint_naive("%s at %s", device_xname(dev), device_xname(parent)); 1350 aprint_naive("%s at %s", device_xname(dev), device_xname(parent));
1351 aprint_normal("%s at %s", device_xname(dev), device_xname(parent)); 1351 aprint_normal("%s at %s", device_xname(dev), device_xname(parent));
1352 if (print) 1352 if (print)
1353 (void) (*print)(aux, NULL); 1353 (void) (*print)(aux, NULL);
1354 } 1354 }
1355 1355
1356 /* 1356 /*
1357 * Before attaching, clobber any unfound devices that are 1357 * Before attaching, clobber any unfound devices that are
1358 * otherwise identical. 1358 * otherwise identical.
1359 * XXX code above is redundant? 1359 * XXX code above is redundant?
1360 */ 1360 */
1361 drvname = dev->dv_cfdriver->cd_name; 1361 drvname = dev->dv_cfdriver->cd_name;
1362 TAILQ_FOREACH(ct, &allcftables, ct_list) { 1362 TAILQ_FOREACH(ct, &allcftables, ct_list) {
1363 for (cf = ct->ct_cfdata; cf->cf_name; cf++) { 1363 for (cf = ct->ct_cfdata; cf->cf_name; cf++) {
1364 if (STREQ(cf->cf_name, drvname) && 1364 if (STREQ(cf->cf_name, drvname) &&
1365 cf->cf_unit == dev->dv_unit) { 1365 cf->cf_unit == dev->dv_unit) {
1366 if (cf->cf_fstate == FSTATE_NOTFOUND) 1366 if (cf->cf_fstate == FSTATE_NOTFOUND)
1367 cf->cf_fstate = FSTATE_FOUND; 1367 cf->cf_fstate = FSTATE_FOUND;
1368#ifdef __BROKEN_CONFIG_UNIT_USAGE 1368#ifdef __BROKEN_CONFIG_UNIT_USAGE
1369 /* 1369 /*
1370 * Bump the unit number on all starred cfdata 1370 * Bump the unit number on all starred cfdata
1371 * entries for this device. 1371 * entries for this device.
1372 */ 1372 */
1373 if (cf->cf_fstate == FSTATE_STAR) 1373 if (cf->cf_fstate == FSTATE_STAR)
1374 cf->cf_unit++; 1374 cf->cf_unit++;
1375#endif /* __BROKEN_CONFIG_UNIT_USAGE */ 1375#endif /* __BROKEN_CONFIG_UNIT_USAGE */
1376 } 1376 }
1377 } 1377 }
1378 } 1378 }
1379#ifdef __HAVE_DEVICE_REGISTER 1379#ifdef __HAVE_DEVICE_REGISTER
1380 device_register(dev, aux); 1380 device_register(dev, aux);
1381#endif 1381#endif
1382 1382
1383 /* Let userland know */ 1383 /* Let userland know */
1384 devmon_report_device(dev, true); 1384 devmon_report_device(dev, true);
1385 1385
1386#if defined(SPLASHSCREEN) && defined(SPLASHSCREEN_PROGRESS) 1386#if defined(SPLASHSCREEN) && defined(SPLASHSCREEN_PROGRESS)
1387 if (splash_progress_state) 1387 if (splash_progress_state)
1388 splash_progress_update(splash_progress_state); 1388 splash_progress_update(splash_progress_state);
1389#endif 1389#endif
1390 (*dev->dv_cfattach->ca_attach)(parent, dev, aux); 1390 (*dev->dv_cfattach->ca_attach)(parent, dev, aux);
1391#if defined(SPLASHSCREEN) && defined(SPLASHSCREEN_PROGRESS) 1391#if defined(SPLASHSCREEN) && defined(SPLASHSCREEN_PROGRESS)
1392 if (splash_progress_state) 1392 if (splash_progress_state)
1393 splash_progress_update(splash_progress_state); 1393 splash_progress_update(splash_progress_state);
1394#endif 1394#endif
1395 1395
1396 if (!device_pmf_is_registered(dev)) 1396 if (!device_pmf_is_registered(dev))
1397 aprint_debug_dev(dev, "WARNING: power management not supported\n"); 1397 aprint_debug_dev(dev, "WARNING: power management not supported\n");
1398 1398
1399 config_process_deferred(&deferred_config_queue, dev); 1399 config_process_deferred(&deferred_config_queue, dev);
1400 return (dev); 1400 return (dev);
1401} 1401}
1402 1402
1403device_t 1403device_t
1404config_attach(device_t parent, cfdata_t cf, void *aux, cfprint_t print) 1404config_attach(device_t parent, cfdata_t cf, void *aux, cfprint_t print)
1405{ 1405{
1406 1406
1407 return (config_attach_loc(parent, cf, NULL, aux, print)); 1407 return (config_attach_loc(parent, cf, NULL, aux, print));
1408} 1408}
1409 1409
1410/* 1410/*
1411 * As above, but for pseudo-devices. Pseudo-devices attached in this 1411 * As above, but for pseudo-devices. Pseudo-devices attached in this
1412 * way are silently inserted into the device tree, and their children 1412 * way are silently inserted into the device tree, and their children
1413 * attached. 1413 * attached.
1414 * 1414 *
1415 * Note that because pseudo-devices are attached silently, any information 1415 * Note that because pseudo-devices are attached silently, any information
1416 * the attach routine wishes to print should be prefixed with the device 1416 * the attach routine wishes to print should be prefixed with the device
1417 * name by the attach routine. 1417 * name by the attach routine.
1418 */ 1418 */
1419device_t 1419device_t
1420config_attach_pseudo(cfdata_t cf) 1420config_attach_pseudo(cfdata_t cf)
1421{ 1421{
1422 device_t dev; 1422 device_t dev;
1423 1423
1424 dev = config_devalloc(ROOT, cf, NULL); 1424 dev = config_devalloc(ROOT, cf, NULL);
1425 if (!dev) 1425 if (!dev)
1426 return (NULL); 1426 return (NULL);
1427 1427
1428 /* XXX mark busy in cfdata */ 1428 /* XXX mark busy in cfdata */
1429 1429
1430 config_devlink(dev); 1430 config_devlink(dev);
1431 1431
1432#if 0 /* XXXJRT not yet */ 1432#if 0 /* XXXJRT not yet */
1433#ifdef __HAVE_DEVICE_REGISTER 1433#ifdef __HAVE_DEVICE_REGISTER
1434 device_register(dev, NULL); /* like a root node */ 1434 device_register(dev, NULL); /* like a root node */
1435#endif 1435#endif
1436#endif 1436#endif
1437 (*dev->dv_cfattach->ca_attach)(ROOT, dev, NULL); 1437 (*dev->dv_cfattach->ca_attach)(ROOT, dev, NULL);
1438 config_process_deferred(&deferred_config_queue, dev); 1438 config_process_deferred(&deferred_config_queue, dev);
1439 return (dev); 1439 return (dev);
1440} 1440}
1441 1441
1442/* 1442/*
1443 * Detach a device. Optionally forced (e.g. because of hardware 1443 * Detach a device. Optionally forced (e.g. because of hardware
1444 * removal) and quiet. Returns zero if successful, non-zero 1444 * removal) and quiet. Returns zero if successful, non-zero

cvs diff -r1.112 -r1.112.6.1 src/sys/sys/device.h (switch to unified diff)

--- src/sys/sys/device.h 2008/06/11 15:56:11 1.112
+++ src/sys/sys/device.h 2009/03/15 19:43:48 1.112.6.1
@@ -1,526 +1,527 @@ @@ -1,526 +1,527 @@
1/* $NetBSD: device.h,v 1.112 2008/06/11 15:56:11 drochner Exp $ */ 1/* $NetBSD: device.h,v 1.112.6.1 2009/03/15 19:43:48 snj Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996, 2000 Christopher G. Demetriou 4 * Copyright (c) 1996, 2000 Christopher G. Demetriou
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
15 * 3. All advertising materials mentioning features or use of this software 15 * 3. All advertising materials mentioning features or use of this software
16 * must display the following acknowledgement: 16 * must display the following acknowledgement:
17 * This product includes software developed for the 17 * This product includes software developed for the
18 * NetBSD Project. See http://www.NetBSD.org/ for 18 * NetBSD Project. See http://www.NetBSD.org/ for
19 * information about NetBSD. 19 * information about NetBSD.
20 * 4. The name of the author may not be used to endorse or promote products 20 * 4. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission. 21 * derived from this software without specific prior written permission.
22 * 22 *
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 26 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 * 33 *
34 * --(license Id: LICENSE.proto,v 1.1 2000/06/13 21:40:26 cgd Exp )-- 34 * --(license Id: LICENSE.proto,v 1.1 2000/06/13 21:40:26 cgd Exp )--
35 */ 35 */
36 36
37/* 37/*
38 * Copyright (c) 1992, 1993 38 * Copyright (c) 1992, 1993
39 * The Regents of the University of California. All rights reserved. 39 * The Regents of the University of California. All rights reserved.
40 * 40 *
41 * This software was developed by the Computer Systems Engineering group 41 * This software was developed by the Computer Systems Engineering group
42 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and 42 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
43 * contributed to Berkeley. 43 * contributed to Berkeley.
44 * 44 *
45 * All advertising materials mentioning features or use of this software 45 * All advertising materials mentioning features or use of this software
46 * must display the following acknowledgement: 46 * must display the following acknowledgement:
47 * This product includes software developed by the University of 47 * This product includes software developed by the University of
48 * California, Lawrence Berkeley Laboratories. 48 * California, Lawrence Berkeley Laboratories.
49 * 49 *
50 * Redistribution and use in source and binary forms, with or without 50 * Redistribution and use in source and binary forms, with or without
51 * modification, are permitted provided that the following conditions 51 * modification, are permitted provided that the following conditions
52 * are met: 52 * are met:
53 * 1. Redistributions of source code must retain the above copyright 53 * 1. Redistributions of source code must retain the above copyright
54 * notice, this list of conditions and the following disclaimer. 54 * notice, this list of conditions and the following disclaimer.
55 * 2. Redistributions in binary form must reproduce the above copyright 55 * 2. Redistributions in binary form must reproduce the above copyright
56 * notice, this list of conditions and the following disclaimer in the 56 * notice, this list of conditions and the following disclaimer in the
57 * documentation and/or other materials provided with the distribution. 57 * documentation and/or other materials provided with the distribution.
58 * 3. Neither the name of the University nor the names of its contributors 58 * 3. Neither the name of the University nor the names of its contributors
59 * may be used to endorse or promote products derived from this software 59 * may be used to endorse or promote products derived from this software
60 * without specific prior written permission. 60 * without specific prior written permission.
61 * 61 *
62 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 62 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
63 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 63 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
64 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 64 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
65 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 65 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
66 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 66 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
67 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 67 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
68 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 68 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
69 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 69 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
70 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 70 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
71 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 71 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
72 * SUCH DAMAGE. 72 * SUCH DAMAGE.
73 * 73 *
74 * @(#)device.h 8.2 (Berkeley) 2/17/94 74 * @(#)device.h 8.2 (Berkeley) 2/17/94
75 */ 75 */
76 76
77#ifndef _SYS_DEVICE_H_ 77#ifndef _SYS_DEVICE_H_
78#define _SYS_DEVICE_H_ 78#define _SYS_DEVICE_H_
79 79
80#include <sys/evcnt.h> 80#include <sys/evcnt.h>
81#include <sys/queue.h> 81#include <sys/queue.h>
82 82
83typedef struct device *device_t; 83typedef struct device *device_t;
84#ifdef _KERNEL 84#ifdef _KERNEL
85#include <sys/pmf.h> 85#include <sys/pmf.h>
86#endif 86#endif
87 87
88#include <prop/proplib.h> 88#include <prop/proplib.h>
89 89
90/* 90/*
91 * Minimal device structures. 91 * Minimal device structures.
92 * Note that all ``system'' device types are listed here. 92 * Note that all ``system'' device types are listed here.
93 */ 93 */
94typedef enum devclass { 94typedef enum devclass {
95 DV_DULL, /* generic, no special info */ 95 DV_DULL, /* generic, no special info */
96 DV_CPU, /* CPU (carries resource utilization) */ 96 DV_CPU, /* CPU (carries resource utilization) */
97 DV_DISK, /* disk drive (label, etc) */ 97 DV_DISK, /* disk drive (label, etc) */
98 DV_IFNET, /* network interface */ 98 DV_IFNET, /* network interface */
99 DV_TAPE, /* tape device */ 99 DV_TAPE, /* tape device */
100 DV_TTY, /* serial line interface (?) */ 100 DV_TTY, /* serial line interface (?) */
101 DV_AUDIODEV, /* audio device */ 101 DV_AUDIODEV, /* audio device */
102 DV_DISPLAYDEV, /* display device */ 102 DV_DISPLAYDEV, /* display device */
103 DV_BUS /* bus device */ 103 DV_BUS /* bus device */
104} devclass_t; 104} devclass_t;
105 105
106/* 106/*
107 * Actions for ca_activate. 107 * Actions for ca_activate.
108 */ 108 */
109typedef enum devact { 109typedef enum devact {
110 DVACT_ACTIVATE, /* activate the device */ 110 DVACT_ACTIVATE, /* activate the device */
111 DVACT_DEACTIVATE /* deactivate the device */ 111 DVACT_DEACTIVATE /* deactivate the device */
112} devact_t; 112} devact_t;
113 113
114typedef enum { 114typedef enum {
115 DVA_SYSTEM, 115 DVA_SYSTEM,
116 DVA_HARDWARE 116 DVA_HARDWARE
117} devactive_t; 117} devactive_t;
118 118
119typedef struct cfdata *cfdata_t; 119typedef struct cfdata *cfdata_t;
120typedef struct cfdriver *cfdriver_t; 120typedef struct cfdriver *cfdriver_t;
121typedef struct cfattach *cfattach_t; 121typedef struct cfattach *cfattach_t;
122 122
123struct device { 123struct device {
124 devclass_t dv_class; /* this device's classification */ 124 devclass_t dv_class; /* this device's classification */
125 TAILQ_ENTRY(device) dv_list; /* entry on list of all devices */ 125 TAILQ_ENTRY(device) dv_list; /* entry on list of all devices */
126 cfdata_t dv_cfdata; /* config data that found us 126 cfdata_t dv_cfdata; /* config data that found us
127 (NULL if pseudo-device) */ 127 (NULL if pseudo-device) */
128 cfdriver_t dv_cfdriver; /* our cfdriver */ 128 cfdriver_t dv_cfdriver; /* our cfdriver */
129 cfattach_t dv_cfattach; /* our cfattach */ 129 cfattach_t dv_cfattach; /* our cfattach */
130 int dv_unit; /* device unit number */ 130 int dv_unit; /* device unit number */
131 char dv_xname[16]; /* external name (name + unit) */ 131 char dv_xname[16]; /* external name (name + unit) */
132 device_t dv_parent; /* pointer to parent device 132 device_t dv_parent; /* pointer to parent device
133 (NULL if pseudo- or root node) */ 133 (NULL if pseudo- or root node) */
134 int dv_depth; /* number of parents until root */ 134 int dv_depth; /* number of parents until root */
135 int dv_flags; /* misc. flags; see below */ 135 int dv_flags; /* misc. flags; see below */
136 void *dv_private; /* this device's private storage */ 136 void *dv_private; /* this device's private storage */
137 int *dv_locators; /* our actual locators (optional) */ 137 int *dv_locators; /* our actual locators (optional) */
138 prop_dictionary_t dv_properties;/* properties dictionary */ 138 prop_dictionary_t dv_properties;/* properties dictionary */
139 139
140 size_t dv_activity_count; 140 size_t dv_activity_count;
141 void (**dv_activity_handlers)(device_t, devactive_t); 141 void (**dv_activity_handlers)(device_t, devactive_t);
142 142
143 bool (*dv_driver_suspend)(device_t PMF_FN_PROTO); 143 bool (*dv_driver_suspend)(device_t PMF_FN_PROTO);
144 bool (*dv_driver_resume)(device_t PMF_FN_PROTO); 144 bool (*dv_driver_resume)(device_t PMF_FN_PROTO);
145 bool (*dv_driver_shutdown)(device_t, int); 145 bool (*dv_driver_shutdown)(device_t, int);
146 bool (*dv_driver_child_register)(device_t); 146 bool (*dv_driver_child_register)(device_t);
147 147
148 void *dv_bus_private; 148 void *dv_bus_private;
149 bool (*dv_bus_suspend)(device_t PMF_FN_PROTO); 149 bool (*dv_bus_suspend)(device_t PMF_FN_PROTO);
150 bool (*dv_bus_resume)(device_t PMF_FN_PROTO); 150 bool (*dv_bus_resume)(device_t PMF_FN_PROTO);
151 bool (*dv_bus_shutdown)(device_t, int); 151 bool (*dv_bus_shutdown)(device_t, int);
152 void (*dv_bus_deregister)(device_t); 152 void (*dv_bus_deregister)(device_t);
153 153
154 void *dv_class_private; 154 void *dv_class_private;
155 bool (*dv_class_suspend)(device_t PMF_FN_PROTO); 155 bool (*dv_class_suspend)(device_t PMF_FN_PROTO);
156 bool (*dv_class_resume)(device_t PMF_FN_PROTO); 156 bool (*dv_class_resume)(device_t PMF_FN_PROTO);
157 void (*dv_class_deregister)(device_t); 157 void (*dv_class_deregister)(device_t);
158 158
159 void *dv_pmf_private; 159 void *dv_pmf_private;
160}; 160};
161 161
162/* dv_flags */ 162/* dv_flags */
163#define DVF_ACTIVE 0x0001 /* device is activated */ 163#define DVF_ACTIVE 0x0001 /* device is activated */
164#define DVF_PRIV_ALLOC 0x0002 /* device private storage != device */ 164#define DVF_PRIV_ALLOC 0x0002 /* device private storage != device */
165#define DVF_POWER_HANDLERS 0x0004 /* device has suspend/resume support */ 165#define DVF_POWER_HANDLERS 0x0004 /* device has suspend/resume support */
166#define DVF_CLASS_SUSPENDED 0x0008 /* device class suspend was called */ 166#define DVF_CLASS_SUSPENDED 0x0008 /* device class suspend was called */
167#define DVF_DRIVER_SUSPENDED 0x0010 /* device driver suspend was called */ 167#define DVF_DRIVER_SUSPENDED 0x0010 /* device driver suspend was called */
168#define DVF_BUS_SUSPENDED 0x0020 /* device bus suspend was called */ 168#define DVF_BUS_SUSPENDED 0x0020 /* device bus suspend was called */
169#define DVF_SELF_SUSPENDED 0x0040 /* device suspended itself */ 169#define DVF_SELF_SUSPENDED 0x0040 /* device suspended itself */
170 170
171TAILQ_HEAD(devicelist, device); 171TAILQ_HEAD(devicelist, device);
172 172
173enum deviter_flags { 173enum deviter_flags {
174 DEVITER_F_RW = 0x1 174 DEVITER_F_RW = 0x1
175 , DEVITER_F_SHUTDOWN = 0x2 175 , DEVITER_F_SHUTDOWN = 0x2
176 , DEVITER_F_LEAVES_FIRST = 0x4 176 , DEVITER_F_LEAVES_FIRST = 0x4
177 , DEVITER_F_ROOT_FIRST = 0x8 177 , DEVITER_F_ROOT_FIRST = 0x8
178}; 178};
179 179
180typedef enum deviter_flags deviter_flags_t; 180typedef enum deviter_flags deviter_flags_t;
181 181
182struct deviter { 182struct deviter {
183 device_t di_prev; 183 device_t di_prev;
184 deviter_flags_t di_flags; 184 deviter_flags_t di_flags;
185 int di_curdepth; 185 int di_curdepth;
186 int di_maxdepth; 186 int di_maxdepth;
187}; 187};
188 188
189typedef struct deviter deviter_t; 189typedef struct deviter deviter_t;
190 190
191/* 191/*
192 * Description of a locator, as part of interface attribute definitions. 192 * Description of a locator, as part of interface attribute definitions.
193 */ 193 */
194struct cflocdesc { 194struct cflocdesc {
195 const char *cld_name; 195 const char *cld_name;
196 const char *cld_defaultstr; /* NULL if no default */ 196 const char *cld_defaultstr; /* NULL if no default */
197 int cld_default; 197 int cld_default;
198}; 198};
199 199
200/* 200/*
201 * Description of an interface attribute, provided by potential 201 * Description of an interface attribute, provided by potential
202 * parent device drivers, referred to by child device configuration data. 202 * parent device drivers, referred to by child device configuration data.
203 */ 203 */
204struct cfiattrdata { 204struct cfiattrdata {
205 const char *ci_name; 205 const char *ci_name;
206 int ci_loclen; 206 int ci_loclen;
207 const struct cflocdesc ci_locdesc[ 207 const struct cflocdesc ci_locdesc[
208#if defined(__GNUC__) && __GNUC__ <= 2 208#if defined(__GNUC__) && __GNUC__ <= 2
209 0 209 0
210#endif 210#endif
211 ]; 211 ];
212}; 212};
213 213
214/* 214/*
215 * Description of a configuration parent. Each device attachment attaches 215 * Description of a configuration parent. Each device attachment attaches
216 * to an "interface attribute", which is given in this structure. The parent 216 * to an "interface attribute", which is given in this structure. The parent
217 * *must* carry this attribute. Optionally, an individual device instance 217 * *must* carry this attribute. Optionally, an individual device instance
218 * may also specify a specific parent device instance. 218 * may also specify a specific parent device instance.
219 */ 219 */
220struct cfparent { 220struct cfparent {
221 const char *cfp_iattr; /* interface attribute */ 221 const char *cfp_iattr; /* interface attribute */
222 const char *cfp_parent; /* optional specific parent */ 222 const char *cfp_parent; /* optional specific parent */
223 int cfp_unit; /* optional specific unit 223 int cfp_unit; /* optional specific unit
224 (-1 to wildcard) */ 224 (-1 to wildcard) */
225}; 225};
226 226
227/* 227/*
228 * Configuration data (i.e., data placed in ioconf.c). 228 * Configuration data (i.e., data placed in ioconf.c).
229 */ 229 */
230struct cfdata { 230struct cfdata {
231 const char *cf_name; /* driver name */ 231 const char *cf_name; /* driver name */
232 const char *cf_atname; /* attachment name */ 232 const char *cf_atname; /* attachment name */
233 short cf_unit; /* unit number */ 233 short cf_unit; /* unit number */
234 short cf_fstate; /* finding state (below) */ 234 short cf_fstate; /* finding state (below) */
235 int *cf_loc; /* locators (machine dependent) */ 235 int *cf_loc; /* locators (machine dependent) */
236 int cf_flags; /* flags from config */ 236 int cf_flags; /* flags from config */
237 const struct cfparent *cf_pspec;/* parent specification */ 237 const struct cfparent *cf_pspec;/* parent specification */
238}; 238};
239#define FSTATE_NOTFOUND 0 /* has not been found */ 239#define FSTATE_NOTFOUND 0 /* has not been found */
240#define FSTATE_FOUND 1 /* has been found */ 240#define FSTATE_FOUND 1 /* has been found */
241#define FSTATE_STAR 2 /* duplicable */ 241#define FSTATE_STAR 2 /* duplicable */
242#define FSTATE_DSTAR 3 /* has not been found, and disabled */ 242#define FSTATE_DSTAR 3 /* has not been found, and disabled */
243#define FSTATE_DNOTFOUND 4 /* duplicate, and disabled */ 243#define FSTATE_DNOTFOUND 4 /* duplicate, and disabled */
244 244
245/* 245/*
246 * Multiple configuration data tables may be maintained. This structure 246 * Multiple configuration data tables may be maintained. This structure
247 * provides the linkage. 247 * provides the linkage.
248 */ 248 */
249struct cftable { 249struct cftable {
250 cfdata_t ct_cfdata; /* pointer to cfdata table */ 250 cfdata_t ct_cfdata; /* pointer to cfdata table */
251 TAILQ_ENTRY(cftable) ct_list; /* list linkage */ 251 TAILQ_ENTRY(cftable) ct_list; /* list linkage */
252}; 252};
253TAILQ_HEAD(cftablelist, cftable); 253TAILQ_HEAD(cftablelist, cftable);
254 254
255typedef int (*cfsubmatch_t)(device_t, cfdata_t, const int *, void *); 255typedef int (*cfsubmatch_t)(device_t, cfdata_t, const int *, void *);
256 256
257/* 257/*
258 * `configuration' attachment and driver (what the machine-independent 258 * `configuration' attachment and driver (what the machine-independent
259 * autoconf uses). As devices are found, they are applied against all 259 * autoconf uses). As devices are found, they are applied against all
260 * the potential matches. The one with the best match is taken, and a 260 * the potential matches. The one with the best match is taken, and a
261 * device structure (plus any other data desired) is allocated. Pointers 261 * device structure (plus any other data desired) is allocated. Pointers
262 * to these are placed into an array of pointers. The array itself must 262 * to these are placed into an array of pointers. The array itself must
263 * be dynamic since devices can be found long after the machine is up 263 * be dynamic since devices can be found long after the machine is up
264 * and running. 264 * and running.
265 * 265 *
266 * Devices can have multiple configuration attachments if they attach 266 * Devices can have multiple configuration attachments if they attach
267 * to different attributes (busses, or whatever), to allow specification 267 * to different attributes (busses, or whatever), to allow specification
268 * of multiple match and attach functions. There is only one configuration 268 * of multiple match and attach functions. There is only one configuration
269 * driver per driver, so that things like unit numbers and the device 269 * driver per driver, so that things like unit numbers and the device
270 * structure array will be shared. 270 * structure array will be shared.
271 */ 271 */
272struct cfattach { 272struct cfattach {
273 const char *ca_name; /* name of attachment */ 273 const char *ca_name; /* name of attachment */
274 LIST_ENTRY(cfattach) ca_list; /* link on cfdriver's list */ 274 LIST_ENTRY(cfattach) ca_list; /* link on cfdriver's list */
275 size_t ca_devsize; /* size of dev data (for malloc) */ 275 size_t ca_devsize; /* size of dev data (for malloc) */
276 int ca_flags; /* flags for driver allocation etc */ 276 int ca_flags; /* flags for driver allocation etc */
277 int (*ca_match)(device_t, cfdata_t, void *); 277 int (*ca_match)(device_t, cfdata_t, void *);
278 void (*ca_attach)(device_t, device_t, void *); 278 void (*ca_attach)(device_t, device_t, void *);
279 int (*ca_detach)(device_t, int); 279 int (*ca_detach)(device_t, int);
280 int (*ca_activate)(device_t, devact_t); 280 int (*ca_activate)(device_t, devact_t);
281 /* technically, the next 2 belong into "struct cfdriver" */ 281 /* technically, the next 2 belong into "struct cfdriver" */
282 int (*ca_rescan)(device_t, const char *, 282 int (*ca_rescan)(device_t, const char *,
283 const int *); /* scan for new children */ 283 const int *); /* scan for new children */
284 void (*ca_childdetached)(device_t, device_t); 284 void (*ca_childdetached)(device_t, device_t);
285}; 285};
286LIST_HEAD(cfattachlist, cfattach); 286LIST_HEAD(cfattachlist, cfattach);
287 287
288#define CFATTACH_DECL2(name, ddsize, matfn, attfn, detfn, actfn, \ 288#define CFATTACH_DECL2(name, ddsize, matfn, attfn, detfn, actfn, \
289 rescanfn, chdetfn) \ 289 rescanfn, chdetfn) \
290struct cfattach __CONCAT(name,_ca) = { \ 290struct cfattach __CONCAT(name,_ca) = { \
291 .ca_name = ___STRING(name), \ 291 .ca_name = ___STRING(name), \
292 .ca_devsize = ddsize, \ 292 .ca_devsize = ddsize, \
293 .ca_match = matfn, \ 293 .ca_match = matfn, \
294 .ca_attach = attfn, \ 294 .ca_attach = attfn, \
295 .ca_detach = detfn, \ 295 .ca_detach = detfn, \
296 .ca_activate = actfn, \ 296 .ca_activate = actfn, \
297 .ca_rescan = rescanfn, \ 297 .ca_rescan = rescanfn, \
298 .ca_childdetached = chdetfn, \ 298 .ca_childdetached = chdetfn, \
299} 299}
300 300
301#define CFATTACH_DECL(name, ddsize, matfn, attfn, detfn, actfn) \ 301#define CFATTACH_DECL(name, ddsize, matfn, attfn, detfn, actfn) \
302 CFATTACH_DECL2(name, ddsize, matfn, attfn, detfn, actfn, NULL, NULL) 302 CFATTACH_DECL2(name, ddsize, matfn, attfn, detfn, actfn, NULL, NULL)
303 303
304#define CFATTACH_DECL2_NEW(name, ddsize, matfn, attfn, detfn, actfn, \ 304#define CFATTACH_DECL2_NEW(name, ddsize, matfn, attfn, detfn, actfn, \
305 rescanfn, chdetfn) \ 305 rescanfn, chdetfn) \
306struct cfattach __CONCAT(name,_ca) = { \ 306struct cfattach __CONCAT(name,_ca) = { \
307 .ca_name = ___STRING(name), \ 307 .ca_name = ___STRING(name), \
308 .ca_devsize = ddsize, \ 308 .ca_devsize = ddsize, \
309 .ca_flags = DVF_PRIV_ALLOC, \ 309 .ca_flags = DVF_PRIV_ALLOC, \
310 .ca_match = matfn, \ 310 .ca_match = matfn, \
311 .ca_attach = attfn, \ 311 .ca_attach = attfn, \
312 .ca_detach = detfn, \ 312 .ca_detach = detfn, \
313 .ca_activate = actfn, \ 313 .ca_activate = actfn, \
314 .ca_rescan = rescanfn, \ 314 .ca_rescan = rescanfn, \
315 .ca_childdetached = chdetfn, \ 315 .ca_childdetached = chdetfn, \
316} 316}
317 317
318#define CFATTACH_DECL_NEW(name, ddsize, matfn, attfn, detfn, actfn) \ 318#define CFATTACH_DECL_NEW(name, ddsize, matfn, attfn, detfn, actfn) \
319 CFATTACH_DECL2_NEW(name, ddsize, matfn, attfn, detfn, actfn, NULL, NULL) 319 CFATTACH_DECL2_NEW(name, ddsize, matfn, attfn, detfn, actfn, NULL, NULL)
320 320
321/* Flags given to config_detach(), and the ca_detach function. */ 321/* Flags given to config_detach(), and the ca_detach function. */
322#define DETACH_FORCE 0x01 /* force detachment; hardware gone */ 322#define DETACH_FORCE 0x01 /* force detachment; hardware gone */
323#define DETACH_QUIET 0x02 /* don't print a notice */ 323#define DETACH_QUIET 0x02 /* don't print a notice */
324 324
325struct cfdriver { 325struct cfdriver {
326 LIST_ENTRY(cfdriver) cd_list; /* link on allcfdrivers */ 326 LIST_ENTRY(cfdriver) cd_list; /* link on allcfdrivers */
327 struct cfattachlist cd_attach; /* list of all attachments */ 327 struct cfattachlist cd_attach; /* list of all attachments */
328 device_t *cd_devs; /* devices found */ 328 device_t *cd_devs; /* devices found */
329 const char *cd_name; /* device name */ 329 const char *cd_name; /* device name */
330 enum devclass cd_class; /* device classification */ 330 enum devclass cd_class; /* device classification */
331 int cd_ndevs; /* size of cd_devs array */ 331 int cd_ndevs; /* size of cd_devs array */
332 const struct cfiattrdata * const *cd_attrs; /* attributes provided */ 332 const struct cfiattrdata * const *cd_attrs; /* attributes provided */
333}; 333};
334LIST_HEAD(cfdriverlist, cfdriver); 334LIST_HEAD(cfdriverlist, cfdriver);
335 335
336#define CFDRIVER_DECL(name, class, attrs) \ 336#define CFDRIVER_DECL(name, class, attrs) \
337struct cfdriver __CONCAT(name,_cd) = { \ 337struct cfdriver __CONCAT(name,_cd) = { \
338 .cd_name = ___STRING(name), \ 338 .cd_name = ___STRING(name), \
339 .cd_class = class, \ 339 .cd_class = class, \
340 .cd_attrs = attrs, \ 340 .cd_attrs = attrs, \
341} 341}
342 342
343/* 343/*
344 * The cfattachinit is a data structure used to associate a list of 344 * The cfattachinit is a data structure used to associate a list of
345 * cfattach's with cfdrivers as found in the static kernel configuration. 345 * cfattach's with cfdrivers as found in the static kernel configuration.
346 */ 346 */
347struct cfattachinit { 347struct cfattachinit {
348 const char *cfai_name; /* driver name */ 348 const char *cfai_name; /* driver name */
349 struct cfattach * const *cfai_list;/* list of attachments */ 349 struct cfattach * const *cfai_list;/* list of attachments */
350}; 350};
351/* 351/*
352 * the same, but with a non-constant list so it can be modified 352 * the same, but with a non-constant list so it can be modified
353 * for LKM bookkeeping 353 * for LKM bookkeeping
354 */ 354 */
355struct cfattachlkminit { 355struct cfattachlkminit {
356 const char *cfai_name; /* driver name */ 356 const char *cfai_name; /* driver name */
357 struct cfattach **cfai_list; /* list of attachments */ 357 struct cfattach **cfai_list; /* list of attachments */
358}; 358};
359 359
360/* 360/*
361 * Configuration printing functions, and their return codes. The second 361 * Configuration printing functions, and their return codes. The second
362 * argument is NULL if the device was configured; otherwise it is the name 362 * argument is NULL if the device was configured; otherwise it is the name
363 * of the parent device. The return value is ignored if the device was 363 * of the parent device. The return value is ignored if the device was
364 * configured, so most functions can return UNCONF unconditionally. 364 * configured, so most functions can return UNCONF unconditionally.
365 */ 365 */
366typedef int (*cfprint_t)(void *, const char *); /* XXX const char * */ 366typedef int (*cfprint_t)(void *, const char *); /* XXX const char * */
367#define QUIET 0 /* print nothing */ 367#define QUIET 0 /* print nothing */
368#define UNCONF 1 /* print " not configured\n" */ 368#define UNCONF 1 /* print " not configured\n" */
369#define UNSUPP 2 /* print " not supported\n" */ 369#define UNSUPP 2 /* print " not supported\n" */
370 370
371/* 371/*
372 * Pseudo-device attach information (function + number of pseudo-devs). 372 * Pseudo-device attach information (function + number of pseudo-devs).
373 */ 373 */
374struct pdevinit { 374struct pdevinit {
375 void (*pdev_attach)(int); 375 void (*pdev_attach)(int);
376 int pdev_count; 376 int pdev_count;
377}; 377};
378 378
379/* This allows us to wildcard a device unit. */ 379/* This allows us to wildcard a device unit. */
380#define DVUNIT_ANY -1 380#define DVUNIT_ANY -1
381 381
382#ifdef _KERNEL 382#ifdef _KERNEL
383 383
384extern struct cfdriverlist allcfdrivers;/* list of all cfdrivers */ 384extern struct cfdriverlist allcfdrivers;/* list of all cfdrivers */
385extern struct devicelist alldevs; /* list of all devices */ 385extern struct devicelist alldevs; /* list of all devices */
386extern struct cftablelist allcftables; /* list of all cfdata tables */ 386extern struct cftablelist allcftables; /* list of all cfdata tables */
387extern device_t booted_device; /* the device we booted from */ 387extern device_t booted_device; /* the device we booted from */
388extern device_t booted_wedge; /* the wedge on that device */ 388extern device_t booted_wedge; /* the wedge on that device */
389extern int booted_partition; /* or the partition on that device */ 389extern int booted_partition; /* or the partition on that device */
390 390
391struct vnode *opendisk(struct device *); 391struct vnode *opendisk(struct device *);
392int config_handle_wedges(struct device *, int); 392int config_handle_wedges(struct device *, int);
393 393
394void config_init(void); 394void config_init(void);
395void drvctl_init(void); 395void drvctl_init(void);
396void configure(void); 396void configure(void);
 397void configure2(void);
397 398
398int config_cfdriver_attach(struct cfdriver *); 399int config_cfdriver_attach(struct cfdriver *);
399int config_cfdriver_detach(struct cfdriver *); 400int config_cfdriver_detach(struct cfdriver *);
400 401
401int config_cfattach_attach(const char *, struct cfattach *); 402int config_cfattach_attach(const char *, struct cfattach *);
402int config_cfattach_detach(const char *, struct cfattach *); 403int config_cfattach_detach(const char *, struct cfattach *);
403 404
404int config_cfdata_attach(cfdata_t, int); 405int config_cfdata_attach(cfdata_t, int);
405int config_cfdata_detach(cfdata_t); 406int config_cfdata_detach(cfdata_t);
406 407
407struct cfdriver *config_cfdriver_lookup(const char *); 408struct cfdriver *config_cfdriver_lookup(const char *);
408struct cfattach *config_cfattach_lookup(const char *, const char *); 409struct cfattach *config_cfattach_lookup(const char *, const char *);
409const struct cfiattrdata *cfiattr_lookup(const char *, const struct cfdriver *); 410const struct cfiattrdata *cfiattr_lookup(const char *, const struct cfdriver *);
410 411
411int config_stdsubmatch(device_t, cfdata_t, const int *, void *); 412int config_stdsubmatch(device_t, cfdata_t, const int *, void *);
412cfdata_t config_search_loc(cfsubmatch_t, device_t, 413cfdata_t config_search_loc(cfsubmatch_t, device_t,
413 const char *, const int *, void *); 414 const char *, const int *, void *);
414cfdata_t config_search_ia(cfsubmatch_t, device_t, 415cfdata_t config_search_ia(cfsubmatch_t, device_t,
415 const char *, void *); 416 const char *, void *);
416cfdata_t config_rootsearch(cfsubmatch_t, const char *, void *); 417cfdata_t config_rootsearch(cfsubmatch_t, const char *, void *);
417device_t config_found_sm_loc(device_t, const char *, const int *, 418device_t config_found_sm_loc(device_t, const char *, const int *,
418 void *, cfprint_t, cfsubmatch_t); 419 void *, cfprint_t, cfsubmatch_t);
419device_t config_found_ia(device_t, const char *, void *, cfprint_t); 420device_t config_found_ia(device_t, const char *, void *, cfprint_t);
420device_t config_found(device_t, void *, cfprint_t); 421device_t config_found(device_t, void *, cfprint_t);
421device_t config_rootfound(const char *, void *); 422device_t config_rootfound(const char *, void *);
422device_t config_attach_loc(device_t, cfdata_t, const int *, void *, cfprint_t); 423device_t config_attach_loc(device_t, cfdata_t, const int *, void *, cfprint_t);
423device_t config_attach(device_t, cfdata_t, void *, cfprint_t); 424device_t config_attach(device_t, cfdata_t, void *, cfprint_t);
424int config_match(device_t, cfdata_t, void *); 425int config_match(device_t, cfdata_t, void *);
425 426
426device_t config_attach_pseudo(cfdata_t); 427device_t config_attach_pseudo(cfdata_t);
427 428
428int config_detach(device_t, int); 429int config_detach(device_t, int);
429int config_detach_children(device_t, int flags); 430int config_detach_children(device_t, int flags);
430int config_activate(device_t); 431int config_activate(device_t);
431int config_deactivate(device_t); 432int config_deactivate(device_t);
432void config_defer(device_t, void (*)(device_t)); 433void config_defer(device_t, void (*)(device_t));
433void config_deferred(device_t); 434void config_deferred(device_t);
434void config_interrupts(device_t, void (*)(device_t)); 435void config_interrupts(device_t, void (*)(device_t));
435void config_pending_incr(void); 436void config_pending_incr(void);
436void config_pending_decr(void); 437void config_pending_decr(void);
437 438
438int config_finalize_register(device_t, int (*)(device_t)); 439int config_finalize_register(device_t, int (*)(device_t));
439void config_finalize(void); 440void config_finalize(void);
440 441
441device_t device_lookup(cfdriver_t, int); 442device_t device_lookup(cfdriver_t, int);
442void *device_lookup_private(cfdriver_t, int); 443void *device_lookup_private(cfdriver_t, int);
443#ifdef __HAVE_DEVICE_REGISTER 444#ifdef __HAVE_DEVICE_REGISTER
444void device_register(device_t, void *); 445void device_register(device_t, void *);
445#endif 446#endif
446 447
447devclass_t device_class(device_t); 448devclass_t device_class(device_t);
448cfdata_t device_cfdata(device_t); 449cfdata_t device_cfdata(device_t);
449cfdriver_t device_cfdriver(device_t); 450cfdriver_t device_cfdriver(device_t);
450cfattach_t device_cfattach(device_t); 451cfattach_t device_cfattach(device_t);
451int device_unit(device_t); 452int device_unit(device_t);
452const char *device_xname(device_t); 453const char *device_xname(device_t);
453device_t device_parent(device_t); 454device_t device_parent(device_t);
454bool device_is_active(device_t); 455bool device_is_active(device_t);
455bool device_is_enabled(device_t); 456bool device_is_enabled(device_t);
456bool device_has_power(device_t); 457bool device_has_power(device_t);
457int device_locator(device_t, u_int); 458int device_locator(device_t, u_int);
458void *device_private(device_t); 459void *device_private(device_t);
459prop_dictionary_t device_properties(device_t); 460prop_dictionary_t device_properties(device_t);
460 461
461device_t deviter_first(deviter_t *, deviter_flags_t); 462device_t deviter_first(deviter_t *, deviter_flags_t);
462void deviter_init(deviter_t *, deviter_flags_t); 463void deviter_init(deviter_t *, deviter_flags_t);
463device_t deviter_next(deviter_t *); 464device_t deviter_next(deviter_t *);
464void deviter_release(deviter_t *); 465void deviter_release(deviter_t *);
465 466
466bool device_active(device_t, devactive_t); 467bool device_active(device_t, devactive_t);
467bool device_active_register(device_t, 468bool device_active_register(device_t,
468 void (*)(device_t, devactive_t)); 469 void (*)(device_t, devactive_t));
469void device_active_deregister(device_t, 470void device_active_deregister(device_t,
470 void (*)(device_t, devactive_t)); 471 void (*)(device_t, devactive_t));
471 472
472bool device_is_a(device_t, const char *); 473bool device_is_a(device_t, const char *);
473 474
474device_t device_find_by_xname(const char *); 475device_t device_find_by_xname(const char *);
475device_t device_find_by_driver_unit(const char *, int); 476device_t device_find_by_driver_unit(const char *, int);
476 477
477bool device_pmf_is_registered(device_t); 478bool device_pmf_is_registered(device_t);
478 479
479bool device_pmf_driver_suspend(device_t PMF_FN_PROTO); 480bool device_pmf_driver_suspend(device_t PMF_FN_PROTO);
480bool device_pmf_driver_resume(device_t PMF_FN_PROTO); 481bool device_pmf_driver_resume(device_t PMF_FN_PROTO);
481bool device_pmf_driver_shutdown(device_t, int); 482bool device_pmf_driver_shutdown(device_t, int);
482 483
483bool device_pmf_driver_register(device_t, 484bool device_pmf_driver_register(device_t,
484 bool (*)(device_t PMF_FN_PROTO), 485 bool (*)(device_t PMF_FN_PROTO),
485 bool (*)(device_t PMF_FN_PROTO), 486 bool (*)(device_t PMF_FN_PROTO),
486 bool (*)(device_t, int)); 487 bool (*)(device_t, int));
487void device_pmf_driver_deregister(device_t); 488void device_pmf_driver_deregister(device_t);
488 489
489bool device_pmf_driver_child_register(device_t); 490bool device_pmf_driver_child_register(device_t);
490void device_pmf_driver_set_child_register(device_t, 491void device_pmf_driver_set_child_register(device_t,
491 bool (*)(device_t)); 492 bool (*)(device_t));
492 493
493void *device_pmf_bus_private(device_t); 494void *device_pmf_bus_private(device_t);
494bool device_pmf_bus_suspend(device_t PMF_FN_PROTO); 495bool device_pmf_bus_suspend(device_t PMF_FN_PROTO);
495bool device_pmf_bus_resume(device_t PMF_FN_PROTO); 496bool device_pmf_bus_resume(device_t PMF_FN_PROTO);
496bool device_pmf_bus_shutdown(device_t, int); 497bool device_pmf_bus_shutdown(device_t, int);
497 498
498void *device_pmf_private(device_t); 499void *device_pmf_private(device_t);
499void device_pmf_unlock(device_t PMF_FN_PROTO); 500void device_pmf_unlock(device_t PMF_FN_PROTO);
500bool device_pmf_lock(device_t PMF_FN_PROTO); 501bool device_pmf_lock(device_t PMF_FN_PROTO);
501 502
502bool device_is_self_suspended(device_t); 503bool device_is_self_suspended(device_t);
503void device_pmf_self_suspend(device_t PMF_FN_PROTO); 504void device_pmf_self_suspend(device_t PMF_FN_PROTO);
504void device_pmf_self_resume(device_t PMF_FN_PROTO); 505void device_pmf_self_resume(device_t PMF_FN_PROTO);
505bool device_pmf_self_wait(device_t PMF_FN_PROTO); 506bool device_pmf_self_wait(device_t PMF_FN_PROTO);
506 507
507void device_pmf_bus_register(device_t, void *, 508void device_pmf_bus_register(device_t, void *,
508 bool (*)(device_t PMF_FN_PROTO), 509 bool (*)(device_t PMF_FN_PROTO),
509 bool (*)(device_t PMF_FN_PROTO), 510 bool (*)(device_t PMF_FN_PROTO),
510 bool (*)(device_t, int), 511 bool (*)(device_t, int),
511 void (*)(device_t)); 512 void (*)(device_t));
512void device_pmf_bus_deregister(device_t); 513void device_pmf_bus_deregister(device_t);
513 514
514void *device_pmf_class_private(device_t); 515void *device_pmf_class_private(device_t);
515bool device_pmf_class_suspend(device_t PMF_FN_PROTO); 516bool device_pmf_class_suspend(device_t PMF_FN_PROTO);
516bool device_pmf_class_resume(device_t PMF_FN_PROTO); 517bool device_pmf_class_resume(device_t PMF_FN_PROTO);
517 518
518void device_pmf_class_register(device_t, void *, 519void device_pmf_class_register(device_t, void *,
519 bool (*)(device_t PMF_FN_PROTO), 520 bool (*)(device_t PMF_FN_PROTO),
520 bool (*)(device_t PMF_FN_PROTO), 521 bool (*)(device_t PMF_FN_PROTO),
521 void (*)(device_t)); 522 void (*)(device_t));
522void device_pmf_class_deregister(device_t); 523void device_pmf_class_deregister(device_t);
523 524
524#endif /* _KERNEL */ 525#endif /* _KERNEL */
525 526
526#endif /* !_SYS_DEVICE_H_ */ 527#endif /* !_SYS_DEVICE_H_ */

cvs diff -r1.228.4.1 -r1.228.4.2 src/sys/sys/systm.h (switch to unified diff)

--- src/sys/sys/systm.h 2009/02/26 20:38:00 1.228.4.1
+++ src/sys/sys/systm.h 2009/03/15 19:43:48 1.228.4.2
@@ -1,504 +1,506 @@ @@ -1,504 +1,506 @@
1/* $NetBSD: systm.h,v 1.228.4.1 2009/02/26 20:38:00 snj Exp $ */ 1/* $NetBSD: systm.h,v 1.228.4.2 2009/03/15 19:43:48 snj Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1982, 1988, 1991, 1993 4 * Copyright (c) 1982, 1988, 1991, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc. 6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed 7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph 8 * to the University of California by American Telephone and Telegraph
9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with 9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 * the permission of UNIX System Laboratories, Inc. 10 * the permission of UNIX System Laboratories, Inc.
11 * 11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions 13 * modification, are permitted provided that the following conditions
14 * are met: 14 * are met:
15 * 1. Redistributions of source code must retain the above copyright 15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer. 16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright 17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the 18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution. 19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors 20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software 21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission. 22 * without specific prior written permission.
23 * 23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE. 34 * SUCH DAMAGE.
35 * 35 *
36 * @(#)systm.h 8.7 (Berkeley) 3/29/95 36 * @(#)systm.h 8.7 (Berkeley) 3/29/95
37 */ 37 */
38 38
39#ifndef _SYS_SYSTM_H_ 39#ifndef _SYS_SYSTM_H_
40#define _SYS_SYSTM_H_ 40#define _SYS_SYSTM_H_
41 41
42#if defined(_KERNEL_OPT) 42#if defined(_KERNEL_OPT)
43#include "opt_ddb.h" 43#include "opt_ddb.h"
44#include "opt_multiprocessor.h" 44#include "opt_multiprocessor.h"
45#endif 45#endif
46 46
47#include <machine/endian.h> 47#include <machine/endian.h>
48 48
49#ifdef _KERNEL 49#ifdef _KERNEL
50#include <sys/types.h> 50#include <sys/types.h>
51#endif 51#endif
52 52
53struct clockframe; 53struct clockframe;
54struct device; 54struct device;
55struct lwp; 55struct lwp;
56struct proc; 56struct proc;
57struct timeval; 57struct timeval;
58struct tty; 58struct tty;
59struct uio; 59struct uio;
60struct vnode; 60struct vnode;
61struct vmspace; 61struct vmspace;
62struct vm_map; 62struct vm_map;
63 63
64extern const char *panicstr; /* panic message */ 64extern const char *panicstr; /* panic message */
65extern int doing_shutdown; /* shutting down */ 65extern int doing_shutdown; /* shutting down */
66 66
67extern const char copyright[]; /* system copyright */ 67extern const char copyright[]; /* system copyright */
68extern char cpu_model[]; /* machine/cpu model name */ 68extern char cpu_model[]; /* machine/cpu model name */
69extern char machine[]; /* machine type */ 69extern char machine[]; /* machine type */
70extern char machine_arch[]; /* machine architecture */ 70extern char machine_arch[]; /* machine architecture */
71extern const char osrelease[]; /* short system version */ 71extern const char osrelease[]; /* short system version */
72extern const char ostype[]; /* system type */ 72extern const char ostype[]; /* system type */
73extern const char kernel_ident[];/* kernel configuration ID */ 73extern const char kernel_ident[];/* kernel configuration ID */
74extern const char version[]; /* system version */ 74extern const char version[]; /* system version */
75 75
76extern int autonicetime; /* time (in seconds) before autoniceval */ 76extern int autonicetime; /* time (in seconds) before autoniceval */
77extern int autoniceval; /* proc priority after autonicetime */ 77extern int autoniceval; /* proc priority after autonicetime */
78 78
79extern int selwait; /* select timeout address */ 79extern int selwait; /* select timeout address */
80 80
81extern int maxmem; /* max memory per process */ 81extern int maxmem; /* max memory per process */
82extern int physmem; /* physical memory */ 82extern int physmem; /* physical memory */
83 83
84extern dev_t dumpdev; /* dump device */ 84extern dev_t dumpdev; /* dump device */
85extern dev_t dumpcdev; /* dump device (character equivalent) */ 85extern dev_t dumpcdev; /* dump device (character equivalent) */
86extern long dumplo; /* offset into dumpdev */ 86extern long dumplo; /* offset into dumpdev */
87extern int dumpsize; /* size of dump in pages */ 87extern int dumpsize; /* size of dump in pages */
88extern const char *dumpspec; /* how dump device was specified */ 88extern const char *dumpspec; /* how dump device was specified */
89 89
90extern dev_t rootdev; /* root device */ 90extern dev_t rootdev; /* root device */
91extern struct vnode *rootvp; /* vnode equivalent to above */ 91extern struct vnode *rootvp; /* vnode equivalent to above */
92extern struct device *root_device; /* device equivalent to above */ 92extern struct device *root_device; /* device equivalent to above */
93extern const char *rootspec; /* how root device was specified */ 93extern const char *rootspec; /* how root device was specified */
94 94
95extern int ncpu; /* number of CPUs configured */ 95extern int ncpu; /* number of CPUs configured */
96extern int ncpuonline; /* number of CPUs online */ 96extern int ncpuonline; /* number of CPUs online */
97#if defined(_KERNEL) 97#if defined(_KERNEL)
98extern bool mp_online; /* secondary processors are started */ 98extern bool mp_online; /* secondary processors are started */
99#endif /* defined(_KERNEL) */ 99#endif /* defined(_KERNEL) */
100 100
101extern const char hexdigits[]; /* "0123456789abcdef" in subr_prf2.c */ 101extern const char hexdigits[]; /* "0123456789abcdef" in subr_prf2.c */
102extern const char HEXDIGITS[]; /* "0123456789ABCDEF" in subr_prf2.c */ 102extern const char HEXDIGITS[]; /* "0123456789ABCDEF" in subr_prf2.c */
103 103
104/* 104/*
105 * These represent the swap pseudo-device (`sw'). This device 105 * These represent the swap pseudo-device (`sw'). This device
106 * is used by the swap pager to indirect through the routines 106 * is used by the swap pager to indirect through the routines
107 * in sys/vm/vm_swap.c. 107 * in sys/vm/vm_swap.c.
108 */ 108 */
109extern const dev_t swapdev; /* swapping device */ 109extern const dev_t swapdev; /* swapping device */
110extern struct vnode *swapdev_vp;/* vnode equivalent to above */ 110extern struct vnode *swapdev_vp;/* vnode equivalent to above */
111 111
112extern const dev_t zerodev; /* /dev/zero */ 112extern const dev_t zerodev; /* /dev/zero */
113 113
114typedef int sy_call_t(struct lwp *, const void *, register_t *); 114typedef int sy_call_t(struct lwp *, const void *, register_t *);
115 115
116extern struct sysent { /* system call table */ 116extern struct sysent { /* system call table */
117 short sy_narg; /* number of args */ 117 short sy_narg; /* number of args */
118 short sy_argsize; /* total size of arguments */ 118 short sy_argsize; /* total size of arguments */
119 int sy_flags; /* flags. see below */ 119 int sy_flags; /* flags. see below */
120 sy_call_t *sy_call; /* implementing function */ 120 sy_call_t *sy_call; /* implementing function */
121} sysent[]; 121} sysent[];
122extern int nsysent; 122extern int nsysent;
123#if BYTE_ORDER == BIG_ENDIAN 123#if BYTE_ORDER == BIG_ENDIAN
124#define SCARG(p,k) ((p)->k.be.datum) /* get arg from args pointer */ 124#define SCARG(p,k) ((p)->k.be.datum) /* get arg from args pointer */
125#elif BYTE_ORDER == LITTLE_ENDIAN 125#elif BYTE_ORDER == LITTLE_ENDIAN
126#define SCARG(p,k) ((p)->k.le.datum) /* get arg from args pointer */ 126#define SCARG(p,k) ((p)->k.le.datum) /* get arg from args pointer */
127#else 127#else
128#error "what byte order is this machine?" 128#error "what byte order is this machine?"
129#endif 129#endif
130 130
131#define SYCALL_INDIRECT 0x0002 /* indirect (ie syscall() or __syscall()) */ 131#define SYCALL_INDIRECT 0x0002 /* indirect (ie syscall() or __syscall()) */
132 132
133extern int boothowto; /* reboot flags, from console subsystem */ 133extern int boothowto; /* reboot flags, from console subsystem */
134#define bootverbose (boothowto & AB_VERBOSE) 134#define bootverbose (boothowto & AB_VERBOSE)
135#define bootquiet (boothowto & AB_QUIET) 135#define bootquiet (boothowto & AB_QUIET)
136 136
137extern void (*v_putc)(int); /* Virtual console putc routine */ 137extern void (*v_putc)(int); /* Virtual console putc routine */
138 138
139/* 139/*
140 * General function declarations. 140 * General function declarations.
141 */ 141 */
142int nullop(void *); 142int nullop(void *);
143int enodev(void); 143int enodev(void);
144int enosys(void); 144int enosys(void);
145int enoioctl(void); 145int enoioctl(void);
146int enxio(void); 146int enxio(void);
147int eopnotsupp(void); 147int eopnotsupp(void);
148 148
149enum hashtype { 149enum hashtype {
150 HASH_LIST, 150 HASH_LIST,
151 HASH_SLIST, 151 HASH_SLIST,
152 HASH_TAILQ 152 HASH_TAILQ
153}; 153};
154 154
155#ifdef _KERNEL 155#ifdef _KERNEL
156void *hashinit(u_int, enum hashtype, bool, u_long *); 156void *hashinit(u_int, enum hashtype, bool, u_long *);
157void hashdone(void *, enum hashtype, u_long); 157void hashdone(void *, enum hashtype, u_long);
158int seltrue(dev_t, int, struct lwp *); 158int seltrue(dev_t, int, struct lwp *);
159int sys_nosys(struct lwp *, const void *, register_t *); 159int sys_nosys(struct lwp *, const void *, register_t *);
160 160
161void aprint_normal(const char *, ...) 161void aprint_normal(const char *, ...)
162 __attribute__((__format__(__printf__,1,2))); 162 __attribute__((__format__(__printf__,1,2)));
163void aprint_error(const char *, ...) 163void aprint_error(const char *, ...)
164 __attribute__((__format__(__printf__,1,2))); 164 __attribute__((__format__(__printf__,1,2)));
165void aprint_naive(const char *, ...) 165void aprint_naive(const char *, ...)
166 __attribute__((__format__(__printf__,1,2))); 166 __attribute__((__format__(__printf__,1,2)));
167void aprint_verbose(const char *, ...) 167void aprint_verbose(const char *, ...)
168 __attribute__((__format__(__printf__,1,2))); 168 __attribute__((__format__(__printf__,1,2)));
169void aprint_debug(const char *, ...) 169void aprint_debug(const char *, ...)
170 __attribute__((__format__(__printf__,1,2))); 170 __attribute__((__format__(__printf__,1,2)));
171 171
172struct device; 172struct device;
173 173
174void aprint_normal_dev(struct device *, const char *, ...) 174void aprint_normal_dev(struct device *, const char *, ...)
175 __attribute__((__format__(__printf__,2,3))); 175 __attribute__((__format__(__printf__,2,3)));
176void aprint_error_dev(struct device *, const char *, ...) 176void aprint_error_dev(struct device *, const char *, ...)
177 __attribute__((__format__(__printf__,2,3))); 177 __attribute__((__format__(__printf__,2,3)));
178void aprint_naive_dev(struct device *, const char *, ...) 178void aprint_naive_dev(struct device *, const char *, ...)
179 __attribute__((__format__(__printf__,2,3))); 179 __attribute__((__format__(__printf__,2,3)));
180void aprint_verbose_dev(struct device *, const char *, ...) 180void aprint_verbose_dev(struct device *, const char *, ...)
181 __attribute__((__format__(__printf__,2,3))); 181 __attribute__((__format__(__printf__,2,3)));
182void aprint_debug_dev(struct device *, const char *, ...) 182void aprint_debug_dev(struct device *, const char *, ...)
183 __attribute__((__format__(__printf__,2,3))); 183 __attribute__((__format__(__printf__,2,3)));
184 184
185struct ifnet; 185struct ifnet;
186 186
187void aprint_normal_ifnet(struct ifnet *, const char *, ...) 187void aprint_normal_ifnet(struct ifnet *, const char *, ...)
188 __attribute__((__format__(__printf__,2,3))); 188 __attribute__((__format__(__printf__,2,3)));
189void aprint_error_ifnet(struct ifnet *, const char *, ...) 189void aprint_error_ifnet(struct ifnet *, const char *, ...)
190 __attribute__((__format__(__printf__,2,3))); 190 __attribute__((__format__(__printf__,2,3)));
191void aprint_naive_ifnet(struct ifnet *, const char *, ...) 191void aprint_naive_ifnet(struct ifnet *, const char *, ...)
192 __attribute__((__format__(__printf__,2,3))); 192 __attribute__((__format__(__printf__,2,3)));
193void aprint_verbose_ifnet(struct ifnet *, const char *, ...) 193void aprint_verbose_ifnet(struct ifnet *, const char *, ...)
194 __attribute__((__format__(__printf__,2,3))); 194 __attribute__((__format__(__printf__,2,3)));
195void aprint_debug_ifnet(struct ifnet *, const char *, ...) 195void aprint_debug_ifnet(struct ifnet *, const char *, ...)
196 __attribute__((__format__(__printf__,2,3))); 196 __attribute__((__format__(__printf__,2,3)));
197 197
198int aprint_get_error_count(void); 198int aprint_get_error_count(void);
199 199
200void printf_tolog(const char *, ...) 200void printf_tolog(const char *, ...)
201 __attribute__((__format__(__printf__,1,2))); 201 __attribute__((__format__(__printf__,1,2)));
202 202
203void printf_nolog(const char *, ...) 203void printf_nolog(const char *, ...)
204 __attribute__((__format__(__printf__,1,2))); 204 __attribute__((__format__(__printf__,1,2)));
205 205
206void printf(const char *, ...) 206void printf(const char *, ...)
207 __attribute__((__format__(__printf__,1,2))); 207 __attribute__((__format__(__printf__,1,2)));
208int sprintf(char *, const char *, ...) 208int sprintf(char *, const char *, ...)
209 __attribute__((__format__(__printf__,2,3))); 209 __attribute__((__format__(__printf__,2,3)));
210int snprintf(char *, size_t, const char *, ...) 210int snprintf(char *, size_t, const char *, ...)
211 __attribute__((__format__(__printf__,3,4))); 211 __attribute__((__format__(__printf__,3,4)));
212void vprintf(const char *, _BSD_VA_LIST_); 212void vprintf(const char *, _BSD_VA_LIST_);
213int vsprintf(char *, const char *, _BSD_VA_LIST_); 213int vsprintf(char *, const char *, _BSD_VA_LIST_);
214int vsnprintf(char *, size_t, const char *, _BSD_VA_LIST_); 214int vsnprintf(char *, size_t, const char *, _BSD_VA_LIST_);
215int humanize_number(char *, size_t, uint64_t, const char *, int); 215int humanize_number(char *, size_t, uint64_t, const char *, int);
216 216
217void twiddle(void); 217void twiddle(void);
218#endif /* _KERNEL */ 218#endif /* _KERNEL */
219 219
220void panic(const char *, ...) 220void panic(const char *, ...)
221 __dead __attribute__((__format__(__printf__,1,2))); 221 __dead __attribute__((__format__(__printf__,1,2)));
222void uprintf(const char *, ...) 222void uprintf(const char *, ...)
223 __attribute__((__format__(__printf__,1,2))); 223 __attribute__((__format__(__printf__,1,2)));
224void uprintf_locked(const char *, ...) 224void uprintf_locked(const char *, ...)
225 __attribute__((__format__(__printf__,1,2))); 225 __attribute__((__format__(__printf__,1,2)));
226void ttyprintf(struct tty *, const char *, ...) 226void ttyprintf(struct tty *, const char *, ...)
227 __attribute__((__format__(__printf__,2,3))); 227 __attribute__((__format__(__printf__,2,3)));
228 228
229char *bitmask_snprintf(u_quad_t, const char *, char *, size_t); 229char *bitmask_snprintf(u_quad_t, const char *, char *, size_t);
230 230
231int format_bytes(char *, size_t, uint64_t); 231int format_bytes(char *, size_t, uint64_t);
232 232
233void tablefull(const char *, const char *); 233void tablefull(const char *, const char *);
234 234
235int kcopy(const void *, void *, size_t); 235int kcopy(const void *, void *, size_t);
236 236
237#ifdef _KERNEL 237#ifdef _KERNEL
238#define bcopy(src, dst, len) memcpy((dst), (src), (len)) 238#define bcopy(src, dst, len) memcpy((dst), (src), (len))
239#define bzero(src, len) memset((src), 0, (len)) 239#define bzero(src, len) memset((src), 0, (len))
240#define bcmp(a, b, len) memcmp((a), (b), (len)) 240#define bcmp(a, b, len) memcmp((a), (b), (len))
241#endif /* KERNEL */ 241#endif /* KERNEL */
242 242
243int copystr(const void *, void *, size_t, size_t *); 243int copystr(const void *, void *, size_t, size_t *);
244int copyinstr(const void *, void *, size_t, size_t *); 244int copyinstr(const void *, void *, size_t, size_t *);
245int copyoutstr(const void *, void *, size_t, size_t *); 245int copyoutstr(const void *, void *, size_t, size_t *);
246int copyin(const void *, void *, size_t); 246int copyin(const void *, void *, size_t);
247int copyout(const void *, void *, size_t); 247int copyout(const void *, void *, size_t);
248 248
249#ifdef _KERNEL 249#ifdef _KERNEL
250typedef int (*copyin_t)(const void *, void *, size_t); 250typedef int (*copyin_t)(const void *, void *, size_t);
251typedef int (*copyout_t)(const void *, void *, size_t); 251typedef int (*copyout_t)(const void *, void *, size_t);
252#endif 252#endif
253 253
254int copyin_proc(struct proc *, const void *, void *, size_t); 254int copyin_proc(struct proc *, const void *, void *, size_t);
255int copyout_proc(struct proc *, const void *, void *, size_t); 255int copyout_proc(struct proc *, const void *, void *, size_t);
256int copyin_vmspace(struct vmspace *, const void *, void *, size_t); 256int copyin_vmspace(struct vmspace *, const void *, void *, size_t);
257int copyout_vmspace(struct vmspace *, const void *, void *, size_t); 257int copyout_vmspace(struct vmspace *, const void *, void *, size_t);
258 258
259int ioctl_copyin(int ioctlflags, const void *src, void *dst, size_t len); 259int ioctl_copyin(int ioctlflags, const void *src, void *dst, size_t len);
260int ioctl_copyout(int ioctlflags, const void *src, void *dst, size_t len); 260int ioctl_copyout(int ioctlflags, const void *src, void *dst, size_t len);
261 261
262int ucas_ptr(volatile void *, void *, void *, void *); 262int ucas_ptr(volatile void *, void *, void *, void *);
263int ucas_int(volatile int *, int, int, int *); 263int ucas_int(volatile int *, int, int, int *);
264 264
265int subyte(void *, int); 265int subyte(void *, int);
266int suibyte(void *, int); 266int suibyte(void *, int);
267int susword(void *, short); 267int susword(void *, short);
268int suisword(void *, short); 268int suisword(void *, short);
269int suswintr(void *, short); 269int suswintr(void *, short);
270int suword(void *, long); 270int suword(void *, long);
271int suiword(void *, long); 271int suiword(void *, long);
272 272
273int fubyte(const void *); 273int fubyte(const void *);
274int fuibyte(const void *); 274int fuibyte(const void *);
275int fusword(const void *); 275int fusword(const void *);
276int fuisword(const void *); 276int fuisword(const void *);
277int fuswintr(const void *); 277int fuswintr(const void *);
278long fuword(const void *); 278long fuword(const void *);
279long fuiword(const void *); 279long fuiword(const void *);
280 280
281void hardclock(struct clockframe *); 281void hardclock(struct clockframe *);
282void softclock(void *); 282void softclock(void *);
283void statclock(struct clockframe *); 283void statclock(struct clockframe *);
284 284
285#ifdef NTP 285#ifdef NTP
286void ntp_init(void); 286void ntp_init(void);
287#ifdef PPS_SYNC 287#ifdef PPS_SYNC
288void hardpps(struct timespec *, long); 288void hardpps(struct timespec *, long);
289#endif /* PPS_SYNC */ 289#endif /* PPS_SYNC */
290#else 290#else
291void ntp_init(void); /* also provides adjtime() functionality */ 291void ntp_init(void); /* also provides adjtime() functionality */
292#endif /* NTP */ 292#endif /* NTP */
293 293
 294void ssp_init(void);
 295
294void initclocks(void); 296void initclocks(void);
295void inittodr(time_t); 297void inittodr(time_t);
296void resettodr(void); 298void resettodr(void);
297void cpu_initclocks(void); 299void cpu_initclocks(void);
298void setrootfstime(time_t); 300void setrootfstime(time_t);
299 301
300void startprofclock(struct proc *); 302void startprofclock(struct proc *);
301void stopprofclock(struct proc *); 303void stopprofclock(struct proc *);
302void proftick(struct clockframe *); 304void proftick(struct clockframe *);
303void setstatclockrate(int); 305void setstatclockrate(int);
304 306
305/* 307/*
306 * Shutdown hooks. Functions to be run with all interrupts disabled 308 * Shutdown hooks. Functions to be run with all interrupts disabled
307 * immediately before the system is halted or rebooted. 309 * immediately before the system is halted or rebooted.
308 */ 310 */
309void *shutdownhook_establish(void (*)(void *), void *); 311void *shutdownhook_establish(void (*)(void *), void *);
310void shutdownhook_disestablish(void *); 312void shutdownhook_disestablish(void *);
311void doshutdownhooks(void); 313void doshutdownhooks(void);
312 314
313/* 315/*
314 * Power management hooks. 316 * Power management hooks.
315 */ 317 */
316void *powerhook_establish(const char *, void (*)(int, void *), void *); 318void *powerhook_establish(const char *, void (*)(int, void *), void *);
317void powerhook_disestablish(void *); 319void powerhook_disestablish(void *);
318void dopowerhooks(int); 320void dopowerhooks(int);
319#define PWR_RESUME 0 321#define PWR_RESUME 0
320#define PWR_SUSPEND 1 322#define PWR_SUSPEND 1
321#define PWR_STANDBY 2 323#define PWR_STANDBY 2
322#define PWR_SOFTRESUME 3 324#define PWR_SOFTRESUME 3
323#define PWR_SOFTSUSPEND 4 325#define PWR_SOFTSUSPEND 4
324#define PWR_SOFTSTANDBY 5 326#define PWR_SOFTSTANDBY 5
325#define PWR_NAMES \ 327#define PWR_NAMES \
326 "resume", /* 0 */ \ 328 "resume", /* 0 */ \
327 "suspend", /* 1 */ \ 329 "suspend", /* 1 */ \
328 "standby", /* 2 */ \ 330 "standby", /* 2 */ \
329 "softresume", /* 3 */ \ 331 "softresume", /* 3 */ \
330 "softsuspend", /* 4 */ \ 332 "softsuspend", /* 4 */ \
331 "softstandby" /* 5 */ 333 "softstandby" /* 5 */
332 334
333/* 335/*
334 * Mountroot hooks (and mountroot declaration). Device drivers establish 336 * Mountroot hooks (and mountroot declaration). Device drivers establish
335 * these to be executed just before (*mountroot)() if the passed device is 337 * these to be executed just before (*mountroot)() if the passed device is
336 * selected as the root device. 338 * selected as the root device.
337 */ 339 */
338extern int (*mountroot)(void); 340extern int (*mountroot)(void);
339void *mountroothook_establish(void (*)(struct device *), struct device *); 341void *mountroothook_establish(void (*)(struct device *), struct device *);
340void mountroothook_disestablish(void *); 342void mountroothook_disestablish(void *);
341void mountroothook_destroy(void); 343void mountroothook_destroy(void);
342void domountroothook(void); 344void domountroothook(void);
343 345
344/* 346/*
345 * Exec hooks. Subsystems may want to do cleanup when a process 347 * Exec hooks. Subsystems may want to do cleanup when a process
346 * execs. 348 * execs.
347 */ 349 */
348void *exechook_establish(void (*)(struct proc *, void *), void *); 350void *exechook_establish(void (*)(struct proc *, void *), void *);
349void exechook_disestablish(void *); 351void exechook_disestablish(void *);
350void doexechooks(struct proc *); 352void doexechooks(struct proc *);
351 353
352/* 354/*
353 * Exit hooks. Subsystems may want to do cleanup when a process exits. 355 * Exit hooks. Subsystems may want to do cleanup when a process exits.
354 */ 356 */
355void *exithook_establish(void (*)(struct proc *, void *), void *); 357void *exithook_establish(void (*)(struct proc *, void *), void *);
356void exithook_disestablish(void *); 358void exithook_disestablish(void *);
357void doexithooks(struct proc *); 359void doexithooks(struct proc *);
358 360
359/* 361/*
360 * Fork hooks. Subsystems may want to do special processing when a process 362 * Fork hooks. Subsystems may want to do special processing when a process
361 * forks. 363 * forks.
362 */ 364 */
363void *forkhook_establish(void (*)(struct proc *, struct proc *)); 365void *forkhook_establish(void (*)(struct proc *, struct proc *));
364void forkhook_disestablish(void *); 366void forkhook_disestablish(void *);
365void doforkhooks(struct proc *, struct proc *); 367void doforkhooks(struct proc *, struct proc *);
366 368
367/* 369/*
368 * kernel syscall tracing/debugging hooks. 370 * kernel syscall tracing/debugging hooks.
369 */ 371 */
370#ifdef _KERNEL 372#ifdef _KERNEL
371bool trace_is_enabled(struct proc *); 373bool trace_is_enabled(struct proc *);
372int trace_enter(register_t, const register_t *, int); 374int trace_enter(register_t, const register_t *, int);
373void trace_exit(register_t, register_t [], int); 375void trace_exit(register_t, register_t [], int);
374#endif 376#endif
375 377
376int uiomove(void *, size_t, struct uio *); 378int uiomove(void *, size_t, struct uio *);
377int uiomove_frombuf(void *, size_t, struct uio *); 379int uiomove_frombuf(void *, size_t, struct uio *);
378 380
379#ifdef _KERNEL 381#ifdef _KERNEL
380int setjmp(label_t *); 382int setjmp(label_t *);
381void longjmp(label_t *) __dead; 383void longjmp(label_t *) __dead;
382#endif 384#endif
383 385
384void consinit(void); 386void consinit(void);
385 387
386void cpu_startup(void); 388void cpu_startup(void);
387void cpu_configure(void); 389void cpu_configure(void);
388void cpu_rootconf(void); 390void cpu_rootconf(void);
389void cpu_dumpconf(void); 391void cpu_dumpconf(void);
390 392
391#ifdef GPROF 393#ifdef GPROF
392void kmstartup(void); 394void kmstartup(void);
393#endif 395#endif
394 396
395#ifdef _KERNEL 397#ifdef _KERNEL
396#include <lib/libkern/libkern.h> 398#include <lib/libkern/libkern.h>
397 399
398/* 400/*
399 * Stuff to handle debugger magic key sequences. 401 * Stuff to handle debugger magic key sequences.
400 */ 402 */
401#define CNS_LEN 128 403#define CNS_LEN 128
402#define CNS_MAGIC_VAL(x) ((x)&0x1ff) 404#define CNS_MAGIC_VAL(x) ((x)&0x1ff)
403#define CNS_MAGIC_NEXT(x) (((x)>>9)&0x7f) 405#define CNS_MAGIC_NEXT(x) (((x)>>9)&0x7f)
404#define CNS_TERM 0x7f /* End of sequence */ 406#define CNS_TERM 0x7f /* End of sequence */
405 407
406typedef struct cnm_state { 408typedef struct cnm_state {
407 int cnm_state; 409 int cnm_state;
408 u_short *cnm_magic; 410 u_short *cnm_magic;
409} cnm_state_t; 411} cnm_state_t;
410 412
411/* Override db_console() in MD headers */ 413/* Override db_console() in MD headers */
412#ifndef cn_trap 414#ifndef cn_trap
413#define cn_trap() console_debugger() 415#define cn_trap() console_debugger()
414#endif 416#endif
415#ifndef cn_isconsole 417#ifndef cn_isconsole
416#define cn_isconsole(d) (cn_tab != NULL && (d) == cn_tab->cn_dev) 418#define cn_isconsole(d) (cn_tab != NULL && (d) == cn_tab->cn_dev)
417#endif 419#endif
418 420
419void cn_init_magic(cnm_state_t *); 421void cn_init_magic(cnm_state_t *);
420void cn_destroy_magic(cnm_state_t *); 422void cn_destroy_magic(cnm_state_t *);
421int cn_set_magic(const char *); 423int cn_set_magic(const char *);
422int cn_get_magic(char *, size_t); 424int cn_get_magic(char *, size_t);
423/* This should be called for each byte read */ 425/* This should be called for each byte read */
424#ifndef cn_check_magic 426#ifndef cn_check_magic
425#define cn_check_magic(d, k, s) \ 427#define cn_check_magic(d, k, s) \
426 do { \ 428 do { \
427 if (cn_isconsole(d)) { \ 429 if (cn_isconsole(d)) { \
428 int _v = (s).cnm_magic[(s).cnm_state]; \ 430 int _v = (s).cnm_magic[(s).cnm_state]; \
429 if ((k) == CNS_MAGIC_VAL(_v)) { \ 431 if ((k) == CNS_MAGIC_VAL(_v)) { \
430 (s).cnm_state = CNS_MAGIC_NEXT(_v); \ 432 (s).cnm_state = CNS_MAGIC_NEXT(_v); \
431 if ((s).cnm_state == CNS_TERM) { \ 433 if ((s).cnm_state == CNS_TERM) { \
432 cn_trap(); \ 434 cn_trap(); \
433 (s).cnm_state = 0; \ 435 (s).cnm_state = 0; \
434 } \ 436 } \
435 } else { \ 437 } else { \
436 (s).cnm_state = 0; \ 438 (s).cnm_state = 0; \
437 } \ 439 } \
438 } \ 440 } \
439 } while (/* CONSTCOND */ 0) 441 } while (/* CONSTCOND */ 0)
440#endif 442#endif
441 443
442/* Encode out-of-band events this way when passing to cn_check_magic() */ 444/* Encode out-of-band events this way when passing to cn_check_magic() */
443#define CNC_BREAK 0x100 445#define CNC_BREAK 0x100
444 446
445#if defined(DDB) || defined(sun3) || defined(sun2) 447#if defined(DDB) || defined(sun3) || defined(sun2)
446/* note that cpu_Debugger() is always available on sun[23] */ 448/* note that cpu_Debugger() is always available on sun[23] */
447void cpu_Debugger(void); 449void cpu_Debugger(void);
448#define Debugger cpu_Debugger 450#define Debugger cpu_Debugger
449#endif 451#endif
450 452
451#ifdef DDB 453#ifdef DDB
452/* 454/*
453 * Enter debugger(s) from console attention if enabled 455 * Enter debugger(s) from console attention if enabled
454 */ 456 */
455extern int db_fromconsole; /* XXX ddb/ddbvar.h */ 457extern int db_fromconsole; /* XXX ddb/ddbvar.h */
456#define console_debugger() if (db_fromconsole) Debugger() 458#define console_debugger() if (db_fromconsole) Debugger()
457#elif defined(Debugger) 459#elif defined(Debugger)
458#define console_debugger() Debugger() 460#define console_debugger() Debugger()
459#else 461#else
460#define console_debugger() do {} while (/* CONSTCOND */ 0) /* NOP */ 462#define console_debugger() do {} while (/* CONSTCOND */ 0) /* NOP */
461#endif 463#endif
462#endif /* _KERNEL */ 464#endif /* _KERNEL */
463 465
464/* For SYSCALL_DEBUG */ 466/* For SYSCALL_DEBUG */
465void scdebug_call(register_t, const register_t[]); 467void scdebug_call(register_t, const register_t[]);
466void scdebug_ret(register_t, int, const register_t[]); 468void scdebug_ret(register_t, int, const register_t[]);
467 469
468void kernel_lock_init(void); 470void kernel_lock_init(void);
469void _kernel_lock(int); 471void _kernel_lock(int);
470void _kernel_unlock(int, int *); 472void _kernel_unlock(int, int *);
471 473
472#if defined(MULTIPROCESSOR) || defined(_LKM) 474#if defined(MULTIPROCESSOR) || defined(_LKM)
473#define KERNEL_LOCK(count, lwp) \ 475#define KERNEL_LOCK(count, lwp) \
474do { \ 476do { \
475 if ((count) != 0) \ 477 if ((count) != 0) \
476 _kernel_lock((count)); \ 478 _kernel_lock((count)); \
477} while (/* CONSTCOND */ 0) 479} while (/* CONSTCOND */ 0)
478#define KERNEL_UNLOCK(all, lwp, p) _kernel_unlock((all), (p)) 480#define KERNEL_UNLOCK(all, lwp, p) _kernel_unlock((all), (p))
479#else 481#else
480#define KERNEL_LOCK(count, lwp) do {(void)(count); (void)(lwp);} while (/* CONSTCOND */ 0) /*NOP*/ 482#define KERNEL_LOCK(count, lwp) do {(void)(count); (void)(lwp);} while (/* CONSTCOND */ 0) /*NOP*/
481#define KERNEL_UNLOCK(all, lwp, ptr) do {(void)(all); (void)(lwp); (void)(ptr);} while (/* CONSTCOND */ 0) /*NOP*/ 483#define KERNEL_UNLOCK(all, lwp, ptr) do {(void)(all); (void)(lwp); (void)(ptr);} while (/* CONSTCOND */ 0) /*NOP*/
482#endif 484#endif
483 485
484#define KERNEL_UNLOCK_LAST(l) KERNEL_UNLOCK(-1, (l), NULL) 486#define KERNEL_UNLOCK_LAST(l) KERNEL_UNLOCK(-1, (l), NULL)
485#define KERNEL_UNLOCK_ALL(l, p) KERNEL_UNLOCK(0, (l), (p)) 487#define KERNEL_UNLOCK_ALL(l, p) KERNEL_UNLOCK(0, (l), (p))
486#define KERNEL_UNLOCK_ONE(l) KERNEL_UNLOCK(1, (l), NULL) 488#define KERNEL_UNLOCK_ONE(l) KERNEL_UNLOCK(1, (l), NULL)
487 489
488/* Preemption control. */ 490/* Preemption control. */
489#ifdef _KERNEL 491#ifdef _KERNEL
490void kpreempt_disable(void); 492void kpreempt_disable(void);
491void kpreempt_enable(void); 493void kpreempt_enable(void);
492bool kpreempt_disabled(void); 494bool kpreempt_disabled(void);
493#endif 495#endif
494 496
495void assert_sleepable(void); 497void assert_sleepable(void);
496#if defined(DEBUG) 498#if defined(DEBUG)
497#define ASSERT_SLEEPABLE() assert_sleepable() 499#define ASSERT_SLEEPABLE() assert_sleepable()
498#else /* defined(DEBUG) */ 500#else /* defined(DEBUG) */
499#define ASSERT_SLEEPABLE() /* nothing */ 501#define ASSERT_SLEEPABLE() /* nothing */
500#endif /* defined(DEBUG) */ 502#endif /* defined(DEBUG) */
501 503
502vaddr_t calc_cache_size(struct vm_map *, int, int); 504vaddr_t calc_cache_size(struct vm_map *, int, int);
503 505
504#endif /* !_SYS_SYSTM_H_ */ 506#endif /* !_SYS_SYSTM_H_ */