[BACK]Return to MAKEDEV.mi CVS log [TXT][DIR] Up to [local] / src / etc

Annotation of src/etc/MAKEDEV.mi, Revision 1.31

1.1       todd        1: include(MAKEDEV.sub)dnl
                      2: dnl
1.31    ! todd        3: vers(a, {-$OpenBSD: MAKEDEV.mi,v 1.30 2002/02/14 14:32:26 todd Exp $-})dnl
1.1       todd        4: dnl
                      5: divert(1)dnl
                      6: {-#-}
                      7: {-#-} Copyright (c) 2001 Todd T. Fries <todd@OpenBSD.org>
                      8: {-#-} All rights reserved.
                      9: {-#-}
                     10: {-#-} Redistribution and use in source and binary forms, with or without
                     11: {-#-} modification, are permitted provided that the following conditions
                     12: {-#-} are met:
                     13: {-#-} 1. Redistributions of source code must retain the above copyright
                     14: {-#-}    notice, this list of conditions and the following disclaimer.
                     15: {-#-} 2. The name of the author may not be used to endorse or promote products
                     16: {-#-}    derived from this software without specific prior written permission.
                     17: {-#-}
                     18: {-#-} THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
                     19: {-#-} INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
                     20: {-#-} AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
                     21: {-#-} THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
                     22: {-#-} EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
                     23: {-#-} PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
                     24: {-#-} OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
                     25: {-#-} WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
                     26: {-#-} OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
                     27: {-#-} ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
                     28: {-#-}
                     29: dnl
                     30: dnl Diversions:  (upon termination, concatenated output queues)
                     31: dnl
                     32: dnl 0 - very top
                     33: dnl 1 - descriptions of devices
                     34: dnl 2 - init of script, function definitions, etc
                     35: dnl 3 - beginning of global recursive R() function
                     36: dnl 7 - body of MAKEDEV, device creations, etc
                     37: dnl 9 - end
                     38: dnl
                     39: dnl HOW TO ADD A DEVICE:
                     40: dnl
                     41: dnl In this file, you must use at least two macros:
                     42: dnl
1.29      todd       43: dnl  Use '__devitem(uniqueid, name-pattern, description)' to create an entry
1.1       todd       44: dnl  in the description at the top of the generated MAKEDEV file:
                     45: dnl
1.29      todd       46: dnl    __devitem(sca, sca*, Sugar Generic device)dnl
1.1       todd       47: dnl
                     48: dnl  This is ultimately shown as:
                     49: dnl
                     50: dnl    #  sca*   Sugar Generic device
                     51: dnl
1.29      todd       52: dnl  Use '_mkdev(uniqueid, shell-pattern, {-shell-script-})dnl' to create
1.1       todd       53: dnl  a shell script fragment used to 'create' the device (be sure to match
                     54: dnl  the uniqueid from above):
                     55: dnl
1.29      todd       56: dnl    _mkdev(sca, sca*, {-M sca$U c major_sca_c $U
                     57: dnl           M rsca$U b major_sca_b Add($U, 128)-})dnl
1.1       todd       58: dnl
                     59: dnl  This is ultimately expanded into:
                     60: dnl
                     61: dnl    sca*)  M sca$U c 24 $U
                     62: dnl           M sca$U b 42 $(($U+128));;
                     63: dnl
1.29      todd       64: dnl In the MAKEDEV.md file, add a '_DEV(uniqueid, charmajor, blockmajor)'
1.1       todd       65: dnl entry:
                     66: dnl
1.29      todd       67: dnl   _DEV(sca, 24, 42)
1.1       todd       68: dnl
                     69: dnl Final step is to add an entry to the 'all' entry below. For a short
                     70: dnl example:
                     71: dnl
1.29      todd       72: dnl   _mkdev({-all-}, {-all-}, {-dnl
                     73: dnl   _dl({-std-}, {-std-}, {-sca-}, {-sca0 sca1 sca2 sca3-})-})dnl
1.1       todd       74: dnl
                     75: dnl would expand to:
                     76: dnl
                     77: dnl   all)
                     78: dnl        R std sca0 sca1 sca2 sca3
                     79: dnl        ;;
                     80: dnl
                     81: dnl presuming '_DEV(sca..' and '_DEV(std)' were in the MAKEDEV.md file.
                     82: dnl
                     83: dnl
                     84: dnl Everything is 'automatically' added to 'MAKEDEV' based on whether or
                     85: dnl not the '_DEV()' entry has a corresponding _mkdev() and __devitem()
                     86: dnl entry in MAKEDEV.sub (this file).
                     87: dnl
                     88: dnl Note: be very wary of adding whitespace, carriage returns, or not
                     89: dnl finishing a macro with ')dnl' .. otherwise, extra blank lines show up
                     90: dnl in the output.
                     91: dnl
1.31    ! todd       92: dnl TODO:
        !            93: dnl
        !            94: dnl make a 'disktgt' macro that automatically does:
        !            95: dnl disktgt(rd, {-Ramdisk-})
        !            96: dnl
        !            97: dnl    target(all,rd,0)
        !            98: dnl    target(ramd,rd,0)
        !            99: dnl    disk_q(rd)
        !           100: dnl    __devitem(rd, {-rd*-}, {-Ramdisk-})dnl
        !           101: dnl
        !           102: dnl
1.29      todd      103: _mkdev(loc, local, {-test -s $T.local && sh $T.local-})dnl
1.1       todd      104: dnl
1.29      todd      105: __devtitle(make, Device "make" file.  Valid arguments)dnl
                    106: __devitem({-all-}, {-all-},
1.4       todd      107: {-makes all known devices{-,-} including local devices.
1.1       todd      108: {-#-}          Tries to make the ``standard'' number of each type.-})dnl
                    109: dnl
                    110: dnl 'all' is special.  The 'D'evice 'L'ist (or _dl) macro checks to see if
                    111: dnl a particular devices is in the MAKEDEV.md file, and if so, includes the
                    112: dnl necessary devices.  Otherwise the devices are not included in the 'all'
                    113: dnl target.  Note this keeps line lengths to less than column 70.  For the
                    114: dnl gory details see the definition of '_dl' in MAKEDEV.sub
                    115: dnl
1.29      todd      116: twrget(all, attyB, sd, 5, 6, 7, 8, 9)dnl
                    117: target(all, sd, 0, 1, 2, 3, 4)dnl
                    118: target(all, mcd, 0)dnl
                    119: twrget(all, fdesc, fd)dnl
                    120: target(all, pty, 0, 1, 2)dnl
                    121: target(all, st, 0, 1)dnl
                    122: target(all, ch, 0)dnl
                    123: target(all, cd, 0, 1)dnl
                    124: target(all, mcd, 0)dnl
                    125: target(all, std)dnl
                    126: target(all, vnd, 0, 1, 2, 3)dnl
                    127: target(all, ccd, 0, 1, 2, 3)dnl
                    128: target(all, raid, 0, 1, 2, 3)dnl
                    129: target(all, rd, 0)dnl
                    130: target(all, rz, 0, 1, 2, 3, 4)dnl
                    131: target(all, hk, 0, 1, 2, 3)dnl
                    132: target(all, hp, 0, 1, 2, 3)dnl
                    133: target(all, ht, 0)dnl
                    134: target(all, ra, 0, 1, 2, 3)dnl
                    135: target(all, rb, 0, 1, 2, 3)dnl
                    136: target(all, rl, 0, 1, 2, 3)dnl
                    137: target(all, rx, 0, 1)dnl
                    138: target(all, tm, 0)dnl
                    139: target(all, up, 0, 1, 2, 3)dnl
                    140: target(all, ut, 0)dnl
                    141: target(all, wd, 0, 1, 2, 3)dnl
                    142: target(all, xy, 0, 1, 2, 3)dnl
                    143: target(all, xd, 0, 1, 2, 3)dnl
                    144: twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
                    145: twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
                    146: twrget(all, aflo, fd, 0, 1, 2, 3)dnl
                    147: target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
                    148: target(all, tun, 0, 1, 2, 3)dnl
                    149: target(all, pctr)dnl
                    150: target(all, pctr0)dnl
                    151: target(all, altq)dnl
                    152: target(all, pf)dnl
                    153: twrget(all, cry, crypto)dnl
                    154: target(all, apm)dnl
                    155: twrget(all, tth, ttyh, 0, 1)dnl
                    156: target(all, ttyA, 0, 1)dnl
                    157: target(all, ttyB, 0, 1, 2, 3, 4, 5)dnl
                    158: twrget(all, attyB, ttyB, 0, 1, 2, 3, 4)dnl
                    159: target(all, tty0, 0, 1, 2, 3)dnl
                    160: twrget(all, mac_tty0, tty0, 0, 1)dnl
                    161: twrget(all, tzs, tty, a, b, c, d)dnl
                    162: twrget(all, czs, cua, a, b, c, d)dnl
                    163: target(all, ttyc, 0, 1, 2, 3, 4, 5, 6, 7)dnl
                    164: twrget(all, com, tty0, 0, 1, 2, 3)dnl
                    165: twrget(all, mac_ttye, ttye, 0)dnl
                    166: target(all, ttye, 0, 1, 2, 3, 4, 5, 6)dnl
                    167: target(all, lkm)dnl
                    168: twrget(all, mmcl, mmclock)dnl
                    169: target(all, lpt, 0, 1, 2)dnl
                    170: twrget(all, lpt, lpa, 0, 1, 2)dnl
                    171: target(all, joy, 0, 1)dnl
                    172: target(all, rnd, random)dnl
                    173: target(all, ses, 0)dnl
                    174: target(all, uk, 0)dnl
                    175: target(all, ss, 0, 1)dnl
                    176: target(all, st, 0)dnl
                    177: target(all, wt, 0)dnl
                    178: target(all, wdt, 0)dnl
                    179: target(all, xfs, 0)dnl
                    180: twrget(all, au, audio, 0)dnl
                    181: twrget(all, speak, speaker)dnl
                    182: target(all, asc, 0)dnl
                    183: target(all, music, 0)dnl
                    184: target(all, radio, 0)dnl
                    185: target(all, tuner, 0)dnl
                    186: target(all, rmidi, 0, 1, 2, 3, 4, 5, 6, 7)dnl
                    187: target(all, usbs)dnl
                    188: target(all, adb)dnl
                    189: target(all, iop, 0, 1)dnl
                    190: target(all, pci)dnl
                    191: twrget(all, wsmouse, wscons)dnl
                    192: twrget(all, btw, bwtwo, 0)dnl
                    193: twrget(all, ctw, cgtwo, 0)dnl
                    194: twrget(all, ctr, cgthree, 0)dnl
                    195: twrget(all, cfr, cgfour, 0)dnl
                    196: twrget(all, csx, cgsix, 0)dnl
                    197: twrget(all, ceg, cgeight, 0)dnl
                    198: twrget(all, cfo, cgfourteen, 0)dnl
                    199: target(all, tcx, 0)dnl
                    200: twrget(all, grf_mac, grf, 0, 1, 2, 3)dnl
                    201: twrget(all, grf_amiga, grf, 0, 1, 2, 3, 4, 5, 6)dnl
                    202: target(all, par, 0)dnl
                    203: twrget(all, amouse, mouse, 0, 1)dnl
                    204: twrget(all, akbd, kbd)dnl
                    205: target(all, apci, 0)dnl
                    206: target(all, ppi, 0)dnl
                    207: target(all, view0, 0, 1, 2, 3, 4, 5)dnl
                    208: target(all, local)dnl
1.18      todd      209: dnl
1.29      todd      210: _mkdev(all, {-all-}, {-dnl
1.18      todd      211: show_target(all)dnl
                    212: -})dnl
                    213: dnl
1.29      todd      214: __devitem(ramdisk, ramdisk, devices to be put on install floppies)dnl
                    215: __devitem(std, {-std-}, standard devices)dnl
1.1       todd      216: dnl
1.18      todd      217: dnl
                    218: dnl
1.1       todd      219: dnl _std
                    220: dnl
                    221: dnl $1: tty
                    222: dnl $2: memstuff
                    223: dnl $3: ksyms
                    224: dnl $4: drum
                    225: dnl $5: klog
                    226: dnl
1.29      todd      227: define({-_std-}, {-dnl
1.1       todd      228: std)
                    229:        M console       c 0 0 600
                    230:        M tty           c $1 0
                    231:        M mem           c $2 0 640 kmem
                    232:        M kmem          c $2 1 640 kmem
                    233:        M null          c $2 2
                    234:        M zero          c $2 12
                    235:        M stdin         c major_fdesc_c 0
                    236:        M stdout        c major_fdesc_c 1
                    237:        M stderr        c major_fdesc_c 2
                    238:        M ksyms         c $3 0 640 kmem
                    239:        M drum          c $4 0 640 kmem
                    240:        M klog          c $5 0 600-})dnl
                    241: dnl
1.29      todd      242: target(usb, usb, 0, 1)dnl
                    243: target(usb, urio, 0)dnl
                    244: twrget(usb, uscan, uscanner, 0)dnl
                    245: target(usb, uhid, 0, 1, 2, 3)dnl
                    246: target(usb, ulpt, 0, 1)dnl
                    247: target(usb, ugen, 0, 1)dnl
                    248: target(usb, utty, 0, 1)dnl
1.18      todd      249: dnl
1.29      todd      250: __devitem({-usbs-}, usbs, make USB devices)dnl
                    251: _mkdev(usbs, usbs, {-dnl
1.18      todd      252: show_target({-usb-})dnl
                    253: -})dnl
1.29      todd      254: __devtitle(tap, Tapes)dnl
                    255: __devitem(wt, {-wt*    -}, QIC-interface (e.g. not SCSI) 3M cartridge tape)dnl
                    256: _mkdev(wt, wt*,
1.1       todd      257: {-name=wt
1.29      todd      258:        n=Mult($U, 8) m=Add($n, 4)
1.1       todd      259:        M $name$U       b major_wt_b $n 640 operator
                    260:        M r$name$U      c major_wt_c $n 640 operator
                    261:        M n$name$U      b major_wt_b $m 640 operator
                    262:        M nr$name$U     c major_wt_c $m 640 operator-})dnl
1.29      todd      263: __devitem(tz, tz*, {-SCSI tapes{-,-} DEC TK50 cartridge tape-})dnl
                    264: __devitem(st, {-st*-}, SCSI tapes)dnl
                    265: _mkdev(st, st*, {-n=Mult($U, 16)
1.1       todd      266:        for pre in " " n e en
                    267:        do
                    268:                M ${pre}st$U    b major_st_b $n 660 operator
                    269:                M ${pre}rst$U   c major_st_c $n 660 operator
1.29      todd      270:                n=Add($n, 1)
1.1       todd      271:        done-})dnl
1.29      todd      272: __devitem(ct, ct*, HP300 HP-IB cartridge tape)dnl
                    273: __devitem(mt, mt*, (Magnetic) 9-track reel tape)dnl
                    274: __devitem(ht, ht*, massbus tm03 & tu??)dnl
                    275: __devitem(tm, tm*, unibus tm11 & te10 emulations (e.g. Emulex tc-11))dnl
                    276: __devitem(ts, ts*, unibus ts11)dnl
                    277: __devitem(ut, ut*, unibus tu45 emulations (e.g.si 9700))dnl
                    278: __devtitle(dis, Disks)dnl
                    279: __devitem(rz, rz*, SCSI disks)dnl
1.31    ! todd      280: __devitem(sd, {-sd*-}, {-SCSI disks, includes flopticals-})dnl
1.29      todd      281: __devitem(hd, {-hd*-}, HP300 HP-IB disks)dnl
                    282: __devitem(cd, {-cd*-}, SCSI cdrom drives)dnl
                    283: __devitem(acd, acd*, ATAPI cdrom drives)dnl
                    284: _mkdev(cd, cd*, {-dodisk2 cd $U major_cd_b major_cd_c $U 0{--}ifstep(cd)-})dnl
                    285: __devitem(mcd, mcd*, Mitsumi cdrom drives)dnl
                    286: _mkdev(mcd, mcd*, {-dodisk2 mcd $U major_mcd_b major_mcd_c $U 0{--}ifstep(mcd)dnl
                    287: -})dnl
                    288: __devitem(ch, {-ch*-}, SCSI media changer)dnl
                    289: _mcdev(ch, ch*, ch, {-major_ch_c-}, 660, operator)dnl
                    290: __devitem(uk, uk*, SCSI Unknown device)dnl
                    291: _mcdev(uk, uk*, uk, {-major_uk_c-}, 640, operator)dnl
                    292: __devitem(ss, ss*, SCSI scanners)dnl
1.31    ! todd      293: _mkdev(ss, ss*, {-M ss$U c major_ss_c Mult($U,16) 640 operator
        !           294:        M nss$U c major_ss_c Add(Mult($U,16),1) 640 operator
        !           295:        M enss$U c major_ss_c Add(Mult($U,16),3) 640 operator
1.1       todd      296:        RMlist="$RMlist scan$U"
                    297:        MKlist="$MKlist;umask 77;ln -s ss$U scan$U"-})dnl
1.29      todd      298: __devitem(ses, ses*, SES/SAF-TE SCSI devices)dnl
                    299: _mkdev(ses, ses*, {-M ses$U c major_ses_c $U 640 operator-})dnl
                    300: __devitem(ramd, ramdisk, makes all devices for a ramdisk kernel)dnl arc
                    301: _mkdev(ramd, ramdisk, {-dnl
1.20      todd      302: show_target(ramd)dnl
                    303: -})dnl
1.29      todd      304: ifelse(MACHINE, mvmeppc, {-dnl
                    305: target(ramd, tty0, 0, 1, 2, 3)dnl
                    306: twrget(ramd, wsdisp, ttyC, 0)dnl
                    307: target(ramd, rd, 0)dnl
                    308: target(ramd, wd, 0, 1, 2, 3)dnl
                    309: target(ramd, sd, 0, 1, 2, 3, 4)dnl
                    310: target(ramd, cd, 0, 1)dnl
                    311: target(ramd, st, 0, 1)dnl
                    312: target(ramd, bpf, 0)dnl
                    313: target(ramd, rd, 0)dnl
                    314: -})dnl
                    315: ifelse(MACHINE, sparc, {-dnl
                    316: target(ramd, fd, 0)dnl
                    317: target(ramd, sd, 0, 1, 2, 3)dnl
                    318: target(ramd, rd, 0)dnl
                    319: target(ramd, cd, 0)dnl
                    320: -})dnl
                    321: ifelse(MACHINE, sparc64, {-dnl
                    322: target(ramd, fd, 0)dnl
                    323: target(ramd, rd, 0)dnl
                    324: target(ramd, sd, 0, 1, 2, 3)dnl
                    325: target(ramd, wd, 0, 1, 2, 3)dnl
                    326: target(ramd, cd, 0, 1)dnl
                    327: target(ramd, st, 0, 1)dnl
                    328: target(ramd, bpf, 0)dnl
                    329: twrget(all, s64_tzs, tty, a, b, c, d)dnl
                    330: twrget(all, s64_czs, cua, a, b, c, d)dnl
                    331: __devitem(s64_tzs, tty[a-z]*, Zilog 8530 Serial Port)dnl
                    332: __devitem(s64_czs, cua[a-z]*, Zilog 8530 Serial Port)dnl
                    333: _mkdev(s64_tzs, {-tty[a-z]-}, {-u=${i#tty*}
1.23      todd      334:        case $u in
                    335:        a) n=0 ;;
                    336:        b) n=1 ;;
                    337:        c) n=2 ;;
                    338:        d) n=3 ;;
                    339:        *) echo unknown tty device $i ;;
                    340:        esac
                    341:        M tty$u c major_s64_tzs_c $n 660 dialer uucp-})dnl
1.29      todd      342: _mkdev(s64_czs, cua[a-z], {-u=${i#cua*}
1.23      todd      343:        case $u in
                    344:        a) n=0 ;;
                    345:        b) n=1 ;;
                    346:        c) n=2 ;;
                    347:        d) n=3 ;;
                    348:        *) echo unknown cua device $i ;;
                    349:        esac
1.29      todd      350:        M cua$u c major_s64_czs_c Add($n, 128) 660 dialer uucp-})dnl
1.18      todd      351: -})dnl
1.29      todd      352: ifelse(MACHINE, i386, {-dnl
                    353: target(ramd, tty0, 0, 1, 2, 3)dnl
                    354: twrget(ramd, wsdisp, ttyC, 0)dnl
                    355: target(ramd, wt, 0)dnl
                    356: target(ramd, fd, 0)dnl
                    357: target(ramd, rd, 0)dnl
                    358: target(ramd, wd, 0, 1, 2, 3)dnl
                    359: target(ramd, sd, 0, 1, 2, 3)dnl
                    360: target(ramd, cd, 0, 1)dnl
                    361: target(ramd, st, 0, 1)dnl
                    362: target(ramd, mcd, 0)dnl
                    363: -})dnl
                    364: ifelse(MACHINE, alpha, {-dnl
                    365: target(ramd, sd, 0, 1, 2)dnl
                    366: target(ramd, wd, 0)dnl
                    367: target(ramd, tty0, 0, 1)dnl
                    368: target(ramd, st, 0)dnl
                    369: target(ramd, cd, 0)dnl
                    370: target(ramd, ttyB, 0, 1)dnl
                    371: target(ramd, ttyE, 0, 1)dnl
                    372: -})dnl
                    373: ifelse(MACHINE, amiga, {-dnl
                    374: target(ramd, kbd)dnl
                    375: target(ramd, pty, 0)dnl
                    376: target(ramd, tty0, 0)dnl
                    377: target(ramd, ttyA, 0, 1)dnl
                    378: target(ramd, ttyB, 0, 1)dnl
                    379: target(ramd, ttye, 0, 1, 2, 3, 4, 5, 6)dnl
                    380: target(ramd, cd, 0, 1)dnl
                    381: target(ramd, sd, 0, 1, 2, 3)dnl
                    382: target(ramd, st, 0, 1)dnl
                    383: target(ramd, fd, 0, 1)dnl
                    384: target(ramd, wd, 0, 1)dnl
                    385: target(ramd, rd, 0)dnl
1.21      todd      386: -})dnl
1.29      todd      387: ifelse(MACHINE, hp300, {-dnl
                    388: _mkdev(st_hp300, ct*|mt*|st*,
1.27      todd      389: {-case $i in
                    390:        ct*) name=ct blk=major_ct_b chr=major_ct_c;;
                    391:        mt*) name=mt blk=major_mt_b chr=major_mt_c;;
                    392:        st*) name=st blk=major_st_hp300_b chr=major_st_hp300_c;;
                    393:        esac
                    394:        case $U in
                    395:        [0-7])
1.29      todd      396:                four=Add($U, 4) eight=Add($U, 8)
                    397:                twelve=Add($U, 12) twenty=Add($U, 20)
1.27      todd      398:                M r$name$U      c $chr $U 660 operator
                    399:                M r$name$four   c $chr $four 660 operator
                    400:                M r$name$eight  c $chr $eight 660 operator
                    401:                M r$name$twelve c $chr $twelve 660 operator
                    402:                MKlist="$MKlist;ln r$name$four nr$name$U";: sanity w/pdp11 v7
                    403:                MKlist="$MKlist;ln r$name$twelve nr$name$eight";: ditto
                    404:                RMlist="$RMlist nr$name$U nr$name$eight"
                    405:                ;;
                    406:        *)
                    407:                echo bad unit for tape in: $1
                    408:                ;;
                    409:        esac-})dnl
1.29      todd      410: __devitem(st_hp300, st*, Exabyte tape)dnl
                    411: __devitem(grf, grf*, raw interface to HP300 graphics devices)dnl
                    412: target( all, grf, 0)dnl
                    413: dnl XXX target( all, hil, 0, 1, 2, 3, 4, 5, 6, 7)dnl
                    414: target( all, hil, )dnl
                    415: twrget( all, st_hp300, st, 0, 1)dnl
                    416: target( all, dca, 0, 1)dnl
                    417: target( all, dcm, 0, 1, 2, 3)dnl
                    418: target( all, hd, 0, 1, 2)dnl
                    419: target( all, ct, 0, 1)dnl
                    420: target( all, ite, 0)dnl
                    421: target(ramd, ct, 0, 1)dnl
                    422: target(ramd, hd, 0, 1, 2)dnl
                    423: target(ramd, sd, 0, 1, 2)dnl
                    424: target(ramd, rd, 0, 1)dnl
                    425: target(ramd, pty, 0)dnl
                    426: target(ramd, hil, )dnl
                    427: target(ramd, grf, 0)dnl
                    428: target(ramd, apci, 0)dnl
                    429: target(ramd, ite, 0)dnl
                    430: target(ramd, dca, 0)dnl
                    431: target(ramd, dcm, 0, 1)dnl
                    432: target(ramd, bpf, 0, 1)dnl
                    433: target(ramd, tun, 0, 1)dnl
                    434: -})dnl
                    435: ifelse(MACHINE, hppa, {-dnl
                    436: target(ramd, st, 0, 1)dnl
                    437: target(ramd, sd, 0, 1, 2, 3)dnl
                    438: target(ramd, rd, 0, 1)dnl
                    439: target(ramd, pty, 0)dnl
                    440: target(ramd, hil)dnl
                    441: target(ramd, com, 0, 1)dnl
                    442: target(ramd, bpf, 0, 1)dnl
                    443: target(ramd, tun, 0, 1)dnl
                    444: -})dnl
                    445: ifelse(MACHINE, mac68k, {-dnl
                    446: target(ramd, sd, 0, 1, 2, 3)dnl
                    447: target(ramd, st, 0, 1)dnl
                    448: target(ramd, adb)dnl
                    449: target(ramd, asc, 0)dnl
                    450: target(ramd, grf, 0, 1)dnl
                    451: target(ramd, ttye, 0)dnl
                    452: twrget(ramd, mac_tty0, tty0, 0, 1)dnl
                    453: target(ramd, pty, 0)dnl
                    454: -})dnl
                    455: ifelse(MACHINE, macppc, {-dnl
                    456: target(ramd, sd, 0, 1, 2, 3, 4)dnl
                    457: target(ramd, wd, 0, 1, 2, 3, 4)dnl
                    458: target(ramd, st, 0, 1)dnl
                    459: target(ramd, cd, 0, 1)dnl)dnl
                    460: target(ramd, rd, 0)dnl
                    461: target(ramd, ttyE, 0)dnl
                    462: target(ramd, tty0, 0, 1)dnl
                    463: target(ramd, pty, 0)dnl
                    464: -})dnl
                    465: ifelse(MACHINE, vax, {-
1.30      todd      466: __devitem(dhu, dhu*, unibus dhu11)dnl
                    467: __devitem(dmz, dmz*, unibus dmz32)dnl
                    468: __devitem(dmf, dmf*, unibus dmf32)dnl
                    469: __devitem(dh, dh*, {-unibus dh11 and emulations (e.g. Able dmax, Emulex cs-11)-})
                    470: __devitem(vt, vt*, {-console-})dnl
                    471: __devitem(dz, dz*, unibus dz11 and dz32)dnl
1.31    ! todd      472: __devitem(dl, dl*, unibus dl11)dnl
1.30      todd      473: _mkdev(dz, dz*,
1.31    ! todd      474: {-case $U in
1.30      todd      475:        [0-7])
                    476:               i=0
                    477:               while [ $i -lt 8 ]; do
1.31    ! todd      478:                       no=Add(Mult($U, 8), $i)
1.30      todd      479:                       if [ $no -lt 10 ]; then
                    480:                               no="0${no}"
                    481:                       fi
1.31    ! todd      482:                       M tty${no} c 1 $no 600
        !           483:                       let i=i+1
1.30      todd      484:               done
                    485:               ;;
                    486:        *)
                    487:               echo bad unit for dz in: $i
                    488:               ;;
                    489:        esac-})dnl
                    490: dnl XXX split this up abit?
1.31    ! todd      491: _mkdev(dhu, dhu*|dmz*|dmf*|dh*|vt*,
1.30      todd      492: {-set -A cnvtbl 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v
                    493:        case $i in
                    494:        vt*)    name=vt; major=68; count=8;
1.31    ! todd      495:                case $U in
1.30      todd      496:                0) ch=w ;;
                    497:                *) echo bad unit for $name in: $i ;;
                    498:                esac;;
                    499:        dmz*)   name=dmz; major=37; count=24;
1.31    ! todd      500:                case $U in
1.30      todd      501:                0) ch=a ;; 1) ch=b ;; 2) ch=c ;; 3) ch=e ;; 4) ch=f ;;
                    502:                *) echo bad unit for $name in: $i ;;
                    503:                esac;;
                    504:        dmf*)   name=dmf; major=22; count=8;
