[BACK]Return to conf.c CVS log [TXT][DIR] Up to [local] / sys / arch / alpha / alpha

Annotation of sys/arch/alpha/alpha/conf.c, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: conf.c,v 1.55 2007/06/20 18:28:56 miod Exp $  */
                      2: /*     $NetBSD: conf.c,v 1.16 1996/10/18 21:26:57 cgd Exp $    */
                      3:
                      4: /*-
                      5:  * Copyright (c) 1991 The Regents of the University of California.
                      6:  * All rights reserved.
                      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. Neither the name of the University nor the names of its contributors
                     17:  *    may be used to endorse or promote products derived from this software
                     18:  *    without specific prior written permission.
                     19:  *
                     20:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     21:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     22:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     23:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     24:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     25:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     26:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     27:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     28:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     29:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     30:  * SUCH DAMAGE.
                     31:  *
                     32:  *      @(#)conf.c     7.9 (Berkeley) 5/28/91
                     33:  */
                     34:
                     35: #include <sys/param.h>
                     36: #include <sys/systm.h>
                     37: #include <sys/buf.h>
                     38: #include <sys/ioctl.h>
                     39: #include <sys/tty.h>
                     40: #include <sys/conf.h>
                     41: #include <sys/vnode.h>
                     42:
                     43: #include "inet.h"
                     44:
                     45: #include "wd.h"
                     46: bdev_decl(wd);
                     47: #include "fd.h"
                     48: bdev_decl(fd);
                     49: #include "st.h"
                     50: #include "cd.h"
                     51: #include "sd.h"
                     52: #include "ss.h"
                     53: #include "uk.h"
                     54: #include "vnd.h"
                     55: #include "raid.h"
                     56: #include "ccd.h"
                     57: #include "rd.h"
                     58: #include "bktr.h"
                     59: #include "radio.h"
                     60:
                     61: struct bdevsw  bdevsw[] =
                     62: {
                     63:        bdev_disk_init(NWD,wd),         /* 0: ST506/ESDI/IDE disk */
                     64:        bdev_swap_init(1,sw),           /* 1: swap pseudo-device */
                     65:        bdev_tape_init(NST,st),         /* 2: SCSI tape */
                     66:        bdev_disk_init(NCD,cd),         /* 3: SCSI CD-ROM */
                     67:        bdev_disk_init(NFD,fd),         /* 4: Floppy disk */
                     68:        bdev_notdef(),                  /* 5 */
                     69:        bdev_disk_init(NRD,rd),         /* 6: ram disk driver */
                     70:        bdev_disk_init(NCCD,ccd),       /* 7: concatenated disk driver */
                     71:        bdev_disk_init(NSD,sd),         /* 8: SCSI disk */
                     72:        bdev_disk_init(NVND,vnd),       /* 9: vnode disk driver */
                     73:        bdev_lkm_dummy(),               /* 10 */
                     74:        bdev_lkm_dummy(),               /* 11 */
                     75:        bdev_lkm_dummy(),               /* 12 */
                     76:        bdev_lkm_dummy(),               /* 13 */
                     77:        bdev_lkm_dummy(),               /* 14 */
                     78:        bdev_lkm_dummy(),               /* 15 */
                     79:        bdev_disk_init(NRAID,raid),     /* 16 */
                     80: };
                     81: int    nblkdev = sizeof (bdevsw) / sizeof (bdevsw[0]);
                     82:
                     83: #define        mmread  mmrw
                     84: #define        mmwrite mmrw
                     85: cdev_decl(mm);
                     86: #include "pty.h"
                     87: #include "tun.h"
                     88: #include "bpfilter.h"
                     89: #include "iop.h"
                     90: #include "ch.h"
                     91: #include "scc.h"
                     92: cdev_decl(scc);
                     93: #include "audio.h"
                     94: #include "com.h"
                     95: cdev_decl(com);
                     96: #include "wsdisplay.h"
                     97: #include "wskbd.h"
                     98: #include "wsmouse.h"
                     99: #include "wsmux.h"
                    100: #include "midi.h"
                    101: cdev_decl(midi);
                    102: #include "sequencer.h"
                    103: cdev_decl(music);
                    104:
                    105: #include "spkr.h"
                    106: cdev_decl(spkr);
                    107:
                    108: #include "bio.h"
                    109: #include "lpt.h"
                    110: cdev_decl(lpt);
                    111: cdev_decl(prom);                       /* XXX XXX XXX */
                    112: cdev_decl(wd);
                    113: cdev_decl(fd);
                    114: #include "cy.h"
                    115: cdev_decl(cy);
                    116: #ifdef XFS
                    117: #include <xfs/nxfs.h>
                    118: cdev_decl(xfs_dev);
                    119: #endif
                    120: #include "ksyms.h"
                    121:
                    122: /* USB Devices */
                    123: #include "usb.h"
                    124: #include "uhid.h"
                    125: #include "ugen.h"
                    126: #include "ulpt.h"
                    127: #include "ucom.h"
                    128: #include "pf.h"
                    129: #ifdef USER_PCICONF
                    130: #include "pci.h"
                    131: cdev_decl(pci);
                    132: #endif
                    133:
                    134: #include "systrace.h"
                    135: #include "hotplug.h"
                    136:
                    137: struct cdevsw  cdevsw[] =
                    138: {
                    139:        cdev_cn_init(1,cn),             /* 0: virtual console */
                    140:        cdev_ctty_init(1,ctty),         /* 1: controlling terminal */
                    141:        cdev_mm_init(1,mm),             /* 2: /dev/{null,mem,kmem,...} */
                    142:        cdev_swap_init(1,sw),           /* 3: /dev/drum (swap pseudo-device) */
                    143:        cdev_tty_init(NPTY,pts),        /* 4: pseudo-tty slave */
                    144:        cdev_ptc_init(NPTY,ptc),        /* 5: pseudo-tty master */
                    145:        cdev_log_init(1,log),           /* 6: /dev/klog */
                    146:        cdev_bpftun_init(NTUN,tun),     /* 7: network tunnel */
                    147:        cdev_disk_init(NSD,sd),         /* 8: SCSI disk */
                    148:        cdev_disk_init(NVND,vnd),       /* 9: vnode disk driver */
                    149:        cdev_fd_init(1,filedesc),       /* 10: file descriptor pseudo-dev */
                    150:        cdev_bpftun_init(NBPFILTER,bpf),/* 11: Berkeley packet filter */
                    151:        cdev_tape_init(NST,st),         /* 12: SCSI tape */
                    152:        cdev_disk_init(NCD,cd),         /* 13: SCSI CD-ROM */
                    153:        cdev_ch_init(NCH,ch),           /* 14: SCSI autochanger */
                    154:        cdev_tty_init(NSCC,scc),        /* 15: scc 8530 serial interface */
                    155:        cdev_lkm_init(NLKM,lkm),        /* 16: loadable module driver */
                    156:        cdev_lkm_dummy(),               /* 17 */
                    157:        cdev_lkm_dummy(),               /* 18 */
                    158:        cdev_lkm_dummy(),               /* 19 */
                    159:        cdev_lkm_dummy(),               /* 20 */
                    160:        cdev_lkm_dummy(),               /* 21 */
                    161:        cdev_lkm_dummy(),               /* 22 */
                    162:        cdev_tty_init(1,prom),          /* 23: XXX prom console */
                    163:        cdev_audio_init(NAUDIO,audio),  /* 24: generic audio I/O */
                    164:        cdev_wsdisplay_init(NWSDISPLAY,wsdisplay), /* 25: workstation console */
                    165:        cdev_tty_init(NCOM,com),        /* 26: ns16550 UART */
                    166:        cdev_disk_init(NCCD,ccd),       /* 27: concatenated disk driver */
                    167:        cdev_disk_init(NRD,rd),         /* 28: ram disk driver */
                    168:        cdev_mouse_init(NWSKBD,wskbd),  /* 29: /dev/kbd XXX */
                    169:        cdev_mouse_init(NWSMOUSE,wsmouse),      /* 30: /dev/mouse XXX */
                    170:        cdev_lpt_init(NLPT,lpt),        /* 31: parallel printer */
                    171:        cdev_scanner_init(NSS,ss),      /* 32: SCSI scanner */
                    172:        cdev_uk_init(NUK,uk),           /* 33: SCSI unknown */
                    173:        cdev_random_init(1,random),     /* 34: random data source */
                    174:        cdev_pf_init(NPF, pf),          /* 35: packet filter */
                    175:        cdev_disk_init(NWD,wd),         /* 36: ST506/ESDI/IDE disk */
                    176:        cdev_disk_init(NFD,fd),         /* 37: Floppy disk */
                    177:         cdev_tty_init(NCY,cy),          /* 38: Cyclom serial port */
                    178:        cdev_ksyms_init(NKSYMS,ksyms),  /* 39: Kernel symbols device */
                    179:        cdev_spkr_init(NSPKR,spkr),     /* 40: PC speaker */
                    180:        cdev_midi_init(NMIDI,midi),     /* 41: MIDI I/O */
                    181:         cdev_midi_init(NSEQUENCER,sequencer),   /* 42: sequencer I/O */
                    182:        cdev_disk_init(NRAID,raid),     /* 43: RAIDframe disk driver */
                    183:        cdev_notdef(),                  /* 44 */
                    184:        cdev_usb_init(NUSB,usb),        /* 45: USB controller */
                    185:        cdev_usbdev_init(NUHID,uhid),   /* 46: USB generic HID */
                    186:        cdev_ulpt_init(NULPT,ulpt),     /* 47: USB printer */
                    187:        cdev_usbdev_init(NUGEN,ugen),   /* 48: USB generic driver */
                    188:        cdev_tty_init(NUCOM, ucom),     /* 49: USB tty */
                    189:        cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */
                    190: #ifdef XFS
                    191:        cdev_xfs_init(NXFS,xfs_dev),    /* 51: xfs communication device */
                    192: #else
                    193:        cdev_notdef(),                  /* 51 */
                    194: #endif
                    195: #ifdef USER_PCICONF
                    196:        cdev_pci_init(NPCI,pci),        /* 52: PCI user */
                    197: #else
                    198:        cdev_notdef(),
                    199: #endif
                    200:        cdev_bio_init(NBIO,bio),        /* 53: ioctl tunnel */
                    201:        cdev_iop_init(NIOP, iop),       /* 54: I2O IOP control interface */
                    202:        cdev_ptm_init(NPTY,ptm),        /* 55: pseudo-tty ptm device */
                    203:        cdev_hotplug_init(NHOTPLUG,hotplug), /* 56: devices hot plugging */
                    204:        cdev_crypto_init(NCRYPTO,crypto), /* 57: /dev/crypto */
                    205:        cdev_bktr_init(NBKTR,bktr),     /* 58: Bt848 video capture device */
                    206:        cdev_radio_init(NRADIO,radio), /* 59: generic radio I/O */
                    207:        cdev_mouse_init(NWSMUX, wsmux), /* 60: ws multiplexor */
                    208: };
                    209: int    nchrdev = sizeof (cdevsw) / sizeof (cdevsw[0]);
                    210:
                    211: int    mem_no = 2;     /* major device number of memory special file */
                    212:
                    213: /*
                    214:  * Swapdev is a fake device implemented
                    215:  * in sw.c used only internally to get to swstrategy.
                    216:  * It cannot be provided to the users, because the
                    217:  * swstrategy routine munches the b_dev and b_blkno entries
                    218:  * before calling the appropriate driver.  This would horribly
                    219:  * confuse, e.g. the hashing routines. Instead, /dev/drum is
                    220:  * provided as a character (raw) device.
                    221:  */
                    222: dev_t  swapdev = makedev(1, 0);
                    223:
                    224: /*
                    225:  * Returns true if dev is /dev/mem or /dev/kmem.
                    226:  */
                    227: int
                    228: iskmemdev(dev)
                    229:        dev_t dev;
                    230: {
                    231:
                    232:        return (major(dev) == mem_no && minor(dev) < 2);
                    233: }
                    234:
                    235: /*
                    236:  * Returns true if dev is /dev/zero.
                    237:  */
                    238: int
                    239: iszerodev(dev)
                    240:        dev_t dev;
                    241: {
                    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: int chrtoblktbl[] = {
                    253:        /* XXXX This needs to be dynamic for LKMs. */
                    254:        /*VCHR*/        /*VBLK*/
                    255:        /*  0 */        NODEV,
                    256:        /*  1 */        NODEV,
                    257:        /*  2 */        NODEV,
                    258:        /*  3 */        NODEV,
                    259:        /*  4 */        NODEV,
                    260:        /*  5 */        NODEV,
                    261:        /*  6 */        NODEV,
                    262:        /*  7 */        NODEV,
                    263:        /*  8 */        8,              /* sd */
                    264:        /*  9 */        9,              /* vnd */
                    265:        /* 10 */        NODEV,
                    266:        /* 11 */        NODEV,
                    267:        /* 12 */        2,              /* st */
                    268:        /* 13 */        3,              /* cd */
                    269:        /* 14 */        NODEV,
                    270:        /* 15 */        NODEV,
                    271:        /* 16 */        NODEV,
                    272:        /* 17 */        NODEV,
                    273:        /* 18 */        NODEV,
                    274:        /* 19 */        NODEV,
                    275:        /* 20 */        NODEV,
                    276:        /* 21 */        NODEV,
                    277:        /* 22 */        NODEV,
                    278:        /* 23 */        NODEV,
                    279:        /* 24 */        NODEV,
                    280:        /* 25 */        NODEV,
                    281:        /* 26 */        NODEV,
                    282:        /* 27 */        7,              /* ccd */
                    283:        /* 28 */        6,              /* rd */
                    284:        /* 29 */        NODEV,
                    285:        /* 30 */        NODEV,
                    286:        /* 31 */        NODEV,
                    287:        /* 32 */        NODEV,
                    288:        /* 33 */        NODEV,
                    289:        /* 34 */        NODEV,
                    290:        /* 35 */        NODEV,
                    291:        /* 36 */        0,
                    292:        /* 37 */        4,              /* fd */
                    293:        /* 38 */        NODEV,
                    294:        /* 39 */        NODEV,
                    295:        /* 40 */        NODEV,
                    296:        /* 41 */        NODEV,
                    297:        /* 42 */        NODEV,
                    298:        /* 43 */        16,             /* raid */
                    299:        /* 44 */        NODEV,
                    300:        /* 45 */        NODEV,
                    301:        /* 46 */        NODEV,
                    302:        /* 47 */        NODEV,
                    303:        /* 48 */        NODEV,
                    304:        /* 49 */        NODEV,
                    305:        /* 50 */        NODEV,
                    306:        /* 51 */        NODEV,
                    307: };
                    308: int nchrtoblktbl = sizeof(chrtoblktbl) / sizeof(chrtoblktbl[0]);

CVSweb