1#!/bin/sh - 2# 3# THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. 4# generated from: 5# 6# OpenBSD: etc.sparc64/MAKEDEV.md,v 1.73 2013/06/03 16:06:42 tedu Exp 7# OpenBSD: MAKEDEV.common,v 1.64 2013/06/03 16:06:42 tedu Exp 8# OpenBSD: MAKEDEV.mi,v 1.81 2012/11/05 08:07:09 jasper Exp 9# OpenBSD: MAKEDEV.sub,v 1.14 2005/02/07 06:14:18 david Exp 10# 11# 12# Copyright (c) 2001-2004 Todd T. Fries <todd@OpenBSD.org> 13# 14# Permission to use, copy, modify, and distribute this software for any 15# purpose with or without fee is hereby granted, provided that the above 16# copyright notice and this permission notice appear in all copies. 17# 18# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 19# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 20# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 21# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 22# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 23# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 24# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 25# 26# Device "make" file. Valid arguments: 27# all makes all known devices, including local devices. 28# Tries to make the ``standard'' number of each type. 29# ramdisk Ramdisk kernel devices 30# std Standard devices 31# local Configuration specific devices 32# Disks: 33# cd* ATAPI and SCSI CD-ROM drives 34# fd* Floppy disk drives (3 1/2", 5 1/4") 35# rd* "rd" pseudo-disks 36# sd* SCSI disks, including flopticals 37# vnd* "file" pseudo-disk devices 38# wd* "winchester" disk drives (ST506, IDE, ESDI, RLL, ...) 39# Tapes: 40# ch* SCSI media changers 41# st* SCSI tape drives 42# Terminal ports: 43# cua[a-z]* Zilog 8530 serial port 44# magma* Magma multiport cards 45# spif* "spif" multiport cards 46# tty[0-7][0-9a-f] NS16x50 serial ports 47# tty[a-z]* Zilog 8530 serial port 48# ttyh* Sab82532 serial devices 49# ttyV* Virtual console concentrator 50# Pseudo terminals: 51# ptm pty master device 52# pty* Set of 62 master pseudo terminals 53# tty* Set of 62 slave pseudo terminals 54# Console ports: 55# console PROM console 56# ttyC-J* wscons display devices 57# wscons Minimal wscons devices 58# wskbd* wscons keyboards 59# wsmux wscons keyboard/mouse mux devices 60# Pointing devices: 61# wsmouse* wscons mice 62# Printers: 63# bpp* Parallel port 64# bpp[jkl] "spif" parallel port 65# bppmag[mno] Magma parallel port 66# lpa* Polled printer port 67# lpt* IEEE 1284 centronics printer 68# USB devices: 69# ttyU* USB serial ports 70# uall All USB devices 71# ugen* Generic USB devices 72# uhid* Generic HID devices 73# ulpt* Printer devices 74# urio* Diamond Multimedia Rio 500 75# usb* Bus control devices used by usbd for attach/detach 76# uscanner* Scanners 77# Special purpose devices: 78# audio* Audio devices 79# bio ioctl tunnel pseudo-device 80# bpf* Berkeley Packet Filter 81# bthub* Bluetooth Hubs 82# crypto Hardware crypto access driver 83# diskmap Disk mapper 84# fd fd/* nodes 85# fuse Userland Filesystem 86# hotplug devices hot plugging 87# lkm Loadable kernel modules interface 88# openprom PROM settings 89# pci* PCI bus devices 90# pf* Packet Filter 91# pppx* PPP Multiplexer 92# rmidi* Raw MIDI devices 93# *random In-kernel random data source 94# systrace* System call tracing device 95# tun* Network tunnel driver 96# uk* Unknown SCSI devices 97# uperf Performance counters 98# video* Video V4L2 devices 99# vscsi* Virtual SCSI controller 100# hvctl Hypervisor control channel 101# spds Service processor domain services channel 102# ldom* Logical domain services channels 103# vdsp* Virtual disk server ports 104PATH=/sbin:/usr/sbin:/bin:/usr/bin 105T=$0 106 107# set this to echo for Echo-Only debugging 108[ "$eo" ] || eo= 109 110hex() 111{ 112 case $1 in 113 [0-9]) echo -n $1;; 114 10) echo -n a;; 115 11) echo -n b;; 116 12) echo -n c;; 117 13) echo -n d;; 118 14) echo -n e;; 119 15) echo -n f;; 120 esac 121} 122 123alph2d() 124{ 125 local t="$1" 126 local p="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" 127 local sub=${p%${t}*} 128 echo ${#sub} 129} 130 131h2d() 132{ 133 local s="$1" 134 local f=${s%*[0-9a-f]} n=${s#[0-9a-f]*} 135 136 echo $(($(_h2d $f)*16+ $(_h2d $n) )) 137} 138 139_h2d() 140{ 141 case $1 in 142 [0-9]) echo -n $1;; 143 a) echo -n 10;; 144 b) echo -n 11;; 145 c) echo -n 12;; 146 d) echo -n 13;; 147 e) echo -n 14;; 148 f) echo -n 15;; 149 esac 150} 151 152unt() 153{ 154 # XXX pdksh can't seem to deal with locally scoped variables 155 # in ${foo#$bar} expansions 156 arg="$1" 157 tmp="${arg#[a-zA-Z]*}" 158 tmp="${tmp%*[a-zA-Z]}" 159 while [ "$tmp" != "$arg" ] 160 do 161 arg=$tmp 162 tmp="${arg#[a-zA-Z]*}" 163 tmp="${tmp%*[a-zA-Z]}" 164 done 165 echo $arg 166} 167 168dodisk() 169{ 170 [ "$DEBUG" ] && set -x 171 n=$(($((${5}*${7:-16}))+${6})) count=0 172 [ 0$7 -ne 8 ] && l="i j k l m n o p" 173 for d in a b c d e f g h $l 174 do 175 M $1$2$d b $3 $(($n+$count)) 640 operator 176 M r$1$2$d c $4 $(($n+$count)) 640 operator 177 let count=count+1 178 done 179} 180 181dodisk2() 182{ 183 n=$(($(($5*${7:-16}))+$6)) 184 M $1$2a b $3 $n 640 operator 185 M r$1$2a c $4 $n 640 operator 186 n=$(($n+2)) 187 M $1$2c b $3 $n 640 operator 188 M r$1$2c c $4 $n 640 operator 189} 190 191# M name b/c major minor [mode] [group] 192RMlist[0]="rm -f" 193 194mkl() { 195 mklist[${#mklist[*]}]=";mknod -m $1 $2 $3 $4 $5" 196} 197 198M() { 199 RMlist[${#RMlist[*]}]=$1 200 mkl ${5-666} $1 $2 $3 $4 201 G=${6:-wheel} 202 [ "$7" ] && { 203 MKlist[${#MKlist[*]}]="&& chown $7:$G $1" 204 } || { 205 case $G in 206 wheel) 207 [ ${#whlist[*]} = 0 ] && whlist[0]="&& chgrp wheel" 208 whlist[${#whlist[*]}]="$1" 209 ;; 210 operator) 211 [ ${#oplist[*]} = 0 ] && oplist[0]="&& chgrp operator" 212 oplist[${#oplist[*]}]="$1" 213 ;; 214 *) 215 MKlist[${#MKlist[*]}]="&& chgrp $G $1"; 216 esac 217 } 218 return 0 219} 220 221R() { 222[ "$DEBUG" ] && set -x 223for i in "$@" 224do 225U=`unt $i` 226[ "$U" ] || U=0 227 228case $i in 229ramdisk) 230 R std fd0 wd0 wd1 wd2 sd0 sd1 sd2 rd0 231 R st0 cd0 bpf0 bio diskmap 232 ;; 233 234std) 235 M console c 0 0 600 236 M tty c 2 0 237 M mem c 3 0 640 kmem 238 M kmem c 3 1 640 kmem 239 M null c 3 2 240 M zero c 3 12 241 M stdin c 24 0 242 M stdout c 24 1 243 M stderr c 24 2 244 M ksyms c 76 0 640 kmem 245 M klog c 16 0 600 246 M openprom c 70 0 640 kmem 247 M mdesc c 70 1 640 kmem 248 ;; 249 250vdsp*) 251 M vdsp$U c 133 $U 600 252 ;; 253 254ldom*) 255 M ldom$U c 132 $(($U+32)) 600 256 ;; 257 258spds) 259 M spds c 132 1 600 260 ;; 261 262hvctl) 263 M hvctl c 132 0 600 264 ;; 265 266vscsi*) 267 M vscsi$U c 128 $U 600 268 ;; 269 270video*) 271 M video$U c 44 $U 272 MKlist[${#MKlist[*]}]=";[ -e video ] || ln -s video$U video" 273 ;; 274 275uperf) 276 M uperf c 25 0 664 277 ;; 278 279uk*) 280 M uk$U c 60 $U 640 operator 281 ;; 282 283tun*) 284 M tun$U c 111 $U 600 285 ;; 286 287systrace) 288 M systrace c 50 0 644 289 ;; 290 291*random) 292 n=0 293 for pre in " " s u a 294 do 295 M ${pre}random c 119 $n 644 296 n=$(($n+1)) 297 done 298 ;; 299 300rmidi*) 301 M rmidi$U c 68 $U 666 302 ;; 303 304pppx*) 305 M pppx$U c 131 $U 600 306 ;; 307 308pf*) 309 M pf c 73 0 600 310 ;; 311 312pci*) 313 M pci$U c 52 $U 600 314 MKlist[${#MKlist[*]}]=";[ -h pci ] || ln -sf pci0 pci" 315 ;; 316 317openprom) 318 M openprom c 70 0 319 ;; 320 321lkm) 322 M lkm c 112 0 640 _lkm 323 ;; 324 325hotplug) 326 M hotplug c 124 $U 400 327 ;; 328 329fuse) 330 M fuse$U c 134 $U 600 331 ;; 332 333fd) 334 RMlist[${#RMlist[*]}]=";mkdir -p fd;rm -f" n=0 335 while [ $n -lt 64 ];do M fd/$n c 24 $n;n=$(($n+1));done 336 MKlist[${#MKlist[*]}]=";chmod 555 fd" 337 ;; 338 339diskmap) 340 M diskmap c 130 0 640 operator 341 ;; 342 343crypto) 344 M crypto c 75 0 345 ;; 346 347bthub*) 348 M bthub$U c 129 $U 349 ;; 350 351bpf*) 352 M bpf$U c 105 $U 600 353 ;; 354 355bio) 356 M bio c 120 0 600 357 ;; 358 359audio*) 360 M sound$U c 69 $U 361 M mixer$U c 69 $(($U+16)) 362 M audio$U c 69 $(($U+128)) 363 M audioctl$U c 69 $(($U+192)) 364 MKlist[${#MKlist[*]}]=";[ -e audio ] || ln -s audio$U audio" 365 MKlist[${#MKlist[*]}]=";[ -e mixer ] || ln -s mixer$U mixer" 366 MKlist[${#MKlist[*]}]=";[ -e sound ] || ln -s sound$U sound" 367 MKlist[${#MKlist[*]}]=";[ -e audioctl ] || ln -s audioctl$U audioctl" 368 ;; 369 370uscanner*) 371 M uscanner$U c 96 $U 660 372 ;; 373 374usb*) 375 [ "$i" = "usb" ] && u= || u=$U 376 M usb$u c 90 $U 660 377 ;; 378 379urio*) 380 M urio$U c 94 $U 660 381 ;; 382 383ulpt*) 384 M ulpt$U c 93 $U 660 385 ;; 386 387uhid*) 388 M uhid$U c 91 $U 660 389 ;; 390 391ugen*) 392 n=$(($U*16)) 393 for j in 0{0,1,2,3,4,5,6,7,8,9} 1{0,1,2,3,4,5} 394 do 395 M ugen$U.$j c 92 $(($n+10#$j)) 660 396 done 397 ;; 398 399uall) 400 R ttyU0 ttyU1 ttyU2 ttyU3 ugen0 ugen1 ulpt0 ulpt1 uhid0 uhid1 401 R uhid2 uhid3 uscanner0 urio0 usb0 usb1 usb2 usb3 usb4 usb5 402 R usb6 usb7 403 ;; 404 405ttyU[0-9a-zA-Z]) 406 U=${i#ttyU*} 407 o=$(alph2d $U) 408 M ttyU$U c 95 $o 660 dialer uucp 409 M cuaU$U c 95 $(($o+128)) 660 dialer uucp 410 ;; 411 412lpt*|lpa*) 413 case $i in 414 lpt*) n=lpt f=0;; 415 lpa*) n=lpa f=128;; 416 esac 417 M $n$U c 37 $(($U+$f)) 600 418 ;; 419 420bpp*) 421 M bpp$U c 107 $U 600 422 ;; 423 424wsmouse[0-9]*) 425 M wsmouse$U c 80 $U 600 426 ;; 427 428wsmux|wsmouse|wskbd) 429 M wsmouse c 81 0 600 430 M wskbd c 81 1 600 431 ;; 432 433wskbd[0-9]*) 434 M wskbd$U c 79 $U 600 435 ;; 436 437wscons) 438 R wsmouse0 wsmouse1 wsmouse2 wsmouse3 wskbd0 wskbd1 wskbd2 439 R wskbd3 wsmux ttyJcfg ttyJ0 ttyJ1 ttyJ2 ttyJ3 ttyJ4 ttyJ5 440 R ttyJ6 ttyJ7 ttyJ8 ttyJ9 ttyJa ttyJb ttyIcfg ttyI0 ttyI1 441 R ttyI2 ttyI3 ttyI4 ttyI5 ttyI6 ttyI7 ttyI8 ttyI9 ttyIa ttyIb 442 R ttyHcfg ttyH0 ttyH1 ttyH2 ttyH3 ttyH4 ttyH5 ttyH6 ttyH7 443 R ttyH8 ttyH9 ttyHa ttyHb ttyGcfg ttyG0 ttyG1 ttyG2 ttyG3 444 R ttyG4 ttyG5 ttyG6 ttyG7 ttyG8 ttyG9 ttyGa ttyGb ttyFcfg 445 R ttyF0 ttyF1 ttyF2 ttyF3 ttyF4 ttyF5 ttyF6 ttyF7 ttyF8 ttyF9 446 R ttyFa ttyFb ttyEcfg ttyE0 ttyE1 ttyE2 ttyE3 ttyE4 ttyE5 447 R ttyE6 ttyE7 ttyE8 ttyE9 ttyEa ttyEb ttyDcfg ttyD0 ttyD1 448 R ttyD2 ttyD3 ttyD4 ttyD5 ttyD6 ttyD7 ttyD8 ttyD9 ttyDa ttyDb 449 R ttyCcfg ttyC0 ttyC1 ttyC2 ttyC3 ttyC4 ttyC5 ttyC6 ttyC7 450 R ttyC8 ttyC9 ttyCa ttyCb 451 ;; 452 453tty[C-J]*) 454 U=${i##tty[C-J]} 455 case $i in 456 ttyC*) n=C m=0;; 457 ttyD*) n=D m=256;; 458 ttyE*) n=E m=512;; 459 ttyF*) n=F m=768;; 460 ttyG*) n=G m=1024;; 461 ttyH*) n=H m=1280;; 462 ttyI*) n=I m=1536;; 463 ttyJ*) n=J m=1792;; 464 esac 465 case $U in 466 [0-9a-f]) M tty$n$U c 78 $((16#$U+$m)) 600;; 467 cfg) M tty${n}cfg c 78 $((255+$m)) 600;; 468 *) echo bad unit $U for $i; exit 1;; 469 esac 470 ;; 471 472pty*) 473 if [ $U -gt 15 ]; then 474 echo bad unit for pty in: $i 475 continue 476 fi 477 set -A letters p q r s t u v w x y z P Q R S T 478 set -A suffixes 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 \ 479 r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X \ 480 Y Z 481 482 name=${letters[$U]} 483 n=0 484 while [ $n -lt 62 ] 485 do 486 nam=$name${suffixes[$n]} 487 off=$(($U*62)) 488 M tty$nam c 20 $(($off+$n)) 489 M pty$nam c 21 $(($off+$n)) 490 n=$(($n+1)) 491 done 492 ;; 493 494ptm) 495 M ptm c 123 0 666 496 ;; 497 498ttyV[0-9a-zA-Z]) 499 U=${i#ttyV*} 500 o=$(alph2d $U) 501 M ttyV$U c 127 $o 600 502 ;; 503 504ttyh*) 505 M ttyh$U c 77 $U 660 dialer uucp 506 ;; 507 508tty[a-z]) 509 u=${i#tty*} 510 case $u in 511 a) n=0 ;; 512 b) n=1 ;; 513 c) n=2 ;; 514 d) n=3 ;; 515 *) echo unknown tty device $i ;; 516 esac 517 M tty$u c 12 $n 660 dialer uucp 518 ;; 519 520tty[0-7][0-9a-f]) 521 U=${i#tty*} 522 o=$(h2d $U) 523 M tty$U c 36 $o 660 dialer uucp 524 M cua$U c 36 $(($o+128)) 660 dialer uucp 525 ;; 526 527spif*) 528 case $U in 529 0) offset=0 nam=j;; 530 1) offset=16 nam=k;; 531 2) offset=32 nam=l;; 532 *) echo "bad unit for $i: $U"; exit 127;; 533 esac 534 offset=$(($U*64)) 535 n=0 536 while [ $n -lt 8 ] 537 do 538 name=${nam}`hex $n` 539 M tty$name c 108 $(($offset+$n)) 660 dialer uucp 540 n=$(($n+1)) 541 done 542 M bpp${nam}0 c 109 $(($offset+0)) 600 543 ;; 544 545magma*) 546 case $U in 547 0) offset=0 nam=m;; 548 1) offset=16 nam=n;; 549 2) offset=32 nam=o;; 550 *) echo "bad unit for $i: $U"; exit 127;; 551 esac 552 offset=$(($U*64)) 553 n=0 554 while [ $n -lt 16 ] 555 do 556 name=${nam}`hex $n` 557 M tty$name c 71 $(($offset+$n)) 660 dialer uucp 558 n=$(($n+1)) 559 done 560 M bpp${nam}0 c 72 $(($offset+0)) 600 561 M bpp${nam}1 c 72 $(($offset+1)) 600 562 ;; 563 564cua[a-z]) 565 u=${i#cua*} 566 case $u in 567 a) n=0 ;; 568 b) n=1 ;; 569 c) n=2 ;; 570 d) n=3 ;; 571 *) echo unknown cua device $i ;; 572 esac 573 M cua$u c 12 $(($n+128)) 660 dialer uucp 574 ;; 575 576st*) 577 n=$(($U*16)) 578 for pre in " " n e en 579 do 580 M ${pre}st$U b 11 $n 660 operator 581 M ${pre}rst$U c 18 $n 660 operator 582 n=$(($n+1)) 583 done 584 ;; 585 586ch*) 587 M ch$U c 19 $U 660 operator 588 ;; 589 590vnd*) 591 dodisk vnd $U 8 110 $U 0 592 ;; 593 594rd*) 595 dodisk2 rd $U 5 61 $U 0 596 ;; 597 598fd*) 599 typnam=$U${i#fd[01]*} 600 case $typnam in 601 0|1) typnum=0;; # no type specified, assume A 602 *A) typnum=0; typnam=0;; 603 *B) typnum=1;; 604 *C) typnum=2;; 605 *D) typnum=3;; 606 *E) typnum=4;; 607 *F) typnum=5;; 608 *G) typnum=6;; 609 *H) typnum=7;; 610 *) echo bad type $typnam for $i; exit 1;; 611 esac 612 case $U in 613 0|1) blk=16; chr=54;; 614 *) echo bad unit $U for $i; exit 1;; 615 esac 616 nam=fd${typnam} 617 n=$(($(($U*128))+$(($typnum*16)))) 618 M ${nam}a b $blk $n 640 operator 619 M ${nam}b b $blk $(($n+1)) 640 operator 620 M ${nam}c b $blk $(($n+2)) 640 operator 621 M ${nam}i b $blk $(($n+8)) 640 operator 622 M r${nam}a c $chr $n 640 operator 623 M r${nam}b c $chr $(($n+1)) 640 operator 624 M r${nam}c c $chr $(($n+2)) 640 operator 625 M r${nam}i c $chr $(($n+8)) 640 operator 626 ;; 627 628cd*) 629 dodisk2 cd $U 18 58 $U 0 630 ;; 631 632local) 633 test -s $T.local && sh $T.local 634 ;; 635 636all) 637 R vdsp0 vdsp1 vdsp2 vdsp3 vdsp4 vdsp5 vdsp6 vdsp7 vdsp8 vdsp9 638 R vdsp10 vdsp11 vdsp12 vdsp13 vdsp14 vdsp15 ldom0 ldom1 ldom2 639 R ldom3 ldom4 ldom5 ldom6 ldom7 spds hvctl ttyV0 ttyV1 ttyV2 640 R ttyV3 ttyV4 ttyV5 ttyV6 ttyV7 cuaa cuab cuac cuad ttya ttyb 641 R ttyc ttyd bthub0 bthub1 bthub2 bpp0 vnd0 vnd1 vnd2 vnd3 sd0 642 R sd1 sd2 sd3 sd4 sd5 sd6 sd7 sd8 sd9 cd0 cd1 rd0 tun0 tun1 643 R tun2 tun3 bio bpf0 bpf1 bpf2 bpf3 bpf4 bpf5 bpf6 bpf7 bpf8 644 R bpf9 pty0 fd1 fd1B fd1C fd1D fd1E fd1F fd1G fd1H fd0 fd0B 645 R fd0C fd0D fd0E fd0F fd0G fd0H diskmap vscsi0 ch0 audio0 646 R audio1 audio2 fuse pppx hotplug ptm local wscons pci0 pci1 647 R pci2 pci3 uall rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 648 R rmidi6 rmidi7 video0 video1 uk0 random lpa0 lpa1 lpa2 lpt0 649 R lpt1 lpt2 lkm tty00 tty01 tty02 tty03 ttyh0 ttyh1 crypto pf 650 R systrace wd0 wd1 wd2 wd3 std st0 st1 fd 651 ;; 652 653wd*|sd*) 654 case $i in 655 wd*) dodisk wd $U 12 26 $U 0;; 656 sd*) dodisk sd $U 7 17 $U 0;; 657 esac 658 ;; 659 660*) 661 echo $i: unknown device 662 ;; 663esac 664done 665} 666R "$@" 667{ 668echo -n ${RMlist[*]} 669echo -n ${mklist[*]} 670echo -n ${MKlist[*]} 671echo -n ${whlist[*]} 672echo ${oplist[*]} 673} | if [ "$eo" = "echo" ]; then 674 cat 675else 676 sh 677fi 678