1.31    ! todd      505:                case $U in
1.30      todd      506:                0) ch=A ;; 1) ch=B ;; 2) ch=C ;; 3) ch=E ;;
                    507:                4) ch=F ;; 5) ch=G ;; 6) ch=H ;; 7) ch=I ;;
                    508:                *) echo bad unit for $name in: $i ;;
                    509:                esac;;
                    510:        dhu*)   name=dhu; major=34; count=16;
1.31    ! todd      511:                case $U in
1.30      todd      512:                0) ch=S ;; 1) ch=T ;; 2) ch=U ;; 3) ch=V ;;
                    513:                4) ch=W ;; 5) ch=X ;; 6) ch=Y ;; 7) ch=Z ;;
                    514:                *) echo bad unit for $name in: $i ;;
                    515:                esac;;
                    516:        dh*)    name=dh; major=12; count=16;
1.31    ! todd      517:                case $U in
1.30      todd      518:                0) ch=h ;; 1) ch=i ;; 2) ch=j ;; 3) ch=k ;;
                    519:                4) ch=l ;; 5) ch=m ;; 6) ch=n ;; 7) ch=o ;;
                    520:                *) echo bad unit for $name in: $i ;;
                    521:                esac;;
                    522:        esac
                    523:        i=0
                    524:        while [ $i -lt $count ]; do
                    525:                let=${cnvtbl[$i]}
                    526:                if [ -n "$let" ] ;then
