Annotation of sys/arch/mvmeppc/mvmeppc/conf.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: conf.c,v 1.21 2007/06/01 23:14:07 deraadt Exp $ */
2:
3: /*
4: * Copyright (c) 1997 Per Fogelstrom
5: * Copyright (c) 1997 RTMX Inc, North Carolina
6: *
7: * Redistribution and use in source and binary forms, with or without
8: * modification, are permitted provided that the following conditions
9: * are met:
10: * 1. Redistributions of source code must retain the above copyright
11: * notice, this list of conditions and the following disclaimer.
12: * 2. Redistributions in binary form must reproduce the above copyright
13: * notice, this list of conditions and the following disclaimer in the
14: * documentation and/or other materials provided with the distribution.
15: * 3. All advertising materials mentioning features or use of this software
16: * must display the following acknowledgement:
17: * This product includes software developed under OpenBSD for RTMX Inc,
18: * North Carolina, USA, by Per Fogelstrom, Opsycon AB, Sweden.
19: * 4. The name of the author may not be used to endorse or promote products
20: * derived from this software without specific prior written permission.
21: *
22: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
23: * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
26: * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32: * SUCH DAMAGE.
33: *
34: */
35: #include <sys/param.h>
36: #include <sys/buf.h>
37: #include <sys/ioctl.h>
38: #include <sys/systm.h>
39: #include <sys/tty.h>
40: #include <sys/vnode.h>
41:
42: #include <machine/conf.h>
43:
44: #if 0
45: #include "wd.h"
46: #else
47: #define NWD 0
48: #endif
49: bdev_decl(wd);
50: #include "sd.h"
51: #include "cd.h"
52:
53: #include "rd.h"
54:
55: #include "vnd.h"
56: #include "ccd.h"
57: #include "raid.h"
58:
59: struct bdevsw bdevsw[] = {
60: bdev_disk_init(NWD,wd), /* 0: ST506/ESDI/IDE disk */
61: bdev_swap_init(1,sw), /* 1 swap pseudo device */
62: bdev_disk_init(NSD,sd), /* 2 SCSI Disk */
63: bdev_disk_init(NCD,cd), /* 3 SCSI CD-ROM */
64: bdev_notdef(), /* 4 unknown*/
65: bdev_notdef(), /* 5 unknown*/
66: bdev_notdef(), /* 6 unknown*/
67: bdev_notdef(), /* 7 unknown*/
68: bdev_lkm_dummy(), /* 8 */
69: bdev_lkm_dummy(), /* 9 */
70: bdev_lkm_dummy(), /* 10 */
71: bdev_lkm_dummy(), /* 11 */
72: bdev_lkm_dummy(), /* 12 */
73: bdev_lkm_dummy(), /* 13 */
74: bdev_disk_init(NVND,vnd), /* 14 vnode disk driver*/
75: bdev_notdef(), /* 15 unknown*/
76: bdev_disk_init(NCCD,ccd), /* 16 concatenated disk driver*/
77: bdev_disk_init(NRD,rd), /* 17 ram disk driver*/
78: bdev_notdef(), /* 18 unknown*/
79: bdev_disk_init(NRAID,raid), /* 19: RAIDframe disk driver */
80: };
81: int nblkdev = sizeof bdevsw / sizeof bdevsw[0];
82:
83: #include "bio.h"
84: #include "pty.h"
85:
86: #include "bugtty.h"
87: cdev_decl(bugtty);
88:
89: #include "st.h"
90: #include "uk.h"
91: #include "ss.h"
92:
93: cdev_decl(wd);
94:
95: #include "bpfilter.h"
96:
97: #include "tun.h"
98:
99: #ifdef XFS
100: #include <xfs/nxfs.h>
101: cdev_decl(xfs_dev);
102: #endif
103:
104: #ifdef LKM
105: #define NLKM 1
106: #else
107: #define NLKM 0
108: #endif
109:
110: #include "ksyms.h"
111:
112: #include "pf.h"
113:
114: #include "systrace.h"
115:
116: struct cdevsw cdevsw[] = {
117: cdev_cn_init(1,cn), /* 0: virtual console */
118: cdev_ctty_init(1,ctty), /* 1: controlling terminal */
119: cdev_mm_init(1,mm), /* 2: /dev/{null,mem,kmem,...} */
120: cdev_swap_init(1,sw), /* 3: /dev/drum (swap pseudo-device) */
121: cdev_tty_init(NPTY,pts), /* 4: pseudo-tty slave */
122: cdev_ptc_init(NPTY,ptc), /* 5: pseudo-tty master */
123: cdev_log_init(1,log), /* 6: /dev/klog */
124: #if 0
125: cdev_tty_init(NCOM,com), /* 7: Serial ports */
126: #else
127: cdev_notdef(), /* 7 */
128: #endif
129: cdev_disk_init(NSD,sd), /* 8: SCSI disk */
130: cdev_disk_init(NCD,cd), /* 9: SCSI CD-ROM */
131: cdev_notdef(), /* 10: SCSI changer */
132: cdev_disk_init(NWD,wd), /* 11: ST506/ESDI/IDE disk */
133: cdev_notdef(), /* 12 */
134: cdev_notdef(), /* 13 */
135: cdev_tty_init(NBUGTTY,bugtty), /* 14: BUGtty (ttyB) */
136: cdev_notdef(), /* 15 */
137: cdev_notdef(), /* 16 */
138: cdev_disk_init(NRD,rd), /* 17: ram disk driver*/
139: cdev_disk_init(NCCD,ccd), /* 18: concatenated disk driver */
140: cdev_disk_init(NVND,vnd), /* 19: vnode disk */
141: cdev_tape_init(NST,st), /* 20: SCSI tape */
142: cdev_fd_init(1,filedesc), /* 21: file descriptor pseudo-dev */
143: cdev_bpftun_init(NBPFILTER,bpf),/* 22: berkeley packet filter */
144: cdev_bpftun_init(NTUN,tun), /* 23: network tunnel */
145: cdev_lkm_init(NLKM,lkm), /* 24: loadable module driver */
146: cdev_notdef(), /* 25 */
147: cdev_notdef(), /* 26 */
148: cdev_notdef(), /* 27 */
149: cdev_notdef(), /* 28 */
150: cdev_notdef(), /* 29 */
151: cdev_notdef(), /* 30 */
152: cdev_notdef(), /* 31 */
153: cdev_notdef(), /* 32 */
154: cdev_lkm_dummy(), /* 33 */
155: cdev_lkm_dummy(), /* 34 */
156: cdev_lkm_dummy(), /* 35 */
157: cdev_lkm_dummy(), /* 36 */
158: cdev_lkm_dummy(), /* 37 */
159: cdev_lkm_dummy(), /* 38 */
160: cdev_pf_init(NPF,pf), /* 39: packet filter */
161: cdev_random_init(1,random), /* 40: random data source */
162: cdev_uk_init(NUK,uk), /* 41: unknown SCSI */
163: cdev_ss_init(NSS,ss), /* 42: SCSI scanner */
164: cdev_ksyms_init(NKSYMS,ksyms), /* 43: Kernel symbols device */
165: cdev_notdef(), /* 44 */
166: cdev_notdef(), /* 45 */
167: cdev_notdef(), /* 46 */
168: cdev_notdef(), /* 47 */
169: cdev_notdef(), /* 48 */
170: cdev_notdef(), /* 49 */
171: cdev_systrace_init(NSYSTRACE,systrace), /* 50: system call tracing */
172: #ifdef XFS
173: cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
174: #else
175: cdev_notdef(), /* 51 */
176: #endif
177: cdev_notdef(), /* 52 */
178: cdev_bio_init(NBIO,bio), /* 53: ioctl tunnel */
179: cdev_disk_init(NRAID,raid), /* 54: RAIDframe disk driver */
180: cdev_ptm_init(NPTY,ptm), /* 55: pseudo-tty ptm device */
181: };
182: int nchrdev = sizeof cdevsw / sizeof cdevsw[0];
183:
184: int mem_no = 2; /* major number of /dev/mem */
185:
186: /*
187: * Swapdev is a fake device implemented in sw.c.
188: * It is used only internally to get to swstrategy.
189: */
190: dev_t swapdev = makedev(1, 0);
191:
192: /*
193: * Check whether dev is /dev/mem or /dev/kmem.
194: */
195: int
196: iskmemdev(dev)
197: dev_t dev;
198: {
199: return major(dev) == mem_no && minor(dev) < 2;
200: }
201:
202: /*
203: * Check whether dev is /dev/zero.
204: */
205: int
206: iszerodev(dev)
207: dev_t dev;
208: {
209: return major(dev) == mem_no && minor(dev) == 12;
210: }
211:
212: dev_t
213: getnulldev()
214: {
215: return makedev(mem_no, 2);
216: }
217:
218: int chrtoblktbl[] = {
219: /*VCHR*/ /*VBLK*/
220: /* 0 */ NODEV,
221: /* 1 */ NODEV,
222: /* 2 */ NODEV,
223: /* 3 */ NODEV,
224: /* 4 */ NODEV,
225: /* 5 */ NODEV,
226: /* 6 */ NODEV,
227: /* 7 */ NODEV,
228: /* 8 */ 2,
229: /* 9 */ NODEV,
230: /* 10 */ NODEV,
231: /* 11 */ 0,
232: /* 12 */ NODEV,
233: /* 13 */ 4,
234: /* 14 */ NODEV,
235: /* 15 */ NODEV,
236: /* 16 */ NODEV,
237: /* 17 */ 17,
238: /* 18 */ NODEV,
239: /* 19 */ NODEV,
240: /* 20 */ NODEV,
241: /* 21 */ NODEV,
242: /* 22 */ NODEV,
243: /* 23 */ NODEV,
244: /* 24 */ NODEV,
245: /* 25 */ NODEV,
246: /* 26 */ NODEV,
247: /* 27 */ NODEV,
248: /* 28 */ NODEV,
249: /* 29 */ NODEV,
250: /* 30 */ NODEV,
251: /* 31 */ NODEV,
252: /* 32 */ NODEV,
253: /* 33 */ NODEV,
254: /* 34 */ NODEV,
255: /* 35 */ NODEV,
256: /* 36 */ NODEV,
257: /* 37 */ NODEV,
258: /* 38 */ NODEV,
259: /* 39 */ NODEV,
260: /* 40 */ NODEV,
261: /* 41 */ NODEV,
262: /* 42 */ NODEV,
263: /* 43 */ NODEV,
264: /* 44 */ NODEV,
265: /* 45 */ NODEV,
266: /* 46 */ NODEV,
267: /* 47 */ NODEV,
268: /* 48 */ NODEV,
269: /* 49 */ NODEV,
270: /* 50 */ NODEV,
271: /* 51 */ NODEV,
272: /* 52 */ NODEV,
273: /* 53 */ NODEV,
274: /* 54 */ 19,
275: };
276: int nchrtoblktbl = sizeof(chrtoblktbl) / sizeof(chrtoblktbl[0]);
277:
278: #include <dev/cons.h>
279:
280: #define bugttycnpollc nullcnpollc
281: cons_decl(bugtty);
282:
283: struct consdev constab[] = {
284: #if NBUGTTY > 0
285: cons_init(bugtty),
286: #endif
287: { 0 },
288: };
CVSweb