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.diff -r1.118 -r1.118.4.1 src/sys/conf/Makefile.kern.inc
(snj)
--- 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 | ## | |
24 | HOST_SH?= sh | 24 | HOST_SH?= sh | |
25 | DBSYM?= dbsym | 25 | DBSYM?= dbsym | |
26 | MKDEP?= mkdep | 26 | MKDEP?= mkdep | |
27 | STRIP?= strip | 27 | STRIP?= strip | |
28 | OBJCOPY?= objcopy | 28 | OBJCOPY?= objcopy | |
29 | OBJDUMP?= objdump | 29 | OBJDUMP?= objdump | |
30 | CSCOPE?= cscope | 30 | CSCOPE?= cscope | |
31 | MKID?= mkid | 31 | MKID?= mkid | |
32 | UUDECODE?= ${TOOL_UUDECODE:Uuudecode} | 32 | UUDECODE?= ${TOOL_UUDECODE:Uuudecode} | |
33 | HEXDUMP?= ${TOOL_HEXDUMP:Uhexdump} | 33 | HEXDUMP?= ${TOOL_HEXDUMP:Uhexdump} | |
34 | GENASSYM?= ${TOOL_GENASSYM:Ugenassym} | 34 | GENASSYM?= ${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 | |
49 | S!= cd ../../../..; pwd | 49 | S!= 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 | ## | |
57 | INCLUDES?= -I. ${EXTRA_INCLUDES} -I${S}/../common/include -I$S/arch \ | 57 | INCLUDES?= -I. ${EXTRA_INCLUDES} -I${S}/../common/include -I$S/arch \ | |
58 | -I$S -nostdinc | 58 | -I$S -nostdinc | |
59 | CPPFLAGS+= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT | 59 | CPPFLAGS+= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT | |
60 | DEFCOPTS?= -O2 | 60 | DEFCOPTS?= -O2 | |
61 | COPTS?= ${DEFCOPTS} | 61 | COPTS?= ${DEFCOPTS} | |
62 | COPTS+= -std=gnu99 | 62 | COPTS+= -std=gnu99 | |
63 | DBG= # might contain unwanted -Ofoo | 63 | DBG= # might contain unwanted -Ofoo | |
64 | DEFWARNINGS?= yes | 64 | DEFWARNINGS?= yes | |
65 | .if (${DEFWARNINGS} == "yes") | 65 | .if (${DEFWARNINGS} == "yes") | |
66 | . if !defined(NOGCCERROR) | 66 | . if !defined(NOGCCERROR) | |
67 | CWARNFLAGS+= -Werror | 67 | CWARNFLAGS+= -Werror | |
68 | . endif | 68 | . endif | |
69 | CWARNFLAGS+= -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith | 69 | CWARNFLAGS+= -Wall -Wno-main -Wno-format-zero-length -Wpointer-arith | |
70 | CWARNFLAGS+= -Wmissing-prototypes -Wstrict-prototypes | 70 | CWARNFLAGS+= -Wmissing-prototypes -Wstrict-prototypes | |
71 | CWARNFLAGS+= -Wswitch -Wshadow | 71 | CWARNFLAGS+= -Wswitch -Wshadow | |
72 | CWARNFLAGS+= -Wcast-qual -Wwrite-strings | 72 | CWARNFLAGS+= -Wcast-qual -Wwrite-strings | |
73 | CWARNFLAGS+= -Wno-unreachable-code | 73 | CWARNFLAGS+= -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. | |
76 | CWARNFLAGS+= -Wno-sign-compare | 76 | CWARNFLAGS+= -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) | |
78 | CWARNFLAGS+= -Wno-pointer-sign -Wno-attributes | 78 | CWARNFLAGS+= -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" | |
81 | CWARNFLAGS+= -Wextra -Wno-unused-parameter | 81 | CWARNFLAGS+= -Wextra -Wno-unused-parameter | |
82 | . endif | 82 | . endif | |
83 | . endif | 83 | . endif | |
84 | .endif | 84 | .endif | |
85 | 85 | |||
86 | CFLAGS+= -ffreestanding -fno-zero-initialized-in-bss | 86 | CFLAGS+= -ffreestanding -fno-zero-initialized-in-bss | |
87 | CFLAGS+= ${DEBUG} ${COPTS} | 87 | CFLAGS+= ${DEBUG} ${COPTS} | |
88 | AFLAGS+= -D_LOCORE -Wa,-fatal-warnings | 88 | AFLAGS+= -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 | |
92 | CFLAGS+= -fno-strict-aliasing | 92 | CFLAGS+= -fno-strict-aliasing | |
93 | .endif | 93 | .endif | |
94 | 94 | |||
95 | .if ${USE_SSP:Uno} == "yes" | 95 | .if ${USE_SSP:Uno} == "yes" | |
96 | CFLAGS+=-fstack-protector -Wstack-protector --param ssp-buffer-size=1 | 96 | CFLAGS+=-fstack-protector -Wstack-protector --param ssp-buffer-size=1 | |
97 | LDFLAGS+=-fstack-protector -Wstack-protector --param ssp-buffer-size=1 | 97 | LDFLAGS+=-fstack-protector -Wstack-protector --param ssp-buffer-size=1 | |
98 | COPTS.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}) | |
105 | COPTS.kern_synch.c+= -fno-reorder-blocks | 106 | COPTS.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} | |
113 | COPTS.${j}+=-g | 114 | COPTS.${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 | # | |
120 | COPTS.debugsyms.c+= -g | 121 | COPTS.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). | |
124 | NORMAL_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"; \ | 125 | NORMAL_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 $< | |
128 | NOPROF_C?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"; \ | 129 | NOPROF_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 $< | |
132 | NORMAL_S?= @${_MKSHMSG} "compile ${.CURDIR:T}/${.TARGET}"; \ | 133 | NORMAL_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 | |
147 | LIBKERN?= ${KERNLIB} | 148 | LIBKERN?= ${KERNLIB} | |
148 | .else | 149 | .else | |
149 | LIBKERN?= ${KERNLIB_PROF} | 150 | LIBKERN?= ${KERNLIB_PROF} | |
150 | .endif | 151 | .endif | |
151 | 152 | |||
152 | LIBKERNLN?= ${KERNLIBLN} | 153 | LIBKERNLN?= ${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 | |
157 | SYSLIBCOMPAT?= ${COMPATLIB} | 158 | SYSLIBCOMPAT?= ${COMPATLIB} | |
158 | .else | 159 | .else | |
159 | SYSLIBCOMPAT?= ${COMPATLIB_PROF} | 160 | SYSLIBCOMPAT?= ${COMPATLIB_PROF} | |
160 | .endif | 161 | .endif | |
161 | 162 | |||
162 | SYSLIBCOMPATLN?= ${COMPATLIBLN} | 163 | SYSLIBCOMPATLN?= ${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 | ## | |
170 | MI_CFILES=devsw.c ioconf.c param.c | 171 | MI_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 | |
172 | MI_OBJS=${MI_CFILES:S/.c/.o/} | 173 | MI_OBJS=${MI_CFILES:S/.c/.o/} | |
173 | 174 | |||
174 | param.c: $S/conf/param.c | 175 | param.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 | |||
179 | param.o: Makefile | 180 | param.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} | |
199 | SYSTEM_OBJ?= ${MD_OBJS} ${MI_OBJS} ${OBJS} ${SYSLIBCOMPAT} ${LIBKERN} | 200 | SYSTEM_OBJ?= ${MD_OBJS} ${MI_OBJS} ${OBJS} ${SYSLIBCOMPAT} ${LIBKERN} | |
200 | SYSTEM_DEP?= Makefile ${SYSTEM_OBJ:O} .gdbinit | 201 | SYSTEM_DEP?= Makefile ${SYSTEM_OBJ:O} .gdbinit | |
201 | SYSTEM_LD_HEAD?=@rm -f $@ | 202 | SYSTEM_LD_HEAD?=@rm -f $@ | |
202 | SYSTEM_LD?= @${_MKSHMSG} " link ${.CURDIR:T}/${.TARGET}"; \ | 203 | SYSTEM_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 | |
206 | SYSTEM_LD_TAIL?=@${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/\\.*//' vers.c; \ | 207 | SYSTEM_LD_TAIL?=@${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/\\.*//' vers.c; \ | |
207 | ${SIZE} $@; chmod 755 $@ | 208 | ${SIZE} $@; chmod 755 $@ | |
208 | 209 | |||
209 | TEXTADDR?= ${LOADADDRESS} # backwards compatibility | 210 | TEXTADDR?= ${LOADADDRESS} # backwards compatibility | |
210 | LINKTEXT?= ${TEXTADDR:C/.+/-Ttext &/} | 211 | LINKTEXT?= ${TEXTADDR:C/.+/-Ttext &/} | |
211 | LINKDATA?= ${DATAADDR:C/.+/-Tdata &/} | 212 | LINKDATA?= ${DATAADDR:C/.+/-Tdata &/} | |
212 | ENTRYPOINT?= start | 213 | ENTRYPOINT?= start | |
213 | LINKENTRY?= ${ENTRYPOINT:C/.+/-e &/} | 214 | LINKENTRY?= ${ENTRYPOINT:C/.+/-e &/} | |
214 | LINKFLAGS?= ${LINKFORMAT} ${LINKTEXT} ${LINKDATA} ${LINKENTRY} \ | 215 | LINKFLAGS?= ${LINKFORMAT} ${LINKTEXT} ${LINKDATA} ${LINKENTRY} \ | |
215 | ${EXTRA_LINKFLAGS} | 216 | ${EXTRA_LINKFLAGS} | |
216 | 217 | |||
217 | LINKFLAGS_DEBUG?= -X | 218 | LINKFLAGS_DEBUG?= -X | |
218 | SYSTEM_LD_TAIL_DEBUG?=; \ | 219 | SYSTEM_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 | |
222 | LINKFLAGS_NORMAL?= -S | 223 | LINKFLAGS_NORMAL?= -S | |
223 | STRIPFLAGS?= -g | 224 | STRIPFLAGS?= -g | |
224 | 225 | |||
225 | DEBUG?= | 226 | DEBUG?= | |
226 | .if !empty(DEBUG:M-g*) | 227 | .if !empty(DEBUG:M-g*) | |
227 | SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_DEBUG} | 228 | SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_DEBUG} | |
228 | LINKFLAGS+= ${LINKFLAGS_DEBUG} | 229 | LINKFLAGS+= ${LINKFLAGS_DEBUG} | |
229 | EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gdb@} | 230 | EXTRA_KERNELS+= ${KERNELS:@.KERNEL.@${.KERNEL.}.gdb@} | |
230 | .elifndef PROF | 231 | .elifndef PROF | |
231 | LINKFLAGS+= ${LINKFLAGS_NORMAL} | 232 | LINKFLAGS+= ${LINKFLAGS_NORMAL} | |
232 | .endif | 233 | .endif | |
233 | 234 | |||
234 | SYSTEM_LD_TAIL+=; \ | 235 | SYSTEM_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 | |||
240 | SYSTEM_LD_HEAD+=${SYSTEM_LD_HEAD_EXTRA} | 241 | SYSTEM_LD_HEAD+=${SYSTEM_LD_HEAD_EXTRA} | |
241 | SYSTEM_LD_TAIL+=${SYSTEM_LD_TAIL_EXTRA} | 242 | SYSTEM_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) | |
247 | assym.h: ${GENASSYM_CONF} ${GENASSYM_EXTRAS} | 248 | assym.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) | |
257 | newvers: vers.o | 258 | newvers: vers.o | |
258 | vers.o: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} $S/conf/newvers.sh $S/conf/osrelease.sh | 259 | vers.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) | |
266 | BUILDSYMLINKS+= config_time.src config_time.h | 267 | BUILDSYMLINKS+= config_time.src config_time.h | |
267 | .endif | 268 | .endif | |
268 | 269 | |||
269 | .if defined(MEMORY_DISK_IMAGE) | 270 | .if defined(MEMORY_DISK_IMAGE) | |
270 | md_root_image.h: ${MEMORY_DISK_IMAGE} | 271 | md_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 | |
275 | CPPFLAGS+= -DMEMORY_DISK_IMAGE | 276 | CPPFLAGS+= -DMEMORY_DISK_IMAGE | |
276 | md_root.o: md_root_image.h | 277 | md_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 | |
280 | md_root.o: Makefile | 281 | md_root.o: Makefile | |
281 | 282 | |||
282 | # depend on root or device configuration | 283 | # depend on root or device configuration | |
283 | autoconf.o conf.o: Makefile | 284 | autoconf.o conf.o: Makefile | |
284 | 285 | |||
285 | # depend on network or filesystem configuration | 286 | # depend on network or filesystem configuration | |
286 | uipc_proto.o vfs_conf.o: Makefile | 287 | uipc_proto.o vfs_conf.o: Makefile | |
287 | 288 | |||
288 | # depend on maxusers and CPU configuration | 289 | # depend on maxusers and CPU configuration | |
289 | assym.h machdep.o: Makefile | 290 | assym.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) | |
308 | kernelnames: | 309 | kernelnames: | |
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 | |
318 | cleandir distclean: __CLEANKERNEL __CLEANDEPEND | 319 | cleandir distclean: __CLEANKERNEL __CLEANDEPEND | |
319 | clean: __CLEANKERNEL | 320 | clean: __CLEANKERNEL | |
320 | depend: .depend | 321 | depend: .depend | |
321 | dependall: depend .WAIT all | 322 | dependall: depend .WAIT all | |
322 | 323 | |||
323 | .if !target(.depend) | 324 | .if !target(.depend) | |
324 | MKDEP_AFLAGS?= ${AFLAGS} | 325 | MKDEP_AFLAGS?= ${AFLAGS} | |
325 | MKDEP_CFLAGS?= ${CFLAGS} | 326 | MKDEP_CFLAGS?= ${CFLAGS} | |
326 | SSRCS=${MD_SFILES} ${SFILES} | 327 | SSRCS=${MD_SFILES} ${SFILES} | |
327 | CSRCS=${MD_CFILES} ${MI_CFILES} ${CFILES} | 328 | CSRCS=${MD_CFILES} ${MI_CFILES} ${CFILES} | |
328 | SRCS=${SSRCS} ${CSRCS} | 329 | SRCS=${SSRCS} ${CSRCS} | |
329 | DEPS= ${SRCS:T:O:u:R:S/$/.d/g} | 330 | DEPS= ${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 | |||
344 | assym.d: assym.h | 345 | assym.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 | |||
352 | DEPS+= assym.d | 353 | DEPS+= 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) | |
360 | ALLSFILES?= ${MD_SFILES} ${SFILES} | 361 | ALLSFILES?= ${MD_SFILES} ${SFILES} | |
361 | LINTSTUBS?= ${ALLSFILES:T:R:C/^.*$/LintStub_&.c/g} | 362 | LINTSTUBS?= ${ALLSFILES:T:R:C/^.*$/LintStub_&.c/g} | |
362 | KERNLINTFLAGS?= -bcehnxzFS | 363 | KERNLINTFLAGS?= -bcehnxzFS | |
363 | NORMAL_LN?= ${LINT} ${KERNLINTFLAGS} ${CPPFLAGS:M-[IDU]*} -i $< | 364 | NORMAL_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} | |
366 | LOBJS?= ${_lsrc:T:S/.c$/.ln/g} ${LIBKERNLN} ${SYSLIBCOMPATLN} | 367 | LOBJS?= ${_lsrc:T:S/.c$/.ln/g} ${LIBKERNLN} ${SYSLIBCOMPATLN} | |
367 | 368 | |||
368 | .for _sfile in ${ALLSFILES} | 369 | .for _sfile in ${ALLSFILES} | |
369 | LintStub_${_sfile:T:R}.c: ${_sfile} assym.h | 370 | LintStub_${_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 | |||
381 | lint: ${LOBJS} | 382 | lint: ${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. | |
388 | syntax-only: ${CFILES} ${MD_CFILES} | 389 | syntax-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. | |
395 | KERNIMAGES?= netbsd | 396 | KERNIMAGES?= 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 | |
400 | MACHINE_NAME!= uname -n | 401 | MACHINE_NAME!= uname -n | |
401 | install: install-kernel-${MACHINE_NAME} | 402 | install: install-kernel-${MACHINE_NAME} | |
402 | .if !target(install-kernel-${MACHINE_NAME}) | 403 | .if !target(install-kernel-${MACHINE_NAME}) | |
403 | install-kernel-${MACHINE_NAME}: | 404 | install-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) | |
414 | tags: | 415 | tags: | |
415 | @echo "see $S/kern/Makefile for tags" | 416 | @echo "see $S/kern/Makefile for tags" | |
416 | .endif | 417 | .endif | |
417 | 418 | |||
418 | EXTRA_CLEAN+= cscope.out cscope.tmp | 419 | EXTRA_CLEAN+= cscope.out cscope.tmp | |
419 | .if !target(cscope.out) | 420 | .if !target(cscope.out) | |
420 | cscope.out: Makefile depend | 421 | cscope.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) | |
438 | cscope: cscope.out | 439 | cscope: cscope.out | |
439 | @${CSCOPE} -d | 440 | @${CSCOPE} -d | |
440 | .endif | 441 | .endif | |
441 | 442 | |||
442 | EXTRA_CLEAN+= ID | 443 | EXTRA_CLEAN+= ID | |
443 | .if !target(mkid) | 444 | .if !target(mkid) | |
444 | .PHONY: mkid | 445 | .PHONY: mkid | |
445 | mkid: ID | 446 | mkid: ID | |
446 | 447 | |||
447 | ID: Makefile depend | 448 | ID: 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 | |||
464 | EXTRA_CLEAN+= .gdbinit | 465 | EXTRA_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. | |
479 | VARSTACK=dev/cgd.c kern/uipc_socket.c miscfs/genfs/genfs_vnops.c \ | 480 | VARSTACK=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} | |
486 | COPTS.${__varstack:T} += -Wno-stack-protector | 487 | COPTS.${__varstack:T} += -Wno-stack-protector | |
487 | .endfor | 488 | .endfor | |
488 | .endif | 489 | .endif | |
489 | 490 | |||
490 | AFLAGS+= ${AOPTS.${.IMPSRC:T}} | 491 | AFLAGS+= ${AOPTS.${.IMPSRC:T}} | |
491 | CFLAGS+= ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} | 492 | CFLAGS+= ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} | |
492 | CPPFLAGS+= ${CPPFLAGS.${.IMPSRC:T}} | 493 | CPPFLAGS+= ${CPPFLAGS.${.IMPSRC:T}} | |
493 | CWARNFLAGS+= ${CWARNFLAGS.${.IMPSRC:T}} | 494 | CWARNFLAGS+= ${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 | ## |
--- 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 | |||
5 | version 20080610 | 5 | version 20080610 | |
6 | 6 | |||
7 | # | 7 | # | |
8 | # device classes | 8 | # device classes | |
9 | # | 9 | # | |
10 | devclass disk | 10 | devclass disk | |
11 | devclass tape | 11 | devclass tape | |
12 | devclass ifnet | 12 | devclass ifnet | |
13 | devclass tty | 13 | devclass tty | |
14 | devclass audiodev | 14 | devclass audiodev | |
15 | devclass displaydev | 15 | devclass displaydev | |
16 | devclass bus | 16 | devclass 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 | # | |
21 | defflag INSECURE | 21 | defflag INSECURE | |
22 | defflag KMEMSTATS | 22 | defflag KMEMSTATS | |
23 | defflag KTRACE | 23 | defflag KTRACE | |
24 | defflag MBUFTRACE | 24 | defflag MBUFTRACE | |
25 | defflag PTRACE | 25 | defflag PTRACE | |
26 | defflag COREDUMP | 26 | defflag COREDUMP | |
27 | defflag opt_modular.h MODULAR | 27 | defflag opt_modular.h MODULAR | |
28 | 28 | |||
29 | defparam DEFCORENAME | 29 | defparam DEFCORENAME | |
30 | defparam HZ | 30 | defparam HZ | |
31 | defparam MAXUPRC | 31 | defparam MAXUPRC | |
32 | defparam RTC_OFFSET | 32 | defparam RTC_OFFSET | |
33 | defflag opt_pipe.h PIPE_SOCKETPAIR PIPE_NODIRECT | 33 | defflag opt_pipe.h PIPE_SOCKETPAIR PIPE_NODIRECT | |
34 | 34 | |||
35 | defflag BUFQ_DISKSORT | 35 | defflag BUFQ_DISKSORT | |
36 | defflag BUFQ_FCFS | 36 | defflag BUFQ_FCFS | |
37 | defflag BUFQ_PRIOCSCAN | 37 | defflag BUFQ_PRIOCSCAN | |
38 | defflag BUFQ_READPRIO | 38 | defflag BUFQ_READPRIO | |
39 | defflag NEW_BUFQ_STRATEGY # same as BUFQ_READPRIO | 39 | defflag NEW_BUFQ_STRATEGY # same as BUFQ_READPRIO | |
40 | 40 | |||
41 | defflag opt_sched.h SCHED_4BSD | 41 | defflag opt_sched.h SCHED_4BSD | |
42 | defflag opt_sched.h SCHED_M2 | 42 | defflag opt_sched.h SCHED_M2 | |
43 | 43 | |||
44 | defparam SOMAXKVA | 44 | defparam SOMAXKVA | |
45 | defflag opt_sock_counters.h SOSEND_COUNTERS | 45 | defflag opt_sock_counters.h SOSEND_COUNTERS | |
46 | defflag opt_sosend_loan.h SOSEND_NO_LOAN | 46 | defflag opt_sosend_loan.h SOSEND_NO_LOAN | |
47 | defflag opt_route.h RTCACHE_DEBUG RTFLUSH_DEBUG | 47 | defflag opt_route.h RTCACHE_DEBUG RTFLUSH_DEBUG | |
48 | 48 | |||
49 | defflag MULTIPROCESSOR | 49 | defflag MULTIPROCESSOR | |
50 | 50 | |||
51 | defflag opt_config.h INCLUDE_CONFIG_FILE INCLUDE_JUST_CONFIG | 51 | defflag opt_config.h INCLUDE_CONFIG_FILE INCLUDE_JUST_CONFIG | |
52 | 52 | |||
53 | defparam opt_dump.h DUMP_ON_PANIC | 53 | defparam opt_dump.h DUMP_ON_PANIC | |
54 | 54 | |||
55 | defflag opt_callout.h CALLWHEEL_STATS | 55 | defflag opt_callout.h CALLWHEEL_STATS | |
56 | 56 | |||
57 | defflag CPU_IN_CKSUM | 57 | defflag CPU_IN_CKSUM | |
58 | 58 | |||
59 | defflag opt_posix.h P1003_1B_SEMAPHORE | 59 | defflag opt_posix.h P1003_1B_SEMAPHORE | |
60 | defflag opt_sysv.h SYSVMSG SYSVSEM SYSVSHM | 60 | defflag opt_sysv.h SYSVMSG SYSVSEM SYSVSHM | |
61 | defparam opt_sysvparam.h SHMMAXPGS SEMMNI SEMMNS SEMUME SEMMNU | 61 | defparam opt_sysvparam.h SHMMAXPGS SEMMNI SEMMNS SEMUME SEMMNU | |
62 | 62 | |||
63 | defflag opt_ntp.h PPS_SYNC NTP | 63 | defflag opt_ntp.h PPS_SYNC NTP | |
64 | 64 | |||
65 | defflag opt_ptm.h NO_DEV_PTM COMPAT_BSDPTY | 65 | defflag opt_ptm.h NO_DEV_PTM COMPAT_BSDPTY | |
66 | 66 | |||
67 | defparam opt_kmempages.h NKMEMPAGES NKMEMPAGES_MIN NKMEMPAGES_MAX | 67 | defparam opt_kmempages.h NKMEMPAGES NKMEMPAGES_MIN NKMEMPAGES_MAX | |
68 | defflag opt_malloclog.h MALLOCLOG | 68 | defflag opt_malloclog.h MALLOCLOG | |
69 | defparam opt_malloclog.h MALLOCLOGSIZE | 69 | defparam opt_malloclog.h MALLOCLOGSIZE | |
70 | defflag opt_malloc_debug.h MALLOC_DEBUG | 70 | defflag opt_malloc_debug.h MALLOC_DEBUG | |
71 | defflag opt_pool.h POOL_DIAGNOSTIC | 71 | defflag opt_pool.h POOL_DIAGNOSTIC | |
72 | defparam opt_poollog.h POOL_LOGSIZE | 72 | defparam opt_poollog.h POOL_LOGSIZE | |
73 | defflag opt_powerhook.h POWERHOOK_DEBUG | 73 | defflag opt_powerhook.h POWERHOOK_DEBUG | |
74 | 74 | |||
75 | defflag opt_revcache.h NAMECACHE_ENTER_REVERSE | 75 | defflag opt_revcache.h NAMECACHE_ENTER_REVERSE | |
76 | 76 | |||
77 | defflag opt_execfmt.h EXEC_AOUT EXEC_COFF EXEC_ECOFF EXEC_ELF32 | 77 | defflag 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 | |||
81 | defflag opt_dkwedge.h DKWEDGE_AUTODISCOVER | 81 | defflag 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 | |||
86 | defflag opt_veriexec.h VERIFIED_EXEC_FP_SHA1 | 86 | defflag 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 | |
94 | defflag opt_syscall_stats.h SYSCALL_STATS | 94 | defflag opt_syscall_stats.h SYSCALL_STATS | |
95 | defflag opt_syscall_stats.h SYSCALL_TIMES: SYSCALL_STATS | 95 | defflag 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) | |
97 | defflag opt_syscall_stats.h SYSCALL_TIMES_HASCOUNTER: SYSCALL_TIMES | 97 | defflag opt_syscall_stats.h SYSCALL_TIMES_HASCOUNTER: SYSCALL_TIMES | |
98 | file kern/subr_syscall_stats.c syscall_stats | 98 | file kern/subr_syscall_stats.c syscall_stats | |
99 | 99 | |||
100 | defparam opt_pax.h PAX_MPROTECT | 100 | defparam 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 | |||
109 | defflag opt_fileassoc.h FILEASSOC | 109 | defflag opt_fileassoc.h FILEASSOC | |
110 | 110 | |||
111 | defflag opt_gre.h GRE_DEBUG | 111 | defflag opt_gre.h GRE_DEBUG | |
112 | 112 | |||
113 | # Write Ahead Physical Block Logging | 113 | # Write Ahead Physical Block Logging | |
114 | defflag opt_wapbl.h WAPBL WAPBL_DEBUG | 114 | defflag opt_wapbl.h WAPBL WAPBL_DEBUG | |
115 | defparam opt_wapbl.h WAPBL_DEBUG_PRINT | 115 | defparam opt_wapbl.h WAPBL_DEBUG_PRINT | |
116 | 116 | |||
117 | # compatibility options | 117 | # compatibility options | |
118 | # | 118 | # | |
119 | defflag opt_sa.h KERN_SA | 119 | defflag opt_sa.h KERN_SA | |
120 | defflag opt_compat_netbsd.h COMPAT_40: KERN_SA | 120 | defflag opt_compat_netbsd.h COMPAT_40: KERN_SA | |
121 | defflag opt_compat_netbsd.h COMPAT_30: COMPAT_40 | 121 | defflag opt_compat_netbsd.h COMPAT_30: COMPAT_40 | |
122 | defflag opt_compat_netbsd.h COMPAT_20: COMPAT_30 | 122 | defflag opt_compat_netbsd.h COMPAT_20: COMPAT_30 | |
123 | defflag opt_compat_netbsd.h COMPAT_16: COMPAT_20 | 123 | defflag opt_compat_netbsd.h COMPAT_16: COMPAT_20 | |
124 | defflag opt_compat_netbsd.h COMPAT_15: COMPAT_16 | 124 | defflag opt_compat_netbsd.h COMPAT_15: COMPAT_16 | |
125 | defflag opt_compat_netbsd.h COMPAT_14: COMPAT_15 | 125 | defflag opt_compat_netbsd.h COMPAT_14: COMPAT_15 | |
126 | defflag opt_compat_netbsd.h COMPAT_13: COMPAT_14 | 126 | defflag opt_compat_netbsd.h COMPAT_13: COMPAT_14 | |
127 | defflag opt_compat_netbsd.h COMPAT_12: COMPAT_13 | 127 | defflag opt_compat_netbsd.h COMPAT_12: COMPAT_13 | |
128 | defflag opt_compat_netbsd.h COMPAT_11: COMPAT_12 | 128 | defflag opt_compat_netbsd.h COMPAT_11: COMPAT_12 | |
129 | defflag opt_compat_netbsd.h COMPAT_10: COMPAT_11 | 129 | defflag opt_compat_netbsd.h COMPAT_10: COMPAT_11 | |
130 | defflag opt_compat_netbsd.h COMPAT_09: COMPAT_10 | 130 | defflag opt_compat_netbsd.h COMPAT_09: COMPAT_10 | |
131 | defflag COMPAT_OSSAUDIO | 131 | defflag COMPAT_OSSAUDIO | |
132 | defflag COMPAT_FREEBSD: COMPAT_30 | 132 | defflag COMPAT_FREEBSD: COMPAT_30 | |
133 | defflag COMPAT_IBCS2 | 133 | defflag COMPAT_IBCS2 | |
134 | defflag COMPAT_IRIX | 134 | defflag COMPAT_IRIX | |
135 | defflag COMPAT_LINUX | 135 | defflag COMPAT_LINUX | |
136 | defflag COMPAT_LINUX32 | 136 | defflag COMPAT_LINUX32 | |
137 | defflag COMPAT_OSF1 | 137 | defflag COMPAT_OSF1 | |
138 | defflag COMPAT_SUNOS: COMPAT_30 | 138 | defflag COMPAT_SUNOS: COMPAT_30 | |
139 | defflag opt_compat_svr4.h COMPAT_SVR4 COMPAT_SVR4_32 SVR4_COMPAT_SOLARIS2 | 139 | defflag opt_compat_svr4.h COMPAT_SVR4 COMPAT_SVR4_32 SVR4_COMPAT_SOLARIS2 | |
140 | defflag COMPAT_ULTRIX | 140 | defflag COMPAT_ULTRIX | |
141 | defflag COMPAT_NETBSD32 | 141 | defflag COMPAT_NETBSD32 | |
142 | defflag COMPAT_AOUT_M68K: COMPAT_40 | 142 | defflag COMPAT_AOUT_M68K: COMPAT_40 | |
143 | defflag COMPAT_M68K4K | 143 | defflag COMPAT_M68K4K | |
144 | defflag COMPAT_MACH | 144 | defflag COMPAT_MACH | |
145 | defflag COMPAT_DARWIN | 145 | defflag COMPAT_DARWIN | |
146 | defflag COMPAT_VAX1K | 146 | defflag COMPAT_VAX1K | |
147 | defflag COMPAT_43 | 147 | defflag COMPAT_43 | |
148 | defflag COMPAT_PECOFF | 148 | defflag COMPAT_PECOFF | |
149 | defflag opt_compat_netbsd.h COMPAT_NOMID | 149 | defflag 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 | |
156 | include "crypto/arc4/files.arc4" | 156 | include "crypto/arc4/files.arc4" | |
157 | include "crypto/des/files.des" | 157 | include "crypto/des/files.des" | |
158 | include "crypto/blowfish/files.blowfish" | 158 | include "crypto/blowfish/files.blowfish" | |
159 | include "crypto/cast128/files.cast128" | 159 | include "crypto/cast128/files.cast128" | |
160 | include "crypto/rijndael/files.rijndael" | 160 | include "crypto/rijndael/files.rijndael" | |
161 | include "crypto/skipjack/files.skipjack" | 161 | include "crypto/skipjack/files.skipjack" | |
162 | 162 | |||
163 | # General-purpose crypto processing framework. | 163 | # General-purpose crypto processing framework. | |
164 | include "opencrypto/files.opencrypto" | 164 | include "opencrypto/files.opencrypto" | |
165 | 165 | |||
166 | # | 166 | # | |
167 | # System monitoring framework | 167 | # System monitoring framework | |
168 | # | 168 | # | |
169 | include "dev/sysmon/files.sysmon" | 169 | include "dev/sysmon/files.sysmon" | |
170 | 170 | |||
171 | # | 171 | # | |
172 | # Networking protocols | 172 | # Networking protocols | |
173 | # | 173 | # | |
174 | include "net80211/files.net80211" | 174 | include "net80211/files.net80211" | |
175 | include "netatalk/files.netatalk" | 175 | include "netatalk/files.netatalk" | |
176 | include "netbt/files.netbt" | 176 | include "netbt/files.netbt" | |
177 | include "netinet/files.netinet" | 177 | include "netinet/files.netinet" | |
178 | include "netinet/files.ipfilter" | 178 | include "netinet/files.ipfilter" | |
179 | include "netinet6/files.netinet6" | 179 | include "netinet6/files.netinet6" | |
180 | include "netinet6/files.ipsec" | 180 | include "netinet6/files.ipsec" | |
181 | include "netipsec/files.netipsec" | 181 | include "netipsec/files.netipsec" | |
182 | include "netiso/files.netiso" | 182 | include "netiso/files.netiso" | |
183 | include "netnatm/files.netnatm" | 183 | include "netnatm/files.netnatm" | |
184 | include "netsmb/files.netsmb" | 184 | include "netsmb/files.netsmb" | |
185 | include "net/files.pf" | 185 | include "net/files.pf" | |
186 | 186 | |||
187 | obsolete defflag CCITT # obsolete | 187 | obsolete defflag CCITT # obsolete | |
188 | obsolete defflag HDLC # obsolete | 188 | obsolete defflag HDLC # obsolete | |
189 | obsolete defflag LLC # obsolete | 189 | obsolete defflag LLC # obsolete | |
190 | obsolete defflag opt_ns.h NS NSIP # obsolete | 190 | obsolete defflag opt_ns.h NS NSIP # obsolete | |
191 | obsolete defflag IPX # obsolete | 191 | obsolete defflag IPX # obsolete | |
192 | obsolete defflag opt_iso.h TPCONS | 192 | obsolete defflag opt_iso.h TPCONS | |
193 | defflag PFIL_HOOKS # pfil(9) | 193 | defflag PFIL_HOOKS # pfil(9) | |
194 | defflag opt_bridge_ipf.h BRIDGE_IPF # bridge(4) use inet_pfil_hooks | 194 | defflag opt_bridge_ipf.h BRIDGE_IPF # bridge(4) use inet_pfil_hooks | |
195 | defflag opt_ppp.h PPP_DEFLATE PPP_BSDCOMP PPP_FILTER | 195 | defflag 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 | |
199 | defflag opt_pppoe.h PPPOE_SERVER PPPOE_TERM_UNKNOWN_SESSIONS | 199 | defflag opt_pppoe.h PPPOE_SERVER PPPOE_TERM_UNKNOWN_SESSIONS | |
200 | 200 | |||
201 | # networking options | 201 | # networking options | |
202 | # | 202 | # | |
203 | defflag GATEWAY | 203 | defflag GATEWAY | |
204 | defparam opt_nmbclusters.h NMBCLUSTERS | 204 | defparam opt_nmbclusters.h NMBCLUSTERS | |
205 | defparam SB_MAX | 205 | defparam SB_MAX | |
206 | 206 | |||
207 | # file system options | 207 | # file system options | |
208 | # | 208 | # | |
209 | defflag SOFTDEP # XXX files.ufs? | 209 | defflag SOFTDEP # XXX files.ufs? | |
210 | defflag QUOTA # XXX files.ufs? | 210 | defflag QUOTA # XXX files.ufs? | |
211 | defflag VNODE_LOCKDEBUG | 211 | defflag VNODE_LOCKDEBUG | |
212 | defflag MAGICLINKS | 212 | defflag MAGICLINKS | |
213 | 213 | |||
214 | # buffer cache size options | 214 | # buffer cache size options | |
215 | # | 215 | # | |
216 | defparam opt_bufcache.h BUFCACHE BUFPAGES | 216 | defparam opt_bufcache.h BUFCACHE BUFPAGES | |
217 | 217 | |||
218 | # userconf | 218 | # userconf | |
219 | # | 219 | # | |
220 | defflag USERCONF | 220 | defflag USERCONF | |
221 | 221 | |||
222 | # sysctl related | 222 | # sysctl related | |
223 | # | 223 | # | |
224 | defflag opt_sysctl.h SYSCTL_DISALLOW_CREATE SYSCTL_DISALLOW_KWRITE | 224 | defflag 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 | # | |
234 | defflag opt_mbr.h COMPAT_386BSD_MBRPART | 234 | defflag opt_mbr.h COMPAT_386BSD_MBRPART | |
235 | 235 | |||
236 | # | 236 | # | |
237 | # debugging options | 237 | # debugging options | |
238 | # | 238 | # | |
239 | include "ddb/files.ddb" # in-kernel dynamic debugger | 239 | include "ddb/files.ddb" # in-kernel dynamic debugger | |
240 | 240 | |||
241 | defflag opt_kgdb.h KGDB | 241 | defflag opt_kgdb.h KGDB | |
242 | defparam opt_kgdb.h KGDB_DEV KGDB_DEVNAME KGDB_DEVPORT | 242 | defparam opt_kgdb.h KGDB_DEV KGDB_DEVNAME KGDB_DEVPORT | |
243 | KGDB_DEVADDR KGDB_DEVRATE KGDB_DEVMODE | 243 | KGDB_DEVADDR KGDB_DEVRATE KGDB_DEVMODE | |
244 | defflag LOCKDEBUG | 244 | defflag LOCKDEBUG | |
245 | defflag SYSCALL_DEBUG | 245 | defflag SYSCALL_DEBUG | |
246 | defflag opt_kstack.h KSTACK_CHECK_MAGIC | 246 | defflag opt_kstack.h KSTACK_CHECK_MAGIC | |
247 | 247 | |||
248 | # memory (ram) disk options | 248 | # memory (ram) disk options | |
249 | # | 249 | # | |
250 | defflag opt_md.h MEMORY_DISK_HOOKS MEMORY_DISK_IS_ROOT | 250 | defflag opt_md.h MEMORY_DISK_HOOKS MEMORY_DISK_IS_ROOT | |
251 | MEMORY_DISK_DYNAMIC | 251 | MEMORY_DISK_DYNAMIC | |
252 | defparam opt_md.h MEMORY_DISK_SERVER=1 MEMORY_DISK_ROOT_SIZE | 252 | defparam opt_md.h MEMORY_DISK_SERVER=1 MEMORY_DISK_ROOT_SIZE | |
253 | MEMORY_RBFLAGS | 253 | MEMORY_RBFLAGS | |
254 | 254 | |||
255 | defflag opt_tftproot.h TFTPROOT TFTPROOT_DEBUG | 255 | defflag opt_tftproot.h TFTPROOT TFTPROOT_DEBUG | |
256 | 256 | |||
257 | # Support for hardware performance monitoring counters | 257 | # Support for hardware performance monitoring counters | |
258 | # | 258 | # | |
259 | defflag opt_perfctrs.h PERFCTRS | 259 | defflag opt_perfctrs.h PERFCTRS | |
260 | 260 | |||
261 | # Machine-independent device majors assignements | 261 | # Machine-independent device majors assignements | |
262 | include "conf/majors" | 262 | include "conf/majors" | |
263 | 263 | |||
264 | # generic attributes | 264 | # generic attributes | |
265 | # | 265 | # | |
266 | define audiobus { } | 266 | define audiobus { } | |
267 | define midibus { } | 267 | define midibus { } | |
268 | define midisyn | 268 | define midisyn | |
269 | define videobus { } | 269 | define videobus { } | |
270 | define ata {[channel = -1]} | 270 | define ata {[channel = -1]} | |
271 | define sata | 271 | define sata | |
272 | define scsi_core | 272 | define scsi_core | |
273 | define scsi {[channel = -1]}: scsi_core | 273 | define scsi {[channel = -1]}: scsi_core | |
274 | define ata_hl {[drive = -1]} | 274 | define ata_hl {[drive = -1]} | |
275 | define atapi { } | 275 | define atapi { } | |
276 | define radiodev { } | 276 | define radiodev { } | |
277 | define gpibdev {[address = -1]} | 277 | define gpibdev {[address = -1]} | |
278 | define gpiobus { } | 278 | define gpiobus { } | |
279 | define onewirebus { } | 279 | define onewirebus { } | |
280 | define pckbport {[slot = -1]} | 280 | define pckbport {[slot = -1]} | |
281 | define pckbport_machdep_cnattach | 281 | define pckbport_machdep_cnattach | |
282 | define firmload | 282 | define firmload | |
283 | 283 | |||
284 | # audio device attributes | 284 | # audio device attributes | |
285 | # | 285 | # | |
286 | define mulaw | 286 | define mulaw | |
287 | define auconv | 287 | define auconv | |
288 | define aurateconv | 288 | define 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 | # | |
292 | device audio: audiodev | 292 | device audio: audiodev | |
293 | attach audio at audiobus | 293 | attach audio at audiobus | |
294 | device midi | 294 | device midi | |
295 | attach midi at midibus | 295 | attach midi at midibus | |
296 | 296 | |||
297 | # console bell via audio device | 297 | # console bell via audio device | |
298 | # | 298 | # | |
299 | define audiobell | 299 | define audiobell | |
300 | 300 | |||
301 | # video devices, attaches to video hardware driver | 301 | # video devices, attaches to video hardware driver | |
302 | # | 302 | # | |
303 | device video | 303 | device video | |
304 | attach video at videobus | 304 | attach 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 | |||
310 | device lm: sysmon_envsys | 310 | device lm: sysmon_envsys | |
311 | file dev/ic/nslm7x.c lm needs-flag | 311 | file dev/ic/nslm7x.c lm needs-flag | |
312 | 312 | |||
313 | # I2C device support | 313 | # I2C device support | |
314 | include "dev/i2c/files.i2c" | 314 | include "dev/i2c/files.i2c" | |
315 | 315 | |||
316 | # SPI device support | 316 | # SPI device support | |
317 | include "dev/spi/files.spi" | 317 | include "dev/spi/files.spi" | |
318 | 318 | |||
319 | # IR device support | 319 | # IR device support | |
320 | include "dev/ir/files.ir" | 320 | include "dev/ir/files.ir" | |
321 | 321 | |||
322 | # Parallel Port Bus support | 322 | # Parallel Port Bus support | |
323 | include "dev/ppbus/files.ppbus" | 323 | include "dev/ppbus/files.ppbus" | |
324 | 324 | |||
325 | # raster operations attributes | 325 | # raster operations attributes | |
326 | # | 326 | # | |
327 | define rasops1 | 327 | define rasops1 | |
328 | define rasops2 | 328 | define rasops2 | |
329 | define rasops4 | 329 | define rasops4 | |
330 | define rasops8 | 330 | define rasops8 | |
331 | define rasops15 | 331 | define rasops15 | |
332 | define rasops16 | 332 | define rasops16 | |
333 | define rasops24 | 333 | define rasops24 | |
334 | define rasops32 | 334 | define rasops32 | |
335 | define rasops_rotation | 335 | define rasops_rotation | |
336 | 336 | |||
337 | # splash screen support | 337 | # splash screen support | |
338 | include "dev/splash/files.splash" | 338 | include "dev/splash/files.splash" | |
339 | 339 | |||
340 | # videomode support | 340 | # videomode support | |
341 | include "dev/videomode/files.videomode" | 341 | include "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 | # | |
346 | define arcnet | 346 | define arcnet | |
347 | define atm | 347 | define atm | |
348 | define eco | 348 | define eco | |
349 | define ether | 349 | define ether | |
350 | define fddi | 350 | define fddi | |
351 | define hippi | 351 | define hippi | |
352 | define ieee1394 | 352 | define ieee1394 | |
353 | define token | 353 | define token | |
354 | define sppp | 354 | define sppp | |
355 | define wlan: arc4, rijndael | 355 | define wlan: arc4, rijndael | |
356 | define crypto | 356 | define crypto | |
357 | 357 | |||
358 | # devices ARPing IPv4 pull this in: | 358 | # devices ARPing IPv4 pull this in: | |
359 | # | 359 | # | |
360 | define arp | 360 | define arp | |
361 | 361 | |||
362 | # | 362 | # | |
363 | # ALTQ network traffic shaping subsystem | 363 | # ALTQ network traffic shaping subsystem | |
364 | # | 364 | # | |
365 | include "altq/files.altq" | 365 | include "altq/files.altq" | |
366 | 366 | |||
367 | # | 367 | # | |
368 | # IPKDB kernel debugger | 368 | # IPKDB kernel debugger | |
369 | # | 369 | # | |
370 | include "ipkdb/files.ipkdb" | 370 | include "ipkdb/files.ipkdb" | |
371 | 371 | |||
372 | # Logical disk | 372 | # Logical disk | |
373 | # | 373 | # | |
374 | device ld: disk | 374 | device ld: disk | |
375 | file dev/ld.c ld needs-flag | 375 | file 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 | # | |
380 | include "dev/mii/files.mii" | 380 | include "dev/mii/files.mii" | |
381 | 381 | |||
382 | # | 382 | # | |
383 | # RAIDframe | 383 | # RAIDframe | |
384 | # | 384 | # | |
385 | include "dev/raidframe/files.raidframe" | 385 | include "dev/raidframe/files.raidframe" | |
386 | 386 | |||
387 | # | 387 | # | |
388 | # Hardware-assisted data mover API | 388 | # Hardware-assisted data mover API | |
389 | # | 389 | # | |
390 | include "dev/dmover/files.dmover" | 390 | include "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 | # | |
399 | device aic: scsi | 399 | device aic: scsi | |
400 | file dev/ic/aic6360.c aic | 400 | file dev/ic/aic6360.c aic | |
401 | 401 | |||
402 | # SMC 93Cx6 Serial EEPROM devices | 402 | # SMC 93Cx6 Serial EEPROM devices | |
403 | # | 403 | # | |
404 | define smc93cx6 | 404 | define smc93cx6 | |
405 | file dev/ic/smc93cx6.c smc93cx6 | 405 | file 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 | # | |
409 | defparam opt_ahc.h AHC_DEBUG | 409 | defparam opt_ahc.h AHC_DEBUG | |
410 | defflag opt_ahc.h AHC_NO_TAGS | 410 | defflag opt_ahc.h AHC_NO_TAGS | |
411 | device ahc: scsi | 411 | device ahc: scsi | |
412 | define ahc_seeprom | 412 | define ahc_seeprom | |
413 | define ahc_aic77xx | 413 | define ahc_aic77xx | |
414 | file dev/ic/aic7xxx.c ahc | 414 | file dev/ic/aic7xxx.c ahc | |
415 | file dev/ic/aic7xxx_osm.c ahc | 415 | file dev/ic/aic7xxx_osm.c ahc | |
416 | file dev/ic/aic7xxx_seeprom.c ahc_seeprom | 416 | file dev/ic/aic7xxx_seeprom.c ahc_seeprom | |
417 | file dev/ic/aic77xx.c ahc_aic77xx | 417 | file dev/ic/aic77xx.c ahc_aic77xx | |
418 | 418 | |||
419 | # Adaptec aic79xx SCSI controllers | 419 | # Adaptec aic79xx SCSI controllers | |
420 | defflag opt_ahd.h AHD_DEBUG | 420 | defflag opt_ahd.h AHD_DEBUG | |
421 | device ahd: scsi | 421 | device ahd: scsi | |
422 | file dev/ic/aic79xx.c ahd | 422 | file dev/ic/aic79xx.c ahd | |
423 | file dev/ic/aic79xx_osm.c ahd | 423 | file dev/ic/aic79xx_osm.c ahd | |
424 | 424 | |||
425 | # DPT EATA SCSI controllers | 425 | # DPT EATA SCSI controllers | |
426 | # | 426 | # | |
427 | device dpt: scsi | 427 | device dpt: scsi | |
428 | file dev/ic/dpt.c dpt | 428 | file dev/ic/dpt.c dpt | |
429 | 429 | |||
430 | # Compaq Smart ARRAY controllers | 430 | # Compaq Smart ARRAY controllers | |
431 | # | 431 | # | |
432 | device cac {unit = -1} | 432 | device cac {unit = -1} | |
433 | file dev/ic/cac.c cac | 433 | file dev/ic/cac.c cac | |
434 | 434 | |||
435 | attach ld at cac with ld_cac | 435 | attach ld at cac with ld_cac | |
436 | file dev/ic/ld_cac.c ld_cac | 436 | file 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 | # | |
440 | device ciss: scsi | 440 | device ciss: scsi | |
441 | file dev/ic/ciss.c ciss | 441 | file dev/ic/ciss.c ciss | |
442 | 442 | |||
443 | # Mylex DAC960 RAID controllers | 443 | # Mylex DAC960 RAID controllers | |
444 | # | 444 | # | |
445 | device mlx {unit = -1} | 445 | device mlx {unit = -1} | |
446 | file dev/ic/mlx.c mlx needs-flag | 446 | file dev/ic/mlx.c mlx needs-flag | |
447 | 447 | |||
448 | attach ld at mlx with ld_mlx | 448 | attach ld at mlx with ld_mlx | |
449 | file dev/ic/ld_mlx.c ld_mlx | 449 | file dev/ic/ld_mlx.c ld_mlx | |
450 | 450 | |||
451 | # ICP-Vortex/Intel RAID controllers | 451 | # ICP-Vortex/Intel RAID controllers | |
452 | # | 452 | # | |
453 | device icp {unit = -1} | 453 | device icp {unit = -1} | |
454 | file dev/ic/icp.c icp needs-flag | 454 | file dev/ic/icp.c icp needs-flag | |
455 | file dev/ic/icp_ioctl.c icp | 455 | file dev/ic/icp_ioctl.c icp | |
456 | 456 | |||
457 | attach ld at icp with ld_icp | 457 | attach ld at icp with ld_icp | |
458 | file dev/ic/ld_icp.c ld_icp | 458 | file dev/ic/ld_icp.c ld_icp | |
459 | 459 | |||
460 | device icpsp: scsi | 460 | device icpsp: scsi | |
461 | file dev/ic/icpsp.c icpsp | 461 | file dev/ic/icpsp.c icpsp | |
462 | attach icpsp at icp | 462 | attach icpsp at icp | |
463 | 463 | |||
464 | # Adaptec FSA RAID controllers | 464 | # Adaptec FSA RAID controllers | |
465 | # | 465 | # | |
466 | device aac {unit = -1} | 466 | device aac {unit = -1} | |
467 | file dev/ic/aac.c aac | 467 | file dev/ic/aac.c aac | |
468 | 468 | |||
469 | attach ld at aac with ld_aac | 469 | attach ld at aac with ld_aac | |
470 | file dev/ic/ld_aac.c ld_aac | 470 | file 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 | # | |
474 | device adv: scsi | 474 | device adv: scsi | |
475 | file dev/ic/adv.c adv | 475 | file dev/ic/adv.c adv | |
476 | file dev/ic/advlib.c adv | 476 | file dev/ic/advlib.c adv | |
477 | file dev/ic/advmcode.c adv | 477 | file dev/ic/advmcode.c adv | |
478 | 478 | |||
479 | # AdvanSys ULTRA WIDE SCSI controllers | 479 | # AdvanSys ULTRA WIDE SCSI controllers | |
480 | # | 480 | # | |
481 | device adw: scsi | 481 | device adw: scsi | |
482 | file dev/ic/adw.c adw | 482 | file 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 | # | |
489 | device bha: scsi | 489 | device bha: scsi | |
490 | file dev/ic/bha.c bha | 490 | file 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 | # | |
495 | device aha: scsi | 495 | device aha: scsi | |
496 | file dev/ic/aha.c aha | 496 | file dev/ic/aha.c aha | |
497 | 497 | |||
498 | # Initio INIC-940/950 SCSI controllers | 498 | # Initio INIC-940/950 SCSI controllers | |
499 | # | 499 | # | |
500 | device iha: scsi | 500 | device iha: scsi | |
501 | file dev/ic/iha.c iha | 501 | file dev/ic/iha.c iha | |
502 | 502 | |||
503 | # Qlogic ISP 10x0 SCSI Controllers | 503 | # Qlogic ISP 10x0 SCSI Controllers | |
504 | # | 504 | # | |
505 | defflag opt_isp.h ISP_DISABLE_1020_SUPPORT | 505 | defflag 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 | |
514 | defparam opt_isp.h ISP_LOGDEFAULT | 514 | defparam opt_isp.h ISP_LOGDEFAULT | |
515 | ISP_VPORTS | 515 | ISP_VPORTS | |
516 | device isp: scsi | 516 | device isp: scsi | |
517 | file dev/ic/isp.c isp | 517 | file dev/ic/isp.c isp | |
518 | file dev/ic/isp_library.c isp | 518 | file dev/ic/isp_library.c isp | |
519 | file dev/ic/isp_netbsd.c isp | 519 | file dev/ic/isp_netbsd.c isp | |
520 | file dev/ic/isp_target.c isp & isp_target_mode | 520 | file dev/ic/isp_target.c isp & isp_target_mode | |
521 | # LSILogic MegaRAID SAS | 521 | # LSILogic MegaRAID SAS | |
522 | # | 522 | # | |
523 | device mfi: scsi | 523 | device mfi: scsi | |
524 | file dev/ic/mfi.c mfi | 524 | file 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 | # | |
528 | device mpt: scsi | 528 | device mpt: scsi | |
529 | file dev/ic/mpt.c mpt | 529 | file dev/ic/mpt.c mpt | |
530 | file dev/ic/mpt_debug.c mpt | 530 | file dev/ic/mpt_debug.c mpt | |
531 | file dev/ic/mpt_netbsd.c mpt | 531 | file dev/ic/mpt_netbsd.c mpt | |
532 | 532 | |||
533 | # Workbit NinjaSCSI-32 controllers | 533 | # Workbit NinjaSCSI-32 controllers | |
534 | device njs: scsi | 534 | device njs: scsi | |
535 | file dev/ic/ninjascsi32.c njs | 535 | file dev/ic/ninjascsi32.c njs | |
536 | 536 | |||
537 | # Symbios/NCR 53c700 SCSI controllers | 537 | # Symbios/NCR 53c700 SCSI controllers | |
538 | device oosiop: scsi | 538 | device oosiop: scsi | |
539 | file dev/ic/oosiop.c oosiop | 539 | file dev/ic/oosiop.c oosiop | |
540 | 540 | |||
541 | # Symbios/NCR 53c710 SCSI controllers | 541 | # Symbios/NCR 53c710 SCSI controllers | |
542 | # | 542 | # | |
543 | device osiop: scsi | 543 | device osiop: scsi | |
544 | file dev/ic/osiop.c osiop | 544 | file dev/ic/osiop.c osiop | |
545 | 545 | |||
546 | # common stuff for siop and esiop | 546 | # common stuff for siop and esiop | |
547 | # | 547 | # | |
548 | define siop_common | 548 | define siop_common | |
549 | file dev/ic/siop_common.c siop_common | 549 | file 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 | # | |
553 | device siop: scsi,siop_common | 553 | device siop: scsi,siop_common | |
554 | file dev/ic/siop.c siop & (siop_pci | siop_gedoens) | 554 | file dev/ic/siop.c siop & (siop_pci | siop_gedoens) | |
555 | defflag opt_siop.h SIOP_SYMLED | 555 | defflag opt_siop.h SIOP_SYMLED | |
556 | 556 | |||
557 | device esiop: scsi,siop_common | 557 | device esiop: scsi,siop_common | |
558 | file dev/ic/esiop.c esiop | 558 | file dev/ic/esiop.c esiop | |
559 | 559 | |||
560 | # UltraStor SCSI controllers | 560 | # UltraStor SCSI controllers | |
561 | # | 561 | # | |
562 | device uha: scsi | 562 | device uha: scsi | |
563 | file dev/ic/uha.c uha | 563 | file dev/ic/uha.c uha | |
564 | 564 | |||
565 | # 3Com common probe code | 565 | # 3Com common probe code | |
566 | define elink | 566 | define elink | |
567 | file dev/isa/elink.c elink | 567 | file dev/isa/elink.c elink | |
568 | 568 | |||
569 | # Aironet PC4500/PC4800 | 569 | # Aironet PC4500/PC4800 | |
570 | # | 570 | # | |
571 | device an: arp, wlan, ifnet | 571 | device an: arp, wlan, ifnet | |
572 | file dev/ic/an.c an | 572 | file dev/ic/an.c an | |
573 | 573 | |||
574 | # AMD 79c930-based 802.11 cards | 574 | # AMD 79c930-based 802.11 cards | |
575 | # | 575 | # | |
576 | device awi: arp, wlan, ifnet | 576 | device awi: arp, wlan, ifnet | |
577 | file dev/ic/awi.c awi | 577 | file dev/ic/awi.c awi | |
578 | file dev/ic/am79c930.c awi | 578 | file dev/ic/am79c930.c awi | |
579 | 579 | |||
580 | # Lucent & Intersil WaveLan IEEE (802.11) | 580 | # Lucent & Intersil WaveLan IEEE (802.11) | |
581 | # | 581 | # | |
582 | device wi: arp, wlan, ifnet | 582 | device wi: arp, wlan, ifnet | |
583 | file dev/ic/wi.c wi | 583 | file 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 | # | |
587 | defflag opt_athhal.h ATHHAL_ASSERT ATHHAL_DEBUG ATHHAL_DEBUG_ALQ | 587 | defflag opt_athhal.h ATHHAL_ASSERT ATHHAL_DEBUG ATHHAL_DEBUG_ALQ | |
588 | device ath: arp, wlan, ifnet | 588 | device ath: arp, wlan, ifnet | |
589 | file dev/ic/ath.c ath | 589 | file dev/ic/ath.c ath | |
590 | file dev/ic/ath_netbsd.c ath | 590 | file dev/ic/ath_netbsd.c ath | |
591 | file dev/ic/athrate-sample.c ath | 591 | file dev/ic/athrate-sample.c ath | |
592 | file contrib/dev/ath/netbsd/ah_osdep.c ath | 592 | file contrib/dev/ath/netbsd/ah_osdep.c ath | |
593 | object /athhal.o ath | 593 | object /athhal.o ath | |
594 | 594 | |||
595 | # ADMtek ADM8211 802.11 | 595 | # ADMtek ADM8211 802.11 | |
596 | # | 596 | # | |
597 | device atw: arp, wlan, ifnet, smc93cx6 | 597 | device atw: arp, wlan, ifnet, smc93cx6 | |
598 | file dev/ic/atw.c atw | 598 | file dev/ic/atw.c atw | |
599 | 599 | |||
600 | # Realtek RTL8180 802.11 | 600 | # Realtek RTL8180 802.11 | |
601 | # | 601 | # | |
602 | device rtw: arp, wlan, ifnet, smc93cx6 | 602 | device rtw: arp, wlan, ifnet, smc93cx6 | |
603 | file dev/ic/rtw.c rtw | 603 | file dev/ic/rtw.c rtw | |
604 | file dev/ic/rtwphy.c rtw | 604 | file dev/ic/rtwphy.c rtw | |
605 | file dev/ic/rtwphyio.c rtw | 605 | file dev/ic/rtwphyio.c rtw | |
606 | 606 | |||
607 | # Ralink RT2500/RT2600 802.11 | 607 | # Ralink RT2500/RT2600 802.11 | |
608 | device ral: arp, ether, ifnet, wlan, firmload | 608 | device ral: arp, ether, ifnet, wlan, firmload | |
609 | file dev/ic/rt2560.c ral | 609 | file dev/ic/rt2560.c ral | |
610 | file dev/ic/rt2661.c ral | 610 | file dev/ic/rt2661.c ral | |
611 | 611 | |||
612 | # 3Com Etherlink-III Ethernet controller | 612 | # 3Com Etherlink-III Ethernet controller | |
613 | # | 613 | # | |
614 | device ep: arp, ether, ifnet, mii, mii_bitbang | 614 | device ep: arp, ether, ifnet, mii, mii_bitbang | |
615 | file dev/ic/elink3.c ep | 615 | file dev/ic/elink3.c ep | |
616 | 616 | |||
617 | # 3Com EtherLink XL Controller | 617 | # 3Com EtherLink XL Controller | |
618 | # | 618 | # | |
619 | device ex: arp, ether, ifnet, mii, mii_bitbang | 619 | device ex: arp, ether, ifnet, mii, mii_bitbang | |
620 | file dev/ic/elinkxl.c ex | 620 | file dev/ic/elinkxl.c ex | |
621 | 621 | |||
622 | # DEC EtherWORKS III (LEMAC) Ethernet controllers | 622 | # DEC EtherWORKS III (LEMAC) Ethernet controllers | |
623 | # | 623 | # | |
624 | device lc: arp, ether, ifnet | 624 | device lc: arp, ether, ifnet | |
625 | file dev/ic/lemac.c lc | 625 | file dev/ic/lemac.c lc | |
626 | 626 | |||
627 | # LANCE and PCnet Ethernet controllers | 627 | # LANCE and PCnet Ethernet controllers | |
628 | # | 628 | # | |
629 | device le: arp, ether, ifnet | 629 | device le: arp, ether, ifnet | |
630 | define le24 | 630 | define le24 | |
631 | define le32 | 631 | define le32 | |
632 | file dev/ic/am7990.c le24 | 632 | file dev/ic/am7990.c le24 | |
633 | file dev/ic/am79900.c le32 | 633 | file dev/ic/am79900.c le32 | |
634 | file dev/ic/lance.c le24 | le32 | 634 | file 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 | # | |
638 | device depca { }: le24 | 638 | device depca { }: le24 | |
639 | file dev/ic/depca.c depca | 639 | file dev/ic/depca.c depca | |
640 | attach le at depca with le_depca | 640 | attach le at depca with le_depca | |
641 | 641 | |||
642 | # Sun HME Ethernet controllers | 642 | # Sun HME Ethernet controllers | |
643 | # | 643 | # | |
644 | device hme: arp, ether, ifnet, mii | 644 | device hme: arp, ether, ifnet, mii | |
645 | file dev/ic/hme.c hme | 645 | file dev/ic/hme.c hme | |
646 | 646 | |||
647 | # Sun GEM Ethernet controllers | 647 | # Sun GEM Ethernet controllers | |
648 | # | 648 | # | |
649 | device gem: arp, ether, ifnet, mii | 649 | device gem: arp, ether, ifnet, mii | |
650 | file dev/ic/gem.c gem | 650 | file dev/ic/gem.c gem | |
651 | 651 | |||
652 | # 8390-family Ethernet controllers | 652 | # 8390-family Ethernet controllers | |
653 | # | 653 | # | |
654 | defflag opt_ipkdb.h IPKDB_DP8390 | 654 | defflag opt_ipkdb.h IPKDB_DP8390 | |
655 | define dp8390nic | 655 | define dp8390nic | |
656 | file dev/ic/dp8390.c dp8390nic | ipkdb_dp8390 | 656 | file 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 | # | |
660 | define dp83905 | 660 | define dp83905 | |
661 | file dev/ic/dp83905.c dp83905 | 661 | file 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 | # | |
666 | define mx98905 | 666 | define mx98905 | |
667 | file dev/ic/mx98905.c mx98905 | 667 | file dev/ic/mx98905.c mx98905 | |
668 | 668 | |||
669 | # TROPIC Token-Ring controller | 669 | # TROPIC Token-Ring controller | |
670 | # | 670 | # | |
671 | device tr: arp, token, ifnet | 671 | device tr: arp, token, ifnet | |
672 | file dev/ic/tropic.c tr | 672 | file dev/ic/tropic.c tr | |
673 | 673 | |||
674 | # NCR 5380 SCSI Bus Controller | 674 | # NCR 5380 SCSI Bus Controller | |
675 | # | 675 | # | |
676 | define ncr5380sbc | 676 | define ncr5380sbc | |
677 | file dev/ic/ncr5380sbc.c ncr5380sbc | 677 | file dev/ic/ncr5380sbc.c ncr5380sbc | |
678 | device nca: scsi, ncr5380sbc | 678 | device nca: scsi, ncr5380sbc | |
679 | 679 | |||
680 | # Sun sc PAL SCSI Bus Controller | 680 | # Sun sc PAL SCSI Bus Controller | |
681 | # | 681 | # | |
682 | define sunscpal | 682 | define sunscpal | |
683 | file dev/ic/sunscpal.c sunscpal | 683 | file dev/ic/sunscpal.c sunscpal | |
684 | device ssc: scsi, sunscpal | 684 | device ssc: scsi, sunscpal | |
685 | 685 | |||
686 | # DEC FDDI Chipset | 686 | # DEC FDDI Chipset | |
687 | # | 687 | # | |
688 | define pdq | 688 | define pdq | |
689 | file dev/ic/pdq.c pdq | 689 | file dev/ic/pdq.c pdq | |
690 | file dev/ic/pdq_ifsubr.c pdq | 690 | file dev/ic/pdq_ifsubr.c pdq | |
691 | 691 | |||
692 | # Cyclades Cyclom-8/16/32 | 692 | # Cyclades Cyclom-8/16/32 | |
693 | # | 693 | # | |
694 | device cy: tty | 694 | device cy: tty | |
695 | file dev/ic/cy.c cy needs-flag | 695 | file dev/ic/cy.c cy needs-flag | |
696 | 696 | |||
697 | # Efficient Networks, Inc. ATM interface | 697 | # Efficient Networks, Inc. ATM interface | |
698 | # | 698 | # | |
699 | device en: atm, ifnet | 699 | device en: atm, ifnet | |
700 | file dev/ic/midway.c en | 700 | file 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 | # | |
704 | define ncr53c9x | 704 | define ncr53c9x | |
705 | device esp: scsi, ncr53c9x | 705 | device esp: scsi, ncr53c9x | |
706 | file dev/ic/ncr53c9x.c ncr53c9x | 706 | file dev/ic/ncr53c9x.c ncr53c9x | |
707 | 707 | |||
708 | # Fujitsu MB87030/MB89352 SCSI Protocol Controller | 708 | # Fujitsu MB87030/MB89352 SCSI Protocol Controller | |
709 | device spc: scsi | 709 | device spc: scsi | |
710 | file dev/ic/mb89352.c spc | 710 | file 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 | |
713 | define wd33c93 | 713 | define wd33c93 | |
714 | file dev/ic/wd33c93.c wd33c93 | 714 | file dev/ic/wd33c93.c wd33c93 | |
715 | 715 | |||
716 | # Hitachi HD44780 LCD panel controller | 716 | # Hitachi HD44780 LCD panel controller | |
717 | define hd44780 | 717 | define hd44780 | |
718 | file dev/ic/hd44780_subr.c hd44780 | 718 | file dev/ic/hd44780_subr.c hd44780 | |
719 | file dev/ic/lcdkp_subr.c hd44780 | 719 | file dev/ic/lcdkp_subr.c hd44780 | |
720 | 720 | |||
721 | # Matrix keypad | 721 | # Matrix keypad | |
722 | define matrixkp | 722 | define matrixkp | |
723 | file dev/ic/matrixkp_subr.c matrixkp | 723 | file dev/ic/matrixkp_subr.c matrixkp | |
724 | 724 | |||
725 | # Hitachi HD64570 serial controller | 725 | # Hitachi HD64570 serial controller | |
726 | # | 726 | # | |
727 | define hd64570 | 727 | define hd64570 | |
728 | file dev/ic/hd64570.c hd64570 | 728 | file 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 | # | |
732 | device ntwoc: ifnet, hd64570 | 732 | device ntwoc: ifnet, hd64570 | |
733 | 733 | |||
734 | # Intel 82586 Ethernet Controller | 734 | # Intel 82586 Ethernet Controller | |
735 | # | 735 | # | |
736 | define i82586 | 736 | define i82586 | |
737 | file dev/ic/i82586.c i82586 | 737 | file dev/ic/i82586.c i82586 | |
738 | 738 | |||
739 | # Intel 82596 Ethernet Controller | 739 | # Intel 82596 Ethernet Controller | |
740 | # | 740 | # | |
741 | define i82596 | 741 | define i82596 | |
742 | file dev/ic/i82596.c i82596 | 742 | file dev/ic/i82596.c i82596 | |
743 | 743 | |||
744 | # Intel 82557/82558/82559 Ethernet Controller | 744 | # Intel 82557/82558/82559 Ethernet Controller | |
745 | # | 745 | # | |
746 | device fxp: ether, ifnet, arp, mii | 746 | device fxp: ether, ifnet, arp, mii | |
747 | file dev/ic/i82557.c fxp | 747 | file 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 | # | |
751 | define seeq8005 | 751 | define seeq8005 | |
752 | file dev/ic/seeq8005.c seeq8005 | 752 | file dev/ic/seeq8005.c seeq8005 | |
753 | 753 | |||
754 | # SMC 91Cxx Ethernet Controller | 754 | # SMC 91Cxx Ethernet Controller | |
755 | # | 755 | # | |
756 | device sm: arp, ether, ifnet, mii, mii_bitbang | 756 | device sm: arp, ether, ifnet, mii, mii_bitbang | |
757 | file dev/ic/smc91cxx.c sm | 757 | file 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 | # | |
761 | device epic: arp, ether, ifnet, mii | 761 | device epic: arp, ether, ifnet, mii | |
762 | file dev/ic/smc83c170.c epic | 762 | file dev/ic/smc83c170.c epic | |
763 | 763 | |||
764 | # DEC SGEC Second Generation Ethernet Controller | 764 | # DEC SGEC Second Generation Ethernet Controller | |
765 | # | 765 | # | |
766 | define sgec | 766 | define sgec | |
767 | file dev/ic/sgec.c sgec | 767 | file dev/ic/sgec.c sgec | |
768 | 768 | |||
769 | # MB86950 Ethernet Controller | 769 | # MB86950 Ethernet Controller | |
770 | # | 770 | # | |
771 | define mb86950 | 771 | define mb86950 | |
772 | file dev/ic/mb86950.c mb86950 | 772 | file dev/ic/mb86950.c mb86950 | |
773 | 773 | |||
774 | # MB8696x Ethernet Controller | 774 | # MB8696x Ethernet Controller | |
775 | # | 775 | # | |
776 | define mb86960 | 776 | define mb86960 | |
777 | file dev/ic/mb86960.c mb86960 | 777 | file dev/ic/mb86960.c mb86960 | |
778 | 778 | |||
779 | # Generic MB8696x Ethernet Controller driver | 779 | # Generic MB8696x Ethernet Controller driver | |
780 | # | 780 | # | |
781 | device mbe: arp, ether, ifnet, mb86960 | 781 | device mbe: arp, ether, ifnet, mb86960 | |
782 | 782 | |||
783 | # Interwave Am78C201 audio driver | 783 | # Interwave Am78C201 audio driver | |
784 | # | 784 | # | |
785 | define interwave | 785 | define interwave | |
786 | file dev/ic/interwave.c interwave | 786 | file dev/ic/interwave.c interwave | |
787 | 787 | |||
788 | # TMS 320av110 MPEG2/audio driver | 788 | # TMS 320av110 MPEG2/audio driver | |
789 | # | 789 | # | |
790 | define tms320av110 | 790 | define tms320av110 | |
791 | file dev/ic/tms320av110.c tms320av110 | 791 | file 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 | # | |
796 | defflag opt_ipkdb.h IPKDB_NE : IPKDB_DP8390 | 796 | defflag opt_ipkdb.h IPKDB_NE : IPKDB_DP8390 | |
797 | device ne: ether, ifnet, arp, dp8390nic, mii | 797 | device ne: ether, ifnet, arp, dp8390nic, mii | |
798 | file dev/ic/ne2000.c ne | ipkdb_ne | 798 | file 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 | # | |
802 | defflag opt_com.h COM_DEBUG | 802 | defflag 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 | |
804 | defflag opt_com.h COM_16650 COM_HAYESP COM_PXA2X0 COM_AU1X00 | 804 | defflag opt_com.h COM_16650 COM_HAYESP COM_PXA2X0 COM_AU1X00 | |
805 | COM_REGMAP | 805 | COM_REGMAP | |
806 | device com { } : tty | 806 | device com { } : tty | |
807 | file dev/ic/com.c com needs-flag | 807 | file dev/ic/com.c com needs-flag | |
808 | 808 | |||
809 | # PC-like keyboard controller | 809 | # PC-like keyboard controller | |
810 | # | 810 | # | |
811 | device pckbc: pckbport | 811 | device pckbc: pckbport | |
812 | file dev/ic/pckbc.c pckbc needs-flag | 812 | file dev/ic/pckbc.c pckbc needs-flag | |
813 | 813 | |||
814 | device attimer | 814 | device attimer | |
815 | file dev/ic/attimer.c attimer needs-flag | 815 | file 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 | # | |
819 | device clmpcc: tty | 819 | device clmpcc: tty | |
820 | file dev/ic/clmpcc.c clmpcc needs-flag | 820 | file dev/ic/clmpcc.c clmpcc needs-flag | |
821 | 821 | |||
822 | # Abit uGuru | 822 | # Abit uGuru | |
823 | # | 823 | # | |
824 | device ug: sysmon_envsys | 824 | device ug: sysmon_envsys | |
825 | file dev/ic/ug.c ug needs-flag | 825 | file dev/ic/ug.c ug needs-flag | |
826 | 826 | |||
827 | # Essential Communications Corp. HIPPI Interface | 827 | # Essential Communications Corp. HIPPI Interface | |
828 | # | 828 | # | |
829 | device esh: hippi, ifnet | 829 | device esh: hippi, ifnet | |
830 | file dev/ic/rrunner.c esh needs-flag | 830 | file 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 | # | |
834 | device bah: ifnet, arcnet, arp | 834 | device bah: ifnet, arcnet, arp | |
835 | file dev/ic/smc90cx6.c bah | 835 | file dev/ic/smc90cx6.c bah | |
836 | 836 | |||
837 | # OPL2/OPL3 FM synth driver | 837 | # OPL2/OPL3 FM synth driver | |
838 | # | 838 | # | |
839 | device opl: midibus, midisyn | 839 | device opl: midibus, midisyn | |
840 | file dev/ic/opl.c opl | 840 | file dev/ic/opl.c opl | |
841 | file dev/ic/oplinstrs.c opl | 841 | file dev/ic/oplinstrs.c opl | |
842 | 842 | |||
843 | # MPU401 MIDI UART compatibles | 843 | # MPU401 MIDI UART compatibles | |
844 | # | 844 | # | |
845 | device mpu: midibus | 845 | device mpu: midibus | |
846 | file dev/ic/mpu.c mpu needs-flag | 846 | file 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 | # | |
850 | define ad1848 | 850 | define ad1848 | |
851 | file dev/ic/ad1848.c ad1848 | 851 | file dev/ic/ad1848.c ad1848 | |
852 | 852 | |||
853 | # AMD 7930 audio/ISDN codec | 853 | # AMD 7930 audio/ISDN codec | |
854 | # | 854 | # | |
855 | define am7930 | 855 | define am7930 | |
856 | file dev/ic/am7930.c am7930 | 856 | file dev/ic/am7930.c am7930 | |
857 | 857 | |||
858 | # SPARC `SUNW,audiocs' | 858 | # SPARC `SUNW,audiocs' | |
859 | # | 859 | # | |
860 | device audiocs: audiobus, auconv, ad1848 | 860 | device audiocs: audiobus, auconv, ad1848 | |
861 | file dev/ic/cs4231.c audiocs | 861 | file dev/ic/cs4231.c audiocs | |
862 | 862 | |||
863 | # AC-97 CODECs | 863 | # AC-97 CODECs | |
864 | # | 864 | # | |
865 | define ac97 | 865 | define ac97 | |
866 | file dev/ic/ac97.c ac97 | 866 | file dev/ic/ac97.c ac97 | |
867 | 867 | |||
868 | # Oki MSM6258 support code | 868 | # Oki MSM6258 support code | |
869 | # | 869 | # | |
870 | define msm6258 | 870 | define msm6258 | |
871 | file dev/ic/msm6258.c msm6258 | 871 | file dev/ic/msm6258.c msm6258 | |
872 | 872 | |||
873 | # LSI64854 DMA controller back-end | 873 | # LSI64854 DMA controller back-end | |
874 | # | 874 | # | |
875 | define lsi64854 | 875 | define lsi64854 | |
876 | file dev/ic/lsi64854.c lsi64854 | 876 | file 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 | # | |
880 | define cd18xx | 880 | define cd18xx | |
881 | file dev/ic/cd18xx.c cd18xx | 881 | file 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 | # | |
885 | define rtl80x9 | 885 | define rtl80x9 | |
886 | file dev/ic/rtl80x9.c rtl80x9 | 886 | file dev/ic/rtl80x9.c rtl80x9 | |
887 | 887 | |||
888 | # Realtek 8129/8139 Ethernet controllers | 888 | # Realtek 8129/8139 Ethernet controllers | |
889 | # | 889 | # | |
890 | device rtk: ether, ifnet, arp, mii | 890 | device rtk: ether, ifnet, arp, mii | |
891 | file dev/ic/rtl81x9.c rtk | re | 891 | file dev/ic/rtl81x9.c rtk | re | |
892 | 892 | |||
893 | # Realtek 8169 Ethernet controllers | 893 | # Realtek 8169 Ethernet controllers | |
894 | # | 894 | # | |
895 | device re: ether, ifnet, arp, mii | 895 | device re: ether, ifnet, arp, mii | |
896 | file dev/ic/rtl8169.c re | 896 | file 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 | # | |
900 | define wdc_common | 900 | define wdc_common | |
901 | define ata_dma | 901 | define ata_dma | |
902 | define ata_udma | 902 | define ata_udma | |
903 | define ata_piobm | 903 | define ata_piobm | |
904 | device wdc: ata, wdc_common | 904 | device wdc: ata, wdc_common | |
905 | 905 | |||
906 | defflag opt_ata.h ATADEBUG | 906 | defflag opt_ata.h ATADEBUG | |
907 | 907 | |||
908 | device atabus: atapi,ata_hl | 908 | device atabus: atapi,ata_hl | |
909 | attach atabus at ata | 909 | attach 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. | |
911 | file dev/ic/wdc.c (ata_dma | ata_udma | ata_piobm | atabus) & atabus & wdc_common needs-flag | 911 | file 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 | |
914 | device njata: ata, ata_piobm, wdc_common | 914 | device njata: ata, ata_piobm, wdc_common | |
915 | file dev/ic/ninjaata32.c njata | 915 | file 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 | # | |
919 | device upc { [offset = -1] } | 919 | device upc { [offset = -1] } | |
920 | attach wdc at upc with wdc_upc | 920 | attach wdc at upc with wdc_upc | |
921 | attach com at upc with com_upc | 921 | attach com at upc with com_upc | |
922 | attach lpt at upc with lpt_upc | 922 | attach lpt at upc with lpt_upc | |
923 | file dev/ic/upc.c upc | 923 | file dev/ic/upc.c upc | |
924 | file dev/ic/wdc_upc.c wdc_upc | 924 | file dev/ic/wdc_upc.c wdc_upc | |
925 | file dev/ic/com_upc.c com_upc | 925 | file dev/ic/com_upc.c com_upc | |
926 | file dev/ic/lpt_upc.c lpt_upc | 926 | file dev/ic/lpt_upc.c lpt_upc | |
927 | 927 | |||
928 | # AHCI-compatible SATA controllers | 928 | # AHCI-compatible SATA controllers | |
929 | define ahcisata_core | 929 | define ahcisata_core | |
930 | file dev/ic/ahcisata_core.c ahcisata_core | 930 | file dev/ic/ahcisata_core.c ahcisata_core | |
931 | device ahcisata: ata, ata_dma, ata_udma, sata, ahcisata_core | 931 | device 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 | # | |
935 | device tlp: arp, ether, ifnet, mii, mii_bitbang | 935 | device tlp: arp, ether, ifnet, mii, mii_bitbang | |
936 | file dev/ic/tulip.c tlp | 936 | file dev/ic/tulip.c tlp | |
937 | 937 | |||
938 | # Adaptec AIC-6915 Ethernet interface | 938 | # Adaptec AIC-6915 Ethernet interface | |
939 | # | 939 | # | |
940 | device sf: arp, ether, ifnet, mii | 940 | device sf: arp, ether, ifnet, mii | |
941 | file dev/ic/aic6915.c sf | 941 | file 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 | # | |
945 | define mk48txx | 945 | define mk48txx | |
946 | file dev/ic/mk48txx.c mk48txx | 946 | file dev/ic/mk48txx.c mk48txx | |
947 | 947 | |||
948 | # Intersil 7170 time-of-day clock | 948 | # Intersil 7170 time-of-day clock | |
949 | # | 949 | # | |
950 | define intersil7170 | 950 | define intersil7170 | |
951 | file dev/ic/intersil7170.c intersil7170 | 951 | file 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 | # | |
955 | define mm58167 | 955 | define mm58167 | |
956 | file dev/ic/mm58167.c mm58167 | 956 | file 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 | # | |
960 | define mc146818 | 960 | define mc146818 | |
961 | file dev/ic/mc146818.c mc146818 | 961 | file dev/ic/mc146818.c mc146818 | |
962 | 962 | |||
963 | # Ricoh RS5C313 time of-day-clock | 963 | # Ricoh RS5C313 time of-day-clock | |
964 | # | 964 | # | |
965 | define rs5c313 | 965 | define rs5c313 | |
966 | file dev/ic/rs5c313.c rs5c313 | 966 | file 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 | # | |
970 | define dl10019 | 970 | define dl10019 | |
971 | file dev/ic/dl10019.c dl10019 | 971 | file 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 | # | |
975 | define ax88190 | 975 | define ax88190 | |
976 | file dev/ic/ax88190.c ax88190 | 976 | file 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 | # | |
980 | device we: ether, ifnet, arp, dp8390nic | 980 | device we: ether, ifnet, arp, dp8390nic | |
981 | file dev/ic/we.c we | 981 | file 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 | # | |
985 | device ate: arp, ether, ifnet, mb86960 | 985 | device 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 | # | |
989 | device fmv: arp, ether, ifnet, mb86960 | 989 | device fmv: arp, ether, ifnet, mb86960 | |
990 | file dev/ic/fmv.c fmv | 990 | file 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 | # | |
994 | device cs: arp, ether, ifnet | 994 | device cs: arp, ether, ifnet | |
995 | device tscs: arp, ether, ifnet | 995 | device tscs: arp, ether, ifnet | |
996 | file dev/ic/cs89x0.c cs | tscs | 996 | file dev/ic/cs89x0.c cs | tscs | |
997 | 997 | |||
998 | # Radio device attributes | 998 | # Radio device attributes | |
999 | # | 999 | # | |
1000 | define tea5757 | 1000 | define tea5757 | |
1001 | file dev/ic/tea5757.c tea5757 | 1001 | file dev/ic/tea5757.c tea5757 | |
1002 | define lm700x | 1002 | define lm700x | |
1003 | file dev/ic/lm700x.c lm700x | 1003 | file dev/ic/lm700x.c lm700x | |
1004 | 1004 | |||
1005 | # Philips PCF8584 i2c controller | 1005 | # Philips PCF8584 i2c controller | |
1006 | define pcf8584 | 1006 | define pcf8584 | |
1007 | file dev/ic/pcf8584.c pcf8584 | 1007 | file 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 | # | |
1011 | define acpipmtimer | 1011 | define acpipmtimer | |
1012 | file dev/ic/acpipmtimer.c acpipmtimer | 1012 | file dev/ic/acpipmtimer.c acpipmtimer | |
1013 | 1013 | |||
1014 | device hpet | 1014 | device hpet | |
1015 | file dev/ic/hpet.c hpet needs-flag | 1015 | file dev/ic/hpet.c hpet needs-flag | |
1016 | 1016 | |||
1017 | # DRM - Direct Rendering Infrastructure: dev/drm | 1017 | # DRM - Direct Rendering Infrastructure: dev/drm | |
1018 | define drm {} | 1018 | define drm {} | |
1019 | include dev/drm/files.drm | 1019 | include 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 | # | |
1024 | define wsdisplaydev {[kbdmux = 1]} | 1024 | define wsdisplaydev {[kbdmux = 1]} | |
1025 | define wsemuldisplaydev {[console = -1], [kbdmux = 1]} | 1025 | define wsemuldisplaydev {[console = -1], [kbdmux = 1]} | |
1026 | define wskbddev {[console = -1], [mux = 1]} | 1026 | define wskbddev {[console = -1], [mux = 1]} | |
1027 | define wsmousedev {[mux = 0]} | 1027 | define wsmousedev {[mux = 0]} | |
1028 | define vcons | 1028 | define vcons | |
1029 | # attribute to pull in raster support | 1029 | # attribute to pull in raster support | |
1030 | # | 1030 | # | |
1031 | define wsrasteremulops | 1031 | define wsrasteremulops | |
1032 | # common PC display functions | 1032 | # common PC display functions | |
1033 | # | 1033 | # | |
1034 | defflag opt_pcdisplay.h PCDISPLAY_SOFTCURSOR | 1034 | defflag opt_pcdisplay.h PCDISPLAY_SOFTCURSOR | |
1035 | define pcdisplayops | 1035 | define pcdisplayops | |
1036 | file dev/ic/pcdisplay_subr.c pcdisplayops | 1036 | file dev/ic/pcdisplay_subr.c pcdisplayops | |
1037 | file dev/ic/pcdisplay_chars.c pcdisplayops | 1037 | file 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) | |
1041 | define fb | 1041 | define fb | |
1042 | # VGA graphics | 1042 | # VGA graphics | |
1043 | # | 1043 | # | |
1044 | defparam opt_vga.h VGA_CONSOLE_SCREENTYPE | 1044 | defparam opt_vga.h VGA_CONSOLE_SCREENTYPE | |
1045 | defflag opt_vga.h VGA_CONSOLE_ATI_BROKEN_FONTSEL | 1045 | defflag opt_vga.h VGA_CONSOLE_ATI_BROKEN_FONTSEL | |
1046 | defflag opt_vga.h VGA_RASTERCONSOLE | 1046 | defflag opt_vga.h VGA_RASTERCONSOLE | |
1047 | defflag opt_vga.h VGA_RESET | 1047 | defflag opt_vga.h VGA_RESET | |
1048 | device vga: displaydev, wsemuldisplaydev, pcdisplayops, drm | 1048 | device vga: displaydev, wsemuldisplaydev, pcdisplayops, drm | |
1049 | file dev/ic/vga.c vga & !vga_rasterconsole needs-flag | 1049 | file dev/ic/vga.c vga & !vga_rasterconsole needs-flag | |
1050 | file dev/ic/vga_raster.c vga_rasterconsole needs-flag | 1050 | file dev/ic/vga_raster.c vga_rasterconsole needs-flag | |
1051 | file dev/ic/vga_subr.c vga | vga_rasterconsole | 1051 | file dev/ic/vga_subr.c vga | vga_rasterconsole | |
1052 | file dev/ic/vga_common.c vga | vga_rasterconsole | 1052 | file 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 | # | |
1055 | device igsfb: wsemuldisplaydev, wsrasteremulops, rasops8, vcons | 1055 | device igsfb: wsemuldisplaydev, wsrasteremulops, rasops8, vcons | |
1056 | file dev/ic/igsfb.c igsfb needs-flag | 1056 | file dev/ic/igsfb.c igsfb needs-flag | |
1057 | file dev/ic/igsfb_subr.c igsfb | 1057 | file dev/ic/igsfb_subr.c igsfb | |
1058 | 1058 | |||
1059 | # STI (hp graphics) | 1059 | # STI (hp graphics) | |
1060 | device sti: wsemuldisplaydev | 1060 | device sti: wsemuldisplaydev | |
1061 | file dev/ic/sti.c sti & (sti_pci | sti_gedoens) | 1061 | file dev/ic/sti.c sti & (sti_pci | sti_gedoens) | |
1062 | 1062 | |||
1063 | include "dev/wscons/files.wscons" | 1063 | include "dev/wscons/files.wscons" | |
1064 | include "dev/rasops/files.rasops" | 1064 | include "dev/rasops/files.rasops" | |
1065 | include "dev/wsfont/files.wsfont" | 1065 | include "dev/wsfont/files.wsfont" | |
1066 | include "dev/wsfb/files.wsfb" | 1066 | include "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 | # | |
1073 | define isabus { } # ISA attachment | 1073 | define isabus { } # ISA attachment | |
1074 | define eisabus { } # EISA attachment | 1074 | define eisabus { } # EISA attachment | |
1075 | define pcibus {[bus = -1]} # PCI attachment | 1075 | define pcibus {[bus = -1]} # PCI attachment | |
1076 | define tcbus { } # TurboChannel attachment | 1076 | define tcbus { } # TurboChannel attachment | |
1077 | define mcabus { } # MicroChannel attachment | 1077 | define mcabus { } # MicroChannel attachment | |
1078 | define usbus { } # USB attachment | 1078 | define usbus { } # USB attachment | |
1079 | define fwbus { } # IEEE 1394 attachment | 1079 | define fwbus { } # IEEE 1394 attachment | |
1080 | define vmebus { } # VME bus attachment | 1080 | define vmebus { } # VME bus attachment | |
1081 | define acpibus { } # ACPI "bus" attachment | 1081 | define acpibus { } # ACPI "bus" attachment | |
1082 | define pcmciabus { [controller = -1], [socket = -1]} # PCMCIA bus attachment | 1082 | define pcmciabus { [controller = -1], [socket = -1]} # PCMCIA bus attachment | |
1083 | define cbbus { } # CardBus attachment | 1083 | define cbbus { } # CardBus attachment | |
1084 | define pcmciaslot { } # PCMCIA slot itself | 1084 | define 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 | |||
1091 | defparam USB_MEM_RESERVE | 1091 | defparam USB_MEM_RESERVE | |
1092 | 1092 | |||
1093 | define usbroothub | 1093 | define usbroothub | |
1094 | file dev/usb/usbroothub_subr.c usbroothub | 1094 | file dev/usb/usbroothub_subr.c usbroothub | |
1095 | 1095 | |||
1096 | device uhci: usbus, usbroothub | 1096 | device uhci: usbus, usbroothub | |
1097 | file dev/usb/uhci.c uhci needs-flag | 1097 | file dev/usb/uhci.c uhci needs-flag | |
1098 | 1098 | |||
1099 | # OHCI USB controller | 1099 | # OHCI USB controller | |
1100 | # | 1100 | # | |
1101 | device ohci: usbus, usbroothub | 1101 | device ohci: usbus, usbroothub | |
1102 | file dev/usb/ohci.c ohci needs-flag | 1102 | file dev/usb/ohci.c ohci needs-flag | |
1103 | 1103 | |||
1104 | # EHCI USB controller | 1104 | # EHCI USB controller | |
1105 | # | 1105 | # | |
1106 | device ehci: usbus, usbroothub | 1106 | device ehci: usbus, usbroothub | |
1107 | file dev/usb/ehci.c ehci needs-flag | 1107 | file dev/usb/ehci.c ehci needs-flag | |
1108 | 1108 | |||
1109 | # SL811HS/T USB controller | 1109 | # SL811HS/T USB controller | |
1110 | defflag opt_slhci.h SLHCI_DEBUG SLHCI_TRY_LSVH SLHCI_PROFILE_TRANSFER | 1110 | defflag opt_slhci.h SLHCI_DEBUG SLHCI_TRY_LSVH SLHCI_PROFILE_TRANSFER | |
1111 | device slhci: usbus, usbroothub | 1111 | device slhci: usbus, usbroothub | |
1112 | file dev/ic/sl811hs.c slhci needs-flag | 1112 | file 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) | |
1115 | define hid | 1115 | define hid | |
1116 | file dev/usb/hid.c hid | 1116 | file 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 | |
1119 | device mtd: arp, ether, ifnet, mii | 1119 | device mtd: arp, ether, ifnet, mii | |
1120 | file dev/ic/mtd803.c mtd | 1120 | file dev/ic/mtd803.c mtd | |
1121 | 1121 | |||
1122 | # radio devices, attaches to radio hardware driver | 1122 | # radio devices, attaches to radio hardware driver | |
1123 | device radio | 1123 | device radio | |
1124 | attach radio at radiodev | 1124 | attach 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 | # | |
1129 | device fwohci: fwbus | 1129 | device fwohci: fwbus | |
1130 | 1130 | |||
1131 | # Sony Programmable I/O Controller | 1131 | # Sony Programmable I/O Controller | |
1132 | device spic: wsmousedev | 1132 | device spic: wsmousedev | |
1133 | file dev/ic/spic.c spic | 1133 | file dev/ic/spic.c spic | |
1134 | 1134 | |||
1135 | # IBM CPC700 PowerPC bridge | 1135 | # IBM CPC700 PowerPC bridge | |
1136 | define cpcbus { addr, [irq=-1] } | 1136 | define cpcbus { addr, [irq=-1] } | |
1137 | device cpc: cpcbus, pcibus | 1137 | device cpc: cpcbus, pcibus | |
1138 | file dev/ic/cpc700.c cpc | 1138 | file dev/ic/cpc700.c cpc | |
1139 | 1139 | |||
1140 | attach com at cpcbus with com_cpcbus | 1140 | attach com at cpcbus with com_cpcbus | |
1141 | file dev/ic/com_cpcbus.c com_cpcbus | 1141 | file dev/ic/com_cpcbus.c com_cpcbus | |
1142 | 1142 | |||
1143 | device cpctim | 1143 | device cpctim | |
1144 | attach cpctim at cpcbus | 1144 | attach cpctim at cpcbus | |
1145 | file dev/ic/timer_cpcbus.c cpctim | 1145 | file dev/ic/timer_cpcbus.c cpctim | |
1146 | 1146 | |||
1147 | device cpciic | 1147 | device cpciic | |
1148 | attach cpciic at cpcbus with iic_cpcbus | 1148 | attach cpciic at cpcbus with iic_cpcbus | |
1149 | file dev/ic/iic_cpcbus.c iic_cpcbus | 1149 | file 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 | # | |
1154 | define bpf_filter | 1154 | define bpf_filter | |
1155 | defparam opt_bpf.h BPF_BUFSIZE | 1155 | defparam opt_bpf.h BPF_BUFSIZE | |
1156 | 1156 | |||
1157 | # Attributes used by the ISDN subsystem | 1157 | # Attributes used by the ISDN subsystem | |
1158 | # | 1158 | # | |
1159 | define isdndev # the ISDN subsystem | 1159 | define isdndev # the ISDN subsystem | |
1160 | define passive_isdn # files needed by passive cards (XXX - protocol | 1160 | define passive_isdn # files needed by passive cards (XXX - protocol | |
1161 | # specific) | 1161 | # specific) | |
1162 | define isdncapi # ISDN CAPI (http://www.capi.org/) | 1162 | define 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. | |
1165 | define nisacsx | 1165 | define nisacsx | |
1166 | file dev/ic/isacsx.c nisacsx needs-flag | 1166 | file dev/ic/isacsx.c nisacsx needs-flag | |
1167 | 1167 | |||
1168 | # The 'standard' isac | 1168 | # The 'standard' isac | |
1169 | define nisac | 1169 | define nisac | |
1170 | file dev/ic/isac.c nisac needs-flag | 1170 | file 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 | # | |
1174 | device isic: isdndev, passive_isdn, nisac | 1174 | device isic: isdndev, passive_isdn, nisac | |
1175 | 1175 | |||
1176 | file dev/ic/isic.c isic | 1176 | file dev/ic/isic.c isic | |
1177 | file dev/ic/isic_l1.c isic|ifpci|ifritz | 1177 | file dev/ic/isic_l1.c isic|ifpci|ifritz | |
1178 | file dev/ic/isic_l1fsm.c isic|ifpci|ifritz | 1178 | file dev/ic/isic_l1fsm.c isic|ifpci|ifritz | |
1179 | file dev/ic/hscx.c isic | 1179 | file dev/ic/hscx.c isic | |
1180 | file dev/ic/isic_bchan.c isic | 1180 | file 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 | |
1189 | device iavc: isdndev, isdncapi, passive_isdn | 1189 | device iavc: isdndev, isdncapi, passive_isdn | |
1190 | file dev/ic/iavc.c iavc | 1190 | file dev/ic/iavc.c iavc | |
1191 | 1191 | |||
1192 | # legitimate pseudo-devices | 1192 | # legitimate pseudo-devices | |
1193 | # | 1193 | # | |
1194 | defpseudodev vnd: disk | 1194 | defpseudodev vnd: disk | |
1195 | defflag opt_vnd.h VND_COMPRESSION | 1195 | defflag opt_vnd.h VND_COMPRESSION | |
1196 | defpseudo ccd: disk | 1196 | defpseudo ccd: disk | |
1197 | defpseudo cgd: disk, des, blowfish, cast128, rijndael | 1197 | defpseudo cgd: disk, des, blowfish, cast128, rijndael | |
1198 | defpseudodev md: disk | 1198 | defpseudodev md: disk | |
1199 | defpseudodev fss: disk | 1199 | defpseudodev fss: disk | |
1200 | 1200 | |||
1201 | defpseudo pty: tty | 1201 | defpseudo pty: tty | |
1202 | defpseudo rnd | 1202 | defpseudo rnd | |
1203 | defpseudo ksyms | 1203 | defpseudo ksyms | |
1204 | defpseudo nullcons | 1204 | defpseudo nullcons | |
1205 | defpseudo lockstat | 1205 | defpseudo lockstat | |
1206 | defpseudo bio: sysmon_envsys | 1206 | defpseudo bio: sysmon_envsys | |
1207 | 1207 | |||
1208 | defpseudo loop: ifnet | 1208 | defpseudo loop: ifnet | |
1209 | defpseudo sl: ifnet | 1209 | defpseudo sl: ifnet | |
1210 | defpseudo ppp: ifnet, bpf_filter | 1210 | defpseudo ppp: ifnet, bpf_filter | |
1211 | defpseudo pppoe: ifnet, ether, sppp | 1211 | defpseudo pppoe: ifnet, ether, sppp | |
1212 | defpseudo sppp: ifnet | 1212 | defpseudo sppp: ifnet | |
1213 | defpseudo tun: ifnet | 1213 | defpseudo tun: ifnet | |
1214 | defpseudo vlan: ifnet, ether | 1214 | defpseudo vlan: ifnet, ether | |
1215 | defpseudo bridge: ifnet, ether | 1215 | defpseudo bridge: ifnet, ether | |
1216 | defpseudo bpfilter: ifnet, bpf_filter | 1216 | defpseudo bpfilter: ifnet, bpf_filter | |
1217 | defpseudo strip: ifnet | 1217 | defpseudo strip: ifnet | |
1218 | defpseudo gre: ifnet | 1218 | defpseudo gre: ifnet | |
1219 | defpseudo gif: ifnet | 1219 | defpseudo gif: ifnet | |
1220 | defpseudo faith: ifnet | 1220 | defpseudo faith: ifnet | |
1221 | defpseudo srt: ifnet | 1221 | defpseudo srt: ifnet | |
1222 | defpseudo stf: ifnet | 1222 | defpseudo stf: ifnet | |
1223 | defpseudodev tap: ifnet, ether, arp, bpf_filter | 1223 | defpseudodev tap: ifnet, ether, arp, bpf_filter | |
1224 | defpseudo carp: ifnet, ether, arp, bpf_filter | 1224 | defpseudo carp: ifnet, ether, arp, bpf_filter | |
1225 | defpseudodev etherip: ifnet, ether, arp, bpf_filter | 1225 | defpseudodev etherip: ifnet, ether, arp, bpf_filter | |
1226 | 1226 | |||
1227 | defpseudo sequencer | 1227 | defpseudo sequencer | |
1228 | defpseudo clockctl | 1228 | defpseudo clockctl | |
1229 | defpseudo irix_kmem | 1229 | defpseudo irix_kmem | |
1230 | defpseudo irix_usema | 1230 | defpseudo 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 | # | |
1235 | defpseudo accf_data | 1235 | defpseudo accf_data | |
1236 | defpseudo accf_http | 1236 | defpseudo accf_http | |
1237 | 1237 | |||
1238 | # ISDN userland pseudo devices | 1238 | # ISDN userland pseudo devices | |
1239 | # | 1239 | # | |
1240 | defpseudo isdntrc: isdndev, tty | 1240 | defpseudo isdntrc: isdndev, tty | |
1241 | defpseudo isdnbchan: isdndev, tty | 1241 | defpseudo isdnbchan: isdndev, tty | |
1242 | defpseudo isdntel: isdndev, tty | 1242 | defpseudo isdntel: isdndev, tty | |
1243 | defpseudo isdnctl: isdndev, tty | 1243 | defpseudo isdnctl: isdndev, tty | |
1244 | defpseudo isdn: isdndev, tty | 1244 | defpseudo isdn: isdndev, tty | |
1245 | 1245 | |||
1246 | # ISDN network interfaces | 1246 | # ISDN network interfaces | |
1247 | defpseudo irip: isdndev, ifnet | 1247 | defpseudo irip: isdndev, ifnet | |
1248 | defflag opt_irip.h IRIP_VJ | 1248 | defflag opt_irip.h IRIP_VJ | |
1249 | defpseudo ippp: isdndev, sppp, ifnet | 1249 | defpseudo ippp: isdndev, sppp, ifnet | |
1250 | 1250 | |||
1251 | # KTTCP network throughput testing pseudo-device | 1251 | # KTTCP network throughput testing pseudo-device | |
1252 | defpseudo kttcp | 1252 | defpseudo kttcp | |
1253 | file dev/kttcp.c kttcp needs-flag | 1253 | file dev/kttcp.c kttcp needs-flag | |
1254 | 1254 | |||
1255 | # Veriexec | 1255 | # Veriexec | |
1256 | defpseudo veriexec | 1256 | defpseudo veriexec | |
1257 | file kern/kern_verifiedexec.c veriexec | 1257 | file kern/kern_verifiedexec.c veriexec | |
1258 | file dev/verified_exec.c veriexec needs-flag | 1258 | file 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 | |
1261 | defpseudo fwiso: ieee1394 | 1261 | defpseudo fwiso: ieee1394 | |
1262 | 1262 | |||
1263 | # driver attach / detach user interface | 1263 | # driver attach / detach user interface | |
1264 | defpseudo drvctl | 1264 | defpseudo drvctl | |
1265 | file kern/kern_drvctl.c drvctl needs-flag | 1265 | file kern/kern_drvctl.c drvctl needs-flag | |
1266 | 1266 | |||
1267 | # cpu control | 1267 | # cpu control | |
1268 | defpseudo cpuctl | 1268 | defpseudo cpuctl | |
1269 | 1269 | |||
1270 | # pass-to-userspace transporter | 1270 | # pass-to-userspace transporter | |
1271 | defpseudo putter | 1271 | defpseudo putter | |
1272 | file dev/putter/putter.c putter | 1272 | file dev/putter/putter.c putter | |
1273 | 1273 | |||
1274 | # userspace block/char device drivers | 1274 | # userspace block/char device drivers | |
1275 | defpseudo pud | 1275 | defpseudo pud | |
1276 | file dev/pud/pud.c pud | 1276 | file dev/pud/pud.c pud | |
1277 | file dev/pud/pud_dev.c pud | 1277 | file dev/pud/pud_dev.c pud | |
1278 | 1278 | |||
1279 | # | 1279 | # | |
1280 | # File systems | 1280 | # File systems | |
1281 | # | 1281 | # | |
1282 | include "coda/files.coda" | 1282 | include "coda/files.coda" | |
1283 | include "fs/adosfs/files.adosfs" | 1283 | include "fs/adosfs/files.adosfs" | |
1284 | include "fs/cd9660/files.cd9660" | 1284 | include "fs/cd9660/files.cd9660" | |
1285 | include "fs/efs/files.efs" | 1285 | include "fs/efs/files.efs" | |
1286 | include "fs/filecorefs/files.filecorefs" | 1286 | include "fs/filecorefs/files.filecorefs" | |
1287 | include "fs/hfs/files.hfs" | 1287 | include "fs/hfs/files.hfs" | |
1288 | include "fs/msdosfs/files.msdosfs" | 1288 | include "fs/msdosfs/files.msdosfs" | |
1289 | include "fs/ntfs/files.ntfs" | 1289 | include "fs/ntfs/files.ntfs" | |
1290 | include "fs/ptyfs/files.ptyfs" | 1290 | include "fs/ptyfs/files.ptyfs" | |
1291 | include "fs/puffs/files.puffs" | 1291 | include "fs/puffs/files.puffs" | |
1292 | include "fs/udf/files.udf" | 1292 | include "fs/udf/files.udf" | |
1293 | include "fs/smbfs/files.smbfs" | 1293 | include "fs/smbfs/files.smbfs" | |
1294 | include "fs/sysvbfs/files.sysvbfs" | 1294 | include "fs/sysvbfs/files.sysvbfs" | |
1295 | include "fs/tmpfs/files.tmpfs" | 1295 | include "fs/tmpfs/files.tmpfs" | |
1296 | include "fs/union/files.union" | 1296 | include "fs/union/files.union" | |
1297 | include "miscfs/fdesc/files.fdesc" | 1297 | include "miscfs/fdesc/files.fdesc" | |
1298 | include "miscfs/kernfs/files.kernfs" | 1298 | include "miscfs/kernfs/files.kernfs" | |
1299 | include "miscfs/nullfs/files.nullfs" | 1299 | include "miscfs/nullfs/files.nullfs" | |
1300 | include "miscfs/overlay/files.overlay" | 1300 | include "miscfs/overlay/files.overlay" | |
1301 | include "miscfs/portal/files.portal" | 1301 | include "miscfs/portal/files.portal" | |
1302 | include "miscfs/procfs/files.procfs" | 1302 | include "miscfs/procfs/files.procfs" | |
1303 | include "miscfs/umapfs/files.umapfs" | 1303 | include "miscfs/umapfs/files.umapfs" | |
1304 | include "nfs/files.nfs" | 1304 | include "nfs/files.nfs" | |
1305 | include "ufs/files.ufs" | 1305 | include "ufs/files.ufs" | |
1306 | 1306 | |||
1307 | # | 1307 | # | |
1308 | # UVM (virtual memory) | 1308 | # UVM (virtual memory) | |
1309 | # | 1309 | # | |
1310 | include "uvm/files.uvm" | 1310 | include "uvm/files.uvm" | |
1311 | 1311 | |||
1312 | # | 1312 | # | |
1313 | # Security models | 1313 | # Security models | |
1314 | # | 1314 | # | |
1315 | include "secmodel/files.secmodel" | 1315 | include "secmodel/files.secmodel" | |
1316 | 1316 | |||
1317 | # | 1317 | # | |
1318 | # kernel sources | 1318 | # kernel sources | |
1319 | # | 1319 | # | |
1320 | file compat/sa/compat_sa.c | 1320 | file compat/sa/compat_sa.c | |
1321 | file conf/debugsyms.c | 1321 | file conf/debugsyms.c | |
1322 | file dev/auconv.c auconv | mulaw | 1322 | file dev/auconv.c auconv | mulaw | |
1323 | file dev/audio.c audio | midi | midibus needs-flag | 1323 | file dev/audio.c audio | midi | midibus needs-flag | |
1324 | file dev/audiobell.c audiobell | 1324 | file dev/audiobell.c audiobell | |
1325 | file dev/aurateconv.c aurateconv needs-flag | 1325 | file dev/aurateconv.c aurateconv needs-flag | |
1326 | file dev/bio.c bio needs-flag | 1326 | file dev/bio.c bio needs-flag | |
1327 | file dev/ccd.c ccd needs-flag | 1327 | file dev/ccd.c ccd needs-flag | |
1328 | file dev/cgd.c cgd needs-flag | 1328 | file dev/cgd.c cgd needs-flag | |
1329 | file dev/cgd_crypto.c cgd | 1329 | file dev/cgd_crypto.c cgd | |
1330 | file dev/clock_subr.c | 1330 | file dev/clock_subr.c | |
1331 | file dev/clockctl.c clockctl needs-flag | 1331 | file dev/clockctl.c clockctl needs-flag | |
1332 | file dev/dksubr.c cgd | xbd | ccd | raid | 1332 | file dev/dksubr.c cgd | xbd | ccd | raid | |
1333 | file dev/dkwedge/dk.c | 1333 | file dev/dkwedge/dk.c | |
1334 | file dev/dkwedge/dkwedge_bsdlabel.c dkwedge_method_bsdlabel | 1334 | file dev/dkwedge/dkwedge_bsdlabel.c dkwedge_method_bsdlabel | |
1335 | file dev/dkwedge/dkwedge_gpt.c dkwedge_method_gpt | 1335 | file dev/dkwedge/dkwedge_gpt.c dkwedge_method_gpt | |
1336 | file dev/dkwedge/dkwedge_mbr.c dkwedge_method_mbr | 1336 | file dev/dkwedge/dkwedge_mbr.c dkwedge_method_mbr | |
1337 | file dev/firmload.c firmload | 1337 | file dev/firmload.c firmload | |
1338 | file dev/fss.c fss needs-count | 1338 | file dev/fss.c fss needs-count | |
1339 | file dev/lockstat.c lockstat needs-flag | 1339 | file dev/lockstat.c lockstat needs-flag | |
1340 | file dev/md.c md needs-count | 1340 | file dev/md.c md needs-count | |
1341 | file dev/midi.c midi | midibus needs-flag | 1341 | file dev/midi.c midi | midibus needs-flag | |
1342 | file dev/midictl.c midisyn | 1342 | file dev/midictl.c midisyn | |
1343 | file dev/midisyn.c midisyn | 1343 | file dev/midisyn.c midisyn | |
1344 | file dev/mm.c | 1344 | file dev/mm.c | |
1345 | file dev/mulaw.c mulaw needs-flag | 1345 | file dev/mulaw.c mulaw needs-flag | |
1346 | file dev/nullcons_subr.c nullcons needs-flag | 1346 | file dev/nullcons_subr.c nullcons needs-flag | |
1347 | file dev/radio.c radio needs-flag | 1347 | file dev/radio.c radio needs-flag | |
1348 | file dev/rnd.c rnd needs-flag | 1348 | file dev/rnd.c rnd needs-flag | |
1349 | file dev/rndpool.c rnd needs-flag | 1349 | file dev/rndpool.c rnd needs-flag | |
1350 | file dev/sequencer.c sequencer needs-flag | 1350 | file dev/sequencer.c sequencer needs-flag | |
1351 | file dev/video.c video needs-flag | 1351 | file dev/video.c video needs-flag | |
1352 | file dev/vnd.c vnd needs-flag | 1352 | file dev/vnd.c vnd needs-flag | |
1353 | file kern/bufq_disksort.c bufq_disksort | 1353 | file kern/bufq_disksort.c bufq_disksort | |
1354 | file kern/bufq_fcfs.c bufq_fcfs | 1354 | file kern/bufq_fcfs.c bufq_fcfs | |
1355 | file kern/bufq_priocscan.c bufq_priocscan | 1355 | file kern/bufq_priocscan.c bufq_priocscan | |
1356 | file kern/bufq_readprio.c bufq_readprio | new_bufq_strategy | 1356 | file kern/bufq_readprio.c bufq_readprio | new_bufq_strategy | |
1357 | file kern/core_elf32.c coredump & exec_elf32 | 1357 | file kern/core_elf32.c coredump & exec_elf32 | |
1358 | file kern/core_elf64.c coredump & exec_elf64 | 1358 | file kern/core_elf64.c coredump & exec_elf64 | |
1359 | file kern/core_netbsd.c coredump & (exec_aout | exec_coff | | 1359 | file kern/core_netbsd.c coredump & (exec_aout | exec_coff | | |
1360 | exec_ecoff | exec_macho | lkm) | 1360 | exec_ecoff | exec_macho | lkm) | |
1361 | file kern/cnmagic.c | 1361 | file kern/cnmagic.c | |
1362 | file kern/exec_aout.c exec_aout | 1362 | file kern/exec_aout.c exec_aout | |
1363 | file kern/exec_conf.c | 1363 | file kern/exec_conf.c | |
1364 | file kern/exec_ecoff.c exec_ecoff | 1364 | file kern/exec_ecoff.c exec_ecoff | |
1365 | file kern/exec_elf32.c exec_elf32 | 1365 | file kern/exec_elf32.c exec_elf32 | |
1366 | file kern/exec_elf64.c exec_elf64 | 1366 | file kern/exec_elf64.c exec_elf64 | |
1367 | file kern/exec_macho.c exec_macho | 1367 | file kern/exec_macho.c exec_macho | |
1368 | file kern/exec_script.c exec_script | 1368 | file kern/exec_script.c exec_script | |
1369 | file kern/exec_subr.c | 1369 | file kern/exec_subr.c | |
1370 | file kern/init_main.c | 1370 | file kern/init_main.c | |
1371 | file kern/init_sysctl.c | 1371 | file kern/init_sysctl.c | |
1372 | file kern/init_sysent.c | 1372 | file kern/init_sysent.c | |
1373 | file kern/kern_acct.c | 1373 | file kern/kern_acct.c | |
1374 | file kern/kern_auth.c | 1374 | file kern/kern_auth.c | |
1375 | file kern/kern_clock.c | 1375 | file kern/kern_clock.c | |
1376 | file kern/kern_condvar.c | 1376 | file kern/kern_condvar.c | |
1377 | file kern/kern_core.c | 1377 | file kern/kern_core.c | |
1378 | file kern/kern_cpu.c | 1378 | file kern/kern_cpu.c | |
1379 | file kern/kern_descrip.c | 1379 | file kern/kern_descrip.c | |
1380 | file kern/kern_event.c | 1380 | file kern/kern_event.c | |
1381 | file kern/kern_exec.c | 1381 | file kern/kern_exec.c | |
1382 | file kern/kern_exit.c | 1382 | file kern/kern_exit.c | |
1383 | file kern/kern_fork.c | 1383 | file kern/kern_fork.c | |
1384 | file kern/kern_idle.c | 1384 | file kern/kern_idle.c | |
1385 | file kern/kern_kthread.c | 1385 | file kern/kern_kthread.c | |
1386 | file kern/kern_ktrace.c ktrace | 1386 | file kern/kern_ktrace.c ktrace | |
1387 | file kern/kern_ksyms.c ksyms | ddb | lkm needs-flag | 1387 | file kern/kern_ksyms.c ksyms | ddb | lkm needs-flag | |
1388 | file kern/kern_lkm.c lkm | 1388 | file kern/kern_lkm.c lkm | |
1389 | file kern/kern_lock.c | 1389 | file kern/kern_lock.c | |
1390 | file kern/kern_lwp.c | 1390 | file kern/kern_lwp.c | |
1391 | file kern/kern_malloc.c | 1391 | file kern/kern_malloc.c | |
1392 | file kern/kern_malloc_stdtype.c | 1392 | file kern/kern_malloc_stdtype.c | |
1393 | file kern/kern_malloc_debug.c malloc_debug | 1393 | file kern/kern_malloc_debug.c malloc_debug | |
1394 | file kern/kern_module.c | 1394 | file kern/kern_module.c | |
1395 | file kern/kern_mutex.c | 1395 | file kern/kern_mutex.c | |
1396 | file kern/kern_fileassoc.c fileassoc | 1396 | file kern/kern_fileassoc.c fileassoc | |
1397 | file kern/kern_ntptime.c | 1397 | file kern/kern_ntptime.c | |
1398 | file kern/kern_pax.c pax_mprotect | pax_segvguard | 1398 | file kern/kern_pax.c pax_mprotect | pax_segvguard | |
1399 | file kern/kern_physio.c | 1399 | file kern/kern_physio.c | |
1400 | file kern/kern_pmf.c | 1400 | file kern/kern_pmf.c | |
1401 | file kern/kern_proc.c | 1401 | file kern/kern_proc.c | |
1402 | file kern/kern_prot.c | 1402 | file kern/kern_prot.c | |
1403 | file kern/kern_ras.c | 1403 | file kern/kern_ras.c | |
1404 | file kern/kern_rate.c | 1404 | file kern/kern_rate.c | |
1405 | file kern/kern_resource.c | 1405 | file kern/kern_resource.c | |
1406 | file kern/kern_runq.c | 1406 | file kern/kern_runq.c | |
1407 | file kern/kern_rwlock.c | 1407 | file kern/kern_rwlock.c | |
1408 | file kern/kern_sig.c | 1408 | file kern/kern_sig.c | |
1409 | file kern/kern_sleepq.c | 1409 | file kern/kern_sleepq.c | |
1410 | file kern/kern_softint.c | 1410 | file kern/kern_softint.c | |
1411 | file kern/kern_ssp.c | |||
1411 | file kern/kern_stub.c | 1412 | file kern/kern_stub.c | |
1412 | file kern/kern_subr.c | 1413 | file kern/kern_subr.c | |
1413 | file kern/kern_synch.c | 1414 | file kern/kern_synch.c | |
1414 | file kern/kern_sysctl.c | 1415 | file kern/kern_sysctl.c | |
1415 | file kern/kern_tc.c | 1416 | file kern/kern_tc.c | |
1416 | file kern/kern_time.c | 1417 | file kern/kern_time.c | |
1417 | file kern/kern_timeout.c | 1418 | file kern/kern_timeout.c | |
1418 | file kern/kern_turnstile.c | 1419 | file kern/kern_turnstile.c | |
1419 | file kern/kern_todr.c | 1420 | file kern/kern_todr.c | |
1420 | file kern/kern_uidinfo.c | 1421 | file kern/kern_uidinfo.c | |
1421 | file kern/kern_uuid.c | 1422 | file kern/kern_uuid.c | |
1422 | file kern/kern_xxx.c | 1423 | file kern/kern_xxx.c | |
1423 | file kern/kgdb_stub.c kgdb | 1424 | file kern/kgdb_stub.c kgdb | |
1424 | file kern/sched_4bsd.c sched_4bsd | 1425 | file kern/sched_4bsd.c sched_4bsd | |
1425 | file kern/sched_m2.c sched_m2 | 1426 | file kern/sched_m2.c sched_m2 | |
1426 | file kern/subr_autoconf.c | 1427 | file kern/subr_autoconf.c | |
1427 | file kern/subr_blist.c vmswap | 1428 | file kern/subr_blist.c vmswap | |
1428 | file kern/subr_bufq.c | 1429 | file kern/subr_bufq.c | |
1429 | file kern/subr_callback.c | 1430 | file kern/subr_callback.c | |
1430 | file kern/subr_debug.c debug | 1431 | file kern/subr_debug.c debug | |
1431 | file kern/subr_devsw.c | 1432 | file kern/subr_devsw.c | |
1432 | file kern/subr_disk.c | 1433 | file kern/subr_disk.c | |
1433 | file kern/subr_iostat.c | 1434 | file kern/subr_iostat.c | |
1434 | file kern/subr_evcnt.c | 1435 | file kern/subr_evcnt.c | |
1435 | file kern/subr_extent.c | 1436 | file kern/subr_extent.c | |
1436 | file kern/subr_hash.c | 1437 | file kern/subr_hash.c | |
1437 | file kern/subr_kmem.c | 1438 | file kern/subr_kmem.c | |
1438 | file kern/subr_kobj.c | 1439 | file kern/subr_kobj.c | |
1439 | file kern/subr_lockdebug.c | 1440 | file kern/subr_lockdebug.c | |
1440 | file kern/subr_log.c | 1441 | file kern/subr_log.c | |
1441 | file kern/subr_percpu.c | 1442 | file kern/subr_percpu.c | |
1442 | file kern/subr_pool.c | 1443 | file kern/subr_pool.c | |
1443 | file kern/subr_prf.c | 1444 | file kern/subr_prf.c | |
1444 | file kern/subr_prf2.c | 1445 | file kern/subr_prf2.c | |
1445 | file kern/subr_prof.c | 1446 | file kern/subr_prof.c | |
1446 | file kern/subr_once.c | 1447 | file kern/subr_once.c | |
1447 | file kern/subr_optstr.c | 1448 | file kern/subr_optstr.c | |
1448 | file kern/subr_specificdata.c | 1449 | file kern/subr_specificdata.c | |
1449 | file kern/subr_tftproot.c tftproot | 1450 | file kern/subr_tftproot.c tftproot | |
1450 | file kern/subr_time.c | 1451 | file kern/subr_time.c | |
1451 | file kern/subr_userconf.c userconf | 1452 | file kern/subr_userconf.c userconf | |
1452 | file kern/subr_vmem.c | 1453 | file kern/subr_vmem.c | |
1453 | file kern/subr_workqueue.c | 1454 | file kern/subr_workqueue.c | |
1454 | file kern/subr_xcall.c | 1455 | file kern/subr_xcall.c | |
1455 | file kern/sys_aio.c | 1456 | file kern/sys_aio.c | |
1456 | file kern/sys_descrip.c | 1457 | file kern/sys_descrip.c | |
1457 | file kern/sys_generic.c | 1458 | file kern/sys_generic.c | |
1458 | file kern/sys_module.c | 1459 | file kern/sys_module.c | |
1459 | file kern/sys_mqueue.c | 1460 | file kern/sys_mqueue.c | |
1460 | file kern/sys_lwp.c | 1461 | file kern/sys_lwp.c | |
1461 | file kern/sys_pipe.c !pipe_socketpair | 1462 | file kern/sys_pipe.c !pipe_socketpair | |
1462 | file kern/sys_pmc.c | 1463 | file kern/sys_pmc.c | |
1463 | file kern/sys_process.c ptrace | ktrace | 1464 | file kern/sys_process.c ptrace | ktrace | |
1464 | file kern/sys_pset.c | 1465 | file kern/sys_pset.c | |
1465 | file kern/sys_select.c | 1466 | file kern/sys_select.c | |
1466 | file kern/sys_sig.c | 1467 | file kern/sys_sig.c | |
1467 | file kern/sys_sched.c | 1468 | file kern/sys_sched.c | |
1468 | file kern/sys_socket.c | 1469 | file kern/sys_socket.c | |
1469 | file kern/syscalls.c syscall_debug | 1470 | file kern/syscalls.c syscall_debug | |
1470 | file kern/sysv_ipc.c sysvshm | sysvsem | sysvmsg | 1471 | file kern/sysv_ipc.c sysvshm | sysvsem | sysvmsg | |
1471 | file kern/sysv_msg.c sysvmsg | 1472 | file kern/sysv_msg.c sysvmsg | |
1472 | file kern/sysv_sem.c sysvsem | 1473 | file kern/sysv_sem.c sysvsem | |
1473 | file kern/sysv_shm.c sysvshm | 1474 | file kern/sysv_shm.c sysvshm | |
1474 | file kern/tty.c | 1475 | file kern/tty.c | |
1475 | file kern/tty_conf.c | 1476 | file kern/tty_conf.c | |
1476 | file kern/tty_bsdpty.c compat_bsdpty | 1477 | file kern/tty_bsdpty.c compat_bsdpty | |
1477 | file kern/tty_pty.c pty needs-flag | 1478 | file kern/tty_pty.c pty needs-flag | |
1478 | file kern/tty_ptm.c pty | 1479 | file kern/tty_ptm.c pty | |
1479 | file kern/tty_subr.c | 1480 | file kern/tty_subr.c | |
1480 | file kern/tty_tty.c | 1481 | file kern/tty_tty.c | |
1481 | file kern/uipc_accf.c | 1482 | file kern/uipc_accf.c | |
1482 | file kern/uipc_domain.c | 1483 | file kern/uipc_domain.c | |
1483 | file kern/uipc_mbuf.c | 1484 | file kern/uipc_mbuf.c | |
1484 | file kern/uipc_mbuf2.c | 1485 | file kern/uipc_mbuf2.c | |
1485 | file net/link_proto.c | 1486 | file net/link_proto.c | |
1486 | file kern/uipc_proto.c | 1487 | file kern/uipc_proto.c | |
1487 | file kern/uipc_sem.c p1003_1b_semaphore | 1488 | file kern/uipc_sem.c p1003_1b_semaphore | |
1488 | file kern/uipc_socket.c | 1489 | file kern/uipc_socket.c | |
1489 | file kern/uipc_socket2.c | 1490 | file kern/uipc_socket2.c | |
1490 | file kern/uipc_syscalls.c | 1491 | file kern/uipc_syscalls.c | |
1491 | file kern/uipc_usrreq.c | 1492 | file kern/uipc_usrreq.c | |
1492 | file kern/vfs_bio.c | 1493 | file kern/vfs_bio.c | |
1493 | file kern/vfs_cache.c | 1494 | file kern/vfs_cache.c | |
1494 | file kern/vfs_dirhash.c | 1495 | file kern/vfs_dirhash.c | |
1495 | file kern/vfs_getcwd.c | 1496 | file kern/vfs_getcwd.c | |
1496 | file kern/vfs_hooks.c | 1497 | file kern/vfs_hooks.c | |
1497 | file kern/vfs_init.c | 1498 | file kern/vfs_init.c | |
1498 | file kern/vfs_lockf.c | 1499 | file kern/vfs_lockf.c | |
1499 | file kern/vfs_lookup.c | 1500 | file kern/vfs_lookup.c | |
1500 | file kern/vfs_subr.c | 1501 | file kern/vfs_subr.c | |
1501 | file kern/vfs_syscalls.c | 1502 | file kern/vfs_syscalls.c | |
1502 | file kern/vfs_trans.c | 1503 | file kern/vfs_trans.c | |
1503 | file kern/vfs_vnops.c | 1504 | file kern/vfs_vnops.c | |
1504 | file kern/vfs_wapbl.c wapbl | 1505 | file kern/vfs_wapbl.c wapbl | |
1505 | file kern/vfs_xattr.c | 1506 | file kern/vfs_xattr.c | |
1506 | file kern/vnode_if.c | 1507 | file kern/vnode_if.c | |
1507 | file miscfs/deadfs/dead_vnops.c | 1508 | file miscfs/deadfs/dead_vnops.c | |
1508 | file miscfs/fifofs/fifo_vnops.c | 1509 | file miscfs/fifofs/fifo_vnops.c | |
1509 | file miscfs/genfs/genfs_io.c | 1510 | file miscfs/genfs/genfs_io.c | |
1510 | file miscfs/genfs/genfs_vfsops.c | 1511 | file miscfs/genfs/genfs_vfsops.c | |
1511 | file miscfs/genfs/genfs_vnops.c | 1512 | file miscfs/genfs/genfs_vnops.c | |
1512 | file miscfs/genfs/layer_subr.c nullfs | overlay | umapfs | lkm | 1513 | file miscfs/genfs/layer_subr.c nullfs | overlay | umapfs | lkm | |
1513 | file miscfs/genfs/layer_vfsops.c nullfs | overlay | umapfs | lkm | 1514 | file miscfs/genfs/layer_vfsops.c nullfs | overlay | umapfs | lkm | |
1514 | file miscfs/genfs/layer_vnops.c nullfs | overlay | umapfs | lkm | 1515 | file miscfs/genfs/layer_vnops.c nullfs | overlay | umapfs | lkm | |
1515 | file miscfs/specfs/spec_vnops.c | 1516 | file miscfs/specfs/spec_vnops.c | |
1516 | file miscfs/syncfs/sync_subr.c | 1517 | file miscfs/syncfs/sync_subr.c | |
1517 | file miscfs/syncfs/sync_vnops.c | 1518 | file miscfs/syncfs/sync_vnops.c | |
1518 | file net/bpf.c bpfilter needs-flag | 1519 | file net/bpf.c bpfilter needs-flag | |
1519 | file net/bpf_filter.c bpf_filter | 1520 | file net/bpf_filter.c bpf_filter | |
1520 | file net/bsd-comp.c ppp & ppp_bsdcomp | 1521 | file net/bsd-comp.c ppp & ppp_bsdcomp | |
1521 | file net/if.c | 1522 | file net/if.c | |
1522 | file net/if_arcsubr.c arcnet needs-flag | 1523 | file net/if_arcsubr.c arcnet needs-flag | |
1523 | file net/if_atmsubr.c atm | 1524 | file net/if_atmsubr.c atm | |
1524 | file net/if_bridge.c bridge needs-flag | 1525 | file net/if_bridge.c bridge needs-flag | |
1525 | file net/bridgestp.c bridge | 1526 | file net/bridgestp.c bridge | |
1526 | file net/if_ecosubr.c eco | 1527 | file net/if_ecosubr.c eco | |
1527 | file net/if_etherip.c etherip needs-flag | 1528 | file net/if_etherip.c etherip needs-flag | |
1528 | file net/if_ethersubr.c ether | fddi | netatalk | token | | 1529 | file net/if_ethersubr.c ether | fddi | netatalk | token | | |
1529 | wlan | 1530 | wlan | |
1530 | file net/if_faith.c faith & inet & inet6 needs-flag | 1531 | file net/if_faith.c faith & inet & inet6 needs-flag | |
1531 | file net/if_fddisubr.c fddi needs-flag | 1532 | file net/if_fddisubr.c fddi needs-flag | |
1532 | file net/if_gif.c gif needs-flag | 1533 | file net/if_gif.c gif needs-flag | |
1533 | file net/if_gre.c gre needs-flag | 1534 | file net/if_gre.c gre needs-flag | |
1534 | file net/if_hippisubr.c hippi needs-flag | 1535 | file net/if_hippisubr.c hippi needs-flag | |
1535 | file net/if_ieee1394subr.c ieee1394 | 1536 | file net/if_ieee1394subr.c ieee1394 | |
1536 | file net/if_loop.c loop needs-flag | 1537 | file net/if_loop.c loop needs-flag | |
1537 | file net/if_media.c | 1538 | file net/if_media.c | |
1538 | file net/if_ppp.c ppp needs-flag | 1539 | file net/if_ppp.c ppp needs-flag | |
1539 | file net/if_srt.c srt | 1540 | file net/if_srt.c srt | |
1540 | file net/if_stf.c stf & inet & inet6 needs-flag | 1541 | file net/if_stf.c stf & inet & inet6 needs-flag | |
1541 | file net/if_sl.c sl needs-flag | 1542 | file net/if_sl.c sl needs-flag | |
1542 | file net/if_spppsubr.c sppp | 1543 | file net/if_spppsubr.c sppp | |
1543 | file net/if_strip.c strip needs-flag | 1544 | file net/if_strip.c strip needs-flag | |
1544 | file net/if_tokensubr.c token needs-flag | 1545 | file net/if_tokensubr.c token needs-flag | |
1545 | file net/if_tap.c tap needs-flag | 1546 | file net/if_tap.c tap needs-flag | |
1546 | file net/if_tun.c tun needs-flag | 1547 | file net/if_tun.c tun needs-flag | |
1547 | file net/if_vlan.c vlan needs-flag | 1548 | file net/if_vlan.c vlan needs-flag | |
1548 | file net/if_pppoe.c pppoe needs-flag | 1549 | file net/if_pppoe.c pppoe needs-flag | |
1549 | file net/pfil.c pfil_hooks | ipfilter | pf | 1550 | file net/pfil.c pfil_hooks | ipfilter | pf | |
1550 | file net/ppp-deflate.c ppp & ppp_deflate | 1551 | file net/ppp-deflate.c ppp & ppp_deflate | |
1551 | file net/ppp_tty.c ppp | 1552 | file net/ppp_tty.c ppp | |
1552 | file net/net_stats.c | 1553 | file net/net_stats.c | |
1553 | file net/radix.c | 1554 | file net/radix.c | |
1554 | file net/raw_cb.c | 1555 | file net/raw_cb.c | |
1555 | file net/raw_usrreq.c | 1556 | file net/raw_usrreq.c | |
1556 | file net/route.c | 1557 | file net/route.c | |
1557 | file net/rtsock.c | 1558 | file net/rtsock.c | |
1558 | file net/slcompress.c sl | ppp | strip | (irip & irip_vj) | 1559 | file net/slcompress.c sl | ppp | strip | (irip & irip_vj) | |
1559 | file net/zlib.c (ppp & ppp_deflate) | ipsec | opencrypto | vnd_compression | 1560 | file net/zlib.c (ppp & ppp_deflate) | ipsec | opencrypto | vnd_compression | |
1560 | file netinet/accf_data.c accf_data | 1561 | file netinet/accf_data.c accf_data | |
1561 | file netinet/accf_http.c accf_http | 1562 | file netinet/accf_http.c accf_http | |
1562 | file netinet/cpu_in_cksum.c (inet | inet6) & !cpu_in_cksum | 1563 | file netinet/cpu_in_cksum.c (inet | inet6) & !cpu_in_cksum | |
1563 | file netinet/if_arp.c arp | netatalk needs-flag | 1564 | file netinet/if_arp.c arp | netatalk needs-flag | |
1564 | file netinet/if_atm.c atm | 1565 | file netinet/if_atm.c atm | |
1565 | file netinet/in4_cksum.c inet | 1566 | file netinet/in4_cksum.c inet | |
1566 | file netinet/in_cksum.c inet | 1567 | file netinet/in_cksum.c inet | |
1567 | file netinet/in_gif.c gif & inet | 1568 | file netinet/in_gif.c gif & inet | |
1568 | file netinet/ip_carp.c carp & (inet | inet6) needs-flag | 1569 | file netinet/ip_carp.c carp & (inet | inet6) needs-flag | |
1569 | file netinet/ip_ecn.c ipsec | fast_ipsec | gif | stf | 1570 | file netinet/ip_ecn.c ipsec | fast_ipsec | gif | stf | |
1570 | file netinet/ip_encap.c inet | inet6 | 1571 | file netinet/ip_encap.c inet | inet6 | |
1571 | file netinet/ip_etherip.c etherip & inet | 1572 | file netinet/ip_etherip.c etherip & inet | |
1572 | file netinet6/ip6_etherip.c etherip & inet6 | 1573 | file netinet6/ip6_etherip.c etherip & inet6 | |
1573 | file netinet6/in6_gif.c gif & inet6 | 1574 | file netinet6/in6_gif.c gif & inet6 | |
1574 | 1575 | |||
1575 | file netisdn/i4b_ctl.c isdnctl needs-flag | 1576 | file netisdn/i4b_ctl.c isdnctl needs-flag | |
1576 | file netisdn/i4b_isppp.c ippp needs-count | 1577 | file netisdn/i4b_isppp.c ippp needs-count | |
1577 | file netisdn/i4b_ipr.c irip needs-count | 1578 | file netisdn/i4b_ipr.c irip needs-count | |
1578 | file netisdn/i4b_rbch.c isdnbchan needs-count | 1579 | file netisdn/i4b_rbch.c isdnbchan needs-count | |
1579 | file netisdn/i4b_tel.c isdntel needs-count | 1580 | file netisdn/i4b_tel.c isdntel needs-count | |
1580 | file netisdn/i4b_trace.c isdntrc needs-count | 1581 | file netisdn/i4b_trace.c isdntrc needs-count | |
1581 | 1582 | |||
1582 | file netisdn/i4b_mbuf.c passive_isdn | 1583 | file netisdn/i4b_mbuf.c passive_isdn | |
1583 | file netisdn/i4b_l2.c passive_isdn | 1584 | file netisdn/i4b_l2.c passive_isdn | |
1584 | file netisdn/i4b_l2fsm.c passive_isdn | 1585 | file netisdn/i4b_l2fsm.c passive_isdn | |
1585 | file netisdn/i4b_uframe.c passive_isdn | 1586 | file netisdn/i4b_uframe.c passive_isdn | |
1586 | file netisdn/i4b_tei.c passive_isdn | 1587 | file netisdn/i4b_tei.c passive_isdn | |
1587 | file netisdn/i4b_sframe.c passive_isdn | 1588 | file netisdn/i4b_sframe.c passive_isdn | |
1588 | file netisdn/i4b_iframe.c passive_isdn | 1589 | file netisdn/i4b_iframe.c passive_isdn | |
1589 | file netisdn/i4b_l2timer.c passive_isdn | 1590 | file netisdn/i4b_l2timer.c passive_isdn | |
1590 | file netisdn/i4b_util.c passive_isdn | 1591 | file netisdn/i4b_util.c passive_isdn | |
1591 | file netisdn/i4b_lme.c passive_isdn | 1592 | file netisdn/i4b_lme.c passive_isdn | |
1592 | # Q.931 handler | 1593 | # Q.931 handler | |
1593 | file netisdn/i4b_q931.c passive_isdn | 1594 | file netisdn/i4b_q931.c passive_isdn | |
1594 | file netisdn/i4b_q932fac.c passive_isdn | 1595 | file netisdn/i4b_q932fac.c passive_isdn | |
1595 | file netisdn/i4b_l3fsm.c passive_isdn | 1596 | file netisdn/i4b_l3fsm.c passive_isdn | |
1596 | file netisdn/i4b_l3timer.c passive_isdn | 1597 | file netisdn/i4b_l3timer.c passive_isdn | |
1597 | file netisdn/i4b_l2if.c passive_isdn | 1598 | file netisdn/i4b_l2if.c passive_isdn | |
1598 | file netisdn/i4b_l4if.c passive_isdn | 1599 | file netisdn/i4b_l4if.c passive_isdn | |
1599 | # isdn device driver, interface to isdnd | 1600 | # isdn device driver, interface to isdnd | |
1600 | file netisdn/i4b_i4bdrv.c isdn needs-flag | 1601 | file netisdn/i4b_i4bdrv.c isdn needs-flag | |
1601 | file netisdn/i4b_l4.c isdndev needs-flag | 1602 | file netisdn/i4b_l4.c isdndev needs-flag | |
1602 | file netisdn/i4b_l4mgmt.c isdndev needs-flag | 1603 | file netisdn/i4b_l4mgmt.c isdndev needs-flag | |
1603 | file netisdn/i4b_l4timer.c isdndev needs-flag | 1604 | file netisdn/i4b_l4timer.c isdndev needs-flag | |
1604 | # capi | 1605 | # capi | |
1605 | file netisdn/i4b_capi_l4if.c isdncapi | 1606 | file netisdn/i4b_capi_l4if.c isdncapi | |
1606 | file netisdn/i4b_capi_llif.c isdncapi | 1607 | file netisdn/i4b_capi_llif.c isdncapi | |
1607 | file netisdn/i4b_capi_msgs.c isdncapi | 1608 | file netisdn/i4b_capi_msgs.c isdncapi | |
1608 | 1609 | |||
1609 | # Game adapter (joystick) | 1610 | # Game adapter (joystick) | |
1610 | device joy | 1611 | device joy | |
1611 | file dev/ic/joy.c joy needs-flag | 1612 | file dev/ic/joy.c joy needs-flag | |
1612 | 1613 | |||
1613 | include "net/agr/files.agr" | 1614 | include "net/agr/files.agr" | |
1614 | 1615 | |||
1615 | # | 1616 | # | |
1616 | # General Purpose Input/Output framework | 1617 | # General Purpose Input/Output framework | |
1617 | # | 1618 | # | |
1618 | define onewire_bitbang | 1619 | define onewire_bitbang | |
1619 | include "dev/gpio/files.gpio" | 1620 | include "dev/gpio/files.gpio" | |
1620 | 1621 | |||
1621 | include "dev/onewire/files.onewire" | 1622 | include "dev/onewire/files.onewire" | |
1622 | 1623 | |||
1623 | # | 1624 | # | |
1624 | # Pseudo audio device | 1625 | # Pseudo audio device | |
1625 | # | 1626 | # | |
1626 | include "dev/pad/files.pad" | 1627 | include "dev/pad/files.pad" | |
1627 | 1628 | |||
1628 | # | 1629 | # | |
1629 | # Intel 386 Real Mode emulator | 1630 | # Intel 386 Real Mode emulator | |
1630 | # | 1631 | # | |
1631 | include "lib/libx86emu/files.x86emu" | 1632 | include "lib/libx86emu/files.x86emu" | |
1632 | 1633 | |||
1633 | # | 1634 | # | |
1634 | # "tprof" profiler. | 1635 | # "tprof" profiler. | |
1635 | # | 1636 | # | |
1636 | include "dev/tprof/files.tprof" | 1637 | include "dev/tprof/files.tprof" |
--- 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 | |||
235 | extern struct proc proc0; | 235 | extern struct proc proc0; | |
236 | extern struct lwp lwp0; | 236 | extern struct lwp lwp0; | |
237 | extern struct cwdinfo cwdi0; | 237 | extern struct cwdinfo cwdi0; | |
238 | extern time_t rootfstime; | 238 | extern time_t rootfstime; | |
239 | 239 | |||
240 | #ifndef curlwp | 240 | #ifndef curlwp | |
241 | struct lwp *curlwp = &lwp0; | 241 | struct lwp *curlwp = &lwp0; | |
242 | #endif | 242 | #endif | |
243 | struct proc *initproc; | 243 | struct proc *initproc; | |
244 | 244 | |||
245 | struct vnode *rootvp, *swapdev_vp; | 245 | struct vnode *rootvp, *swapdev_vp; | |
246 | int boothowto; | 246 | int boothowto; | |
247 | int cold = 1; /* still working on startup */ | 247 | int cold = 1; /* still working on startup */ | |
248 | struct timeval boottime; /* time at system startup - will only follow settime deltas */ | 248 | struct timeval boottime; /* time at system startup - will only follow settime deltas */ | |
249 | 249 | |||
250 | int start_init_exec; /* semaphore for start_init() */ | 250 | int start_init_exec; /* semaphore for start_init() */ | |
251 | 251 | |||
252 | static void check_console(struct lwp *l); | 252 | static void check_console(struct lwp *l); | |
253 | static void start_init(void *); | 253 | static void start_init(void *); | |
254 | void main(void); | 254 | void main(void); | |
255 | void ssp_init(void); | |||
256 | ||||
257 | #if defined(__SSP__) || defined(__SSP_ALL__) | |||
258 | long __stack_chk_guard[8] = {0, 0, 0, 0, 0, 0, 0, 0}; | |||
259 | void __stack_chk_fail(void); | |||
260 | ||||
261 | void | |||
262 | __stack_chk_fail(void) | |||
263 | { | |||
264 | panic("stack overflow detected; terminated"); | |||
265 | } | |||
266 | ||||
267 | void | |||
268 | ssp_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 | |||
295 | void | |||
296 | ssp_init(void) | |||
297 | { | |||
298 | ||||
299 | } | |||
300 | #endif | |||
301 | 255 | |||
302 | void __secmodel_none(void); | 256 | void __secmodel_none(void); | |
303 | __weak_alias(secmodel_start,__secmodel_none); | 257 | __weak_alias(secmodel_start,__secmodel_none); | |
304 | void | 258 | void | |
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 | */ | |
316 | void | 270 | void | |
317 | main(void) | 271 | main(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 | |||
719 | static void | 677 | static void | |
720 | check_console(struct lwp *l) | 678 | check_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 | */ | |
738 | static const char * const initpaths[] = { | 696 | static 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 | */ | |
749 | static void | 707 | static void | |
750 | start_init(void *arg) | 708 | start_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 | */ | |
923 | vaddr_t | 881 | vaddr_t | |
924 | calc_cache_size(struct vm_map *map, int pct, int va_pct) | 882 | calc_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 | } |
/* $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
--- 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> | |
125 | extern struct splash_progress *splash_progress_state; | 125 | extern 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 | |||
133 | typedef struct pmf_private { | 133 | typedef 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 | */ | |
145 | extern struct cfdata cfdata[]; | 145 | extern struct cfdata cfdata[]; | |
146 | extern const short cfroots[]; | 146 | extern 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 | */ | |
152 | struct cfdriverlist allcfdrivers = LIST_HEAD_INITIALIZER(&allcfdrivers); | 152 | struct cfdriverlist allcfdrivers = LIST_HEAD_INITIALIZER(&allcfdrivers); | |
153 | extern struct cfdriver * const cfdriver_list_initial[]; | 153 | extern struct cfdriver * const cfdriver_list_initial[]; | |
154 | 154 | |||
155 | /* | 155 | /* | |
156 | * Initial list of cfattach's. | 156 | * Initial list of cfattach's. | |
157 | */ | 157 | */ | |
158 | extern const struct cfattachinit cfattachinit[]; | 158 | extern 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 | */ | |
164 | struct cftablelist allcftables = TAILQ_HEAD_INITIALIZER(allcftables); | 164 | struct cftablelist allcftables = TAILQ_HEAD_INITIALIZER(allcftables); | |
165 | static struct cftable initcftable; | 165 | static struct cftable initcftable; | |
166 | 166 | |||
167 | #define ROOT ((device_t)NULL) | 167 | #define ROOT ((device_t)NULL) | |
168 | 168 | |||
169 | struct matchinfo { | 169 | struct 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 | |||
178 | static char *number(char *, int); | 178 | static char *number(char *, int); | |
179 | static void mapply(struct matchinfo *, cfdata_t); | 179 | static void mapply(struct matchinfo *, cfdata_t); | |
180 | static device_t config_devalloc(const device_t, const cfdata_t, const int *); | 180 | static device_t config_devalloc(const device_t, const cfdata_t, const int *); | |
181 | static void config_devdealloc(device_t); | 181 | static void config_devdealloc(device_t); | |
182 | static void config_makeroom(int, struct cfdriver *); | 182 | static void config_makeroom(int, struct cfdriver *); | |
183 | static void config_devlink(device_t); | 183 | static void config_devlink(device_t); | |
184 | static void config_devunlink(device_t); | 184 | static void config_devunlink(device_t); | |
185 | 185 | |||
186 | static void pmflock_debug(device_t, const char *, int); | 186 | static void pmflock_debug(device_t, const char *, int); | |
187 | static void pmflock_debug_with_flags(device_t, const char *, int PMF_FN_PROTO); | 187 | static void pmflock_debug_with_flags(device_t, const char *, int PMF_FN_PROTO); | |
188 | 188 | |||
189 | static device_t deviter_next1(deviter_t *); | 189 | static device_t deviter_next1(deviter_t *); | |
190 | static void deviter_reinit(deviter_t *); | 190 | static void deviter_reinit(deviter_t *); | |
191 | 191 | |||
192 | struct deferred_config { | 192 | struct 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 | |||
198 | TAILQ_HEAD(deferred_config_head, deferred_config); | 198 | TAILQ_HEAD(deferred_config_head, deferred_config); | |
199 | 199 | |||
200 | struct deferred_config_head deferred_config_queue = | 200 | struct deferred_config_head deferred_config_queue = | |
201 | TAILQ_HEAD_INITIALIZER(deferred_config_queue); | 201 | TAILQ_HEAD_INITIALIZER(deferred_config_queue); | |
202 | struct deferred_config_head interrupt_config_queue = | 202 | struct deferred_config_head interrupt_config_queue = | |
203 | TAILQ_HEAD_INITIALIZER(interrupt_config_queue); | 203 | TAILQ_HEAD_INITIALIZER(interrupt_config_queue); | |
204 | int interrupt_config_threads = 8; | 204 | int interrupt_config_threads = 8; | |
205 | 205 | |||
206 | static void config_process_deferred(struct deferred_config_head *, device_t); | 206 | static 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. */ | |
209 | struct finalize_hook { | 209 | struct 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 | }; | |
214 | static TAILQ_HEAD(, finalize_hook) config_finalize_list = | 214 | static TAILQ_HEAD(, finalize_hook) config_finalize_list = | |
215 | TAILQ_HEAD_INITIALIZER(config_finalize_list); | 215 | TAILQ_HEAD_INITIALIZER(config_finalize_list); | |
216 | static int config_finalize_done; | 216 | static int config_finalize_done; | |
217 | 217 | |||
218 | /* list of all devices */ | 218 | /* list of all devices */ | |
219 | struct devicelist alldevs = TAILQ_HEAD_INITIALIZER(alldevs); | 219 | struct devicelist alldevs = TAILQ_HEAD_INITIALIZER(alldevs); | |
220 | kcondvar_t alldevs_cv; | 220 | kcondvar_t alldevs_cv; | |
221 | kmutex_t alldevs_mtx; | 221 | kmutex_t alldevs_mtx; | |
222 | static int alldevs_nread = 0; | 222 | static int alldevs_nread = 0; | |
223 | static int alldevs_nwrite = 0; | 223 | static int alldevs_nwrite = 0; | |
224 | static lwp_t *alldevs_writer = NULL; | 224 | static lwp_t *alldevs_writer = NULL; | |
225 | 225 | |||
226 | static int config_pending; /* semaphore for mountroot */ | 226 | static int config_pending; /* semaphore for mountroot */ | |
227 | static kmutex_t config_misc_lock; | 227 | static kmutex_t config_misc_lock; | |
228 | static kcondvar_t config_misc_cv; | 228 | static 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 | |||
233 | static int config_initialized; /* config_init() has been called. */ | 233 | static int config_initialized; /* config_init() has been called. */ | |
234 | 234 | |||
235 | static int config_do_twiddle; | 235 | static int config_do_twiddle; | |
236 | 236 | |||
237 | struct vnode * | 237 | struct vnode * | |
238 | opendisk(struct device *dv) | 238 | opendisk(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 | |||
280 | int | 280 | int | |
281 | config_handle_wedges(struct device *dv, int par) | 281 | config_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 | */ | |
348 | void | 348 | void | |
349 | config_init(void) | 349 | config_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 | |||
387 | void | 387 | void | |
388 | config_deferred(device_t dev) | 388 | config_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 | |||
394 | static void | 394 | static void | |
395 | config_interrupts_thread(void *cookie) | 395 | config_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 | */ | |
411 | void | 411 | void | |
412 | configure(void) | 412 | configure(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. */ | 440 | void | |
445 | ssp_init(); | 441 | configure2(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 | */ | |
487 | static void | 487 | static void | |
488 | devmon_report_device(device_t dev, bool isattach) | 488 | devmon_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 | */ | |
515 | int | 515 | int | |
516 | config_cfdriver_attach(struct cfdriver *cd) | 516 | config_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 | */ | |
535 | int | 535 | int | |
536 | config_cfdriver_detach(struct cfdriver *cd) | 536 | config_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 | */ | |
560 | struct cfdriver * | 560 | struct cfdriver * | |
561 | config_cfdriver_lookup(const char *name) | 561 | config_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 | */ | |
576 | int | 576 | int | |
577 | config_cfattach_attach(const char *driver, struct cfattach *ca) | 577 | config_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 | */ | |
600 | int | 600 | int | |
601 | config_cfattach_detach(const char *driver, struct cfattach *ca) | 601 | config_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 | */ | |
627 | static struct cfattach * | 627 | static struct cfattach * | |
628 | config_cfattach_lookup_cd(struct cfdriver *cd, const char *atname) | 628 | config_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 | */ | |
643 | struct cfattach * | 643 | struct cfattach * | |
644 | config_cfattach_lookup(const char *name, const char *atname) | 644 | config_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 | */ | |
659 | static void | 659 | static void | |
660 | mapply(struct matchinfo *m, cfdata_t cf) | 660 | mapply(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 | |||
675 | int | 675 | int | |
676 | config_stdsubmatch(device_t parent, cfdata_t cf, const int *locs, void *aux) | 676 | config_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 | */ | |
702 | static const struct cfiattrdata * | 702 | static const struct cfiattrdata * | |
703 | cfdriver_get_iattr(const struct cfdriver *cd, const char *ia) | 703 | cfdriver_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 | */ | |
723 | const struct cfiattrdata * | 723 | const struct cfiattrdata * | |
724 | cfiattr_lookup(const char *name, const struct cfdriver *cd) | 724 | cfiattr_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 | */ | |
744 | static int | 744 | static int | |
745 | cfparent_match(const device_t parent, const struct cfparent *cfp) | 745 | cfparent_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 | */ | |
791 | static void | 791 | static void | |
792 | rescan_with_cfdata(const struct cfdata *cf) | 792 | rescan_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 | */ | |
824 | int | 824 | int | |
825 | config_cfdata_attach(cfdata_t cf, int scannow) | 825 | config_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 | */ | |
843 | static int | 843 | static int | |
844 | dev_in_cfdata(const struct device *d, const struct cfdata *cf) | 844 | dev_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 | */ | |
859 | int | 859 | int | |
860 | config_cfdata_detach(cfdata_t cf) | 860 | config_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 | */ | |
896 | int | 896 | int | |
897 | config_match(device_t parent, cfdata_t cf, void *aux) | 897 | config_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 | */ | |
921 | cfdata_t | 921 | cfdata_t | |
922 | config_search_loc(cfsubmatch_t fn, device_t parent, | 922 | config_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 | |||
972 | cfdata_t | 972 | cfdata_t | |
973 | config_search_ia(cfsubmatch_t fn, device_t parent, const char *ifattr, | 973 | config_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 | */ | |
986 | cfdata_t | 986 | cfdata_t | |
987 | config_rootsearch(cfsubmatch_t fn, const char *rootname, void *aux) | 987 | config_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 | |||
1012 | static const char * const msgs[3] = { "", " not configured\n", " unsupported\n" }; | 1012 | static 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 | */ | |
1022 | device_t | 1022 | device_t | |
1023 | config_found_sm_loc(device_t parent, | 1023 | config_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 | |||
1050 | device_t | 1050 | device_t | |
1051 | config_found_ia(device_t parent, const char *ifattr, void *aux, | 1051 | config_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 | |||
1058 | device_t | 1058 | device_t | |
1059 | config_found(device_t parent, void *aux, cfprint_t print) | 1059 | config_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 | */ | |
1068 | device_t | 1068 | device_t | |
1069 | config_rootfound(const char *rootname, void *aux) | 1069 | config_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 */ | |
1080 | static char * | 1080 | static char * | |
1081 | number(char *ep, int n) | 1081 | number(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 | */ | |
1096 | static void | 1096 | static void | |
1097 | config_makeroom(int n, struct cfdriver *cd) | 1097 | config_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 | |||
1129 | static void | 1129 | static void | |
1130 | config_devlink(device_t dev) | 1130 | config_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 | |||
1152 | static void | 1152 | static void | |
1153 | config_devunlink(device_t dev) | 1153 | config_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 | |||
1177 | static device_t | 1177 | static device_t | |
1178 | config_devalloc(const device_t parent, const cfdata_t cf, const int *locs) | 1178 | config_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 | |||
1284 | static void | 1284 | static void | |
1285 | config_devdealloc(device_t dev) | 1285 | config_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 | */ | |
1309 | device_t | 1309 | device_t | |
1310 | config_attach_loc(device_t parent, cfdata_t cf, | 1310 | config_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 | |||
1403 | device_t | 1403 | device_t | |
1404 | config_attach(device_t parent, cfdata_t cf, void *aux, cfprint_t print) | 1404 | config_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 | */ | |
1419 | device_t | 1419 | device_t | |
1420 | config_attach_pseudo(cfdata_t cf) | 1420 | config_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 |
--- 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 | |||
83 | typedef struct device *device_t; | 83 | typedef 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 | */ | |
94 | typedef enum devclass { | 94 | typedef 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 | */ | |
109 | typedef enum devact { | 109 | typedef 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 | |||
114 | typedef enum { | 114 | typedef enum { | |
115 | DVA_SYSTEM, | 115 | DVA_SYSTEM, | |
116 | DVA_HARDWARE | 116 | DVA_HARDWARE | |
117 | } devactive_t; | 117 | } devactive_t; | |
118 | 118 | |||
119 | typedef struct cfdata *cfdata_t; | 119 | typedef struct cfdata *cfdata_t; | |
120 | typedef struct cfdriver *cfdriver_t; | 120 | typedef struct cfdriver *cfdriver_t; | |
121 | typedef struct cfattach *cfattach_t; | 121 | typedef struct cfattach *cfattach_t; | |
122 | 122 | |||
123 | struct device { | 123 | struct 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 | |||
171 | TAILQ_HEAD(devicelist, device); | 171 | TAILQ_HEAD(devicelist, device); | |
172 | 172 | |||
173 | enum deviter_flags { | 173 | enum 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 | |||
180 | typedef enum deviter_flags deviter_flags_t; | 180 | typedef enum deviter_flags deviter_flags_t; | |
181 | 181 | |||
182 | struct deviter { | 182 | struct 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 | |||
189 | typedef struct deviter deviter_t; | 189 | typedef 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 | */ | |
194 | struct cflocdesc { | 194 | struct 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 | */ | |
204 | struct cfiattrdata { | 204 | struct 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 | */ | |
220 | struct cfparent { | 220 | struct 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 | */ | |
230 | struct cfdata { | 230 | struct 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 | */ | |
249 | struct cftable { | 249 | struct 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 | }; | |
253 | TAILQ_HEAD(cftablelist, cftable); | 253 | TAILQ_HEAD(cftablelist, cftable); | |
254 | 254 | |||
255 | typedef int (*cfsubmatch_t)(device_t, cfdata_t, const int *, void *); | 255 | typedef 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 | */ | |
272 | struct cfattach { | 272 | struct 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 | }; | |
286 | LIST_HEAD(cfattachlist, cfattach); | 286 | LIST_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) \ | |
290 | struct cfattach __CONCAT(name,_ca) = { \ | 290 | struct 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) \ | |
306 | struct cfattach __CONCAT(name,_ca) = { \ | 306 | struct 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 | |||
325 | struct cfdriver { | 325 | struct 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 | }; | |
334 | LIST_HEAD(cfdriverlist, cfdriver); | 334 | LIST_HEAD(cfdriverlist, cfdriver); | |
335 | 335 | |||
336 | #define CFDRIVER_DECL(name, class, attrs) \ | 336 | #define CFDRIVER_DECL(name, class, attrs) \ | |
337 | struct cfdriver __CONCAT(name,_cd) = { \ | 337 | struct 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 | */ | |
347 | struct cfattachinit { | 347 | struct 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 | */ | |
355 | struct cfattachlkminit { | 355 | struct 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 | */ | |
366 | typedef int (*cfprint_t)(void *, const char *); /* XXX const char * */ | 366 | typedef 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 | */ | |
374 | struct pdevinit { | 374 | struct 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 | |||
384 | extern struct cfdriverlist allcfdrivers;/* list of all cfdrivers */ | 384 | extern struct cfdriverlist allcfdrivers;/* list of all cfdrivers */ | |
385 | extern struct devicelist alldevs; /* list of all devices */ | 385 | extern struct devicelist alldevs; /* list of all devices */ | |
386 | extern struct cftablelist allcftables; /* list of all cfdata tables */ | 386 | extern struct cftablelist allcftables; /* list of all cfdata tables */ | |
387 | extern device_t booted_device; /* the device we booted from */ | 387 | extern device_t booted_device; /* the device we booted from */ | |
388 | extern device_t booted_wedge; /* the wedge on that device */ | 388 | extern device_t booted_wedge; /* the wedge on that device */ | |
389 | extern int booted_partition; /* or the partition on that device */ | 389 | extern int booted_partition; /* or the partition on that device */ | |
390 | 390 | |||
391 | struct vnode *opendisk(struct device *); | 391 | struct vnode *opendisk(struct device *); | |
392 | int config_handle_wedges(struct device *, int); | 392 | int config_handle_wedges(struct device *, int); | |
393 | 393 | |||
394 | void config_init(void); | 394 | void config_init(void); | |
395 | void drvctl_init(void); | 395 | void drvctl_init(void); | |
396 | void configure(void); | 396 | void configure(void); | |
397 | void configure2(void); | |||
397 | 398 | |||
398 | int config_cfdriver_attach(struct cfdriver *); | 399 | int config_cfdriver_attach(struct cfdriver *); | |
399 | int config_cfdriver_detach(struct cfdriver *); | 400 | int config_cfdriver_detach(struct cfdriver *); | |
400 | 401 | |||
401 | int config_cfattach_attach(const char *, struct cfattach *); | 402 | int config_cfattach_attach(const char *, struct cfattach *); | |
402 | int config_cfattach_detach(const char *, struct cfattach *); | 403 | int config_cfattach_detach(const char *, struct cfattach *); | |
403 | 404 | |||
404 | int config_cfdata_attach(cfdata_t, int); | 405 | int config_cfdata_attach(cfdata_t, int); | |
405 | int config_cfdata_detach(cfdata_t); | 406 | int config_cfdata_detach(cfdata_t); | |
406 | 407 | |||
407 | struct cfdriver *config_cfdriver_lookup(const char *); | 408 | struct cfdriver *config_cfdriver_lookup(const char *); | |
408 | struct cfattach *config_cfattach_lookup(const char *, const char *); | 409 | struct cfattach *config_cfattach_lookup(const char *, const char *); | |
409 | const struct cfiattrdata *cfiattr_lookup(const char *, const struct cfdriver *); | 410 | const struct cfiattrdata *cfiattr_lookup(const char *, const struct cfdriver *); | |
410 | 411 | |||
411 | int config_stdsubmatch(device_t, cfdata_t, const int *, void *); | 412 | int config_stdsubmatch(device_t, cfdata_t, const int *, void *); | |
412 | cfdata_t config_search_loc(cfsubmatch_t, device_t, | 413 | cfdata_t config_search_loc(cfsubmatch_t, device_t, | |
413 | const char *, const int *, void *); | 414 | const char *, const int *, void *); | |
414 | cfdata_t config_search_ia(cfsubmatch_t, device_t, | 415 | cfdata_t config_search_ia(cfsubmatch_t, device_t, | |
415 | const char *, void *); | 416 | const char *, void *); | |
416 | cfdata_t config_rootsearch(cfsubmatch_t, const char *, void *); | 417 | cfdata_t config_rootsearch(cfsubmatch_t, const char *, void *); | |
417 | device_t config_found_sm_loc(device_t, const char *, const int *, | 418 | device_t config_found_sm_loc(device_t, const char *, const int *, | |
418 | void *, cfprint_t, cfsubmatch_t); | 419 | void *, cfprint_t, cfsubmatch_t); | |
419 | device_t config_found_ia(device_t, const char *, void *, cfprint_t); | 420 | device_t config_found_ia(device_t, const char *, void *, cfprint_t); | |
420 | device_t config_found(device_t, void *, cfprint_t); | 421 | device_t config_found(device_t, void *, cfprint_t); | |
421 | device_t config_rootfound(const char *, void *); | 422 | device_t config_rootfound(const char *, void *); | |
422 | device_t config_attach_loc(device_t, cfdata_t, const int *, void *, cfprint_t); | 423 | device_t config_attach_loc(device_t, cfdata_t, const int *, void *, cfprint_t); | |
423 | device_t config_attach(device_t, cfdata_t, void *, cfprint_t); | 424 | device_t config_attach(device_t, cfdata_t, void *, cfprint_t); | |
424 | int config_match(device_t, cfdata_t, void *); | 425 | int config_match(device_t, cfdata_t, void *); | |
425 | 426 | |||
426 | device_t config_attach_pseudo(cfdata_t); | 427 | device_t config_attach_pseudo(cfdata_t); | |
427 | 428 | |||
428 | int config_detach(device_t, int); | 429 | int config_detach(device_t, int); | |
429 | int config_detach_children(device_t, int flags); | 430 | int config_detach_children(device_t, int flags); | |
430 | int config_activate(device_t); | 431 | int config_activate(device_t); | |
431 | int config_deactivate(device_t); | 432 | int config_deactivate(device_t); | |
432 | void config_defer(device_t, void (*)(device_t)); | 433 | void config_defer(device_t, void (*)(device_t)); | |
433 | void config_deferred(device_t); | 434 | void config_deferred(device_t); | |
434 | void config_interrupts(device_t, void (*)(device_t)); | 435 | void config_interrupts(device_t, void (*)(device_t)); | |
435 | void config_pending_incr(void); | 436 | void config_pending_incr(void); | |
436 | void config_pending_decr(void); | 437 | void config_pending_decr(void); | |
437 | 438 | |||
438 | int config_finalize_register(device_t, int (*)(device_t)); | 439 | int config_finalize_register(device_t, int (*)(device_t)); | |
439 | void config_finalize(void); | 440 | void config_finalize(void); | |
440 | 441 | |||
441 | device_t device_lookup(cfdriver_t, int); | 442 | device_t device_lookup(cfdriver_t, int); | |
442 | void *device_lookup_private(cfdriver_t, int); | 443 | void *device_lookup_private(cfdriver_t, int); | |
443 | #ifdef __HAVE_DEVICE_REGISTER | 444 | #ifdef __HAVE_DEVICE_REGISTER | |
444 | void device_register(device_t, void *); | 445 | void device_register(device_t, void *); | |
445 | #endif | 446 | #endif | |
446 | 447 | |||
447 | devclass_t device_class(device_t); | 448 | devclass_t device_class(device_t); | |
448 | cfdata_t device_cfdata(device_t); | 449 | cfdata_t device_cfdata(device_t); | |
449 | cfdriver_t device_cfdriver(device_t); | 450 | cfdriver_t device_cfdriver(device_t); | |
450 | cfattach_t device_cfattach(device_t); | 451 | cfattach_t device_cfattach(device_t); | |
451 | int device_unit(device_t); | 452 | int device_unit(device_t); | |
452 | const char *device_xname(device_t); | 453 | const char *device_xname(device_t); | |
453 | device_t device_parent(device_t); | 454 | device_t device_parent(device_t); | |
454 | bool device_is_active(device_t); | 455 | bool device_is_active(device_t); | |
455 | bool device_is_enabled(device_t); | 456 | bool device_is_enabled(device_t); | |
456 | bool device_has_power(device_t); | 457 | bool device_has_power(device_t); | |
457 | int device_locator(device_t, u_int); | 458 | int device_locator(device_t, u_int); | |
458 | void *device_private(device_t); | 459 | void *device_private(device_t); | |
459 | prop_dictionary_t device_properties(device_t); | 460 | prop_dictionary_t device_properties(device_t); | |
460 | 461 | |||
461 | device_t deviter_first(deviter_t *, deviter_flags_t); | 462 | device_t deviter_first(deviter_t *, deviter_flags_t); | |
462 | void deviter_init(deviter_t *, deviter_flags_t); | 463 | void deviter_init(deviter_t *, deviter_flags_t); | |
463 | device_t deviter_next(deviter_t *); | 464 | device_t deviter_next(deviter_t *); | |
464 | void deviter_release(deviter_t *); | 465 | void deviter_release(deviter_t *); | |
465 | 466 | |||
466 | bool device_active(device_t, devactive_t); | 467 | bool device_active(device_t, devactive_t); | |
467 | bool device_active_register(device_t, | 468 | bool device_active_register(device_t, | |
468 | void (*)(device_t, devactive_t)); | 469 | void (*)(device_t, devactive_t)); | |
469 | void device_active_deregister(device_t, | 470 | void device_active_deregister(device_t, | |
470 | void (*)(device_t, devactive_t)); | 471 | void (*)(device_t, devactive_t)); | |
471 | 472 | |||
472 | bool device_is_a(device_t, const char *); | 473 | bool device_is_a(device_t, const char *); | |
473 | 474 | |||
474 | device_t device_find_by_xname(const char *); | 475 | device_t device_find_by_xname(const char *); | |
475 | device_t device_find_by_driver_unit(const char *, int); | 476 | device_t device_find_by_driver_unit(const char *, int); | |
476 | 477 | |||
477 | bool device_pmf_is_registered(device_t); | 478 | bool device_pmf_is_registered(device_t); | |
478 | 479 | |||
479 | bool device_pmf_driver_suspend(device_t PMF_FN_PROTO); | 480 | bool device_pmf_driver_suspend(device_t PMF_FN_PROTO); | |
480 | bool device_pmf_driver_resume(device_t PMF_FN_PROTO); | 481 | bool device_pmf_driver_resume(device_t PMF_FN_PROTO); | |
481 | bool device_pmf_driver_shutdown(device_t, int); | 482 | bool device_pmf_driver_shutdown(device_t, int); | |
482 | 483 | |||
483 | bool device_pmf_driver_register(device_t, | 484 | bool 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)); | |
487 | void device_pmf_driver_deregister(device_t); | 488 | void device_pmf_driver_deregister(device_t); | |
488 | 489 | |||
489 | bool device_pmf_driver_child_register(device_t); | 490 | bool device_pmf_driver_child_register(device_t); | |
490 | void device_pmf_driver_set_child_register(device_t, | 491 | void device_pmf_driver_set_child_register(device_t, | |
491 | bool (*)(device_t)); | 492 | bool (*)(device_t)); | |
492 | 493 | |||
493 | void *device_pmf_bus_private(device_t); | 494 | void *device_pmf_bus_private(device_t); | |
494 | bool device_pmf_bus_suspend(device_t PMF_FN_PROTO); | 495 | bool device_pmf_bus_suspend(device_t PMF_FN_PROTO); | |
495 | bool device_pmf_bus_resume(device_t PMF_FN_PROTO); | 496 | bool device_pmf_bus_resume(device_t PMF_FN_PROTO); | |
496 | bool device_pmf_bus_shutdown(device_t, int); | 497 | bool device_pmf_bus_shutdown(device_t, int); | |
497 | 498 | |||
498 | void *device_pmf_private(device_t); | 499 | void *device_pmf_private(device_t); | |
499 | void device_pmf_unlock(device_t PMF_FN_PROTO); | 500 | void device_pmf_unlock(device_t PMF_FN_PROTO); | |
500 | bool device_pmf_lock(device_t PMF_FN_PROTO); | 501 | bool device_pmf_lock(device_t PMF_FN_PROTO); | |
501 | 502 | |||
502 | bool device_is_self_suspended(device_t); | 503 | bool device_is_self_suspended(device_t); | |
503 | void device_pmf_self_suspend(device_t PMF_FN_PROTO); | 504 | void device_pmf_self_suspend(device_t PMF_FN_PROTO); | |
504 | void device_pmf_self_resume(device_t PMF_FN_PROTO); | 505 | void device_pmf_self_resume(device_t PMF_FN_PROTO); | |
505 | bool device_pmf_self_wait(device_t PMF_FN_PROTO); | 506 | bool device_pmf_self_wait(device_t PMF_FN_PROTO); | |
506 | 507 | |||
507 | void device_pmf_bus_register(device_t, void *, | 508 | void 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)); | |
512 | void device_pmf_bus_deregister(device_t); | 513 | void device_pmf_bus_deregister(device_t); | |
513 | 514 | |||
514 | void *device_pmf_class_private(device_t); | 515 | void *device_pmf_class_private(device_t); | |
515 | bool device_pmf_class_suspend(device_t PMF_FN_PROTO); | 516 | bool device_pmf_class_suspend(device_t PMF_FN_PROTO); | |
516 | bool device_pmf_class_resume(device_t PMF_FN_PROTO); | 517 | bool device_pmf_class_resume(device_t PMF_FN_PROTO); | |
517 | 518 | |||
518 | void device_pmf_class_register(device_t, void *, | 519 | void 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)); | |
522 | void device_pmf_class_deregister(device_t); | 523 | void 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_ */ |
--- 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 | |||
53 | struct clockframe; | 53 | struct clockframe; | |
54 | struct device; | 54 | struct device; | |
55 | struct lwp; | 55 | struct lwp; | |
56 | struct proc; | 56 | struct proc; | |
57 | struct timeval; | 57 | struct timeval; | |
58 | struct tty; | 58 | struct tty; | |
59 | struct uio; | 59 | struct uio; | |
60 | struct vnode; | 60 | struct vnode; | |
61 | struct vmspace; | 61 | struct vmspace; | |
62 | struct vm_map; | 62 | struct vm_map; | |
63 | 63 | |||
64 | extern const char *panicstr; /* panic message */ | 64 | extern const char *panicstr; /* panic message */ | |
65 | extern int doing_shutdown; /* shutting down */ | 65 | extern int doing_shutdown; /* shutting down */ | |
66 | 66 | |||
67 | extern const char copyright[]; /* system copyright */ | 67 | extern const char copyright[]; /* system copyright */ | |
68 | extern char cpu_model[]; /* machine/cpu model name */ | 68 | extern char cpu_model[]; /* machine/cpu model name */ | |
69 | extern char machine[]; /* machine type */ | 69 | extern char machine[]; /* machine type */ | |
70 | extern char machine_arch[]; /* machine architecture */ | 70 | extern char machine_arch[]; /* machine architecture */ | |
71 | extern const char osrelease[]; /* short system version */ | 71 | extern const char osrelease[]; /* short system version */ | |
72 | extern const char ostype[]; /* system type */ | 72 | extern const char ostype[]; /* system type */ | |
73 | extern const char kernel_ident[];/* kernel configuration ID */ | 73 | extern const char kernel_ident[];/* kernel configuration ID */ | |
74 | extern const char version[]; /* system version */ | 74 | extern const char version[]; /* system version */ | |
75 | 75 | |||
76 | extern int autonicetime; /* time (in seconds) before autoniceval */ | 76 | extern int autonicetime; /* time (in seconds) before autoniceval */ | |
77 | extern int autoniceval; /* proc priority after autonicetime */ | 77 | extern int autoniceval; /* proc priority after autonicetime */ | |
78 | 78 | |||
79 | extern int selwait; /* select timeout address */ | 79 | extern int selwait; /* select timeout address */ | |
80 | 80 | |||
81 | extern int maxmem; /* max memory per process */ | 81 | extern int maxmem; /* max memory per process */ | |
82 | extern int physmem; /* physical memory */ | 82 | extern int physmem; /* physical memory */ | |
83 | 83 | |||
84 | extern dev_t dumpdev; /* dump device */ | 84 | extern dev_t dumpdev; /* dump device */ | |
85 | extern dev_t dumpcdev; /* dump device (character equivalent) */ | 85 | extern dev_t dumpcdev; /* dump device (character equivalent) */ | |
86 | extern long dumplo; /* offset into dumpdev */ | 86 | extern long dumplo; /* offset into dumpdev */ | |
87 | extern int dumpsize; /* size of dump in pages */ | 87 | extern int dumpsize; /* size of dump in pages */ | |
88 | extern const char *dumpspec; /* how dump device was specified */ | 88 | extern const char *dumpspec; /* how dump device was specified */ | |
89 | 89 | |||
90 | extern dev_t rootdev; /* root device */ | 90 | extern dev_t rootdev; /* root device */ | |
91 | extern struct vnode *rootvp; /* vnode equivalent to above */ | 91 | extern struct vnode *rootvp; /* vnode equivalent to above */ | |
92 | extern struct device *root_device; /* device equivalent to above */ | 92 | extern struct device *root_device; /* device equivalent to above */ | |
93 | extern const char *rootspec; /* how root device was specified */ | 93 | extern const char *rootspec; /* how root device was specified */ | |
94 | 94 | |||
95 | extern int ncpu; /* number of CPUs configured */ | 95 | extern int ncpu; /* number of CPUs configured */ | |
96 | extern int ncpuonline; /* number of CPUs online */ | 96 | extern int ncpuonline; /* number of CPUs online */ | |
97 | #if defined(_KERNEL) | 97 | #if defined(_KERNEL) | |
98 | extern bool mp_online; /* secondary processors are started */ | 98 | extern bool mp_online; /* secondary processors are started */ | |
99 | #endif /* defined(_KERNEL) */ | 99 | #endif /* defined(_KERNEL) */ | |
100 | 100 | |||
101 | extern const char hexdigits[]; /* "0123456789abcdef" in subr_prf2.c */ | 101 | extern const char hexdigits[]; /* "0123456789abcdef" in subr_prf2.c */ | |
102 | extern const char HEXDIGITS[]; /* "0123456789ABCDEF" in subr_prf2.c */ | 102 | extern 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 | */ | |
109 | extern const dev_t swapdev; /* swapping device */ | 109 | extern const dev_t swapdev; /* swapping device */ | |
110 | extern struct vnode *swapdev_vp;/* vnode equivalent to above */ | 110 | extern struct vnode *swapdev_vp;/* vnode equivalent to above */ | |
111 | 111 | |||
112 | extern const dev_t zerodev; /* /dev/zero */ | 112 | extern const dev_t zerodev; /* /dev/zero */ | |
113 | 113 | |||
114 | typedef int sy_call_t(struct lwp *, const void *, register_t *); | 114 | typedef int sy_call_t(struct lwp *, const void *, register_t *); | |
115 | 115 | |||
116 | extern struct sysent { /* system call table */ | 116 | extern 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[]; | |
122 | extern int nsysent; | 122 | extern 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 | |||
133 | extern int boothowto; /* reboot flags, from console subsystem */ | 133 | extern 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 | |||
137 | extern void (*v_putc)(int); /* Virtual console putc routine */ | 137 | extern void (*v_putc)(int); /* Virtual console putc routine */ | |
138 | 138 | |||
139 | /* | 139 | /* | |
140 | * General function declarations. | 140 | * General function declarations. | |
141 | */ | 141 | */ | |
142 | int nullop(void *); | 142 | int nullop(void *); | |
143 | int enodev(void); | 143 | int enodev(void); | |
144 | int enosys(void); | 144 | int enosys(void); | |
145 | int enoioctl(void); | 145 | int enoioctl(void); | |
146 | int enxio(void); | 146 | int enxio(void); | |
147 | int eopnotsupp(void); | 147 | int eopnotsupp(void); | |
148 | 148 | |||
149 | enum hashtype { | 149 | enum 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 | |
156 | void *hashinit(u_int, enum hashtype, bool, u_long *); | 156 | void *hashinit(u_int, enum hashtype, bool, u_long *); | |
157 | void hashdone(void *, enum hashtype, u_long); | 157 | void hashdone(void *, enum hashtype, u_long); | |
158 | int seltrue(dev_t, int, struct lwp *); | 158 | int seltrue(dev_t, int, struct lwp *); | |
159 | int sys_nosys(struct lwp *, const void *, register_t *); | 159 | int sys_nosys(struct lwp *, const void *, register_t *); | |
160 | 160 | |||
161 | void aprint_normal(const char *, ...) | 161 | void aprint_normal(const char *, ...) | |
162 | __attribute__((__format__(__printf__,1,2))); | 162 | __attribute__((__format__(__printf__,1,2))); | |
163 | void aprint_error(const char *, ...) | 163 | void aprint_error(const char *, ...) | |
164 | __attribute__((__format__(__printf__,1,2))); | 164 | __attribute__((__format__(__printf__,1,2))); | |
165 | void aprint_naive(const char *, ...) | 165 | void aprint_naive(const char *, ...) | |
166 | __attribute__((__format__(__printf__,1,2))); | 166 | __attribute__((__format__(__printf__,1,2))); | |
167 | void aprint_verbose(const char *, ...) | 167 | void aprint_verbose(const char *, ...) | |
168 | __attribute__((__format__(__printf__,1,2))); | 168 | __attribute__((__format__(__printf__,1,2))); | |
169 | void aprint_debug(const char *, ...) | 169 | void aprint_debug(const char *, ...) | |
170 | __attribute__((__format__(__printf__,1,2))); | 170 | __attribute__((__format__(__printf__,1,2))); | |
171 | 171 | |||
172 | struct device; | 172 | struct device; | |
173 | 173 | |||
174 | void aprint_normal_dev(struct device *, const char *, ...) | 174 | void aprint_normal_dev(struct device *, const char *, ...) | |
175 | __attribute__((__format__(__printf__,2,3))); | 175 | __attribute__((__format__(__printf__,2,3))); | |
176 | void aprint_error_dev(struct device *, const char *, ...) | 176 | void aprint_error_dev(struct device *, const char *, ...) | |
177 | __attribute__((__format__(__printf__,2,3))); | 177 | __attribute__((__format__(__printf__,2,3))); | |
178 | void aprint_naive_dev(struct device *, const char *, ...) | 178 | void aprint_naive_dev(struct device *, const char *, ...) | |
179 | __attribute__((__format__(__printf__,2,3))); | 179 | __attribute__((__format__(__printf__,2,3))); | |
180 | void aprint_verbose_dev(struct device *, const char *, ...) | 180 | void aprint_verbose_dev(struct device *, const char *, ...) | |
181 | __attribute__((__format__(__printf__,2,3))); | 181 | __attribute__((__format__(__printf__,2,3))); | |
182 | void aprint_debug_dev(struct device *, const char *, ...) | 182 | void aprint_debug_dev(struct device *, const char *, ...) | |
183 | __attribute__((__format__(__printf__,2,3))); | 183 | __attribute__((__format__(__printf__,2,3))); | |
184 | 184 | |||
185 | struct ifnet; | 185 | struct ifnet; | |
186 | 186 | |||
187 | void aprint_normal_ifnet(struct ifnet *, const char *, ...) | 187 | void aprint_normal_ifnet(struct ifnet *, const char *, ...) | |
188 | __attribute__((__format__(__printf__,2,3))); | 188 | __attribute__((__format__(__printf__,2,3))); | |
189 | void aprint_error_ifnet(struct ifnet *, const char *, ...) | 189 | void aprint_error_ifnet(struct ifnet *, const char *, ...) | |
190 | __attribute__((__format__(__printf__,2,3))); | 190 | __attribute__((__format__(__printf__,2,3))); | |
191 | void aprint_naive_ifnet(struct ifnet *, const char *, ...) | 191 | void aprint_naive_ifnet(struct ifnet *, const char *, ...) | |
192 | __attribute__((__format__(__printf__,2,3))); | 192 | __attribute__((__format__(__printf__,2,3))); | |
193 | void aprint_verbose_ifnet(struct ifnet *, const char *, ...) | 193 | void aprint_verbose_ifnet(struct ifnet *, const char *, ...) | |
194 | __attribute__((__format__(__printf__,2,3))); | 194 | __attribute__((__format__(__printf__,2,3))); | |
195 | void aprint_debug_ifnet(struct ifnet *, const char *, ...) | 195 | void aprint_debug_ifnet(struct ifnet *, const char *, ...) | |
196 | __attribute__((__format__(__printf__,2,3))); | 196 | __attribute__((__format__(__printf__,2,3))); | |
197 | 197 | |||
198 | int aprint_get_error_count(void); | 198 | int aprint_get_error_count(void); | |
199 | 199 | |||
200 | void printf_tolog(const char *, ...) | 200 | void printf_tolog(const char *, ...) | |
201 | __attribute__((__format__(__printf__,1,2))); | 201 | __attribute__((__format__(__printf__,1,2))); | |
202 | 202 | |||
203 | void printf_nolog(const char *, ...) | 203 | void printf_nolog(const char *, ...) | |
204 | __attribute__((__format__(__printf__,1,2))); | 204 | __attribute__((__format__(__printf__,1,2))); | |
205 | 205 | |||
206 | void printf(const char *, ...) | 206 | void printf(const char *, ...) | |
207 | __attribute__((__format__(__printf__,1,2))); | 207 | __attribute__((__format__(__printf__,1,2))); | |
208 | int sprintf(char *, const char *, ...) | 208 | int sprintf(char *, const char *, ...) | |
209 | __attribute__((__format__(__printf__,2,3))); | 209 | __attribute__((__format__(__printf__,2,3))); | |
210 | int snprintf(char *, size_t, const char *, ...) | 210 | int snprintf(char *, size_t, const char *, ...) | |
211 | __attribute__((__format__(__printf__,3,4))); | 211 | __attribute__((__format__(__printf__,3,4))); | |
212 | void vprintf(const char *, _BSD_VA_LIST_); | 212 | void vprintf(const char *, _BSD_VA_LIST_); | |
213 | int vsprintf(char *, const char *, _BSD_VA_LIST_); | 213 | int vsprintf(char *, const char *, _BSD_VA_LIST_); | |
214 | int vsnprintf(char *, size_t, const char *, _BSD_VA_LIST_); | 214 | int vsnprintf(char *, size_t, const char *, _BSD_VA_LIST_); | |
215 | int humanize_number(char *, size_t, uint64_t, const char *, int); | 215 | int humanize_number(char *, size_t, uint64_t, const char *, int); | |
216 | 216 | |||
217 | void twiddle(void); | 217 | void twiddle(void); | |
218 | #endif /* _KERNEL */ | 218 | #endif /* _KERNEL */ | |
219 | 219 | |||
220 | void panic(const char *, ...) | 220 | void panic(const char *, ...) | |
221 | __dead __attribute__((__format__(__printf__,1,2))); | 221 | __dead __attribute__((__format__(__printf__,1,2))); | |
222 | void uprintf(const char *, ...) | 222 | void uprintf(const char *, ...) | |
223 | __attribute__((__format__(__printf__,1,2))); | 223 | __attribute__((__format__(__printf__,1,2))); | |
224 | void uprintf_locked(const char *, ...) | 224 | void uprintf_locked(const char *, ...) | |
225 | __attribute__((__format__(__printf__,1,2))); | 225 | __attribute__((__format__(__printf__,1,2))); | |
226 | void ttyprintf(struct tty *, const char *, ...) | 226 | void ttyprintf(struct tty *, const char *, ...) | |
227 | __attribute__((__format__(__printf__,2,3))); | 227 | __attribute__((__format__(__printf__,2,3))); | |
228 | 228 | |||
229 | char *bitmask_snprintf(u_quad_t, const char *, char *, size_t); | 229 | char *bitmask_snprintf(u_quad_t, const char *, char *, size_t); | |
230 | 230 | |||
231 | int format_bytes(char *, size_t, uint64_t); | 231 | int format_bytes(char *, size_t, uint64_t); | |
232 | 232 | |||
233 | void tablefull(const char *, const char *); | 233 | void tablefull(const char *, const char *); | |
234 | 234 | |||
235 | int kcopy(const void *, void *, size_t); | 235 | int 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 | |||
243 | int copystr(const void *, void *, size_t, size_t *); | 243 | int copystr(const void *, void *, size_t, size_t *); | |
244 | int copyinstr(const void *, void *, size_t, size_t *); | 244 | int copyinstr(const void *, void *, size_t, size_t *); | |
245 | int copyoutstr(const void *, void *, size_t, size_t *); | 245 | int copyoutstr(const void *, void *, size_t, size_t *); | |
246 | int copyin(const void *, void *, size_t); | 246 | int copyin(const void *, void *, size_t); | |
247 | int copyout(const void *, void *, size_t); | 247 | int copyout(const void *, void *, size_t); | |
248 | 248 | |||
249 | #ifdef _KERNEL | 249 | #ifdef _KERNEL | |
250 | typedef int (*copyin_t)(const void *, void *, size_t); | 250 | typedef int (*copyin_t)(const void *, void *, size_t); | |
251 | typedef int (*copyout_t)(const void *, void *, size_t); | 251 | typedef int (*copyout_t)(const void *, void *, size_t); | |
252 | #endif | 252 | #endif | |
253 | 253 | |||
254 | int copyin_proc(struct proc *, const void *, void *, size_t); | 254 | int copyin_proc(struct proc *, const void *, void *, size_t); | |
255 | int copyout_proc(struct proc *, const void *, void *, size_t); | 255 | int copyout_proc(struct proc *, const void *, void *, size_t); | |
256 | int copyin_vmspace(struct vmspace *, const void *, void *, size_t); | 256 | int copyin_vmspace(struct vmspace *, const void *, void *, size_t); | |
257 | int copyout_vmspace(struct vmspace *, const void *, void *, size_t); | 257 | int copyout_vmspace(struct vmspace *, const void *, void *, size_t); | |
258 | 258 | |||
259 | int ioctl_copyin(int ioctlflags, const void *src, void *dst, size_t len); | 259 | int ioctl_copyin(int ioctlflags, const void *src, void *dst, size_t len); | |
260 | int ioctl_copyout(int ioctlflags, const void *src, void *dst, size_t len); | 260 | int ioctl_copyout(int ioctlflags, const void *src, void *dst, size_t len); | |
261 | 261 | |||
262 | int ucas_ptr(volatile void *, void *, void *, void *); | 262 | int ucas_ptr(volatile void *, void *, void *, void *); | |
263 | int ucas_int(volatile int *, int, int, int *); | 263 | int ucas_int(volatile int *, int, int, int *); | |
264 | 264 | |||
265 | int subyte(void *, int); | 265 | int subyte(void *, int); | |
266 | int suibyte(void *, int); | 266 | int suibyte(void *, int); | |
267 | int susword(void *, short); | 267 | int susword(void *, short); | |
268 | int suisword(void *, short); | 268 | int suisword(void *, short); | |
269 | int suswintr(void *, short); | 269 | int suswintr(void *, short); | |
270 | int suword(void *, long); | 270 | int suword(void *, long); | |
271 | int suiword(void *, long); | 271 | int suiword(void *, long); | |
272 | 272 | |||
273 | int fubyte(const void *); | 273 | int fubyte(const void *); | |
274 | int fuibyte(const void *); | 274 | int fuibyte(const void *); | |
275 | int fusword(const void *); | 275 | int fusword(const void *); | |
276 | int fuisword(const void *); | 276 | int fuisword(const void *); | |
277 | int fuswintr(const void *); | 277 | int fuswintr(const void *); | |
278 | long fuword(const void *); | 278 | long fuword(const void *); | |
279 | long fuiword(const void *); | 279 | long fuiword(const void *); | |
280 | 280 | |||
281 | void hardclock(struct clockframe *); | 281 | void hardclock(struct clockframe *); | |
282 | void softclock(void *); | 282 | void softclock(void *); | |
283 | void statclock(struct clockframe *); | 283 | void statclock(struct clockframe *); | |
284 | 284 | |||
285 | #ifdef NTP | 285 | #ifdef NTP | |
286 | void ntp_init(void); | 286 | void ntp_init(void); | |
287 | #ifdef PPS_SYNC | 287 | #ifdef PPS_SYNC | |
288 | void hardpps(struct timespec *, long); | 288 | void hardpps(struct timespec *, long); | |
289 | #endif /* PPS_SYNC */ | 289 | #endif /* PPS_SYNC */ | |
290 | #else | 290 | #else | |
291 | void ntp_init(void); /* also provides adjtime() functionality */ | 291 | void ntp_init(void); /* also provides adjtime() functionality */ | |
292 | #endif /* NTP */ | 292 | #endif /* NTP */ | |
293 | 293 | |||
294 | void ssp_init(void); | |||
295 | ||||
294 | void initclocks(void); | 296 | void initclocks(void); | |
295 | void inittodr(time_t); | 297 | void inittodr(time_t); | |
296 | void resettodr(void); | 298 | void resettodr(void); | |
297 | void cpu_initclocks(void); | 299 | void cpu_initclocks(void); | |
298 | void setrootfstime(time_t); | 300 | void setrootfstime(time_t); | |
299 | 301 | |||
300 | void startprofclock(struct proc *); | 302 | void startprofclock(struct proc *); | |
301 | void stopprofclock(struct proc *); | 303 | void stopprofclock(struct proc *); | |
302 | void proftick(struct clockframe *); | 304 | void proftick(struct clockframe *); | |
303 | void setstatclockrate(int); | 305 | void 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 | */ | |
309 | void *shutdownhook_establish(void (*)(void *), void *); | 311 | void *shutdownhook_establish(void (*)(void *), void *); | |
310 | void shutdownhook_disestablish(void *); | 312 | void shutdownhook_disestablish(void *); | |
311 | void doshutdownhooks(void); | 313 | void doshutdownhooks(void); | |
312 | 314 | |||
313 | /* | 315 | /* | |
314 | * Power management hooks. | 316 | * Power management hooks. | |
315 | */ | 317 | */ | |
316 | void *powerhook_establish(const char *, void (*)(int, void *), void *); | 318 | void *powerhook_establish(const char *, void (*)(int, void *), void *); | |
317 | void powerhook_disestablish(void *); | 319 | void powerhook_disestablish(void *); | |
318 | void dopowerhooks(int); | 320 | void 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 | */ | |
338 | extern int (*mountroot)(void); | 340 | extern int (*mountroot)(void); | |
339 | void *mountroothook_establish(void (*)(struct device *), struct device *); | 341 | void *mountroothook_establish(void (*)(struct device *), struct device *); | |
340 | void mountroothook_disestablish(void *); | 342 | void mountroothook_disestablish(void *); | |
341 | void mountroothook_destroy(void); | 343 | void mountroothook_destroy(void); | |
342 | void domountroothook(void); | 344 | void 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 | */ | |
348 | void *exechook_establish(void (*)(struct proc *, void *), void *); | 350 | void *exechook_establish(void (*)(struct proc *, void *), void *); | |
349 | void exechook_disestablish(void *); | 351 | void exechook_disestablish(void *); | |
350 | void doexechooks(struct proc *); | 352 | void 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 | */ | |
355 | void *exithook_establish(void (*)(struct proc *, void *), void *); | 357 | void *exithook_establish(void (*)(struct proc *, void *), void *); | |
356 | void exithook_disestablish(void *); | 358 | void exithook_disestablish(void *); | |
357 | void doexithooks(struct proc *); | 359 | void 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 | */ | |
363 | void *forkhook_establish(void (*)(struct proc *, struct proc *)); | 365 | void *forkhook_establish(void (*)(struct proc *, struct proc *)); | |
364 | void forkhook_disestablish(void *); | 366 | void forkhook_disestablish(void *); | |
365 | void doforkhooks(struct proc *, struct proc *); | 367 | void 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 | |
371 | bool trace_is_enabled(struct proc *); | 373 | bool trace_is_enabled(struct proc *); | |
372 | int trace_enter(register_t, const register_t *, int); | 374 | int trace_enter(register_t, const register_t *, int); | |
373 | void trace_exit(register_t, register_t [], int); | 375 | void trace_exit(register_t, register_t [], int); | |
374 | #endif | 376 | #endif | |
375 | 377 | |||
376 | int uiomove(void *, size_t, struct uio *); | 378 | int uiomove(void *, size_t, struct uio *); | |
377 | int uiomove_frombuf(void *, size_t, struct uio *); | 379 | int uiomove_frombuf(void *, size_t, struct uio *); | |
378 | 380 | |||
379 | #ifdef _KERNEL | 381 | #ifdef _KERNEL | |
380 | int setjmp(label_t *); | 382 | int setjmp(label_t *); | |
381 | void longjmp(label_t *) __dead; | 383 | void longjmp(label_t *) __dead; | |
382 | #endif | 384 | #endif | |
383 | 385 | |||
384 | void consinit(void); | 386 | void consinit(void); | |
385 | 387 | |||
386 | void cpu_startup(void); | 388 | void cpu_startup(void); | |
387 | void cpu_configure(void); | 389 | void cpu_configure(void); | |
388 | void cpu_rootconf(void); | 390 | void cpu_rootconf(void); | |
389 | void cpu_dumpconf(void); | 391 | void cpu_dumpconf(void); | |
390 | 392 | |||
391 | #ifdef GPROF | 393 | #ifdef GPROF | |
392 | void kmstartup(void); | 394 | void 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 | |||
406 | typedef struct cnm_state { | 408 | typedef 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 | |||
419 | void cn_init_magic(cnm_state_t *); | 421 | void cn_init_magic(cnm_state_t *); | |
420 | void cn_destroy_magic(cnm_state_t *); | 422 | void cn_destroy_magic(cnm_state_t *); | |
421 | int cn_set_magic(const char *); | 423 | int cn_set_magic(const char *); | |
422 | int cn_get_magic(char *, size_t); | 424 | int 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] */ | |
447 | void cpu_Debugger(void); | 449 | void 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 | */ | |
455 | extern int db_fromconsole; /* XXX ddb/ddbvar.h */ | 457 | extern 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 */ | |
465 | void scdebug_call(register_t, const register_t[]); | 467 | void scdebug_call(register_t, const register_t[]); | |
466 | void scdebug_ret(register_t, int, const register_t[]); | 468 | void scdebug_ret(register_t, int, const register_t[]); | |
467 | 469 | |||
468 | void kernel_lock_init(void); | 470 | void kernel_lock_init(void); | |
469 | void _kernel_lock(int); | 471 | void _kernel_lock(int); | |
470 | void _kernel_unlock(int, int *); | 472 | void _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) \ | |
474 | do { \ | 476 | do { \ | |
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 | |
490 | void kpreempt_disable(void); | 492 | void kpreempt_disable(void); | |
491 | void kpreempt_enable(void); | 493 | void kpreempt_enable(void); | |
492 | bool kpreempt_disabled(void); | 494 | bool kpreempt_disabled(void); | |
493 | #endif | 495 | #endif | |
494 | 496 | |||
495 | void assert_sleepable(void); | 497 | void 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 | |||
502 | vaddr_t calc_cache_size(struct vm_map *, int, int); | 504 | vaddr_t calc_cache_size(struct vm_map *, int, int); | |
503 | 505 | |||
504 | #endif /* !_SYS_SYSTM_H_ */ | 506 | #endif /* !_SYS_SYSTM_H_ */ |