1.31    ! todd      527:                        M tty${ch}${let} c $major Add(Mult($U, $count), $i) 600
1.30      todd      528:                else
1.31    ! todd      529:                        echo bad count for ${name}: $U, $count, $i
1.30      todd      530:                fi
1.31    ! todd      531:                let i=i+1
1.30      todd      532:        done
                    533:        ;;
                    534:
                    535: dl*)
                    536:        major=66
1.31    ! todd      537:        let=${cnvtbl[$U]}
1.30      todd      538:        if [ -n "$let" ] ;then
1.31    ! todd      539:                M ttyJ${let} c $major $U 600
1.30      todd      540:        else
1.31    ! todd      541:                echo bad number for ${name}: $U
1.30      todd      542:        fi-})dnl
                    543: dnl
1.29      todd      544: target( all, hd, 0, 1, 2)dnl
1.31    ! todd      545: target( all, mt, 0, 1)dnl
        !           546: target( all, ts, 0, 1)dnl
1.30      todd      547: target( all, uu, 0)dnl
1.31    ! todd      548: target( all, st, 0, 1)dnl
1.30      todd      549: target( all, dhu, 0)dnl
                    550: target( all, dmz, 0)dnl
                    551: target( all, dmf, 0)dnl
                    552: target( all, dh, 0)dnl
                    553: target( all, dz, 0)dnl
