Annotation of sys/arch/hppa64/hppa64/conf.c, Revision 1.1.1.1
1.1 nbrk 1: /* $OpenBSD: conf.c,v 1.6 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 "ccd.h"
44: #include "vnd.h"
45: #include "rd.h"
46: #include "sd.h"
47: #include "st.h"
48: #include "cd.h"
49: #include "ch.h"
50: #include "ss.h"
51: #include "uk.h"
52: #include "wd.h"
53: bdev_decl(wd);
54: cdev_decl(wd);
55: #if 0
56: #include "fd.h"
57: #else
58: #define NFD 0
59: #endif
60: bdev_decl(fd);
61: cdev_decl(fd);
62:
63: struct bdevsw bdevsw[] =
64: {
65: bdev_swap_init(1,sw), /* 0: swap pseudo-device */
66: bdev_disk_init(NCCD,ccd), /* 1: concatenated disk driver */
67: bdev_disk_init(NVND,vnd), /* 2: vnode disk driver */
68: bdev_disk_init(NRD,rd), /* 3: RAM disk */
69: bdev_disk_init(NSD,sd), /* 4: SCSI disk */
70: bdev_tape_init(NST,st), /* 5: SCSI tape */
71: bdev_disk_init(NCD,cd), /* 6: SCSI CD-ROM */
72: bdev_disk_init(NFD,fd), /* 7: floppy drive */
73: bdev_disk_init(NWD,wd), /* 8: ST506 drive */
74: /* 9: */
75: bdev_lkm_dummy(),
76: bdev_lkm_dummy(),
77: bdev_lkm_dummy(),
78: bdev_lkm_dummy(),
79: bdev_lkm_dummy(),
80: bdev_lkm_dummy(),
81: };
82: int nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
83:
84: #include "audio.h"
85: #include "bio.h"
86: #include "pty.h"
87: #include "wsdisplay.h"
88: #include "wskbd.h"
89: #include "wsmouse.h"
90: #include "wsmux.h"
91: #ifdef XFS
92: #include <xfs/nxfs.h>
93: cdev_decl(xfs_dev);
94: #endif
95:
96: #include "inet.h"
97: #include "bpfilter.h"
98: #include "tun.h"
99:
100: #include "ksyms.h"
101:
102: #include "lpt.h"
103: cdev_decl(lpt);
104:
105: #include "com.h"
106: cdev_decl(com);
107:
108: #include "pf.h"
109:
110: #include "systrace.h"
111:
112: #ifdef USER_PCICONF
113: #include "pci.h"
114: cdev_decl(pci);
115: #endif
116:
117: struct cdevsw cdevsw[] =
118: {
119: cdev_cn_init(1,cn), /* 0: virtual console */
120: cdev_ctty_init(1,ctty), /* 1: controlling terminal */
121: cdev_mm_init(1,mm), /* 2: /dev/{null,mem,kmem,...} */
122: cdev_swap_init(1,sw), /* 3: /dev/drum (swap pseudo-device) */
123: cdev_tty_init(NPTY,pts), /* 4: pseudo-tty slave */
124: cdev_ptc_init(NPTY,ptc), /* 5: pseudo-tty master */
125: cdev_log_init(1,log), /* 6: /dev/klog */
126: cdev_disk_init(NCCD,ccd), /* 7: concatenated disk */
127: cdev_disk_init(NVND,vnd), /* 8: vnode disk driver */
128: cdev_disk_init(NRD,rd), /* 9: RAM disk */
129: cdev_disk_init(NSD,sd), /* 10: SCSI disk */
130: cdev_tape_init(NST,st), /* 11: SCSI tape */
131: cdev_disk_init(NCD,cd), /* 12: SCSI cd-rom */
132: cdev_ch_init(NCH,ch), /* 13: SCSI changer */
133: cdev_ss_init(NSS,ss), /* 14: SCSI scanner */
134: cdev_uk_init(NUK,uk), /* 15: SCSI unknown */
135: cdev_fd_init(1,filedesc), /* 16: file descriptor pseudo-device */
136: cdev_bpftun_init(NBPFILTER,bpf),/* 17: Berkeley packet filter */
137: cdev_bpftun_init(NTUN,tun), /* 18: network tunnel */
138: cdev_lkm_init(NLKM,lkm), /* 19: loadable module driver */
139: cdev_random_init(1,random), /* 20: random generator */
140: cdev_pf_init(NPF,pf), /* 21: packet filter */
141: cdev_tty_init(1,pdc), /* 22: PDC device */
142: cdev_tty_init(NCOM,com), /* 23: RS232 */
143: cdev_disk_init(NFD,fd), /* 24: floppy drive */
144: cdev_ksyms_init(NKSYMS,ksyms), /* 25: Kernel symbols device */
145: cdev_lpt_init(NLPT,lpt), /* 26: parallel printer */
146: cdev_wsdisplay_init(NWSDISPLAY, /* 27: workstation console */
147: wsdisplay),
148: cdev_mouse_init(NWSKBD,wskbd), /* 28: keyboards */
149: cdev_mouse_init(NWSMOUSE,wsmouse), /* 29: mice */
150: cdev_mouse_init(NWSMUX,wsmux), /* 30: mux */
151: #ifdef USER_PCICONF
152: cdev_pci_init(NPCI,pci), /* 31: PCI user */
153: #else
154: cdev_notdef(),
155: #endif
156: #ifdef XFS
157: cdev_xfs_init(NXFS,xfs_dev), /* 32: xfs communication device */
158: #else
159: cdev_notdef(),
160: #endif
161: cdev_notdef(), /* 33: ALTQ (deprecated) */
162: cdev_systrace_init(NSYSTRACE,systrace), /* 34: system call tracing */
163: cdev_audio_init(NAUDIO,audio), /* 35: /dev/audio */
164: cdev_crypto_init(NCRYPTO,crypto), /* 36: /dev/crypto */
165: cdev_bio_init(NBIO,bio), /* 37: ioctl tunnel */
166: cdev_ptm_init(NPTY,ptm), /* 38: pseudo-tty ptm device */
167: cdev_disk_init(NWD,wd), /* 39: ST506 disk */
168: cdev_lkm_dummy(),
169: cdev_lkm_dummy(),
170: cdev_lkm_dummy(),
171: cdev_lkm_dummy(),
172: cdev_lkm_dummy(),
173: cdev_lkm_dummy(),
174: };
175: int nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
176:
177: int mem_no = 2; /* major device number of memory special file */
178:
179: /*
180: * Swapdev is a fake device implemented
181: * in sw.c used only internally to get to swstrategy.
182: * It cannot be provided to the users, because the
183: * swstrategy routine munches the b_dev and b_blkno entries
184: * before calling the appropriate driver. This would horribly
185: * confuse, e.g. the hashing routines. Instead, /dev/drum is
186: * provided as a character (raw) device.
187: */
188: dev_t swapdev = makedev(0, 0);
189:
190: int chrtoblktbl[] = {
191: /* XXXX This needs to be dynamic for LKMs. */
192: /*VCHR*/ /*VBLK*/
193: /* 0 */ NODEV,
194: /* 1 */ NODEV,
195: /* 2 */ NODEV,
196: /* 3 */ NODEV,
197: /* 4 */ NODEV,
198: /* 5 */ NODEV,
199: /* 6 */ NODEV,
200: /* 7 */ 1,
201: /* 8 */ 2,
202: /* 9 */ 3,
203: /* 10 */ 4,
204: /* 11 */ 5,
205: /* 12 */ 6,
206: /* 13 */ NODEV,
207: /* 14 */ NODEV,
208: /* 15 */ NODEV,
209: /* 16 */ NODEV,
210: /* 17 */ NODEV,
211: /* 18 */ NODEV,
212: /* 19 */ NODEV,
213: /* 20 */ NODEV,
214: /* 21 */ NODEV,
215: /* 22 */ NODEV,
216: /* 23 */ NODEV,
217: /* 24 */ 7,
218: /* 25 */ NODEV,
219: /* 26 */ NODEV,
220: /* 27 */ NODEV,
221: /* 28 */ NODEV,
222: /* 29 */ NODEV,
223: /* 30 */ NODEV,
224: /* 31 */ NODEV,
225: /* 32 */ NODEV,
226: /* 33 */ NODEV,
227: /* 34 */ NODEV,
228: /* 35 */ NODEV,
229: /* 36 */ NODEV,
230: /* 37 */ NODEV,
231: /* 38 */ NODEV,
232: /* 39 */ NODEV,
233: };
234: int nchrtoblktbl = sizeof(chrtoblktbl) / sizeof(chrtoblktbl[0]);
235:
236: /*
237: * Returns true if dev is /dev/zero.
238: */
239: int
240: iszerodev(dev)
241: dev_t dev;
242: {
243: return (major(dev) == mem_no && minor(dev) == 12);
244: }
245:
246: dev_t
247: getnulldev()
248: {
249: return makedev(mem_no, 2);
250: }
251:
252: /*
253: * Returns true if dev is /dev/mem or /dev/kmem.
254: */
255: int
256: iskmemdev(dev)
257: dev_t dev;
258: {
259: return (major(dev) == mem_no && minor(dev) < 2);
260: }
261:
262: #include <dev/cons.h>
263:
264: cons_decl(pdc);
265: cons_decl(ws);
266: cons_decl(com);
267:
268: struct consdev constab[] = {
269: cons_init(pdc), /* XXX you'd better leave it here for pdc.c */
270: #if NWSDISPLAY1 > 0
271: cons_init(ws),
272: #endif
273: #if NCOM1 > 0
274: cons_init(com),
275: #endif
276: { 0 }
277: };
278:
CVSweb