MAKEDEV.mi revision 1.53
1include(MAKEDEV.sub)dnl 2dnl 3vers(a, {-$OpenBSD: MAKEDEV.mi,v 1.53 2002/12/05 04:30:21 kjc Exp $-})dnl 4dnl 5divert(1)dnl 6{-#-} 7{-#-} Copyright (c) 2001,2002 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{-#-} 29dnl 30dnl Diversions: (upon termination, concatenated output queues) 31dnl 32dnl 0 - very top 33dnl 1 - descriptions of devices 34dnl 2 - init of script, function definitions, etc 35dnl 3 - beginning of global recursive R() function 36dnl 7 - body of MAKEDEV, device creations, etc 37dnl 9 - end 38dnl 39dnl HOW TO ADD A DEVICE: 40dnl 41dnl In this file, you must use at least two macros: 42dnl 43dnl Use '__devitem(uniqueid, name-pattern, description)' to create an entry 44dnl in the description at the top of the generated MAKEDEV file: 45dnl 46dnl __devitem(sca, sca*, Sugar Generic device)dnl 47dnl __devitem(cry, crypto, hardware crypto access driver)dnl 48dnl 49dnl This is ultimately shown as: 50dnl 51dnl # sca* Sugar Generic device 52dnl # crypto hardware crypto access driver 53dnl 54dnl Use '_mkdev(uniqueid, shell-pattern, {-shell-script-})dnl' to create 55dnl a shell script fragment used to 'create' the device (be sure to match 56dnl the uniqueid from above): 57dnl 58dnl _mkdev(sca, sca*, {-M sca$U c major_sca_c $U 59dnl M rsca$U b major_sca_b Add($U, 128)-})dnl 60dnl _mkdev(cry, crypto, {-M crypto c major_cry_c 0-})dnl 61dnl 62dnl This is ultimately expanded into: 63dnl 64dnl sca*) 65dnl M sca$U c 24 $U 66dnl M sca$U b 42 $(($U+128)) 67dnl ;; 68dnl 69dnl crypto) 70dnl M crypto c 47 0 71dnl ;; 72dnl 73dnl In the MAKEDEV.md file, add a '_DEV(uniqueid, charmajor, blockmajor)' 74dnl entry: 75dnl 76dnl _DEV(sca, 24, 42) 77dnl _DEV(cry, 47) 78dnl 79dnl Final step is to use the 'target/twrget' macros to have the 'all)' target 80dnl generate one or more device(s). Usage of 'target/twrget' is: 81dnl target(target_name, device_name [, append_string ] .. ) 82dnl twrget(target_name, uniqueid, device_name, [, append_string ] .. ) 83dnl 84dnl target_name a unique name that later is used as an argument to 85dnl 'show_target()' (which expands all devices for a 86dnl given 'target_name'). 87dnl uniqueid same as 'uniqueid' above 88dnl device_name string representing the device to be mknod'ed 89dnl append_string for each append_string, `device_name' is prepended 90dnl 91dnl Note: 'target(a,b,c)' is equivalent to 'twrget(a,b,b,c)' 92dnl 93dnl 94dnl For a short example: 95dnl 96dnl target(all, std)dnl 97dnl target(all, sca, 0, 1, 2, 3)dnl 98dnl twrget(all, cry, crypto)dnl 99dnl 100dnl would expand to: 101dnl 102dnl all) 103dnl R std sca0 sca1 sca2 sca3 crypto 104dnl ;; 105dnl 106dnl presuming '_DEV(sca, ?, ?)' and '_DEV(std)' were in the MAKEDEV.md file. 107dnl 108dnl 109dnl Everything is 'automatically' added to 'MAKEDEV' based on whether or 110dnl not the '_DEV()' entry has a corresponding _mkdev() and __devitem() 111dnl entry in MAKEDEV.mi (this file). 112dnl 113dnl Note: be very wary of adding whitespace, carriage returns, or not 114dnl finishing a macro with ')dnl' .. otherwise, extra blank lines show up 115dnl in the output. 116dnl 117dnl TODO: 118dnl 119dnl make a 'disktgt' macro that automatically does: 120dnl disktgt(rd, {-rd-}) 121dnl 122dnl target(all,rd,0) 123dnl target(ramd,rd,0) 124dnl disk_q(rd) 125dnl __devitem(rd, {-rd*-}, {-rd-})dnl 126dnl 127dnl Note: not all disks are generated in 'all)'. (e.g. vax has a lot of 128dnl disks that are not generated by 'all)') 129dnl 130dnl 131_mkdev(loc, local, {-test -s $T.local && sh $T.local-})dnl 132dnl 133__devtitle(make, Device "make" file. Valid arguments)dnl 134__devitem({-all-}, {-all-}, 135{-makes all known devices{-,-} including local devices. 136{-#-} Tries to make the ``standard'' number of each type.-})dnl 137dnl 138dnl 139target(all, mcd, 0)dnl 140twrget(all, fdesc, fd)dnl 141target(all, st, 0, 1)dnl 142target(all, std)dnl 143target(all, raid, 0, 1, 2, 3)dnl 144target(all, rz, 0, 1, 2, 3, 4)dnl 145target(all, hp, 0, 1, 2, 3)dnl 146target(all, ra, 0, 1, 2, 3)dnl 147target(all, rx, 0, 1)dnl 148target(all, wd, 0, 1, 2, 3)dnl 149target(all, xd, 0, 1, 2, 3)dnl 150twrget(all, aflo, fd, 0, 1, 2, 3)dnl 151target(all, systrace)dnl 152target(all, pctr)dnl 153target(all, pctr0)dnl 154target(all, pf)dnl 155twrget(all, cry, crypto)dnl 156target(all, apm)dnl 157twrget(all, tth, ttyh, 0, 1)dnl 158target(all, ttyA, 0, 1)dnl 159target(all, ttyB, 0, 1, 2, 3, 4, 5)dnl 160twrget(all, attyB, ttyB, 0, 1, 2, 3, 4)dnl 161target(all, tty0, 0, 1, 2, 3)dnl 162twrget(all, mac_tty0, tty0, 0, 1)dnl 163twrget(all, tzs, tty, a, b, c, d)dnl 164twrget(all, czs, cua, a, b, c, d)dnl 165target(all, ttyc, 0, 1, 2, 3, 4, 5, 6, 7)dnl 166twrget(all, com, tty0, 0, 1, 2, 3)dnl 167twrget(all, mac_ttye, ttye, 0)dnl 168target(all, ttye, 0, 1, 2, 3, 4, 5, 6)dnl 169target(all, lkm)dnl 170twrget(all, mmcl, mmclock)dnl 171target(all, lpt, 0, 1, 2)dnl 172twrget(all, lpt, lpa, 0, 1, 2)dnl 173target(all, joy, 0, 1)dnl 174twrget(all, rnd, random)dnl 175target(all, uk, 0)dnl 176target(all, wt, 0)dnl 177target(all, wdt, 0)dnl 178twrget(all, au, audio, 0)dnl 179twrget(all, speak, speaker)dnl 180target(all, asc, 0)dnl 181target(all, music, 0)dnl 182target(all, radio, 0)dnl 183target(all, tuner, 0)dnl 184target(all, rmidi, 0, 1, 2, 3, 4, 5, 6, 7)dnl 185target(all, usbs)dnl 186target(all, adb)dnl 187target(all, iop, 0, 1)dnl 188target(all, pci)dnl 189twrget(all, wsmouse, wscons)dnl 190twrget(all, btw, bwtwo, 0)dnl 191twrget(all, ctw, cgtwo, 0)dnl 192twrget(all, ctr, cgthree, 0)dnl 193twrget(all, cfr, cgfour, 0)dnl 194twrget(all, csx, cgsix, 0)dnl 195twrget(all, ceg, cgeight, 0)dnl 196twrget(all, cfo, cgfourteen, 0)dnl 197target(all, tcx, 0)dnl 198twrget(all, grf_mac, grf, 0, 1, 2, 3)dnl 199twrget(all, grf_amiga, grf, 0, 1, 2, 3, 4, 5, 6)dnl 200target(all, par, 0)dnl 201twrget(all, amouse, mouse, 0, 1)dnl 202twrget(all, akbd, kbd)dnl 203target(all, apci, 0)dnl 204target(all, ppi, 0)dnl 205target(all, view0, 0, 1, 2, 3, 4, 5)dnl 206target(all, local)dnl 207target(all, gpr, 0)dnl 208dnl 209_mkdev(all, {-all-}, {-dnl 210show_target(all)dnl 211-})dnl 212dnl 213__devitem(ramdisk, ramdisk, devices to be put on ramdisk-based media)dnl 214__devitem(std, {-std-}, standard devices)dnl 215dnl 216dnl 217dnl 218dnl _std 219dnl 220dnl $1: tty 221dnl $2: memstuff 222dnl $3: ksyms 223dnl $4: drum 224dnl $5: klog 225dnl 226define({-_std-}, {-dnl 227std) 228 M console c 0 0 600 229 M tty c $1 0 230 M mem c $2 0 640 kmem 231 M kmem c $2 1 640 kmem 232 M null c $2 2 233 M zero c $2 12 234 M stdin c major_fdesc_c 0 235 M stdout c major_fdesc_c 1 236 M stderr c major_fdesc_c 2 237 M ksyms c $3 0 640 kmem 238 M drum c $4 0 640 kmem 239 M klog c $5 0 600-})dnl 240dnl 241target(usb, usb, 0, 1)dnl 242target(usb, urio, 0)dnl 243twrget(usb, uscan, uscanner, 0)dnl 244target(usb, uhid, 0, 1, 2, 3)dnl 245target(usb, ulpt, 0, 1)dnl 246target(usb, ugen, 0, 1)dnl 247target(usb, utty, 0, 1)dnl 248dnl 249__devitem({-usbs-}, usbs, make USB devices)dnl 250_mkdev(usbs, usbs, {-dnl 251show_target({-usb-})dnl 252-})dnl 253__devtitle(tap, Tapes)dnl 254__devitem(wt, {-wt* -}, QIC-interface (e.g. not SCSI) 3M cartridge tape)dnl 255_mkdev(wt, wt*, 256{-name=wt 257 n=Mult($U, 8) m=Add($n, 4) 258 M $name$U b major_wt_b $n 640 operator 259 M r$name$U c major_wt_c $n 640 operator 260 M n$name$U b major_wt_b $m 640 operator 261 M nr$name$U c major_wt_c $m 640 operator-})dnl 262__devitem(tz, tz*, {-SCSI tapes{-,-} DEC TK50 cartridge tape-})dnl 263__devitem(st, {-st*-}, SCSI tapes)dnl 264_mkdev(st, st*, {-n=Mult($U, 16) 265 for pre in " " n e en 266 do 267 M ${pre}st$U b major_st_b $n 660 operator 268 M ${pre}rst$U c major_st_c $n 660 operator 269 n=Add($n, 1) 270 done-})dnl 271__devitem(ct, ct*, HP300 HP-IB cartridge tape)dnl 272__devitem(mt, mt*, (Magnetic) 9-track reel tape)dnl 273__devitem(ht, ht*, massbus tm03 & tu??)dnl 274__devitem(tm, tm*, unibus tm11 & te10 emulations (e.g. Emulex tc-11))dnl 275__devitem(ts, ts*, unibus ts11)dnl 276__devitem(ut, ut*, unibus tu45 emulations (e.g.si 9700))dnl 277__devtitle(dis, Disks)dnl 278__devitem(rz, rz*, SCSI disks)dnl 279__devitem(sd, {-sd*-}, {-SCSI disks, includes flopticals-})dnl 280__devitem(hd, {-hd*-}, HP300 HP-IB disks)dnl 281__devitem(cd, {-cd*-}, SCSI cdrom drives)dnl 282__devitem(acd, acd*, ATAPI cdrom drives)dnl 283_mkdev(cd, cd*, {-dodisk2 cd $U major_cd_b major_cd_c $U 0{--}ifstep(cd)-})dnl 284__devitem(mcd, mcd*, Mitsumi cdrom drives)dnl 285_mkdev(mcd, mcd*, {-dodisk2 mcd $U major_mcd_b major_mcd_c $U 0{--}ifstep(mcd)dnl 286-})dnl 287__devitem(ch, {-ch*-}, SCSI media changer)dnl 288_mcdev(ch, ch*, ch, {-major_ch_c-}, 660, operator)dnl 289__devitem(uk, uk*, SCSI Unknown device)dnl 290_mcdev(uk, uk*, uk, {-major_uk_c-}, 640, operator)dnl 291__devitem(ss, ss*, SCSI scanners)dnl 292_mkdev(ss, ss*, {-M ss$U c major_ss_c Mult($U,16) 640 operator 293 M nss$U c major_ss_c Add(Mult($U,16),1) 640 operator 294 M enss$U c major_ss_c Add(Mult($U,16),3) 640 operator 295 RMlist="$RMlist scan$U" 296 MKlist="$MKlist;umask 77;ln -s ss$U scan$U"-})dnl 297__devitem(ses, ses*, SES/SAF-TE SCSI devices)dnl 298_mkdev(ses, ses*, {-M ses$U c major_ses_c $U 640 operator-})dnl 299__devitem(ramd, ramdisk, makes all devices for a ramdisk kernel)dnl arc 300_mkdev(ramd, ramdisk, {-dnl 301show_target(ramd)dnl 302-})dnl 303target(ramd, std)dnl 304target(ramd, random)dnl 305target(ramd, bpf, 0)dnl 306__devitem(rd, {-rd*-}, "rd" pseudo-disks)dnl 307_mkdev(rd, rd*, {-dodisk2 rd $U major_rd_b major_rd_c $U 0{--}ifstep(rd)-})dnl 308__devitem(xd, xd*, Xylogic 753/7053 disks)dnl 309__devitem(xy, xy*, {- Xylogic 450/451 disks-})dnl 310__devitem(flo, {-fd*-}, {-Floppy disk drives (3 1/2"{-,-} 5 1/4")-})dnl 311_mkdev(flo, fd*, 312{-typnam=$U${i#fd[01]*} 313 case $typnam in 314 0|1) typnum=0;; # no type specified, assume A 315 *A) typnum=0; typnam=0;; 316 *B) typnum=1;; 317 *C) typnum=2;; 318 *D) typnum=3;; 319 *E) typnum=4;; 320 *F) typnum=5;; 321 *G) typnum=6;; 322 *H) typnum=7;; 323 *) echo bad type $typnam for $i; exit 1;; 324 esac 325 case $U in 326 0|1) blk=major_flo_b; chr=major_flo_c;; 327 *) echo bad unit $U for $i; exit 1;; 328 esac 329 nam=fd${typnam} 330 n=Add(Mult($U, 128), Mult($typnum, 16)) 331 M ${nam}a b $blk $n 640 operator 332 M ${nam}b b $blk Add($n, 1) 640 operator 333 M ${nam}c b $blk Add($n, 2) 640 operator 334 M r${nam}a c $chr $n 640 operator 335 M r${nam}b c $chr Add($n, 1) 640 operator 336 M r${nam}c c $chr Add($n, 2) 640 operator-}, 664)dnl 337__devitem(aflo, ramdisk, devices needed for install floppies)dnl 338_mkdev(aflo, fd*, {-case $U in 0|1|2|3) 339 M fd${U}a b major_aflo_b Mult($U, 16) 640 operator 340 M fd${U}b b major_aflo_b Add(Mult($U, 16), 1) 640 operator 341 M rfd${U}a c major_aflo_c Mult($U, 16) 640 operator 342 M rfd${U}b c major_aflo_c Add(Mult($U, 16), 1) 640 operator;; 343 *) echo bad unit for floppy disk in: $i;; 344 esac-})dnl 345__devitem(iop, iop*, I2O controller device)dnl 346_mcdev(iop, iop*, iop, {-major_iop_c-}, 660)dnl 347__devitem(wdt, wdt0, watchdog timer)dnl 348_mcdev(wdt, wdt0, wdt, {-major_wdt_c-}, 440, operator)dnl 349__devitem(local, local, configuration specific devices)dnl 350__devitem(wd, {-wd*-}, {-"winchester" disk drives (ST506, IDE, ESDI, RLL, ...)-})dnl 351__devitem(ccd, ccd*, concatenated disk devices)dnl 352__devitem(raid, raid*, RAIDframe disk devices)dnl 353__devitem(vnd, vnd*, "file" pseudo-disks)dnl 354_mkdev(vnd, vnd*, {-dodisk vnd $U major_vnd_b major_vnd_c $U 0{--}ifstep(vnd) 355 dodisk svnd $U major_vnd_b major_vnd_c $U 128{--}ifstep(vnd)-})dnl 356__devitem(ra, ra*, {-MSCP disks (ra??, hd??)-})dnl 357__devitem(hp, hp*, {-massbuss rm??-})dnl 358__devitem(hk, hk*, {-unibus rk06 and rk07-})dnl 359__devitem(up, up*, {-other unibus devices (e.g. on Emulex sc-21v controller)-})dnl 360__devitem(rb, rb*, {-730 idc w/ rb80 and/or rb02-})dnl 361__devitem(rx, rx*, {-MSCP floppy disk (rx33/50/...)-})dnl 362__devitem(rl, rl*, {-unibus r102-})dnl 363__devitem(hd, hd*, {-HDC9224 hd disks on VS2000-})dnl 364dnl 365dnl For normal disk devices, add a disk_q entry; anything else define like 366dnl the rest (such as vnd above). 367dnl 368disk_q({-ccd-})dnl 369disk_q({-hd-})dnl 370disk_q({-hk-})dnl 371disk_q({-hp-})dnl 372disk_q({-ra-})dnl 373disk_q({-raid-})dnl 374disk_q({-rb-})dnl 375disk_q({-rl-})dnl 376disk_q({-rx-})dnl 377disk_q({-sd-})dnl 378disk_q({-xy-})dnl 379disk_q({-xd-})dnl 380disk_q({-up-})dnl 381disk_q({-wd-})dnl 382disk_q({-rz-})dnl 383dnl 384__devitem(loc, local, configuration specific devices)dnl 385_mkdev(loc, local, {-test -s $T.local && sh $T.local-})dnl 386_mkdev({-disks-}, {-undefine({-C_ase-})show_disks()undefine({-C_ase-})-}, 387{-case $i in 388show_disks2()dnl 389 esac-})dnl 390__mkdev({-disks-}){--}dnl 391dnl 392__devtitle(cons, Console ports)dnl 393__devitem(ttyv0, ttyv0, pccons or pcvt screen 0)dnl 394__devitem(ttyv, ttyv*, pcvt)dnl 395__devitem(ttye, ttye*, ite bitmapped consoles)dnl 396__devitem(mac_ttye, ttye*, ite bitmapped consoles)dnl 397__devitem(wscons, ttyC0, wscons screen 0)dnl 398twrget(wscons, wscons, ttyC, cfg, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b)dnl 399target(wscons, wsmux)dnl 400target(wscons, wskbd, 0, 1, 2, 3)dnl 401target(wscons, wsmouse, 0, 1, 2, 3)dnl 402_mkdev({-wscons-}, {-wscons-}, {-dnl 403show_target(wscons)dnl 404-})dnl 405__devitem(wsdisp, ttyC-F*, wscons virtual consoles)dnl 406_mkdev({-wsdisp-}, tty[C-F]*, {-U=${i##tty[C-F]} 407 case $i in 408 ttyC*) n=C m=expr(0*256);; 409 ttyD*) n=D m=expr(1*256);; 410 ttyE*) n=E m=expr(2*256);; 411 ttyF*) n=F m=expr(3*256);; 412 esac 413 case $U in 414 [0-9a-f]) M tty$n$U c major_wsdisp_c {-$(( 16#$U + $m ))-} 600;; 415 cfg) M tty${n}cfg c major_wsdisp_c Add(255,$m) 600;; 416 *) echo bad unit $U for $i; exit 1;; 417 esac-})dnl 418__devitem(wskbd, wskbd*, wscons keyboards)dnl 419_mkdev(wskbd, wskbd*, {-M wskbd$U c major_wskbd_c $U 600-})dnl 420__devitem(wsmux, wsmux, wscons keyboard/mouse mux devices)dnl 421_mkdev(wsmux, wsmux|wsmouse|wskbd, {-M wsmouse c major_wsmux_c 0 600 422 M wskbd c major_wsmux_c 1 600-})dnl 423__devitem(pcons, console, PROM console)dnl 424__devtitle(point, Pointing devices)dnl 425__devitem(wsmouse, wsmouse*, wscons mice)dnl 426_mkdev(wsmouse, wsmouse*, {-M wsmouse$U c major_wsmouse_c $U 600-})dnl 427__devitem(quad, quadmouse, "quadrature mouse")dnl 428__devtitle(pty, Pseudo terminals)dnl 429__devitem(tty, tty*, set of 16 slave psuedo terminals)dnl 430__devitem(pty, pty*, set of 16 master pseudo terminals)dnl 431_mkdev(pty, pty*, {-if [ $U -gt 15 ]; then 432 echo bad unit for pty in: $i 433 continue 434 fi 435 set -A tbl p q r s t u v w x y z P Q R S T 436 name=${tbl[$U]} 437 n=0 438 while [ $n -lt 16 ] 439 do 440 nam=$name$(hex $n) 441 off=Mult($U, 16) 442 M tty$nam c major_tty_c Add($off, $n) 443 M pty$nam c major_pty_c Add($off, $n) 444 n=Add($n, 1) 445 done-})dnl 446__devitem(dc, dc*, {-4 channel serial interface (keyboard{-,-} mouse{-,-}modem{-,-} printer)-})dnl 447__devtitle(prn, Printers)dnl 448__devitem(par, par*, motherboard parallel port)dnl 449__devitem(lpt, lpt*, IEEE 1284 centronics printer)dnl 450_mkdev(lpt, lpt*|lpa*, 451{-case $i in 452 lpt*) n=lpt f=0;; 453 lpa*) n=lpa f=128;; 454 esac 455 M $n$U c major_lpt_c Add($U, $f) 600-})dnl 456__devitem(lpa, lpa*, interruptless lp)dnl 457__devitem(ppi, ppi*, HP-IB plotters)dnl 458__devtitle({-usb-}, USB devices)dnl 459__devitem({-usb-}, usb*, Bus control devices used by usbd for attach/detach)dnl 460_mkdev({-usb-}, usb*, {-[ "$i" = "usb" ] && u= || u=$U 461 M usb$u c major_usb_c $U 660-})dnl 462__devitem(uhid, uhid*, Generic HID devices)dnl 463_mcdev({-uhid-}, uhid*, {-uhid-}, {-major_uhid_c-}, 660)dnl 464__devitem(ulpt, ulpt*, Printer devices)dnl 465_mcdev({-ulpt-}, ulpt*, {-ulpt-}, {-major_ulpt_c-}, 660)dnl 466__devitem(utty, utty*, Serial ports)dnl 467_mcdev({-utty-}, utty*, {-utty-}, {-major_utty_c-}, 660)dnl 468__devitem(urio, urio*, Diamond Multimedia Rio 500)dnl 469_mcdev({-urio-}, urio*, {-urio-}, {-major_urio_c-}, 660)dnl 470__devitem(uscan, uscanner*, Scanners)dnl 471_mcdev({-uscan-}, uscanner*, {-uscanner-}, {-major_uscan_c-}, 660)dnl 472__devitem(ugen, ugen*, Generic device)dnl 473_mkdev(ugen, ugen*, {-n=Mult($U, 16) 474 for j in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 475 do 476 M ugen$U.$j c major_ugen_c Add($n, $j) 660 477 done-})dnl 478__devtitle(cpu, Cpus)dnl 479__devitem(cpu, cpu*, cpus)dnl 480__devtitle(call, Call units)dnl 481__devtitle(term, Terminal ports)dnl 482__devtitle(termp, Terminal multiplexers)dnl 483__devitem(dca, dca*, HP200/300 single port serial interface)dnl 484__devitem(dcm, dcm*, HP200/300 4 port serial mux interface)dnl 485__devitem(apci, apci*, HP400 4 port serial mux interface)dnl 486__devitem({-com-}, {-tty0*-}, NS16x50 serial ports)dnl 487_mkdev(com, {-tty0*-}, {-M tty$U c major_com_c $U 660 dialer uucp 488 M cua$U c major_com_c Add($U, 128) 660 dialer uucp-})dnl 489__devitem(ttyc, ttyc*, Cyclades serial ports)dnl 490__devitem(tzs, tty[a-z]*, Zilog 8530 Serial Port)dnl 491_mkdev(tzs, {-tty[a-z]-}, {-u=${i#tty*} 492 case $u in 493 a) n=0 ;; 494 b) n=1 ;; 495 c) n=4 ;; 496 d) n=5 ;; 497 *) echo unknown tty device $i ;; 498 esac 499 M tty$u c major_tzs_c $n 660 dialer uucp-})dnl 500__devitem(tth, ttyh*, Sab82532 serial devices)dnl 501_mkdev(tth, ttyh*, {-M ttyh$U c major_tth_c $U 660 dialer uucp-})dnl 502__devitem(czs, cua[a-z]*, Zilog 8530 Serial Port)dnl 503_mkdev(czs, cua[a-z], {-u=${i#cua*} 504 case $u in 505 a) n=0 ;; 506 b) n=1 ;; 507 c) n=4 ;; 508 d) n=5 ;; 509 *) echo unknown cua device $i ;; 510 esac 511 M cua$u c major_czs_c Add($n, 128) 660 dialer uucp-})dnl 512__devitem(arm_tty, tty*, {-alias for PC COM ports{-,-} this is what the system really wants-})dnl 513__devitem(tty0, tty00, standard serial port)dnl 514__devitem(mac_tty0, tty00, standard serial port)dnl 515__devitem(ttyA, ttyA*, mfc serial ports)dnl 516__devitem(attyB, ttyB*, ISA COM ports)dnl amiga 517__devitem(ttyz, tty[a-d], onboard zs serial ports)dnl 518__devitem(cuaz, cua[a-d], onboard zs serial ports)dnl 519__devitem(ttyB, ttyB?, DEC 3000 ZS8530 ("scc") serial ports)dnl 520__devitem(scc, scc*, 82530 serial interface)dnl 521__devitem(arc_ttyC, ttyC0, pccons)dnl 522__devitem(i386_ttyC, ttyC*, pcvt)dnl 523__devitem(ttyC, ttyC?, {-AlphaStation NS16550 ("com serial ports")-})dnl 524__devitem(ttyE, ttyE?, Workstation console (framebuffer & keyboard) tty emulators)dnl 525__devitem(ser02, ser02, {-serial2 port (channel A on 8530)-})dnl 526__devitem(mdm02, mdm02, {-modem2 port (channel B on 8530)-})dnl 527__devtitle(spec, Special purpose devices)dnl 528__devitem(apm, apm , power management device)dnl 529_mkdev(apm, apm*, {-M apm c major_apm_c 0 644 530 M apmctl c major_apm_c 8 644-})dnl 531__devitem(pcmcia, pcmcia*, PCMCIA card drivers)dnl 532__devitem(pctr, pctr*, PC Performance Tuning Register access device)dnl 533_mkdev(pctr, pctr, {-M pctr c major_pctr_c 0 644-})dnl 534__devitem(systrace, systrace*, system call tracing device)dnl 535_mkdev(systrace, systrace, {-M systrace c major_systrace_c 0 644-})dnl 536__devitem(au, audio*, audio device)dnl 537_mkdev(au, audio*, {-M sound$U c major_au_c $U 538 M mixer$U c major_au_c Add($U, 16) 539 M audio$U c major_au_c Add($U, 128) 540 M audioctl$U c major_au_c Add($U, 192) 541 MKlist="$MKlist;[ -e audio ] || ln -s audio$U audio" 542 MKlist="$MKlist;[ -e mixer ] || ln -s mixer$U mixer" 543 MKlist="$MKlist;[ -e sound ] || ln -s sound$U sound" 544 MKlist="$MKlist;[ -e audioctl ] || ln -s audioctl$U audioctl"-})dnl 545__devitem(asc, asc*, ASC Audio device)dnl 546_mkdev(asc, asc*, {-M asc$U major_asc_c 0-})dnl 547__devitem(music, music*, midi devices)dnl 548_mkdev(music, music*, {-M music$U c major_music_c $U 549 M sequencer$U c major_music_c Add($U, 128) 550 MKlist="$MKlist;[ -e music ] || ln -s music$U music" 551 MKlist="$MKlist;[ -e sequencer ] || ln -s sequencer$U sequencer"-})dnl 552__devitem(radio, radio*, FM tuner device)dnl 553_mkdev(radio, radio*, {-M radio$U c major_radio_c $U 554 MKlist="$MKlist;[ -e radio ] || ln -s radio$U radio"-})dnl 555__devitem(fdesc, fd, makes fd/* for the fdescfs)dnl 556_mkdev(fdesc, fd, {-RMlist="mkdir -p fd;$RMlist" n=0 557 while [ $n -lt 64 ];do M fd/$n c major_fdesc_c $n;n=Add($n, 1);done 558 MKlist="$MKlist;chmod 555 fd"-})dnl 559__devtitle(graph, Graphics devices)dnl 560__devitem(grf_mac, grf*, {-custom chip (grf0){-,-} Retina Z2/Z3 (grf1/grf2){-,-} 561{-#-} Cirrus boards (grf3){-,-} A2410 (grf4) video or 562{-#-} CyberVision 64 (grf5)-})dnl 563__devitem(grf_amiga, grf*, {-Motherboard bitmapped video.-})dnl 564__devitem(ite, ite*, terminal emulator interface to HP300 graphics devices)dnl 565__devitem({-hil-}, {-hil-}, HP300 HIL input devices)dnl 566__devitem(oppr, openprom)dnl 567_cdev(oppr, openprom, 70, 0)dnl 568__devitem(btw, bwtwo*)dnl 569_mcdev(btw, bwtwo*, bwtwo, {-major_btw_c-}, 666)dnl 570__devitem(ctw, cgtwo*)dnl 571_mcdev(ctw, cgtwo*, cgtwo, {-major_ctw_c-}, 666)dnl 572__devitem(ctr, cgthree*)dnl 573_mcdev(ctr, cgthree*, cgthree, {-major_ctr_c-}, 666)dnl 574__devitem(cfr, cgfour*)dnl 575_mcdev(cfr, cgfour*, cgfour, {-major_cfr_c-}, 666)dnl 576__devitem(csx, cgsix*)dnl 577_mcdev(csx, cgsix*, cgsix, {-major_csx_c-}, 666)dnl 578__devitem(ceg, cgeight*)dnl 579_mcdev(ceg, cgeight*, cgeight, {-major_ceg_c-}, 666)dnl 580__devitem(cfo, cgfourteen*)dnl 581_mcdev(cfo, cgfourteen*, cgfourteen, {-major_cfo_c-})dnl 582__devitem(tcx, tcx*)dnl 583_mcdev(tcx, tcx*, tcx, {-major_tcx_c-})dnl 584__devitem(cry, crypto, hardware crypto access driver)dnl 585_mkdev(cry, crypto, {-M crypto c major_cry_c-} 0)dnl 586__devitem(pf, pf*, Packet Filter)dnl 587_mkdev(pf, {-pf*-}, {-M pf c major_pf_c 0 600-})dnl 588__devitem(bpf, bpf*, Berkeley Packet Filter)dnl 589_mkdev(bpf, {-bpf*-}, {-M bpf$U c major_bpf_c $U 600-}, 600)dnl 590_mkdev(tun, {-tun*-}, {-M tun$U c major_tun_c $U 600-}, 600)dnl 591__devitem(speak, speaker, pc speaker)dnl 592_mkdev(speak, speaker, {-M speaker c major_speak_c 0 600-})dnl 593__devitem(kbd, kbd, keyboard (provides events, for X11))dnl 594_cdev(kbd, kbd, {-major_kbd_c-}, 0, 600)dnl 595__devitem(kbd_atari, kbd, Atari keyboard)dnl 596__devitem(akbd, kbd, Amiga keyboard)dnl 597__devitem(rkbd, kbd, raw keyboard)dnl 598__devitem(kbdctl, kbdctl, keyboard control)dnl 599__devitem(beep, beep, riscpc speaker)dnl 600__devitem(iic, iic*, IIC bus device)dnl 601__devitem(rtc, rtc*, RTC device)dnl 602__devitem(view, view*, generic interface to graphic displays)dnl 603__devitem(aconf, aconf, {-autoconfig information (not yet)-})dnl 604__devitem(mouse-, mouse-*, "mouse link")dnl 605__devitem(mouse, mouse, mouse (provides events, for X11))dnl 606__devitem(amouse, mouse*, Amiga mice)dnl 607__devitem(lkm, lkm, loadable kernel modules interface)dnl 608_cdev(lkm, lkm, {-major_lkm_c-}, 0, 640, kmem)dnl 609__devitem(mmcl, mmclock, memory mapped clock)dnl 610__devitem(tun, tun*, network tunnel driver)dnl 611__devitem(rnd, *random, inkernel random data source)dnl 612_mkdev(rnd, *random, {-n=0 613 for pre in " " s u p a 614 do 615 M ${pre}random c major_rnd_c $n 644 616 n=Add($n, 1) 617 done-}, 644)dnl 618__devitem(joy, joy*, joystick driver)dnl 619_mcdev(joy, joy*, joy, {-major_joy_c-}, 666)dnl 620__devitem(mag, magma*, magma card (makes 16 tty and 2 bpp))dnl 621__devitem(bppmag, bppmag[mno], magma parallel port device)dnl 622__devitem(spif, spif*, spif card (makes 8 tty and 1 bpp))dnl 623__devitem(bppsp, bpp[jkl], spif parallel port device)dnl 624_mkdev(mag, magma*, {-case $U in 625 0) offset=0 nam=m;; 626 1) offset=16 nam=n;; 627 2) offset=32 nam=o;; 628 *) echo "bad unit for $i: $U"; exit 127;; 629 esac 630 offset=Mult($U, 64) 631 n=0 632 while [ $n -lt 16 ] 633 do 634 name=${nam}`hex $n` 635 M tty$name c major_mag_c Add($offset, $n) 660 dialer uucp 636 n=Add($n, 1) 637 done 638 M bpp${nam}0 c major_bppmag_c Add($offset, 0) 600 639 M bpp${nam}1 c major_bppmag_c Add($offset, 1) 600-})dnl 640_mkdev(spif, spif*, {-case $U in 641 0) offset=0 nam=j;; 642 1) offset=16 nam=k;; 643 2) offset=32 nam=l;; 644 *) echo "bad unit for $i: $U"; exit 127;; 645 esac 646 offset=Mult($U, 64) 647 n=0 648 while [ $n -lt 8 ] 649 do 650 name=${nam}`hex $n` 651 M tty$name c major_spif_c Add($offset, $n) 660 dialer uucp 652 n=Add($n, 1) 653 done 654 M bpp${nam}0 c major_bppsp_c Add($offset, 0) 600-})dnl 655__devitem(bpp, bpp*, parallel port devices)dnl 656__devitem(xfs, xfs*, XFS filesystem devices)dnl 657_mcdev(xfs, xfs*, xfs, {-major_xfs_c-}, 600)dnl 658__devitem(hil, hil, HIL input devices)dnl 659__devitem(rmidi, rmidi*, raw midi devices)dnl 660_mcdev(rmidi, rmidi*, rmidi, {-major_rmidi_c-}, 666)dnl 661__devtitle(plat, Platform-specific devices)dnl 662__devitem(fb, fb*, framebuffer device)dnl 663__devitem(bktr, bktr*, video capturing)dnl 664_mcdev(bktr, bktr*, bktr, {-major_bktr_c-}, 644)dnl 665__devitem(tuner, tuner*, tuner device)dnl 666_mkdev(tuner, tuner*, {-M tuner$U c major_bktr_c Add(Mult($U, 2), 16) 644-}, 644)dnl 667__devitem(pci, pci, PCI bus device)dnl 668_mkdev(pci, pci, {-M pci c major_pci_c 0 600-}, 600)dnl 669__devitem(adb, adb, Apple Desktop bus event interface)dnl 670_mkdev(adb, adb, {-M adb c major_adb_c 0-})dnl 671__devitem(pdc, pdc, PDC device)dnl 672_mkdev(local, local, {-test -s $T.local && sh $T.local-}, 666)dnl 673__devitem(gpr, gpr*, gpr400 pcmcia device)dnl 674_mcdev(gpr, gpr*, gpr, {-major_gpr_c-})dnl 675dnl 676divert(1)dnl 677include(etc.MACHINE/MAKEDEV.md)dnl 678dnl 679dnl 680divert(0)dnl 681#!/bin/sh - 682# 683# THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. 684# generated from: 685# 686show_vers()dnl <-- now that all files are included, show versions 687# 688dnl 689divert(2)dnl 690PATH=/sbin:/usr/sbin:/bin:/usr/bin 691T=$0 692 693# set this to echo for Echo-Only debugging 694[ "$eo" ] || eo= 695 696hex() 697{ 698 case ${--}1 in 699 [0-9]) echo -n {-$-}1;; 700 10) echo -n a;; 701 11) echo -n b;; 702 12) echo -n c;; 703 13) echo -n d;; 704 14) echo -n e;; 705 15) echo -n f;; 706 esac 707} 708 709trunc() 710{ 711 # XXX pdksh can't seem to deal with locally scoped variables 712 # in ${foo#$bar} expansions 713 arg1="{-$-}1" 714 arg2="{-$-}2" 715 case {-$-}3 in 716 l) echo ${arg2#$arg1} ;; 717 r|*) echo ${arg1#$arg2} ;; 718 esac 719} 720 721unt() 722{ 723 # XXX pdksh can't seem to deal with locally scoped variables 724 # in ${foo#$bar} expansions 725 arg="{-$-}1" 726 tmp="${arg#[a-zA-Z]*}" 727 tmp="${tmp%*[a-zA-Z]}" 728 while [ "$tmp" != "$arg" ] 729 do 730 arg=$tmp 731 tmp="${arg#[a-zA-Z]*}" 732 tmp="${tmp%*[a-zA-Z]}" 733 done 734 echo $arg 735} 736dnl 737dnl dodisk(name, unit, blkmaj, chrmaj, unit, off[, stepping]) 738dnl arg: 1 2 3 4 5 6 7 739dnl 740 741dodisk() 742{ 743 [ "$DEBUG" ] && set -x 744 n=Add(Mult(${5}, ${7:-16}), ${6}) count=0 745 RMlist="$RMlist {-$-}1{-$-}2? r{-$-}1{-$-}2?" 746 [ 0$7 -ne 8 ] && l="i j k l m n o p" 747 for d in a b c d e f g h $l 748 do 749 M {-$-}1{-$-}2$d b {-$-}3 Add($n, $count) 640 750 M r{-$-}1{-$-}2$d c {-$-}4 Add($n, $count) 640 751 let count=count+1 752 done 753 MKlist="$MKlist;chown root.operator {-$-}1{-$-}2? r{-$-}1{-$-}2?" 754} 755dnl 756dnl dodisk2(name, unit, blkmaj, chrmaj, unit, off[, stepping]) 757dnl 758dnl 1. name - prefix name of the device 759dnl 2. unit - beginning unit number for block devices 760dnl 3. blkmaj - block device major number 761dnl 4. chrmaj - character device major number 762dnl 5. unit - beginning unit number for character devices 763dnl 6. off - offset from 0 for all minor numbers (see svnd for an example) 764dnl 7. step - optional, defaults to 16, number of partitions per device 765dnl 766 767dodisk2() 768{ 769 n=Add(Mult({-$-}5, ${7:-16}), {-$-}6) 770 M {-$-}1{-$-}2a b {-$-}3 $n 640 operator 771 M r{-$-}1{-$-}2a c {-$-}4 $n 640 operator 772 n=Add($n, 2) 773 M {-$-}1{-$-}2c b {-$-}3 $n 640 operator 774 M r{-$-}1{-$-}2c c {-$-}4 $n 640 operator 775} 776 777# M name b/c major minor [mode] [group] 778RMlist="rm -f" 779MKlist=":" 780 781mkl() { 782dnl 783dnl uncomment if multi mknod happens 784dnl 785ifelse(1, 0, 786[ "${mklist[{-$-}1]}" ] && mklist[{-$-}1]="${mklist[{-$-}1]} {-$-}2 {-$-}3 {-$-}4 {-$-}5" || { 787 mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5" 788 modes="$modes {-$-}1" 789 }, 790dnl 791dnl non multi mknod 792dnl 793 [ "${mklist[{-$-}1]}" ] && { 794 mklist[{-$-}1]="${mklist[{-$-}1]};mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5" 795 } || { 796 mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5" 797 modes="$modes {-$-}1" 798 }) 799} 800 801M() { 802 RMlist="$RMlist {-$-}1" 803 mkl ${5-666} {-$-}1 {-$-}2 {-$-}3 {-$-}4 804 mklist="$mklist {-$-}1" 805 G={-$-}{6:-wheel} 806 [ "{-$-}7" ] && { 807 MKlist="$MKlist;chown {-$-}7.{-$-}G {-$-}1" 808 } || { 809 case $G in 810 wheel)g=0;;kmem)g=2;;operator)g=5;;tty)g=4;;dialer)g=117;; 811 esac 812 [ "${grplist[$g]}" ] && { 813 grplist[$g]="${grplist[$g]} {-$-}1" 814 } || { 815 groups="$groups $g" 816 grplist[$g]="chgrp $G {-$-}1" 817 } 818 } 819 return 0 820} 821divert(7)dnl 822dnl 823dnl there is no blank line at the end of etc.arch/MAKEDEV.md files, so add one 824dnl on the following line: 825 826show_devs()dnl 827dnl 828divert(9)dnl 829*) 830 echo $i: unknown device 831 ;; 832esac 833done 834} 835_recurse "$@" 836if [ "$os" = "SunOS" ]; then 837 eo=transform 838 transform() { 839 case $mode in 840 600) mask=077;; 841 640) mask=027;; 842 660) mask=007;; 843 644) mask=022;; 844 666) mask=0;; 845 440) mask=227;; 846 esac 847 echo `echo "$@"|sed \ 848 's/mknod -m \([0-9]*\) /umask '$mask';mknod /;s/-m [0-9]* //g;\ 849 s/operator/5/g;s/root.kmem/root.2/g;s/root\./root:/g'` 850 } 851fi 852list="$RMlist" 853for mode in $modes; do 854 list="$list;${mklist[$mode]}" 855done 856for group in $groups; do 857 list="$list;${grplist[$group]}" 858done 859list="$list;$MKlist" 860if [ "$eo" = "echo" -o "$eo" = "transform" ]; then 861 $eo "$list" 862else 863 echo "$list" | sh 864fi 865divert(3)dnl 866dnl 867 868R() { 869[ "$DEBUG" ] && set -x 870for i in "$@" 871do 872U=`unt $i` 873[ "$U" ] || U=0 874 875case $i in 876dnl 877