1.31    ! todd      554: target( all, dl, 0)dnl
        !           555: target( all, vt, 0)dnl
1.29      todd      556: target(ramd, fd, 0)dnl
                    557: target(ramd, sd, 0, 1, 2, 3)dnl
                    558: target(ramd, rd, 0)dnl
                    559: target(ramd, cd, 0)dnl
                    560: target(ramd, bpf, 0)dnl
                    561: -})dnl
                    562: target(ramd, std)dnl
                    563: target(ramd, random)dnl
                    564: target(ramd, bpf, 0)dnl
                    565: __devitem(rd, {-rd*-}, "ramdisk" pseudo-disks)dnl
                    566: _mkdev(rd, rd*, {-dodisk2 rd $U major_rd_b major_rd_c $U 0{--}ifstep(rd)-})dnl
                    567: __devitem(xd, xd*, Xylogic 753/7053 disks)dnl
                    568: __devitem(xy, xy*, {-  Xylogic 450/451 disks-})dnl
                    569: __devitem(flo, {-fd*-}, {-Floppy disk drives (3 1/2"{-,-} 5 1/4")-})dnl
                    570: _mkdev(flo, fd*,
1.1       todd      571: {-typnam=$U${i#fd[01]*}
                    572:        case $typnam in
                    573:        0|1)    typnum=0;; # no type specified, assume A
1.26      deraadt   574:        *A)     typnum=0; typnam=0;;
                    575:        *B)     typnum=1;;
                    576:        *C)     typnum=2;;
                    577:        *D)     typnum=3;;
                    578:        *E)     typnum=4;;
                    579:        *F)     typnum=5;;
                    580:        *G)     typnum=6;;
                    581:        *H)     typnum=7;;
                    582:        *)      echo bad type $typnam for $i; exit 1;;
1.1       todd      583:        esac
                    584:        case $U in
                    585:        0|1)    blk=major_flo_b; chr=major_flo_c;;
                    586:        *)      echo bad unit $U for $i; exit 1;;
                    587:        esac
                    588:        nam=fd${typnam}
1.29      todd      589:        n=Add(Mult($U, 128), Mult($typnum, 16))
1.1       todd      590:        M ${nam}a       b $blk $n 640 operator
1.29      todd      591:        M ${nam}b       b $blk Add($n, 1) 640 operator
                    592:        M ${nam}c       b $blk Add($n, 2) 640 operator
