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

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

1.1       nbrk        1: /*     $OpenBSD: conf.c,v 1.41 2007/05/28 22:26:03 todd Exp $  */
                      2: /*     $NetBSD: conf.c,v 1.39 1997/05/12 08:17:53 thorpej 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 "ccd.h"
                     44: #include "cd.h"
                     45: #include "ch.h"
                     46: #include "ct.h"
                     47: bdev_decl(ct);
                     48: #include "mt.h"
                     49: bdev_decl(mt);
                     50: #include "hd.h"
                     51: bdev_decl(hd);
                     52: #include "rd.h"
                     53: #include "sd.h"
                     54: #include "ss.h"
                     55: #include "st.h"
                     56: #include "uk.h"
                     57: #include "vnd.h"
                     58:
                     59: struct bdevsw  bdevsw[] =
                     60: {
                     61:        bdev_tape_init(NCT,ct),         /* 0: cs80 cartridge tape */
                     62:        bdev_tape_init(NMT,mt),         /* 1: magnetic reel tape */
                     63:        bdev_disk_init(NHD,hd),         /* 2: HPIB disk */
                     64:        bdev_swap_init(1,sw),           /* 3: swap pseudo-device */
                     65:        bdev_disk_init(NSD,sd),         /* 4: SCSI disk */
                     66:        bdev_disk_init(NCCD,ccd),       /* 5: concatenated disk driver */
                     67:        bdev_disk_init(NVND,vnd),       /* 6: vnode disk driver */
                     68:        bdev_tape_init(NST,st),         /* 7: SCSI tape */
                     69:        bdev_disk_init(NRD,rd),         /* 8: RAM disk */
                     70:        bdev_disk_init(NCD,cd),         /* 9: SCSI CD-ROM */
                     71:        bdev_lkm_dummy(),               /* 10 */
                     72:        bdev_lkm_dummy(),               /* 11 */
                     73:        bdev_lkm_dummy(),               /* 12 */
                     74:        bdev_lkm_dummy(),               /* 13 */
                     75:        bdev_lkm_dummy(),               /* 14 */
                     76:        bdev_lkm_dummy(),               /* 15 */
                     77: };
                     78: int    nblkdev = sizeof(bdevsw) / sizeof(bdevsw[0]);
                     79:
                     80: /* open, close, read, write, ioctl -- XXX should be a generic device */
                     81: #define        cdev_ppi_init(c,n) { \
                     82:        dev_init(c,n,open), dev_init(c,n,close), dev_init(c,n,read), \
                     83:        dev_init(c,n,write), dev_init(c,n,ioctl), (dev_type_stop((*))) nullop, \
                     84:        0, (dev_type_poll((*))) enodev, (dev_type_mmap((*))) enodev }
                     85:
                     86: #include "bio.h"
                     87: #define        mmread  mmrw
                     88: #define        mmwrite mmrw
                     89: cdev_decl(mm);
                     90: #include "pty.h"
                     91: cdev_decl(ct);
                     92: cdev_decl(hd);
                     93: #include "ppi.h"
                     94: cdev_decl(ppi);
                     95: #include "dca.h"
                     96: cdev_decl(dca);
                     97: #include "apci.h"
                     98: cdev_decl(apci);
                     99: #include "dcm.h"
                    100: cdev_decl(dcm);
                    101: cdev_decl(mt);
                    102: cdev_decl(fd);
                    103: #include "bpfilter.h"
                    104: #include "tun.h"
                    105: #include "ksyms.h"
                    106: #ifdef XFS
                    107: #include <xfs/nxfs.h>
                    108: cdev_decl(xfs_dev);
                    109: #endif
                    110: #include "wsdisplay.h"
                    111: #include "wskbd.h"
                    112: #include "wsmouse.h"
                    113: #include "wsmux.h"
                    114: #include "pf.h"
                    115: #include "systrace.h"
                    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_tape_init(NCT,ct),         /* 7: cs80 cartridge tape */
                    127:        cdev_disk_init(NSD,sd),         /* 8: SCSI disk */
                    128:        cdev_disk_init(NHD,hd),         /* 9: HPIB disk */
                    129:        cdev_notdef(),                  /* 10 */
                    130:        cdev_ppi_init(NPPI,ppi),        /* 11: printer/plotter interface */
                    131:        cdev_tty_init(NDCA,dca),        /* 12: built-in single-port serial */
                    132:        cdev_notdef(),                  /* 13: was console terminal emulator */
                    133:        cdev_notdef(),                  /* 14: was human interface loop */
                    134:        cdev_tty_init(NDCM,dcm),        /* 15: 4-port serial */
                    135:        cdev_tape_init(NMT,mt),         /* 16: magnetic reel tape */
                    136:        cdev_disk_init(NCCD,ccd),       /* 17: concatenated disk */
                    137:        cdev_disk_init(NCD,cd),         /* 18: SCSI CD-ROM */
                    138:        cdev_disk_init(NVND,vnd),       /* 19: vnode disk driver */
                    139:        cdev_tape_init(NST,st),         /* 20: SCSI tape */
                    140:        cdev_fd_init(1,filedesc),       /* 21: file descriptor pseudo-device */
                    141:        cdev_bpftun_init(NBPFILTER,bpf),/* 22: Berkeley packet filter */
                    142:        cdev_bpftun_init(NTUN,tun),     /* 23: network tunnel */
                    143:        cdev_lkm_init(NLKM,lkm),        /* 24: loadable module driver */
                    144:        cdev_lkm_dummy(),               /* 25 */
                    145:        cdev_lkm_dummy(),               /* 26 */
                    146:        cdev_lkm_dummy(),               /* 27 */
                    147:        cdev_lkm_dummy(),               /* 28 */
                    148:        cdev_lkm_dummy(),               /* 29 */
                    149:        cdev_lkm_dummy(),               /* 30 */
                    150:        cdev_lkm_dummy(),               /* 31 */
                    151:        cdev_random_init(1,random),     /* 32: random generator */
                    152:        cdev_pf_init(NPF,pf),           /* 33: packet filter */
                    153:        cdev_disk_init(NRD,rd),         /* 34: RAM disk */
                    154:        cdev_tty_init(NAPCI,apci),      /* 35: Apollo APCI UARTs */
                    155:        cdev_ksyms_init(NKSYMS,ksyms),  /* 36: Kernel symbols device */
                    156:        cdev_uk_init(NUK,uk),           /* 37 */
                    157:        cdev_ss_init(NSS,ss),           /* 38 */
                    158:        cdev_ch_init(NCH,ch),           /* 39 */
                    159:        cdev_wsdisplay_init(NWSDISPLAY,wsdisplay), /* 40: frame buffers */
                    160:        cdev_mouse_init(NWSKBD,wskbd),  /* 41: keyboards */
                    161:        cdev_mouse_init(NWSMOUSE,wsmouse), /* 42: mice */
                    162:        cdev_mouse_init(NWSMUX,wsmux),  /* 43: ws multiplexor */
                    163:        cdev_notdef(),                  /* 44 */
                    164:        cdev_notdef(),                  /* 45 */
                    165:        cdev_notdef(),                  /* 46 */
                    166:        cdev_notdef(),                  /* 47 */
                    167:        cdev_notdef(),                  /* 48 */
                    168:        cdev_bio_init(NBIO,bio),        /* 49: ioctl tunnel */
                    169:        cdev_systrace_init(NSYSTRACE,systrace), /* 50 system call tracing */
                    170: #ifdef XFS
                    171:        cdev_xfs_init(NXFS,xfs_dev),    /* 51: xfs communication device */
                    172: #else
                    173:        cdev_notdef(),                  /* 51 */
                    174: #endif
                    175:        cdev_ptm_init(NPTY,ptm),        /* 52: pseudo-tty ptm device */
                    176:
                    177: };
                    178: int    nchrdev = sizeof(cdevsw) / sizeof(cdevsw[0]);
                    179:
                    180: int    mem_no = 2;     /* major device number of memory special file */
                    181:
                    182: /*
                    183:  * Swapdev is a fake device implemented
                    184:  * in sw.c used only internally to get to swstrategy.
                    185:  * It cannot be provided to the users, because the
                    186:  * swstrategy routine munches the b_dev and b_blkno entries
                    187:  * before calling the appropriate driver.  This would horribly
                    188:  * confuse, e.g. the hashing routines. Instead, /dev/drum is
                    189:  * provided as a character (raw) device.
                    190:  */
                    191: dev_t  swapdev = makedev(3, 0);
                    192:
                    193: /*
                    194:  * Returns true if dev is /dev/mem or /dev/kmem.
                    195:  */
                    196: int
                    197: iskmemdev(dev)
                    198:        dev_t dev;
                    199: {
                    200:
                    201:        return (major(dev) == mem_no && minor(dev) < 2);
                    202: }
                    203:
                    204: /*
                    205:  * Returns true if dev is /dev/zero.
                    206:  */
                    207: int
                    208: iszerodev(dev)
                    209:        dev_t dev;
                    210: {
                    211:
                    212:        return (major(dev) == mem_no && minor(dev) == 12);
                    213: }
                    214:
                    215: dev_t
                    216: getnulldev()
                    217: {
                    218:        return makedev(mem_no, 2);
                    219: }
                    220:
                    221: int chrtoblktbl[] = {
                    222:        /* XXXX This needs to be dynamic for LKMs. */
                    223:        /*VCHR*/        /*VBLK*/
                    224:        /*  0 */        NODEV,
                    225:        /*  1 */        NODEV,
                    226:        /*  2 */        NODEV,
                    227:        /*  3 */        NODEV,
                    228:        /*  4 */        NODEV,
                    229:        /*  5 */        NODEV,
                    230:        /*  6 */        NODEV,
                    231:        /*  7 */        0,
                    232:        /*  8 */        4,
                    233:        /*  9 */        2,
                    234:        /* 10 */        NODEV,
                    235:        /* 11 */        NODEV,
                    236:        /* 12 */        NODEV,
                    237:        /* 13 */        NODEV,
                    238:        /* 14 */        NODEV,
                    239:        /* 15 */        NODEV,
                    240:        /* 16 */        NODEV,
                    241:        /* 17 */        5,
                    242:        /* 18 */        9,
                    243:        /* 19 */        6,
                    244:        /* 20 */        7,
                    245:        /* 21 */        NODEV,
                    246:        /* 22 */        NODEV,
                    247:        /* 23 */        NODEV,
                    248:        /* 24 */        NODEV,
                    249:        /* 25 */        NODEV,
                    250:        /* 26 */        NODEV,
                    251:        /* 27 */        NODEV,
                    252:        /* 28 */        NODEV,
                    253:        /* 29 */        NODEV,
                    254:        /* 30 */        NODEV,
                    255:        /* 31 */        NODEV,
                    256:        /* 32 */        NODEV,
                    257:        /* 33 */        NODEV,
                    258:        /* 34 */        8,
                    259: };
                    260: int nchrtoblktbl = sizeof(chrtoblktbl) / sizeof(chrtoblktbl[0]);
                    261:
                    262: /*
                    263:  * This entire table could be autoconfig()ed but that would mean that
                    264:  * the kernel's idea of the console would be out of sync with that of
                    265:  * the standalone boot.  I think it best that they both use the same
                    266:  * known algorithm unless we see a pressing need otherwise.
                    267:  */
                    268: #include <dev/cons.h>
                    269:
                    270: cons_decl(ws);
                    271:
                    272: #define dcacnpollc             nullcnpollc
                    273: cons_decl(dca);
                    274:
                    275: #define        apcicnpollc             nullcnpollc
                    276: cons_decl(apci);
                    277:
                    278: #define dcmcnpollc             nullcnpollc
                    279: cons_decl(dcm);
                    280:
                    281: struct consdev constab[] = {
                    282: #if NWSDISPLAY > 0
                    283:        cons_init(ws),
                    284: #endif
                    285: #if NDCA > 0
                    286:        cons_init(dca),
                    287: #endif
                    288: #if NAPCI > 0
                    289:        cons_init(apci),
                    290: #endif
                    291: #if NDCM > 0
                    292:        cons_init(dcm),
                    293: #endif
                    294:        { 0 },
                    295: };

CVSweb