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