1.1       todd      593:        M r${nam}a      c $chr $n 640 operator
1.29      todd      594:        M r${nam}b      c $chr Add($n, 1) 640 operator
                    595:        M r${nam}c      c $chr Add($n, 2) 640 operator-}, 664)dnl
                    596: __devitem(aflo, ramdisk, devices needed for install floppies)dnl
                    597: _mkdev(aflo, fd*, {-case $U in 0|1|2|3)
                    598:        M fd${U}a b major_aflo_b Mult($U, 16) 640 operator
                    599:        M fd${U}b b major_aflo_b Add(Mult($U, 16), 1) 640 operator
                    600:        M rfd${U}a c major_aflo_c Mult($U, 16) 640 operator
                    601:        M rfd${U}b c major_aflo_c Add(Mult($U, 16), 1) 640 operator;;
1.1       todd      602:        *) echo bad unit for floppy disk in: $i;;
                    603:        esac-})dnl
1.29      todd      604: __devitem(iop, iop*, I2O controller device)dnl
                    605: _mcdev(iop, iop*, iop, {-major_iop_c-}, 660)dnl
                    606: __devitem(wdt, wdt0, watchdog timer)dnl
                    607: _mcdev(wdt, wdt0, wdt, {-major_wdt_c-}, 440, operator)dnl
                    608: __devitem(local, local, configuration specific devices)dnl
                    609: __devitem(wd, {-wd*-}, {-"winchester" disk drives (ST506, IDE, ESDI, RLL, ...)-})dnl
                    610: __devitem(ccd, ccd*, concatenated disk devices)dnl
                    611: __devitem(raid, raid*, RAIDframe disk devices)dnl
                    612: __devitem(vnd, vnd*, "file" pseudo-disks)dnl
                    613: _mkdev(vnd, vnd*, {-dodisk vnd $U major_vnd_b major_vnd_c $U 0{--}ifstep(vnd)
1.6       todd      614:        dodisk svnd $U major_vnd_b major_vnd_c $U 128{--}ifstep(vnd)-})dnl
1.29      todd      615: __devitem(ra, ra*, {-MSCP disks (ra??, hd??)-})dnl
                    616: __devitem(hp, hp*, {-massbuss rm??-})dnl
                    617: __devitem(hk, hk*, {-unibus rk06 and rk07-})dnl
                    618: __devitem(up, up*, {-other unibus devices (e.g. on Emulex sc-21v controller)-})dnl
                    619: __devitem(rb, rb*, {-730 idc w/ rb80 and/or rb02-})dnl
                    620: __devitem(rx, rx*, {-MSCP floppy disk (rx33/50/...)-})dnl
                    621: __devitem(rl, rl*, {-unibus r102-})dnl
                    622: __devitem(hd, hd*, {-HDC9224 hd disks on VS2000-})dnl
1.1       todd      623: dnl
                    624: dnl For normal disk devices, add a disk_q entry; anything else define like
                    625: dnl the rest (such as vnd above).
                    626: dnl
1.18      todd      627: disk_q({-ccd-})dnl
                    628: disk_q({-hd-})dnl
                    629: disk_q({-hk-})dnl
                    630: disk_q({-hp-})dnl
                    631: disk_q({-ra-})dnl
                    632: disk_q({-raid-})dnl
                    633: disk_q({-rb-})dnl
                    634: disk_q({-rl-})dnl
                    635: disk_q({-rx-})dnl
                    636: disk_q({-sd-})dnl
1.1       todd      637: disk_q({-xy-})dnl
                    638: disk_q({-xd-})dnl
1.18      todd      639: disk_q({-up-})dnl
                    640: disk_q({-wd-})dnl
1.1       todd      641: disk_q({-rz-})dnl
                    642: dnl
1.29      todd      643: __devitem(loc, local, configuration specific devices)dnl
                    644: _mkdev(loc, local, {-test -s $T.local && sh $T.local-})dnl
                    645: _mkdev({-disks-}, {-undefine({-C_ase-})show_disks()undefine({-C_ase-})-},
1.1       todd      646: {-case $i in
                    647: show_disks2()dnl
1.6       todd      648:        esac-})dnl
1.1       todd      649: __mkdev({-disks-}){--}dnl
                    650: dnl
1.29      todd      651: __devtitle(cons, Console ports)dnl
                    652: __devitem(ttyv0, ttyv0, pccons or pcvt screen 0)dnl
                    653: __devitem(ttyv, ttyv*, pcvt)dnl
                    654: __devitem(ttye, ttye*, ite bitmapped consoles)dnl
                    655: __devitem(mac_ttye, ttye*, ite bitmapped consoles)dnl
                    656: __devitem(wscons, ttyC0, wscons screen 0)dnl
                    657: _mkdev({-wscons-}, {-wscons-}, {-dnl
1.1       todd      658: _dl(dnl
1.29      todd      659: {-wscons-}, {-ttyCcfg-},
                    660: {-wsdisp-}, {-ttyC0 ttyC1 ttyC2 ttyC3 ttyC4 ttyC5 ttyC6 ttyC7 ttyC8 ttyC9-},
                    661: {-wsdisp-}, {-ttyCa ttyCb-},
                    662: {-wsmux-}, {-wsmux-},
                    663: {-wskbd-}, {-wskbd0 wskbd1 wskbd2 wskbd3-},
                    664: {-wsmouse-}, {-wsmouse0 wsmouse1 wsmouse2 wsmouse3-})-})dnl
                    665: __devitem(wsdisp, ttyC*, wscons virtual consoles)dnl
                    666: _mkdev({-wsdisp-}, ttyC*, {-U=${i##ttyC}
1.3       todd      667:        case $U in
1.8       todd      668:        [0-9a-f]) M ttyC$U c major_wsdisp_c {-$(( 16#$U ))-} 600;;
                    669:        cfg) M ttyCcfg c major_wsdisp_c 255 600;;
1.3       todd      670:        *) echo bad unit $U for $i; exit 1;;
1.6       todd      671:        esac-})dnl
1.29      todd      672: __devitem(wskbd, wskbd*, wscons keyboards)dnl
                    673: _mkdev(wskbd, wskbd*, {-M wskbd$U c major_wskbd_c $U 600-})dnl
                    674: __devitem(wsmux, wsmux, wscons keyboard/mouse mux devices)dnl
                    675: _mkdev(wsmux, wsmux|wsmouse|wskbd, {-M wsmouse c major_wsmux_c 0 600
1.1       todd      676:        M wskbd c major_wsmux_c 1 600-})dnl
1.29      todd      677: __devitem(pcons, console, PROM console)dnl
                    678: __devtitle(point, Pointing devices)dnl
                    679: __devitem(wsmouse, wsmouse*, wscons mice)dnl
                    680: _mkdev(wsmouse, wsmouse*, {-M wsmouse$U c major_wsmouse_c $U 600-})dnl
                    681: __devitem(quad, quadmouse, "quadrature mouse")dnl
                    682: __devtitle(pty, Pseudo terminals)dnl
                    683: __devitem(tty, tty*, set of 16 slave psuedo terminals)dnl
                    684: __devitem(pty, pty*, set of 16 master pseudo terminals)dnl
1.31    ! todd      685: _mkdev(pty, pty*, {-if [ $U -gt 15 ]; then
        !           686:                echo bad unit for pty in: $i
        !           687:                continue
        !           688:        fi
        !           689:        set -A tbl p q r s t u v w x y z P Q R S T
        !           690:        name=${tbl[$U]}
1.1       todd      691:        n=0
                    692:        while [ $n -lt 16 ]
                    693:        do
                    694:                nam=$name$(hex $n)
1.31    ! todd      695:                off=Mult($U, 16)
1.29      todd      696:                M tty$nam c major_tty_c Add($off, $n)
                    697:                M pty$nam c major_pty_c Add($off, $n)
                    698:                n=Add($n, 1)
1.1       todd      699:        done-})dnl
1.29      todd      700: __devitem(dc, dc*, {-4 channel serial interface (keyboard{-,-} mouse{-,-}modem{-,-} printer)-})dnl
                    701: __devtitle(prn, Printers)dnl
                    702: __devitem(par, par*, motherboard parallel port)dnl
                    703: __devitem(lpt, lpt*, IEEE 1284 centronics printer)dnl
                    704: _mkdev(lpt, lpt*|lpa*,
1.1       todd      705: {-case $i in
                    706:        lpt*) n=lpt f=0;;
                    707:        lpa*) n=lpa f=128;;
                    708:        esac
1.29      todd      709:        M $n$U c major_lpt_c Add($U, $f) 600-})dnl
                    710: __devitem(lpa, lpa*, interruptless lp)dnl
                    711: __devitem(ppi, ppi*, HP-IB plotters)dnl
                    712: __devtitle({-usb-}, USB devices)dnl
                    713: __devitem({-usb-}, usb*, Bus control devices used by usbd for attach/detach)dnl
                    714: _mkdev({-usb-}, usb*, {-[ "$i" = "usb" ] && u= || u=$U
1.1       todd      715:        M usb$u c major_usb_c $U 660-})dnl
1.29      todd      716: __devitem(uhid, uhid*, Generic HID devices)dnl
                    717: _mcdev({-uhid-}, uhid*, {-uhid-}, {-major_uhid_c-}, 660)dnl
                    718: __devitem(ulpt, ulpt*, Printer devices)dnl
                    719: _mcdev({-ulpt-}, ulpt*, {-ulpt-}, {-major_ulpt_c-}, 660)dnl
                    720: __devitem(utty, utty*, Serial ports)dnl
                    721: _mcdev({-utty-}, utty*, {-utty-}, {-major_utty_c-}, 660)dnl
                    722: __devitem(urio, urio*, Diamond Multimedia Rio 500)dnl
                    723: _mcdev({-urio-}, urio*, {-urio-}, {-major_urio_c-}, 660)dnl
                    724: __devitem(uscan, uscanner*, Scanners)dnl
                    725: _mcdev({-uscan-}, uscanner*, {-uscanner-}, {-major_uscan_c-}, 660)dnl
                    726: __devitem(ugen, ugen*, Generic device)dnl
                    727: _mkdev(ugen, ugen*, {-n=Mult($U, 16)
1.1       todd      728:        for j in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
                    729:        do
1.29      todd      730:                M ugen$U.$j c major_ugen_c Add($n, $j) 660
1.1       todd      731:        done-})dnl
1.29      todd      732: __devtitle(cpu, Cpus)dnl
                    733: __devitem(cpu, cpu*, cpus)dnl
                    734: __devtitle(call, Call units)dnl
                    735: __devtitle(term, Terminal ports)dnl
                    736: __devtitle(termp, Terminal multiplexers)dnl
                    737: __devitem(dca, dca*, HP200/300 single port serial interface)dnl
                    738: __devitem(dcm, dcm*, HP200/300 4 port serial mux interface)dnl
                    739: __devitem(apci, apci*, HP400 4 port serial mux interface)dnl
                    740: __devitem({-com-}, {-tty0*-}, NS16x50 serial ports)dnl
                    741: _mkdev(com, {-tty0*-}, {-M tty$U c major_com_c $U 660 dialer uucp
                    742:        M cua$U c major_com_c Add($U, 128) 660 dialer uucp-})dnl
                    743: __devitem(ttyc, ttyc*, Cyclades serial ports)dnl
                    744: __devitem(tzs, tty[a-z]*, Zilog 8530 Serial Port)dnl
                    745: _mkdev(tzs, {-tty[a-z]-}, {-u=${i#tty*}
1.1       todd      746:        case $u in
                    747:        a) n=0 ;;
                    748:        b) n=1 ;;
                    749:        c) n=4 ;;
                    750:        d) n=5 ;;
                    751:        *) echo unknown tty device $i ;;
                    752:        esac
                    753:        M tty$u c major_tzs_c $n 660 dialer uucp-})dnl
