Annotation of sys/arch/sparc/sparc/conf.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: conf.c,v 1.46 2007/05/28 22:26:03 todd Exp $ */
2: /* $NetBSD: conf.c,v 1.40 1996/04/11 19:20:03 thorpej Exp $ */
3:
4: /*
5: * Copyright (c) 1992, 1993
6: * The Regents of the University of California. All rights reserved.
7: *
8: * This software was developed by the Computer Systems Engineering group
9: * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
10: * contributed to Berkeley.
11: *
12: * All advertising materials mentioning features or use of this software
13: * must display the following acknowledgement:
14: * This product includes software developed by the University of
15: * California, Lawrence Berkeley Laboratory.
16: *
17: * Redistribution and use in source and binary forms, with or without
18: * modification, are permitted provided that the following conditions
19: * are met:
20: * 1. Redistributions of source code must retain the above copyright
21: * notice, this list of conditions and the following disclaimer.
22: * 2. Redistributions in binary form must reproduce the above copyright
23: * notice, this list of conditions and the following disclaimer in the
24: * documentation and/or other materials provided with the distribution.
25: * 3. Neither the name of the University nor the names of its contributors
26: * may be used to endorse or promote products derived from this software
27: * without specific prior written permission.
28: *
29: * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32: * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39: * SUCH DAMAGE.
40: *
41: * @(#)conf.c 8.3 (Berkeley) 11/14/93
42: */
43:
44: #include <sys/param.h>
45: #include <sys/systm.h>
46: #include <sys/buf.h>
47: #include <sys/ioctl.h>
48: #include <sys/vnode.h>
49: #include <sys/tty.h>
50: #include <sys/conf.h>
51:
52: #include <machine/conf.h>
53:
54: #include "bio.h"
55: #include "pty.h"
56: #include "bpfilter.h"
57: #include "tun.h"
58: #include "audio.h"
59: #include "vnd.h"
60: #include "ccd.h"
61: #include "raid.h"
62: #include "ch.h"
63: #include "ss.h"
64: #include "uk.h"
65: #include "sd.h"
66: #include "st.h"
67: #include "cd.h"
68: #include "rd.h"
69: #include "presto.h"
70:
71: #include "zstty.h"
72:
73: #include "fdc.h" /* has NFDC and NFD; see files.sparc */
74: #include "xd.h"
75: #include "xy.h"
76: #include "bpp.h"
77: #include "magma.h" /* has NMTTY and NMBPP */
78: #include "spif.h" /* has NSTTY and NSBPP */
79: #include "scf.h"
80: #include "flash.h"
81: #include "fga.h"
82: #include "daadio.h"
83: #include "com.h"
84:
85: #include "wsdisplay.h"
86: #include "wskbd.h"
87: #include "wsmouse.h"
88: #include "wsmux.h"
89:
90: #ifdef XFS
91: #include <xfs/nxfs.h>
92: cdev_decl(xfs_dev);
93: #endif
94: #include "ksyms.h"
95:
96: struct bdevsw bdevsw[] =
97: {
98: bdev_notdef(), /* 0 */
99: bdev_notdef(), /* 1 */
100: bdev_notdef(), /* 2 */
101: bdev_disk_init(NXY,xy), /* 3: SMD disk */
102: bdev_swap_init(1,sw), /* 4 swap pseudo-device */
103: bdev_notdef(), /* 5 */
104: bdev_notdef(), /* 6 */
105: bdev_disk_init(NSD,sd), /* 7: SCSI disk */
106: bdev_disk_init(NVND,vnd), /* 8: vnode disk driver */
107: bdev_disk_init(NCCD,ccd), /* 9: concatenated disk driver */
108: bdev_disk_init(NXD,xd), /* 10: SMD disk */
109: bdev_tape_init(NST,st), /* 11: SCSI tape */
110: bdev_notdef(), /* 12 */
111: bdev_notdef(), /* 13 */
112: bdev_notdef(), /* 14 */
113: bdev_notdef(), /* 15 */
114: bdev_disk_init(NFD,fd), /* 16: floppy disk */
115: bdev_disk_init(NRD,rd), /* 17: ram disk driver */
116: bdev_disk_init(NCD,cd), /* 18: SCSI CD-ROM */
117: bdev_lkm_dummy(), /* 19 */
118: bdev_lkm_dummy(), /* 20 */
119: bdev_lkm_dummy(), /* 21 */
120: bdev_lkm_dummy(), /* 22 */
121: bdev_lkm_dummy(), /* 23 */
122: bdev_lkm_dummy(), /* 24 */
123: bdev_disk_init(NRAID,raid), /* 25: RAIDframe disk driver */
124: bdev_disk_init(NPRESTO,presto), /* 26: Prestoserve NVRAM */
125: };
126: int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
127:
128: #include "pf.h"
129: #include "systrace.h"
130: #include "tctrl.h"
131:
132: struct cdevsw cdevsw[] =
133: {
134: cdev_cn_init(1,cn), /* 0: virtual console */
135: cdev_notdef(), /* 1 */
136: cdev_ctty_init(1,ctty), /* 2: controlling terminal */
137: cdev_mm_init(1,mm), /* 3: /dev/{null,mem,kmem,...} */
138: cdev_notdef(), /* 4 */
139: cdev_notdef(), /* 5 */
140: cdev_notdef(), /* 6 */
141: cdev_swap_init(1,sw), /* 7: /dev/drum (swap pseudo-device) */
142: cdev_notdef(), /* 8 */
143: cdev_disk_init(NXY,xy), /* 9: SMD disk */
144: cdev_notdef(), /* 10 */
145: cdev_notdef(), /* 11 */
146: cdev_tty_init(NZSTTY,zs), /* 12: zs serial */
147: cdev_notdef(), /* 13: was /dev/mouse */
148: cdev_notdef(), /* 14 */
149: cdev_notdef(), /* 15: sun /dev/winNNN */
150: cdev_log_init(1,log), /* 16: /dev/klog */
151: cdev_disk_init(NSD,sd), /* 17: SCSI disk */
152: cdev_tape_init(NST,st), /* 18: SCSI tape */
153: cdev_ch_init(NCH,ch), /* 19: SCSI autochanger */
154: cdev_tty_init(NPTY,pts), /* 20: pseudo-tty slave */
155: cdev_ptc_init(NPTY,ptc), /* 21: pseudo-tty master */
156: cdev_notdef(), /* 22: was /dev/fb */
157: cdev_disk_init(NCCD,ccd), /* 23: concatenated disk driver */
158: cdev_fd_init(1,filedesc), /* 24: file descriptor pseudo-device */
159: cdev_disk_init(NPRESTO,presto), /* 25: Prestoserve NVRAM */
160: cdev_notdef(), /* 26 */
161: cdev_notdef(), /* 27: was /dev/bwtwo */
162: cdev_notdef(), /* 28 */
163: cdev_notdef(), /* 29: was /dev/kbd */
164: cdev_apm_init(NTCTRL,apm), /* 30: tctrl APM interface */
165: cdev_notdef(), /* 31: was /dev/cgtwo */
166: cdev_notdef(), /* 32: should be /dev/gpone */
167: cdev_notdef(), /* 33 */
168: cdev_notdef(), /* 34 */
169: cdev_notdef(), /* 35 */
170: cdev_tty_init(NCOM,com), /* 36: SPARCbook modem */
171: cdev_notdef(), /* 37 */
172: cdev_notdef(), /* 38 */
173: cdev_notdef(), /* 39: was /dev/cgfour */
174: cdev_notdef(), /* 40 */
175: cdev_notdef(), /* 41 */
176: cdev_disk_init(NXD,xd), /* 42: SMD disk */
177: cdev_svr4_net_init(NSVR4_NET,svr4_net), /* 43: svr4 net pseudo-device */
178: cdev_notdef(), /* 44 */
179: cdev_notdef(), /* 45 */
180: cdev_notdef(), /* 46 */
181: cdev_notdef(), /* 47 */
182: cdev_notdef(), /* 48 */
183: cdev_notdef(), /* 49 */
184: cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */
185: #ifdef XFS
186: cdev_xfs_init(NXFS,xfs_dev), /* 51: xfs communication device */
187: #else
188: cdev_notdef(), /* 51 */
189: #endif
190: cdev_notdef(), /* 52 */
191: cdev_notdef(), /* 53 */
192: cdev_disk_init(NFD,fd), /* 54: floppy disk */
193: cdev_notdef(), /* 55: was /dev/cgthree */
194: cdev_notdef(), /* 56 */
195: cdev_notdef(), /* 57 */
196: cdev_disk_init(NCD,cd), /* 58: SCSI CD-ROM */
197: cdev_pf_init(NPF,pf), /* 59: packet filter */
198: cdev_notdef(), /* 60 */
199: cdev_notdef(), /* 61 */
200: cdev_notdef(), /* 62 */
201: cdev_notdef(), /* 63 */
202: cdev_notdef(), /* 64: was /dev/cgeight */
203: cdev_notdef(), /* 65 */
204: cdev_notdef(), /* 66 */
205: cdev_notdef(), /* 67: was /dev/cgsix */
206: cdev_notdef(), /* 68 */
207: cdev_gen_init(NAUDIO,audio), /* 69: /dev/audio */
208: #if defined(SUN4) || defined(SUN4C) || defined(SUN4M)
209: cdev_openprom_init(1,openprom), /* 70: /dev/openprom */
210: #else
211: cdev_notdef(), /* 70 */
212: #endif
213: cdev_notdef(), /* 71 */
214: cdev_notdef(), /* 72 */
215: cdev_notdef(), /* 73 */
216: cdev_notdef(), /* 74 */
217: cdev_notdef(), /* 75 */
218: cdev_notdef(), /* 76 */
219: cdev_notdef(), /* 77 */
220: cdev_wsdisplay_init(NWSDISPLAY, /* 78: frame buffers, etc. */
221: wsdisplay),
222: cdev_mouse_init(NWSKBD, wskbd), /* 79: keyboards */
223: cdev_mouse_init(NWSMOUSE, wsmouse), /* 80: mice */
224: cdev_mouse_init(NWSMUX, wsmux), /* 81: ws multiplexer */
225: cdev_notdef(), /* 82 */
226: cdev_notdef(), /* 83 */
227: cdev_notdef(), /* 84 */
228: cdev_notdef(), /* 85 */
229: cdev_notdef(), /* 86 */
230: cdev_notdef(), /* 87 */
231: cdev_notdef(), /* 88 */
232: cdev_notdef(), /* 89 */
233: cdev_notdef(), /* 90 */
234: cdev_notdef(), /* 91 */
235: cdev_notdef(), /* 92 */
236: cdev_notdef(), /* 93 */
237: cdev_notdef(), /* 94 */
238: cdev_notdef(), /* 95 */
239: cdev_notdef(), /* 96 */
240: cdev_daadio_init(NDAADIO,daadio), /* 97: daadio */
241: cdev_fga_init(NFGA,fga), /* 98: fga */
242: cdev_notdef(), /* 99: was /dev/cgfourteen */
243: cdev_tty_init(NMTTY,mtty), /* 100: magma */
244: cdev_gen_init(NMBPP,mbpp), /* 101: magma */
245: cdev_tty_init(NSTTY,stty), /* 102: spif */
246: cdev_gen_init(NSBPP,sbpp), /* 103: spif */
247: cdev_bpp_init(NBPP,bpp), /* 104: bpp */
248: cdev_bpftun_init(NBPFILTER,bpf),/* 105: packet filter */
249: cdev_disk_init(NRD,rd), /* 106: ram disk driver */
250: cdev_scf_init(NSCF,scf), /* 107: sysconfig regs */
251: cdev_flash_init(NFLASH,flash), /* 108: flash memory */
252: cdev_notdef(), /* 109: was /dev/tcx */
253: cdev_disk_init(NVND,vnd), /* 110: vnode disk driver */
254: cdev_bpftun_init(NTUN,tun), /* 111: network tunnel */
255: cdev_lkm_init(NLKM,lkm), /* 112: loadable module driver */
256: cdev_lkm_dummy(), /* 113 */
257: cdev_lkm_dummy(), /* 114 */
258: cdev_lkm_dummy(), /* 115 */
259: cdev_lkm_dummy(), /* 116 */
260: cdev_lkm_dummy(), /* 117 */
261: cdev_lkm_dummy(), /* 118 */
262: cdev_random_init(1,random), /* 119: random generator */
263: cdev_uk_init(NUK,uk), /* 120: unknown SCSI */
264: cdev_ss_init(NSS,ss), /* 121: SCSI scanner */
265: cdev_ksyms_init(NKSYMS,ksyms), /* 122: Kernel symbols device */
266: cdev_disk_init(NRAID,raid), /* 123: RAIDframe disk driver */
267: cdev_bio_init(NBIO,bio), /* 124: ioctl tunnel */
268: cdev_ptm_init(NPTY,ptm), /* 125: pseudo-tty ptm device */
269: };
270: int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
271:
272: int mem_no = 3; /* major device number of memory special file */
273:
274: /*
275: * Swapdev is a fake device implemented
276: * in sw.c used only internally to get to swstrategy.
277: * It cannot be provided to the users, because the
278: * swstrategy routine munches the b_dev and b_blkno entries
279: * before calling the appropriate driver. This would horribly
280: * confuse, e.g. the hashing routines. Instead, /dev/drum is
281: * provided as a character (raw) device.
282: */
283: dev_t swapdev = makedev(4, 0);
284:
285: /*
286: * Routine that identifies /dev/mem and /dev/kmem.
287: *
288: * A minimal stub routine can always return 0.
289: */
290: int
291: iskmemdev(dev)
292: dev_t dev;
293: {
294:
295: return (major(dev) == mem_no && minor(dev) < 2);
296: }
297:
298: int
299: iszerodev(dev)
300: dev_t dev;
301: {
302: return (major(dev) == mem_no && minor(dev) == 12);
303: }
304:
305: dev_t
306: getnulldev()
307: {
308: return makedev(mem_no, 2);
309: }
310:
311: int chrtoblktbl[] = {
312: /* XXXX This needs to be dynamic for LKMs. */
313: /*VCHR*/ /*VBLK*/
314: /* 0 */ NODEV,
315: /* 1 */ NODEV,
316: /* 2 */ NODEV,
317: /* 3 */ NODEV,
318: /* 4 */ NODEV,
319: /* 5 */ NODEV,
320: /* 6 */ NODEV,
321: /* 7 */ NODEV,
322: /* 8 */ NODEV,
323: /* 9 */ 3,
324: /* 10 */ NODEV,
325: /* 11 */ NODEV,
326: /* 12 */ NODEV,
327: /* 13 */ NODEV,
328: /* 14 */ NODEV,
329: /* 15 */ NODEV,
330: /* 16 */ NODEV,
331: /* 17 */ 7,
332: /* 18 */ 11,
333: /* 19 */ NODEV,
334: /* 20 */ NODEV,
335: /* 21 */ NODEV,
336: /* 22 */ NODEV,
337: /* 23 */ 9,
338: /* 24 */ NODEV,
339: /* 25 */ 26,
340: /* 26 */ NODEV,
341: /* 27 */ NODEV,
342: /* 28 */ NODEV,
343: /* 29 */ NODEV,
344: /* 30 */ NODEV,
345: /* 31 */ NODEV,
346: /* 32 */ NODEV,
347: /* 33 */ NODEV,
348: /* 34 */ NODEV,
349: /* 35 */ NODEV,
350: /* 36 */ NODEV,
351: /* 37 */ NODEV,
352: /* 38 */ NODEV,
353: /* 39 */ NODEV,
354: /* 40 */ NODEV,
355: /* 41 */ NODEV,
356: /* 42 */ 10,
357: /* 43 */ NODEV,
358: /* 44 */ NODEV,
359: /* 45 */ NODEV,
360: /* 46 */ NODEV,
361: /* 47 */ NODEV,
362: /* 48 */ NODEV,
363: /* 49 */ NODEV,
364: /* 50 */ NODEV,
365: /* 51 */ NODEV,
366: /* 52 */ NODEV,
367: /* 53 */ NODEV,
368: /* 54 */ 16,
369: /* 55 */ NODEV,
370: /* 56 */ NODEV,
371: /* 57 */ NODEV,
372: /* 58 */ 18,
373: /* 59 */ NODEV,
374: /* 60 */ NODEV,
375: /* 61 */ NODEV,
376: /* 62 */ NODEV,
377: /* 63 */ NODEV,
378: /* 64 */ NODEV,
379: /* 65 */ NODEV,
380: /* 66 */ NODEV,
381: /* 67 */ NODEV,
382: /* 68 */ NODEV,
383: /* 69 */ NODEV,
384: /* 70 */ NODEV,
385: /* 71 */ NODEV,
386: /* 72 */ NODEV,
387: /* 73 */ NODEV,
388: /* 74 */ NODEV,
389: /* 75 */ NODEV,
390: /* 76 */ NODEV,
391: /* 77 */ NODEV,
392: /* 78 */ NODEV,
393: /* 79 */ NODEV,
394: /* 80 */ NODEV,
395: /* 81 */ NODEV,
396: /* 82 */ NODEV,
397: /* 83 */ NODEV,
398: /* 84 */ NODEV,
399: /* 85 */ NODEV,
400: /* 86 */ NODEV,
401: /* 87 */ NODEV,
402: /* 88 */ NODEV,
403: /* 89 */ NODEV,
404: /* 90 */ NODEV,
405: /* 91 */ NODEV,
406: /* 92 */ NODEV,
407: /* 93 */ NODEV,
408: /* 94 */ NODEV,
409: /* 95 */ NODEV,
410: /* 96 */ NODEV,
411: /* 97 */ NODEV,
412: /* 98 */ NODEV,
413: /* 99 */ NODEV,
414: /*100 */ NODEV,
415: /*101 */ NODEV,
416: /*102 */ NODEV,
417: /*103 */ NODEV,
418: /*104 */ NODEV,
419: /*105 */ NODEV,
420: /*106 */ 17,
421: /*107 */ NODEV,
422: /*108 */ NODEV,
423: /*109 */ NODEV,
424: /*110 */ 8,
425: /*111 */ NODEV,
426: /*112 */ NODEV,
427: /*113 */ NODEV,
428: /*114 */ NODEV,
429: /*115 */ NODEV,
430: /*116 */ NODEV,
431: /*117 */ NODEV,
432: /*118 */ NODEV,
433: /*119 */ NODEV,
434: /*120 */ NODEV,
435: /*121 */ NODEV,
436: /*122 */ NODEV,
437: /*123 */ 25,
438: };
439: int nchrtoblktbl = sizeof(chrtoblktbl) / sizeof(chrtoblktbl[0]);
CVSweb