Annotation of sys/arch/aviion/aviion/conf.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: conf.c,v 1.4 2007/05/28 22:26:03 todd Exp $ */
2:
3: /*-
4: * Copyright (c) 1991 The Regents of the University of California.
5: * All rights reserved.
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. Neither the name of the University nor the names of its contributors
16: * may be used to endorse or promote products derived from this software
17: * without specific prior written permission.
18: *
19: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29: * SUCH DAMAGE.
30: *
31: * @(#)conf.c 7.9 (Berkeley) 5/28/91
32: */
33:
34: #include <sys/param.h>
35: #include <sys/systm.h>
36: #include <sys/buf.h>
37: #include <sys/ioctl.h>
38: #include <sys/tty.h>
39: #include <sys/vnode.h>
40:
41: #include <machine/conf.h>
42:
43: #include "bpfilter.h"
44: #include "ccd.h"
45: #include "cd.h"
46: #include "ch.h"
47: #include "dart.h"
48: #include "ksyms.h"
49: #include "nvram.h"
50: #include "pf.h"
51: #include "bio.h"
52: #include "pty.h"
53: #include "rd.h"
54: #include "sd.h"
55: #include "ss.h"
56: #include "st.h"
57: #include "systrace.h"
58: #include "tun.h"
59: #include "uk.h"
60: #include "vme.h"
61: #include "vnd.h"
62: #ifdef XFS
63: #include <xfs/nxfs.h>
64: cdev_decl(xfs_dev);
65: #endif
66:
67: struct bdevsw bdevsw[] =
68: {
69: bdev_notdef(), /* 0 */
70: bdev_notdef(), /* 1 */
71: bdev_notdef(), /* 2 */
72: bdev_swap_init(1,sw), /* 3: swap pseudo-device */
73: bdev_disk_init(NSD,sd), /* 4: SCSI disk */
74: bdev_tape_init(NST,st), /* 5: SCSI tape */
75: bdev_disk_init(NCD,cd), /* 6: SCSI CD-ROM */
76: bdev_disk_init(NRD,rd), /* 7: ramdisk */
77: bdev_disk_init(NVND,vnd), /* 8: vnode disk driver */
78: bdev_disk_init(NCCD,ccd), /* 9: concatenated disk driver */
79: bdev_notdef(), /* 10 */
80: bdev_notdef(), /* 11 */
81: bdev_notdef(), /* 12 */
82: bdev_lkm_dummy(), /* 13 */
83: bdev_lkm_dummy(), /* 14 */
84: bdev_lkm_dummy(), /* 15 */
85: bdev_lkm_dummy(), /* 16 */
86: bdev_lkm_dummy(), /* 17 */
87: bdev_lkm_dummy(), /* 18 */
88: };
89: int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
90:
91: struct cdevsw cdevsw[] =
92: {
93: cdev_cn_init(1,cn), /* 0: virtual console */
94: cdev_ctty_init(1,ctty), /* 1: controlling terminal */
95: cdev_mm_init(1,mm), /* 2: /dev/{null,mem,kmem,...} */
96: cdev_swap_init(1,sw), /* 3: /dev/drum (swap pseudo-device) */
97: cdev_tty_init(NPTY,pts), /* 4: pseudo-tty slave */
98: cdev_ptc_init(NPTY,ptc), /* 5: pseudo-tty master */
99: cdev_log_init(1,log), /* 6: /dev/klog */
100: cdev_notdef(), /* 7 */
101: cdev_disk_init(NSD,sd), /* 8: SCSI disk */
102: cdev_disk_init(NCD,cd), /* 9: SCSI CD-ROM */
103: cdev_mm_init(NNVRAM,nvram), /* 10: /dev/nvramX */
104: cdev_notdef(), /* 11: */
105: cdev_tty_init(NDART,dart), /* 12: on-board serial (tty[ab]) */
106: cdev_notdef(), /* 13 */
107: cdev_notdef(), /* 14 */
108: cdev_notdef(), /* 15 */
109: cdev_notdef(), /* 16 */
110: cdev_disk_init(NCCD,ccd), /* 17: concatenated disk */
111: cdev_disk_init(NRD,rd), /* 18: ramdisk disk */
112: cdev_disk_init(NVND,vnd), /* 19: vnode disk */
113: cdev_tape_init(NST,st), /* 20: SCSI tape */
114: cdev_fd_init(1,filedesc), /* 21: file descriptor pseudo-dev */
115: cdev_bpftun_init(NBPFILTER,bpf),/* 22: berkeley packet filter */
116: cdev_bpftun_init(NTUN,tun), /* 23: network tunnel */
117: cdev_lkm_init(NLKM,lkm), /* 24: loadable module driver */
118: cdev_notdef(), /* 25 */
119: cdev_notdef(), /* 26: XD disk */
120: cdev_notdef(), /* 27 */
121: cdev_notdef(), /* 28: lp */
122: cdev_notdef(), /* 29: lptwo */
123: cdev_mm_init(NVME,vme), /* 30: /dev/vme* */
124: cdev_notdef(), /* 31: old /dev/vmelX */
125: cdev_notdef(), /* 32: old /dev/vmesX */
126: cdev_lkm_dummy(), /* 33 */
127: cdev_lkm_dummy(), /* 34 */
128: cdev_lkm_dummy(), /* 35 */
129: cdev_lkm_dummy(), /* 36 */
130: cdev_lkm_dummy(), /* 37 */
131: cdev_lkm_dummy(), /* 38 */
132: cdev_pf_init(NPF,pf), /* 39: packet filter */
133: cdev_random_init(1,random), /* 40: random data source */
134: cdev_uk_init(NUK,uk), /* 41 */
135: cdev_ss_init(NSS,ss), /* 42 */
136: cdev_ksyms_init(NKSYMS,ksyms), /* 43: Kernel symbols device */
137: cdev_ch_init(NCH,ch), /* 44: SCSI autochanger */
138: cdev_notdef(), /* 45 */
139: cdev_notdef(), /* 46 */
140: cdev_notdef(), /* 47 */
141: cdev_notdef(), /* 48 */
142: cdev_bio_init(NBIO,bio), /* 49: ioctl tunnel */
143: cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */
144: #ifdef XFS
145: cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
146: #else
147: cdev_notdef(), /* 51 */
148: #endif
149: cdev_ptm_init(NPTY,ptm), /* 52: pseudo-tty ptm device */
150: };
151: int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
152:
153: int mem_no = 2; /* major device number of memory special file */
154:
155: /*
156: * Swapdev is a fake device implemented
157: * in sw.c used only internally to get to swstrategy.
158: * It cannot be provided to the users, because the
159: * swstrategy routine munches the b_dev and b_blkno entries
160: * before calling the appropriate driver. This would horribly
161: * confuse, e.g. the hashing routines. Instead, /dev/drum is
162: * provided as a character (raw) device.
163: */
164: dev_t swapdev = makedev(3, 0);
165:
166: /*
167: * Returns true if dev is /dev/mem or /dev/kmem.
168: */
169: int
170: iskmemdev(dev)
171: dev_t dev;
172: {
173:
174: return (major(dev) == mem_no && minor(dev) < 2);
175: }
176:
177: /*
178: * Returns true if dev is /dev/zero.
179: */
180: int
181: iszerodev(dev)
182: dev_t dev;
183: {
184:
185: return (major(dev) == mem_no && minor(dev) == 12);
186: }
187:
188: dev_t
189: getnulldev()
190: {
191: return makedev(mem_no, 2);
192: }
193:
194: int chrtoblktbl[] = {
195: /* XXXX This needs to be dynamic for LKMs. */
196: /*VCHR*/ /*VBLK*/
197: /* 0 */ NODEV,
198: /* 1 */ NODEV,
199: /* 2 */ NODEV,
200: /* 3 */ NODEV,
201: /* 4 */ NODEV,
202: /* 5 */ NODEV,
203: /* 6 */ NODEV,
204: /* 7 */ NODEV,
205: /* 8 */ 4, /* SCSI disk */
206: /* 9 */ 6, /* SCSI CD-ROM */
207: /* 10 */ NODEV,
208: /* 11 */ NODEV,
209: /* 12 */ NODEV,
210: /* 13 */ NODEV,
211: /* 14 */ NODEV,
212: /* 15 */ NODEV,
213: /* 16 */ NODEV,
214: /* 17 */ NODEV,
215: /* 18 */ 7, /* ram disk */
216: /* 19 */ 8, /* vnode disk */
217: /* 20 */ NODEV,
218: /* 21 */ NODEV,
219: /* 22 */ NODEV,
220: /* 23 */ NODEV,
221: /* 24 */ NODEV,
222: /* 25 */ NODEV,
223: /* 26 */ 10, /* XD disk */
224: };
225: int nchrtoblktbl = sizeof(chrtoblktbl) / sizeof(chrtoblktbl[0]);
226:
227: /*
228: * This entire table could be autoconfig()ed but that would mean that
229: * the kernel's idea of the console would be out of sync with that of
230: * the standalone boot. I think it best that they both use the same
231: * known algorithm unless we see a pressing need otherwise.
232: */
233: #include <dev/cons.h>
234:
235: #define dartcnpollc nullcnpollc
236: cons_decl(dart);
237:
238: struct consdev constab[] = {
239: #if NDART > 0
240: cons_init(dart),
241: #endif
242: { 0 },
243: };
CVSweb