1.29      todd      754: __devitem(tth, ttyh*, Sab82532 serial devices)dnl
                    755: _mkdev(tth, ttyh*, {-M ttyh$U c major_tth_c $U 660 dialer uucp-})dnl
                    756: __devitem(czs, cua[a-z]*, Zilog 8530 Serial Port)dnl
                    757: _mkdev(czs, cua[a-z], {-u=${i#cua*}
1.1       todd      758:        case $u in
                    759:        a) n=0 ;;
                    760:        b) n=1 ;;
                    761:        c) n=4 ;;
                    762:        d) n=5 ;;
                    763:        *) echo unknown cua device $i ;;
                    764:        esac
1.29      todd      765:        M cua$u c major_czs_c Add($n, 128) 660 dialer uucp-})dnl
                    766: __devitem(arm_tty, tty*, {-alias for PC COM ports{-,-} this is what the system really wants-})dnl
                    767: __devitem(tty0, tty00, standard serial port)dnl
                    768: __devitem(mac_tty0, tty00, standard serial port)dnl
                    769: __devitem(ttyA, ttyA*, mfc serial ports)dnl
                    770: __devitem(attyB, ttyB*, ISA COM ports)dnl  amiga
                    771: __devitem(ttyz, tty[a-d], onboard zs serial ports)dnl
                    772: __devitem(cuaz, cua[a-d], onboard zs serial ports)dnl
                    773: __devitem(ttyB, ttyB?, DEC 3000 ZS8530 ("scc") serial ports)dnl
                    774: __devitem(scc, scc*, 82530 serial interface)dnl
                    775: __devitem(arc_ttyC, ttyC0, pccons)dnl
                    776: __devitem(i386_ttyC, ttyC*, pcvt)dnl
                    777: __devitem(ttyC, ttyC?, {-AlphaStation NS16550 ("com serial ports")-})dnl
                    778: __devitem(ttyE, ttyE?, Workstation console (framebuffer & keyboard) tty emulators)dnl
                    779: __devitem(ser02, ser02, {-serial2 port (channel A on 8530)-})dnl
                    780: __devitem(mdm02, mdm02, {-modem2 port (channel B on 8530)-})dnl
                    781: __devtitle(spec, Special purpose devices)dnl
                    782: __devitem(apm, apm     , power management device)dnl
                    783: _mkdev(apm, apm*, {-M apm      c major_apm_c 0 644
1.1       todd      784:        M apmctl        c major_apm_c 8 644-})dnl
1.29      todd      785: __devitem(pcmcia, pcmcia*, PCMCIA card drivers)dnl
                    786: __devitem(pctr, pctr*, PC Performance Tuning Register access device)dnl
                    787: _mkdev(pctr, pctr, {-M pctr c major_pctr_c 0 644-})dnl
                    788: __devitem(au, audio*, audio device)dnl
                    789: _mkdev(au, audio*, {-M sound$U c major_au_c $U
                    790:        M mixer$U       c major_au_c Add($U, 16)
                    791:        M audio$U       c major_au_c Add($U, 128)
                    792:        M audioctl$U    c major_au_c Add($U, 192)
1.1       todd      793:        MKlist="$MKlist;[ -e audio ] || ln -s audio$U audio"
                    794:        MKlist="$MKlist;[ -e mixer ] || ln -s mixer$U mixer"
                    795:        MKlist="$MKlist;[ -e sound ] || ln -s sound$U sound"
                    796:        MKlist="$MKlist;[ -e audioctl ] || ln -s audioctl$U audioctl"-})dnl
1.29      todd      797: __devitem(asc, asc*, ASC Audio device)dnl
                    798: _mkdev(asc, asc*, {-M asc$U major_asc_c 0-})dnl
                    799: __devitem(music, music*, midi devices)dnl
                    800: _mkdev(music, music*, {-M music$U     c major_music_c $U
                    801:        M sequencer$U c major_music_c Add($U, 128)
1.1       todd      802:        MKlist="$MKlist;[ -e music ] || ln -s music$U music"
                    803:        MKlist="$MKlist;[ -e sequencer ] || ln -s sequencer$U sequencer"-})dnl
