This commit was manufactured by cvs2svn to create tag 'FreeBSD-release/1.0'.
[unix-history] / sys / i386 / i386 / conf.c
CommitLineData
15637ed4
RG
1/*-
2 * Copyright (c) 1990 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * William Jolitz.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 * must display the following acknowledgement:
18 * This product includes software developed by the University of
19 * California, Berkeley and its contributors.
20 * 4. 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
22 * without specific prior written permission.
23 *
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
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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
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
34 * SUCH DAMAGE.
35 *
78ed81a3 36 * from: @(#)conf.c 5.8 (Berkeley) 5/12/91
37 * $Id: conf.c,v 1.11 1993/10/23 10:49:24 jkh Exp $
15637ed4 38 */
15637ed4
RG
39
40#include "param.h"
41#include "systm.h"
42#include "buf.h"
43#include "ioctl.h"
44#include "tty.h"
45#include "conf.h"
46
47int nullop(), enxio(), enodev(), rawread(), rawwrite(), swstrategy();
48int rawread(), rawwrite(), swstrategy();
49
50#include "wd.h"
51#if NWD > 0
52int wdopen(),wdclose(),wdstrategy(),wdioctl();
53int wddump(),wdsize();
54#else
55#define wdopen enxio
56#define wdclose enxio
57#define wdstrategy enxio
58#define wdioctl enxio
59#define wddump enxio
60#define wdsize NULL
61#endif
62
15637ed4
RG
63#include "sd.h"
64#if NSD > 0
65int sdopen(),sdclose(),sdstrategy(),sdioctl();
78ed81a3 66int sddump(),sdsize();
15637ed4
RG
67#else
68#define sdopen enxio
69#define sdclose enxio
70#define sdstrategy enxio
71#define sdioctl enxio
72#define sddump enxio
73#define sdsize NULL
74#endif
75
76#include "st.h"
77#if NST > 0
78int stopen(),stclose(),ststrategy(),stioctl();
79/*int stdump(),stsize();*/
80#define stdump enxio
81#define stsize NULL
82#else
83#define stopen enxio
84#define stclose enxio
85#define ststrategy enxio
86#define stioctl enxio
87#define stdump enxio
88#define stsize NULL
89#endif
90
91#include "cd.h"
92#if NCD > 0
93int cdopen(),cdclose(),cdstrategy(),cdioctl();
94int /*cddump(),*/cdsize();
95#define cddump enxio
96#else
97#define cdopen enxio
98#define cdclose enxio
99#define cdstrategy enxio
100#define cdioctl enxio
101#define cddump enxio
102#define cdsize NULL
103#endif
104
78ed81a3 105#include "mcd.h"
106#if NMCD > 0
107int mcdopen(),mcdclose(),mcdstrategy(),mcdioctl();
108int /*mcddump(),*/mcdsize();
109#define mcddump enxio
110#else
111#define mcdopen enxio
112#define mcdclose enxio
113#define mcdstrategy enxio
114#define mcdioctl enxio
115#define mcddump enxio
116#define mcdsize NULL
117#endif
118
15637ed4
RG
119#include "ch.h"
120#if NCH > 0
121int chopen(),chclose(),chioctl();
122#else
123#define chopen enxio
124#define chclose enxio
125#define chioctl enxio
126#endif
127
78ed81a3 128#include "sg.h"
129#if NSG > 0
130int sgopen(),sgclose(),sgioctl(),sgstrategy();
131#define sgdump enxio
132#define sgsize NULL
133#else
134#define sgopen enxio
135#define sgclose enxio
136#define sgstrategy enxio
137#define sgioctl enxio
138#define sgdump enxio
139#define sgsize NULL
140#endif
141
15637ed4
RG
142#include "wt.h"
143#if NWT > 0
144int wtopen(),wtclose(),wtstrategy(),wtioctl();
145int wtdump(),wtsize();
146#else
147#define wtopen enxio
148#define wtclose enxio
149#define wtstrategy enxio
150#define wtioctl enxio
151#define wtdump enxio
152#define wtsize NULL
153#endif
154
155#include "fd.h"
156#if NFD > 0
78ed81a3 157int Fdopen(),fdclose(),fdstrategy(),fdioctl();
15637ed4
RG
158#define fddump enxio
159#define fdsize NULL
160#else
161#define Fdopen enxio
162#define fdclose enxio
163#define fdstrategy enxio
164#define fdioctl enxio
165#define fddump enxio
166#define fdsize NULL
167#endif
168
169int swstrategy(),swread(),swwrite();
170
171struct bdevsw bdevsw[] =
172{
173 { wdopen, wdclose, wdstrategy, wdioctl, /*0*/
174 wddump, wdsize, NULL },
175 { enodev, enodev, swstrategy, enodev, /*1*/
176 enodev, enodev, NULL },
177 { Fdopen, fdclose, fdstrategy, fdioctl, /*2*/
178 fddump, fdsize, NULL },
179 { wtopen, wtclose, wtstrategy, wtioctl, /*3*/
180 wtdump, wtsize, B_TAPE },
15637ed4
RG
181 { sdopen, sdclose, sdstrategy, sdioctl, /*4*/
182 sddump, sdsize, NULL },
15637ed4
RG
183 { stopen, stclose, ststrategy, stioctl, /*5*/
184 stdump, stsize, NULL },
185 { cdopen, cdclose, cdstrategy, cdioctl, /*6*/
186 cddump, cdsize, NULL },
78ed81a3 187 { mcdopen, mcdclose, mcdstrategy, mcdioctl, /*7*/
188 mcddump, mcdsize, NULL },
15637ed4
RG
189/*
190 * If you need a bdev major number, please contact the 386bsd patchkit
191 * coordinator by sending mail to "patches@cs.montana.edu".
192 * If you assign one yourself it may conflict with someone else.
193 */
194};
195int nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]);
196
197int cnopen(),cnclose(),cnread(),cnwrite(),cnioctl(),cnselect();
198
199int pcopen(),pcclose(),pcread(),pcwrite(),pcioctl(),pcmmap();
200extern struct tty pccons;
201
202int cttyopen(), cttyread(), cttywrite(), cttyioctl(), cttyselect();
203
78ed81a3 204int mmopen(), mmclose(), mmrw();
15637ed4
RG
205#define mmselect seltrue
206
207#include "pty.h"
208#if NPTY > 0
209int ptsopen(),ptsclose(),ptsread(),ptswrite(),ptsstop();
210int ptcopen(),ptcclose(),ptcread(),ptcwrite(),ptcselect();
211int ptyioctl();
212struct tty pt_tty[];
213#else
214#define ptsopen enxio
215#define ptsclose enxio
216#define ptsread enxio
217#define ptswrite enxio
218#define ptcopen enxio
219#define ptcclose enxio
220#define ptcread enxio
221#define ptcwrite enxio
222#define ptyioctl enxio
223#define pt_tty NULL
224#define ptcselect enxio
225#define ptsstop nullop
226#endif
227
228#include "com.h"
229#if NCOM > 0
230int comopen(),comclose(),comread(),comwrite(),comioctl(),comselect();
231#define comreset enxio
232extern struct tty com_tty[];
233#else
234#define comopen enxio
235#define comclose enxio
236#define comread enxio
237#define comwrite enxio
238#define comioctl enxio
239#define comreset enxio
240#define comselect enxio
241#define com_tty NULL
242#endif
243
244int logopen(),logclose(),logread(),logioctl(),logselect();
245
246int ttselect(), seltrue();
247
248#include "lpt.h"
249#if NLPT > 0
250int lptopen(),lptclose(),lptwrite(),lptioctl();
251#else
252#define lptopen enxio
253#define lptclose enxio
254#define lptwrite enxio
255#define lptioctl enxio
256#endif
257
15637ed4
RG
258#include "tw.h"
259#if NTW > 0
260int twopen(),twclose(),twread(),twwrite(),twselect();
261#else
262#define twopen enxio
263#define twclose enxio
264#define twread enxio
265#define twwrite enxio
266#define twselect enxio
267#endif
268
78ed81a3 269#include "sb.h" /* Sound Blaster */
270#if NSB > 0
271int sbopen(), sbclose(), sbioctl(), sbread(), sbwrite();
272int sbselect();
273#else
274#define sbopen enxio
275#define sbclose enxio
276#define sbioctl enxio
277#define sbread enxio
278#define sbwrite enxio
279#define sbselect seltrue
280#endif
281
282#include "snd.h" /* General Sound Driver */
283#if NSND > 0
284int sndopen(), sndclose(), sndioctl(), sndread(), sndwrite();
285int sndselect();
286#else
287#define sndopen enxio
288#define sndclose enxio
289#define sndioctl enxio
290#define sndread enxio
291#define sndwrite enxio
292#define sndselect seltrue
293#endif
294
15637ed4
RG
295int fdopen();
296
297#include "bpfilter.h"
298#if NBPFILTER > 0
299int bpfopen(),bpfclose(),bpfread(),bpfwrite(),bpfselect(),bpfioctl();
300#else
301#define bpfopen enxio
302#define bpfclose enxio
303#define bpfread enxio
304#define bpfwrite enxio
305#define bpfselect enxio
306#define bpfioctl enxio
307#endif
308
309#include "dcfclk.h"
310#if NDCFCLK > 0
311int dcfclkopen(),dcfclkclose(),dcfclkread(),dcfclkioctl(),dcfclkselect();
312#else
313#define dcfclkopen enxio
314#define dcfclkclose enxio
315#define dcfclkread enxio
316#define dcfclkioctl enxio
317#define dcfclkselect enxio
318#endif
319
320#include "lpa.h"
321#if NLPA > 0
322int lpaopen(),lpaclose(),lpawrite(),lpaioctl();
323#else
324#define lpaopen enxio
325#define lpaclose enxio
326#define lpawrite enxio
327#define lpaioctl enxio
328#endif
329
330#include "speaker.h"
331#if NSPEAKER > 0
332int spkropen(),spkrclose(),spkrwrite(),spkrioctl();
333#else
334#define spkropen enxio
335#define spkrclose enxio
336#define spkrwrite enxio
337#define spkrioctl enxio
338#endif
339
340#include "mse.h"
341#if NMSE > 0
342int mseopen(),mseclose(),mseread(),mseselect();
343#else
344#define mseopen enxio
345#define mseclose enxio
346#define mseread enxio
347#define mseselect enxio
348#endif
349
350#include "sio.h"
351#if NSIO > 0
352int sioopen(),sioclose(),sioread(),siowrite(),sioioctl(),sioselect(),
353 siostop();
354#define sioreset enxio
355extern struct tty sio_tty[];
356#else
357#define sioopen enxio
358#define sioclose enxio
359#define sioread enxio
360#define siowrite enxio
361#define sioioctl enxio
362#define siostop enxio
363#define sioreset enxio
364#define sioselect enxio
365#define sio_tty NULL
366#endif
367
368struct cdevsw cdevsw[] =
369{
370 { cnopen, cnclose, cnread, cnwrite, /*0*/
371 cnioctl, nullop, nullop, NULL, /* console */
372 cnselect, enodev, NULL },
373 { cttyopen, nullop, cttyread, cttywrite, /*1*/
374 cttyioctl, nullop, nullop, NULL, /* tty */
375 cttyselect, enodev, NULL },
78ed81a3 376 { mmopen, mmclose, mmrw, mmrw, /*2*/
377 enodev, nullop, nullop, NULL, /* memory */
378 mmselect, enodev, NULL },
15637ed4
RG
379 { wdopen, wdclose, rawread, rawwrite, /*3*/
380 wdioctl, enodev, nullop, NULL, /* wd */
381 seltrue, enodev, wdstrategy },
382 { nullop, nullop, rawread, rawwrite, /*4*/
383 enodev, enodev, nullop, NULL, /* swap */
384 enodev, enodev, swstrategy },
385 { ptsopen, ptsclose, ptsread, ptswrite, /*5*/
386 ptyioctl, ptsstop, nullop, pt_tty, /* ttyp */
387 ttselect, enodev, NULL },
388 { ptcopen, ptcclose, ptcread, ptcwrite, /*6*/
389 ptyioctl, nullop, nullop, pt_tty, /* ptyp */
390 ptcselect, enodev, NULL },
391 { logopen, logclose, logread, enodev, /*7*/
392 logioctl, enodev, nullop, NULL, /* klog */
393 logselect, enodev, NULL },
394 { comopen, comclose, comread, comwrite, /*8*/
395 comioctl, enodev, comreset, com_tty, /* com */
396 comselect, enodev, NULL },
397 { Fdopen, fdclose, rawread, rawwrite, /*9*/
398 fdioctl, enodev, nullop, NULL, /* Fd (!=fd) */
399 seltrue, enodev, fdstrategy },
400 { wtopen, wtclose, rawread, rawwrite, /*10*/
401 wtioctl, enodev, nullop, NULL, /* wt */
402 seltrue, enodev, wtstrategy },
403 { enodev, enodev, enodev, enodev, /*11*/
404 enodev, enodev, nullop, NULL,
405 seltrue, enodev, enodev },
406 { pcopen, pcclose, pcread, pcwrite, /*12*/
407 pcioctl, nullop, nullop, &pccons, /* pc */
408 ttselect, pcmmap, NULL },
15637ed4
RG
409 { sdopen, sdclose, rawread, rawwrite, /*13*/
410 sdioctl, enodev, nullop, NULL, /* sd */
411 seltrue, enodev, sdstrategy },
15637ed4
RG
412 { stopen, stclose, rawread, rawwrite, /*14*/
413 stioctl, enodev, nullop, NULL, /* st */
414 seltrue, enodev, ststrategy },
415 { cdopen, cdclose, rawread, enodev, /*15*/
416 cdioctl, enodev, nullop, NULL, /* cd */
417 seltrue, enodev, cdstrategy },
418 { lptopen, lptclose, nullop, lptwrite, /*16*/
419 lptioctl, nullop, nullop, NULL, /* lpt */
420 seltrue, enodev, enodev},
421 { chopen, chclose, enxio, enxio, /*17*/
422 chioctl, enxio, enxio, NULL, /* ch */
423 enxio, enxio, enxio },
78ed81a3 424 { sgopen, sgclose, enodev, enodev, /*18*/
425 sgioctl, enodev, nullop, NULL, /* scsi 'generic' */
426 seltrue, enodev, sgstrategy },
15637ed4
RG
427 { twopen, twclose, twread, twwrite, /*19*/
428 enodev, nullop, nullop, NULL, /* tw */
429 twselect, enodev, enodev },
78ed81a3 430 { sbopen, sbclose, sbread, sbwrite, /*20*/
431 sbioctl, enodev, enodev, NULL, /* soundblaster*/
432 sbselect, enodev, NULL },
433 { enodev, enodev, enodev, enodev, /*21*/
434 enodev, enodev, nullop, NULL, /* psm */
435 enodev, enodev, enodev },
15637ed4
RG
436 { fdopen, enxio, enxio, enxio, /*22*/
437 enxio, enxio, enxio, NULL, /* fd (!=Fd) */
438 enxio, enxio, enxio },
439 { bpfopen, bpfclose, bpfread, bpfwrite, /*23*/
440 bpfioctl, enodev, nullop, NULL, /* bpf */
441 bpfselect, enodev, NULL },
442 { dcfclkopen, dcfclkclose, dcfclkread, enodev, /*24*/
443 dcfclkioctl, enodev, nullop, NULL, /* dcfclk */
444 dcfclkselect, enodev, NULL },
445 { lpaopen, lpaclose, nullop, lpawrite, /*25*/
446 lpaioctl, nullop, nullop, NULL, /* lpa */
447 seltrue, enodev, enodev},
448 { spkropen, spkrclose, enxio, spkrwrite, /*26*/
449 spkrioctl, enxio, enxio, NULL, /* spkr */
450 enxio, enxio, enxio },
451 { mseopen, mseclose, mseread, nullop, /*27*/
452 nullop, enodev, nullop, NULL, /* mse */
453 mseselect, enodev, NULL },
454 { sioopen, sioclose, sioread, siowrite, /*28*/
455 sioioctl, siostop, sioreset, sio_tty, /* sio */
456 sioselect, enodev, NULL },
78ed81a3 457 { mcdopen, mcdclose, rawread, enodev, /*29*/
458 mcdioctl, enodev, nullop, NULL, /* mitsumi cd */
459 seltrue, enodev, mcdstrategy },
460 { sndopen, sndclose, sndread, sndwrite, /*30*/
461 sndioctl, enodev, enodev, NULL, /* sound driver */
462 sndselect, enodev, NULL },
15637ed4 463/*
78ed81a3 464 * If you need a cdev major number, please contact the FreeBSD team
465 * by sending mail to `freebsd-hackers@freefall.cdrom.com'.
15637ed4
RG
466 * If you assign one yourself it may then conflict with someone else.
467 */
468};
469int nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);
470
471int mem_no = 2; /* major device number of memory special file */
472
473/*
474 * Swapdev is a fake device implemented
475 * in sw.c used only internally to get to swstrategy.
476 * It cannot be provided to the users, because the
477 * swstrategy routine munches the b_dev and b_blkno entries
478 * before calling the appropriate driver. This would horribly
479 * confuse, e.g. the hashing routines. Instead, /dev/drum is
480 * provided as a character (raw) device.
481 */
482dev_t swapdev = makedev(1, 0);