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

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

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

CVSweb