1.29      todd      804: __devitem(radio, radio*, FM tuner device)dnl
                    805: _mkdev(radio, radio*, {-M radio$U     c major_radio_c $U
1.8       todd      806:        MKlist="$MKlist;[ -e radio ] || ln -s radio$U radio"-})dnl
1.29      todd      807: __devitem(fdesc, fd, makes fd/* for the fdescfs)dnl
                    808: _mkdev(fdesc, fd, {-RMlist="mkdir -p fd;$RMlist" n=0
                    809:        while [ $n -lt 64 ];do M fd/$n c major_fdesc_c $n;n=Add($n, 1);done
1.1       todd      810:        MKlist="$MKlist;chmod 555 fd"-})dnl
1.29      todd      811: __devtitle(graph, Graphics devices)dnl
                    812: __devitem(grf_mac, grf*, {-custom chip (grf0){-,-} Retina Z2/Z3 (grf1/grf2){-,-}
1.1       todd      813: {-#-}          Cirrus boards (grf3){-,-} A2410 (grf4) video or
                    814: {-#-}          CyberVision 64 (grf5)-})dnl
1.29      todd      815: __devitem(grf_amiga, grf*, {-Motherboard bitmapped video.-})dnl
                    816: __devitem(ite, ite*, terminal emulator interface to HP300 graphics devices)dnl
                    817: __devitem({-hil-}, {-hil-}, HP300 HIL input devices)dnl
                    818: __devitem(oppr, openprom)dnl
                    819: _cdev(oppr, openprom, 70, 0)dnl
                    820: __devitem(btw, bwtwo*)dnl
                    821: _mcdev(btw, bwtwo*, bwtwo, {-major_btw_c-}, 666)dnl
                    822: __devitem(ctw, cgtwo*)dnl
                    823: _mcdev(ctw, cgtwo*, cgtwo, {-major_ctw_c-}, 666)dnl
                    824: __devitem(ctr, cgthree*)dnl
                    825: _mcdev(ctr, cgthree*, cgthree, {-major_ctr_c-}, 666)dnl
                    826: __devitem(cfr, cgfour*)dnl
                    827: _mcdev(cfr, cgfour*, cgfour, {-major_cfr_c-}, 666)dnl
                    828: __devitem(csx, cgsix*)dnl
                    829: _mcdev(csx, cgsix*, cgsix, {-major_csx_c-}, 666)dnl
                    830: __devitem(ceg, cgeight*)dnl
                    831: _mcdev(ceg, cgeight*, cgeight, {-major_ceg_c-}, 666)dnl
                    832: __devitem(cfo, cgfourteen*)dnl
                    833: _mcdev(cfo, cgfourteen*, cgfourteen, {-major_cfo_c-})dnl
                    834: __devitem(tcx, tcx*)dnl
                    835: _mcdev(tcx, tcx*, tcx, {-major_tcx_c-})dnl
                    836: __devitem(cry, crypto, hardware crypto access driver)dnl
                    837: _mkdev(cry, crypto, {-M crypto c major_cry_c-} 0)dnl
                    838: __devitem(pf, pf*, Packet Filter)dnl
                    839: _mkdev(pf, {-pf*-}, {-M pf c major_pf_c 0 600-})dnl
                    840: __devitem(bpf, bpf*, Berkeley Packet Filter)dnl
                    841: _mkdev(bpf, {-bpf*-}, {-M bpf$U c major_bpf_c $U 600-}, 600)dnl
                    842: _mkdev(tun, {-tun*-}, {-M tun$U c major_tun_c $U 600-}, 600)dnl
                    843: __devitem(altq, altq/, ALTQ control interface)dnl
                    844: _mkdev(altq, altq, {-RMlist="mkdir -p altq;$RMlist"
1.1       todd      845:        for d in altq cbq wfq afm fifoq red rio localq hfsc cdnr blue priq; do
                    846:                M altq/$d c major_altq_c $U 644
1.29      todd      847:                U=Add($U, 1)
1.1       todd      848:        done-})dnl
1.29      todd      849: __devitem(speak, speaker, pc speaker)dnl
                    850: _mkdev(speak, speaker, {-M speaker c major_speak_c 0 600-})dnl
                    851: __devitem(kbd, kbd, keyboard (provides events, for X11))dnl
                    852: _cdev(kbd, kbd, {-major_kbd_c-}, 0, 600)dnl
                    853: __devitem(kbd_atari, kbd, Atari keyboard)dnl
                    854: __devitem(akbd, kbd, Amiga keyboard)dnl
                    855: __devitem(rkbd, kbd, raw keyboard)dnl
                    856: __devitem(kbdctl, kbdctl, keyboard control)dnl
                    857: __devitem(beep, beep, riscpc speaker)dnl
                    858: __devitem(iic, iic*, IIC bus device)dnl
                    859: __devitem(rtc, rtc*, RTC device)dnl
                    860: __devitem(view, view*, generic interface to graphic displays)dnl
                    861: __devitem(aconf, aconf, {-autoconfig information (not yet)-})dnl
                    862: __devitem(mouse-, mouse-*, "mouse link")dnl
                    863: __devitem(mouse, mouse, mouse (provides events, for X11))dnl
                    864: __devitem(amouse, mouse*, Amiga mice)dnl
                    865: __devitem(lkm, lkm, loadable kernel modules interface)dnl
                    866: _cdev(lkm, lkm, {-major_lkm_c-}, 0, 640, kmem)dnl
                    867: __devitem(mmcl, mmclock, memory mapped clock)dnl
                    868: __devitem(tun, tun*, network tunnel driver)dnl
                    869: __devitem(rnd, *random, inkernel random data source)dnl
                    870: _mkdev(rnd, *random, {-n=0
1.1       todd      871:        for pre in " " s u p a
                    872:        do
                    873:                M ${pre}random c major_rnd_c $n 644
1.29      todd      874:                n=Add($n, 1)
                    875:        done-}, 644)dnl
                    876: __devitem(joy, joy*, joystick driver)dnl
                    877: _mcdev(joy, joy*, joy, {-major_joy_c-}, 666)dnl
                    878: __devitem(mag, magma*, magma card (makes 16 tty and 2 bpp))dnl
                    879: __devitem(bppmag, bppmag[mno], magma parallel port device)dnl
                    880: __devitem(spif, spif*, spif card (makes 8 tty and 1 bpp))dnl
                    881: __devitem(bppsp, bpp[jkl], spif parallel port device)dnl
                    882: _mkdev(mag, magma*, {-case $U in
1.18      todd      883:        0)      offset=0  nam=m;;
                    884:        1)      offset=16 nam=n;;
                    885:        2)      offset=32 nam=o;;
                    886:        *)      echo "bad unit for $i: $U"; exit 127;;
                    887:        esac
1.29      todd      888:        offset=Mult($U, 64)
1.18      todd      889:        n=0
                    890:        while [ $n -lt 16 ]
                    891:        do
                    892:                name=${nam}`hex $n`
1.29      todd      893:                M tty$name c major_mag_c Add($offset, $n) 660 dialer uucp
                    894:                n=Add($n, 1)
1.18      todd      895:        done
1.29      todd      896:        M bpp${nam}0 c major_bppmag_c Add($offset, 0) 600
                    897:        M bpp${nam}1 c major_bppmag_c Add($offset, 1) 600-})dnl
                    898: _mkdev(spif, spif*, {-case $U in
1.18      todd      899:        0)      offset=0  nam=j;;
                    900:        1)      offset=16 nam=k;;
                    901:        2)      offset=32 nam=l;;
                    902:        *)      echo "bad unit for $i: $U"; exit 127;;
                    903:        esac
1.29      todd      904:        offset=Mult($U, 64)
1.18      todd      905:        n=0
                    906:        while [ $n -lt 8 ]
                    907:        do
                    908:                name=${nam}`hex $n`
1.29      todd      909:                M tty$name c major_spif_c Add($offset, $n) 660 dialer uucp
                    910:                n=Add($n, 1)
1.18      todd      911:        done
1.29      todd      912:        M bpp${nam}0 c major_bppsp_c Add($offset, 0) 600-})dnl
                    913: __devitem(bpp, bpp*, parallel port devices)dnl
                    914: __devitem(xfs, xfs*, XFS filesystem devices)dnl
                    915: _mcdev(xfs, xfs*, xfs, {-major_xfs_c-}, 600)dnl
                    916: __devitem(hil, hil, HIL input devices)dnl
                    917: __devitem(rmidi, rmidi*, raw midi devices)dnl
                    918: _mcdev(rmidi, rmidi*, rmidi, {-major_rmidi_c-}, 666)dnl
                    919: __devtitle(plat, Platform-specific devices)dnl
                    920: __devitem(fb, fb*, framebuffer device)dnl
                    921: __devitem(bktr, bktr*, video capturing)dnl
                    922: _mcdev(bktr, bktr*, bktr, {-major_bktr_c-}, 644)dnl
                    923: __devitem(tuner, tuner*, tuner device)dnl
                    924: _mkdev(tuner, tuner*, {-M tuner$U c major_bktr_c Add(Mult($U, 2), 16) 644-}, 644)dnl
                    925: __devitem(pci, pci, PCI bus device)dnl
                    926: _mkdev(pci, pci, {-M pci c major_pci_c 0 664-}, 664)dnl
                    927: __devitem(adb, adb, Apple Desktop bus event interface)dnl
                    928: _mkdev(adb, adb, {-M adb c major_adb_c 0-})dnl
                    929: __devitem(pdc, pdc, PDC device)dnl
                    930: _mkdev(local, local, {-test -s $T.local && sh $T.local-}, 666)dnl
1.1       todd      931: dnl
                    932: divert(1)dnl
                    933: include(etc.MACHINE/MAKEDEV.md)dnl
                    934: dnl
                    935: dnl
                    936: divert(0)dnl
                    937: #!/bin/sh -
                    938: #
                    939: # THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
                    940: # generated from:
                    941: #
                    942: show_vers()dnl <-- now that all files are included, show versions
                    943: #
1.6       todd      944: {-#-}  $Open{--}BSD$
1.1       todd      945: dnl
                    946: divert(2)dnl
                    947: PATH=/sbin:/usr/sbin:/bin:/usr/bin
                    948: T=$0
                    949:
                    950: # set this to echo for Echo-Only debugging
                    951: [ "$eo" ] || eo=
                    952:
                    953: hex()
                    954: {
                    955:        case ${--}1 in
1.26      deraadt   956:        [0-9]) echo -n {-$-}1;;
                    957:        10) echo -n a;;
                    958:        11) echo -n b;;
                    959:        12) echo -n c;;
                    960:        13) echo -n d;;
                    961:        14) echo -n e;;
                    962:        15) echo -n f;;
1.1       todd      963:        esac
                    964: }
1.26      deraadt   965:
1.1       todd      966: trunc()
                    967: {
                    968:        # XXX pdksh can't seem to deal with locally scoped variables
                    969:        # in ${foo#$bar} expansions
                    970:        arg1="{-$-}1"
                    971:        arg2="{-$-}2"
                    972:        case {-$-}3 in
                    973:        l)   echo ${arg2#$arg1} ;;
                    974:        r|*) echo ${arg1#$arg2} ;;
                    975:        esac
                    976: }
1.26      deraadt   977:
1.1       todd      978: unt()
                    979: {
                    980:        # XXX pdksh can't seem to deal with locally scoped variables
                    981:        # in ${foo#$bar} expansions
                    982:        arg="{-$-}1"
                    983:        tmp="${arg#[a-zA-Z]*}"
                    984:        tmp="${tmp%*[a-zA-Z]}"
                    985:        while [ "$tmp" != "$arg" ]
                    986:        do
                    987:                arg=$tmp
                    988:                tmp="${arg#[a-zA-Z]*}"
                    989:                tmp="${tmp%*[a-zA-Z]}"
                    990:        done
                    991:        echo $arg
                    992: }
                    993: dnl
1.29      todd      994: dnl dodisk(name, unit, blkmaj, chrmaj, unit, off[, stepping])
1.5       todd      995: dnl   arg: 1    2    3      4      5    6    7
1.1       todd      996: dnl
1.26      deraadt   997:
1.1       todd      998: dodisk()
                    999: {
1.27      todd     1000:        [ "$DEBUG" ] && set -x
1.29      todd     1001:        n=Add(Mult(${5}, ${7:-16}), ${6}) count=0
1.1       todd     1002:        RMlist="$RMlist {-$-}1{-$-}2? r{-$-}1{-$-}2?"
1.13      todd     1003:        [ 0$7 -ne 8 ] && l="i j k l m n o p"
                   1004:        for d in a b c d e f g h $l
1.1       todd     1005:        do
1.29      todd     1006:                M {-$-}1{-$-}2$d        b {-$-}3 Add($n, $count) 640
                   1007:                M r{-$-}1{-$-}2$d       c {-$-}4 Add($n, $count) 640
1.1       todd     1008:                let count=count+1
                   1009:        done
                   1010:        MKlist="$MKlist;chown root.operator {-$-}1{-$-}2? r{-$-}1{-$-}2?"
                   1011: }
                   1012: dnl
1.29      todd     1013: dnl dodisk2(name, unit, blkmaj, chrmaj, unit, off[, stepping])
1.1       todd     1014: dnl
                   1015: dnl 1. name    - prefix name of the device
                   1016: dnl 2. unit    - beginning unit number for block devices
                   1017: dnl 3. blkmaj  - block device major number
                   1018: dnl 4. chrmaj  - character device major number
                   1019: dnl 5. unit    - beginning unit number for character devices
                   1020: dnl 6. off     - offset from 0 for all minor numbers (see svnd for an example)
1.5       todd     1021: dnl 7. step    - optional, defaults to 16, number of partitions per device
1.1       todd     1022: dnl
1.26      deraadt  1023:
1.1       todd     1024: dodisk2()
                   1025: {
1.29      todd     1026:        n=Add(Mult({-$-}5, ${7:-16}), {-$-}6)
1.1       todd     1027:        M {-$-}1{-$-}2a b {-$-}3 $n 640 operator
                   1028:        M r{-$-}1{-$-}2a c {-$-}4 $n 640 operator
1.29      todd     1029:        n=Add($n, 2)
1.1       todd     1030:        M {-$-}1{-$-}2c b {-$-}3 $n 640 operator
                   1031:        M r{-$-}1{-$-}2c c {-$-}4 $n 640 operator
                   1032: }
                   1033:
                   1034: # M name b/c major minor [mode] [group]
                   1035: RMlist="rm -f"
                   1036: MKlist=":"
1.26      deraadt  1037:
1.1       todd     1038: mkl() {
                   1039: dnl
                   1040: dnl uncomment if multi mknod happens
                   1041: dnl
1.29      todd     1042: ifelse(1, 0,
1.1       todd     1043: [ "${mklist[{-$-}1]}" ] && mklist[{-$-}1]="${mklist[{-$-}1]} {-$-}2 {-$-}3 {-$-}4 {-$-}5" || {
1.30      todd     1044:          mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
                   1045:          modes="$modes {-$-}1"
1.1       todd     1046:      },
                   1047: dnl
                   1048: dnl non multi mknod
                   1049: dnl
1.26      deraadt  1050:        [ "${mklist[{-$-}1]}" ] && {
                   1051:                mklist[{-$-}1]="${mklist[{-$-}1]};mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
                   1052:        } || {
                   1053:                mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
                   1054:                modes="$modes {-$-}1"
                   1055:        })
1.1       todd     1056: }
1.26      deraadt  1057:
1.1       todd     1058: M() {
                   1059:        RMlist="$RMlist {-$-}1"
                   1060:        mkl ${5-666} {-$-}1 {-$-}2 {-$-}3 {-$-}4
                   1061:        mklist="$mklist {-$-}1"
                   1062:        G={-$-}{6:-wheel}
                   1063:        [ "{-$-}7" ] && {
                   1064:                MKlist="$MKlist;chown {-$-}7.{-$-}G {-$-}1"
                   1065:        } || {
                   1066:                case $G in
                   1067:                wheel)g=0;;kmem)g=2;;operator)g=5;;tty)g=4;;dialer)g=117;;
                   1068:                esac
                   1069:                [ "${grplist[$g]}" ] && {
                   1070:                        grplist[$g]="${grplist[$g]} {-$-}1"
                   1071:                } || {
                   1072:                        groups="$groups $g"
                   1073:                        grplist[$g]="chgrp $G {-$-}1"
                   1074:                }
                   1075:        }
                   1076:        return 0
                   1077: }
                   1078: divert(7)dnl
                   1079: dnl
                   1080: dnl there is no blank line at the end of etc.arch/MAKEDEV.md files, so add one
                   1081: dnl on the following line:
                   1082:
                   1083: show_devs()dnl
                   1084: dnl
                   1085: divert(9)dnl
                   1086: *)
                   1087:        echo $i: unknown device
                   1088:        ;;
                   1089: esac
                   1090: done
                   1091: }
                   1092: _recurse "$@"
                   1093: if [ "$os" = "SunOS" ]; then
                   1094:        eo=transform
                   1095:        transform() {
                   1096:                case $mode in
                   1097:                600) mask=077;;
                   1098:                640) mask=027;;
                   1099:                660) mask=007;;
                   1100:                644) mask=022;;
                   1101:                666) mask=0;;
                   1102:                440) mask=227;;
                   1103:                esac
                   1104:                echo `echo "$@"|sed \
1.26      deraadt  1105:                    's/mknod -m \([0-9]*\) /umask '$mask';mknod /;s/-m [0-9]* //g;\
                   1106:                    s/operator/5/g;s/root.kmem/root.2/g;s/root\./root:/g'`
1.1       todd     1107:        }
                   1108: fi
                   1109: list="$RMlist"
                   1110: for mode in $modes; do
                   1111:        list="$list;${mklist[$mode]}"
                   1112: done
                   1113: for group in $groups; do
                   1114:        list="$list;${grplist[$group]}"
                   1115: done
                   1116: list="$list;$MKlist"
                   1117: if [ "$eo" = "echo" -o "$eo" = "transform" ]; then
                   1118:        $eo "$list"
                   1119: else
                   1120:        echo "$list" | sh
                   1121: fi
                   1122: divert(3)dnl
                   1123: dnl
1.26      deraadt  1124:
1.1       todd     1125: R() {
1.23      todd     1126: [ "$DEBUG" ] && set -x
1.1       todd     1127: for i in "$@"
                   1128: do
                   1129: U=`unt $i`
                   1130: [ "$U" ] || U=0
                   1131:
                   1132: case $i in
                   1133: dnl