1#!/bin/sh - 2# 3# THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT. 4# generated from: 5# 6# OpenBSD: etc.sparc64/MAKEDEV.md,v 1.88 2019/10/20 16:31:10 kettenis Exp 7# OpenBSD: MAKEDEV.common,v 1.103 2019/06/11 14:48:56 jcs Exp 8# OpenBSD: MAKEDEV.mi,v 1.83 2016/09/11 03:06:31 deraadt 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# usb* Bus control devices used by usbd for attach/detach 75# Special purpose devices: 76# audio* Audio devices 77# bio ioctl tunnel pseudo-device 78# bpf Berkeley Packet Filter 79# diskmap Disk mapper 80# drm* Direct Rendering Manager 81# fd fd/* nodes 82# fuse Userland Filesystem 83# hotplug devices hot plugging 84# openprom PROM settings 85# pci* PCI bus devices 86# pf* Packet Filter 87# pppx* PPP Multiplexer 88# rmidi* Raw MIDI devices 89# *random In-kernel random data source 90# tun* Network tunnel driver 91# tap* Ethernet tunnel driver 92# uk* Unknown SCSI devices 93# uperf Performance counters 94# video* Video V4L2 devices 95# vscsi* Virtual SCSI controller 96# hvctl Hypervisor control channel 97# spds Service processor domain services channel 98# ldom* Logical domain services channels 99# vdsp* Virtual disk server ports 100# switch* Switch driver 101PATH=/sbin:/usr/sbin:/bin:/usr/bin 102T=$0 103 104# set this to echo for Echo-Only debugging 105[ "$eo" ] || eo= 106 107hex() 108{ 109 case $1 in 110 [0-9]) echo -n $1;; 111 10) echo -n a;; 112 11) echo -n b;; 113 12) echo -n c;; 114 13) echo -n d;; 115 14) echo -n e;; 116 15) echo -n f;; 117 esac 118} 119 120alph2d() 121{ 122 local t="$1" 123 local p="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" 124 local sub=${p%${t}*} 125 echo ${#sub} 126} 127 128h2d() 129{ 130 local s="$1" 131 local f=${s%*[0-9a-f]} n=${s#[0-9a-f]*} 132 133 echo $(($(_h2d $f)*16+ $(_h2d $n) )) 134} 135 136_h2d() 137{ 138 case $1 in 139 [0-9]) echo -n $1;; 140 a) echo -n 10;; 141 b) echo -n 11;; 142 c) echo -n 12;; 143 d) echo -n 13;; 144 e) echo -n 14;; 145 f) echo -n 15;; 146 esac 147} 148 149unt() 150{ 151 # XXX pdksh can't seem to deal with locally scoped variables 152 # in ${foo#$bar} expansions 153 arg="$1" 154 tmp="${arg#[a-zA-Z]*}" 155 tmp="${tmp%*[a-zA-Z]}" 156 while [ "$tmp" != "$arg" ] 157 do 158 arg=$tmp 159 tmp="${arg#[a-zA-Z]*}" 160 tmp="${tmp%*[a-zA-Z]}" 161 done 162 echo $arg 163} 164 165dodisk() 166{ 167 [ "$DEBUG" ] && set -x 168 n=$(($((${5}*${7:-16}))+${6})) count=0 169 [ 0$7 -ne 8 ] && l="i j k l m n o p" 170 for d in a b c d e f g h $l 171 do 172 M $1$2$d b $3 $(($n+$count)) 640 operator 173 M r$1$2$d c $4 $(($n+$count)) 640 operator 174 let count=count+1 175 done 176} 177 178dodisk2() 179{ 180 n=$(($(($5*${7:-16}))+$6)) 181 M $1$2a b $3 $n 640 operator 182 M r$1$2a c $4 $n 640 operator 183 n=$(($n+2)) 184 M $1$2c b $3 $n 640 operator 185 M r$1$2c c $4 $n 640 operator 186} 187 188# M name b/c major minor [mode] [group] 189RMlist[0]="rm -f" 190 191mkl() { 192 : ${mklist[0]:=";mknod"} 193 mklist[${#mklist[*]}]=" -m $1 $2 $3 $4 $5" 194} 195 196M() { 197 RMlist[${#RMlist[*]}]=$1 198 mkl ${5-666} $1 $2 $3 $4 199 G=${6:-wheel} 200 [ "$7" ] && { 201 MKlist[${#MKlist[*]}]="&& chown $7:$G $1" 202 } || { 203 case $G in 204 wheel) 205 [ ${#whlist[*]} = 0 ] && whlist[0]="&& chgrp wheel" 206 whlist[${#whlist[*]}]="$1" 207 ;; 208 operator) 209 [ ${#oplist[*]} = 0 ] && oplist[0]="&& chgrp operator" 210 oplist[${#oplist[*]}]="$1" 211 ;; 212 *) 213 MKlist[${#MKlist[*]}]="&& chgrp $G $1"; 214 esac 215 } 216 return 0 217} 218 219R() { 220[ "$DEBUG" ] && set -x 221for i in "$@" 222do 223U=`unt $i` 224[ "$U" ] || U=0 225 226case $i in 227ramdisk) 228 R std fd0 wd0 wd1 wd2 sd0 sd1 sd2 rd0 229 R st0 cd0 bpf bio diskmap random 230 ;; 231 232std) 233 M console c 0 0 600 234 M tty c 2 0 235 M mem c 3 0 640 kmem 236 M kmem c 3 1 640 kmem 237 M null c 3 2 238 M zero c 3 12 239 M stdin c 24 0 240 M stdout c 24 1 241 M stderr c 24 2 242 M ksyms c 76 0 640 kmem 243 M klog c 16 0 600 244 M openprom c 70 0 600 245 M mdesc c 70 1 640 kmem 246 M pri c 70 2 640 kmem 247 ;; 248 249switch*) 250 M switch$U c 136 $U 600 251 ;; 252 253vdsp*) 254 M vdsp$U c 133 $U 600 255 ;; 256 257ldom*) 258 M ldom$U c 132 $(($U+32)) 600 259 ;; 260 261spds) 262 M spds c 132 1 600 263 ;; 264 265hvctl) 266 M hvctl c 132 0 600 267 ;; 268 269vscsi*) 270 M vscsi$U c 128 $U 600 271 ;; 272 273video*) 274 M video$U c 44 $U 600 275 MKlist[${#MKlist[*]}]=";[ -e video ] || ln -s video$U video" 276 ;; 277 278uperf) 279 M uperf c 25 0 664 280 ;; 281 282uk*) 283 M uk$U c 60 $U 640 operator 284 ;; 285 286tap*) 287 M tap$U c 135 $U 600 288 ;; 289 290tun*) 291 M tun$U c 111 $U 600 292 ;; 293 294*random) 295 M urandom c 119 0 644 296 RMlist[${#RMlist[*]}]=random 297 MKlist[${#MKlist[*]}]=";ln -s urandom random" 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 321hotplug) 322 M hotplug c 124 $U 400 323 ;; 324 325fuse) 326 M fuse$U c 134 $U 600 327 ;; 328 329fd) 330 RMlist[${#RMlist[*]}]=";mkdir -p fd;rm -f" n=0 331 while [ $n -lt 64 ];do M fd/$n c 24 $n;n=$(($n+1));done 332 MKlist[${#MKlist[*]}]=";chmod 555 fd" 333 ;; 334 335drm*) 336 M drm$U c 87 $U 600 337 r=$(($U+128)) 338 M drmR$r c 87 $r 600 339 ;; 340 341diskmap) 342 M diskmap c 130 0 640 operator 343 ;; 344 345bpf) 346 M bpf c 105 0 600 347 M bpf0 c 105 0 600 348 ;; 349 350bio) 351 M bio c 120 0 600 352 ;; 353 354audio*) 355 M audio$U c 69 $U 356 M mixer$U c 69 $(($U+16)) 357 M audioctl$U c 69 $(($U+192)) 358 MKlist[${#MKlist[*]}]=";[ -e mixer ] || ln -s mixer$U mixer" 359 ;; 360 361usb*) 362 [ "$i" = "usb" ] && u= || u=$U 363 M usb$u c 90 $U 660 364 ;; 365 366ulpt*) 367 M ulpt$U c 93 $U 660 368 ;; 369 370uhid*) 371 M uhid$U c 91 $U 660 372 ;; 373 374ugen*) 375 n=$(($U*16)) 376 for j in 0{0,1,2,3,4,5,6,7,8,9} 1{0,1,2,3,4,5} 377 do 378 M ugen$U.$j c 92 $(($n+10#$j)) 660 379 done 380 ;; 381 382uall) 383 R ttyU0 ttyU1 ttyU2 ttyU3 ugen0 ugen1 ugen2 ugen3 ugen4 ugen5 384 R ugen6 ugen7 ulpt0 ulpt1 uhid0 uhid1 uhid2 uhid3 uhid4 uhid5 385 R uhid6 uhid7 usb0 usb1 usb2 usb3 usb4 usb5 usb6 usb7 386 ;; 387 388ttyU[0-9a-zA-Z]) 389 U=${i#ttyU*} 390 o=$(alph2d $U) 391 M ttyU$U c 95 $o 660 dialer root 392 M cuaU$U c 95 $(($o+128)) 660 dialer root 393 ;; 394 395lpt*|lpa*) 396 case $i in 397 lpt*) n=lpt f=0;; 398 lpa*) n=lpa f=128;; 399 esac 400 M $n$U c 37 $(($U+$f)) 600 401 ;; 402 403bpp*) 404 M bpp$U c 107 $U 600 405 ;; 406 407wsmouse[0-9]*) 408 M wsmouse$U c 80 $U 600 409 ;; 410 411wsmux|wsmouse|wskbd) 412 M wsmouse c 81 0 600 413 M wskbd c 81 1 600 414 ;; 415 416wskbd[0-9]*) 417 M wskbd$U c 79 $U 600 418 ;; 419 420wscons) 421 R wsmouse0 wsmouse1 wsmouse2 wsmouse3 wsmouse4 wsmouse5 422 R wsmouse6 wsmouse7 wsmouse8 wsmouse9 wskbd0 wskbd1 wskbd2 423 R wskbd3 wsmux ttyJcfg ttyJ0 ttyJ1 ttyJ2 ttyJ3 ttyJ4 ttyJ5 424 R ttyJ6 ttyJ7 ttyJ8 ttyJ9 ttyJa ttyJb ttyIcfg ttyI0 ttyI1 425 R ttyI2 ttyI3 ttyI4 ttyI5 ttyI6 ttyI7 ttyI8 ttyI9 ttyIa ttyIb 426 R ttyHcfg ttyH0 ttyH1 ttyH2 ttyH3 ttyH4 ttyH5 ttyH6 ttyH7 427 R ttyH8 ttyH9 ttyHa ttyHb ttyGcfg ttyG0 ttyG1 ttyG2 ttyG3 428 R ttyG4 ttyG5 ttyG6 ttyG7 ttyG8 ttyG9 ttyGa ttyGb ttyFcfg 429 R ttyF0 ttyF1 ttyF2 ttyF3 ttyF4 ttyF5 ttyF6 ttyF7 ttyF8 ttyF9 430 R ttyFa ttyFb ttyEcfg ttyE0 ttyE1 ttyE2 ttyE3 ttyE4 ttyE5 431 R ttyE6 ttyE7 ttyE8 ttyE9 ttyEa ttyEb ttyDcfg ttyD0 ttyD1 432 R ttyD2 ttyD3 ttyD4 ttyD5 ttyD6 ttyD7 ttyD8 ttyD9 ttyDa ttyDb 433 R ttyCcfg ttyC0 ttyC1 ttyC2 ttyC3 ttyC4 ttyC5 ttyC6 ttyC7 434 R ttyC8 ttyC9 ttyCa ttyCb 435 ;; 436 437tty[C-J]*) 438 U=${i##tty[C-J]} 439 case $i in 440 ttyC*) n=C m=0;; 441 ttyD*) n=D m=256;; 442 ttyE*) n=E m=512;; 443 ttyF*) n=F m=768;; 444 ttyG*) n=G m=1024;; 445 ttyH*) n=H m=1280;; 446 ttyI*) n=I m=1536;; 447 ttyJ*) n=J m=1792;; 448 esac 449 case $U in 450 [0-9a-f]) M tty$n$U c 78 $((16#$U+$m)) 600;; 451 cfg) M tty${n}cfg c 78 $((255+$m)) 600;; 452 *) echo bad unit $U for $i; exit 1;; 453 esac 454 ;; 455 456pty*) 457 if [ $U -gt 15 ]; then 458 echo bad unit for pty in: $i 459 continue 460 fi 461 set -A letters p q r s t u v w x y z P Q R S T 462 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 \ 463 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 \ 464 Y Z 465 466 name=${letters[$U]} 467 n=0 468 while [ $n -lt 62 ] 469 do 470 nam=$name${suffixes[$n]} 471 off=$(($U*62)) 472 M tty$nam c 20 $(($off+$n)) 473 M pty$nam c 21 $(($off+$n)) 474 n=$(($n+1)) 475 done 476 ;; 477 478ptm) 479 M ptm c 123 0 666 480 ;; 481 482ttyV[0-9a-zA-Z]) 483 U=${i#ttyV*} 484 o=$(alph2d $U) 485 M ttyV$U c 127 $o 600 486 ;; 487 488ttyh*) 489 M ttyh$U c 77 $U 660 dialer root 490 ;; 491 492tty[a-z]) 493 u=${i#tty*} 494 case $u in 495 a) n=0 ;; 496 b) n=1 ;; 497 c) n=2 ;; 498 d) n=3 ;; 499 *) echo unknown tty device $i ;; 500 esac 501 M tty$u c 12 $n 660 dialer root 502 ;; 503 504tty[0-7][0-9a-f]) 505 U=${i#tty*} 506 o=$(h2d $U) 507 M tty$U c 36 $o 660 dialer root 508 M cua$U c 36 $(($o+128)) 660 dialer root 509 ;; 510 511spif*) 512 case $U in 513 0) offset=0 nam=j;; 514 1) offset=16 nam=k;; 515 2) offset=32 nam=l;; 516 *) echo "bad unit for $i: $U"; exit 127;; 517 esac 518 offset=$(($U*64)) 519 n=0 520 while [ $n -lt 8 ] 521 do 522 name=${nam}`hex $n` 523 M tty$name c 108 $(($offset+$n)) 660 dialer root 524 n=$(($n+1)) 525 done 526 M bpp${nam}0 c 109 $(($offset+0)) 600 527 ;; 528 529magma*) 530 case $U in 531 0) offset=0 nam=m;; 532 1) offset=16 nam=n;; 533 2) offset=32 nam=o;; 534 *) echo "bad unit for $i: $U"; exit 127;; 535 esac 536 offset=$(($U*64)) 537 n=0 538 while [ $n -lt 16 ] 539 do 540 name=${nam}`hex $n` 541 M tty$name c 71 $(($offset+$n)) 660 dialer root 542 n=$(($n+1)) 543 done 544 M bpp${nam}0 c 72 $(($offset+0)) 600 545 M bpp${nam}1 c 72 $(($offset+1)) 600 546 ;; 547 548cua[a-z]) 549 u=${i#cua*} 550 case $u in 551 a) n=0 ;; 552 b) n=1 ;; 553 c) n=2 ;; 554 d) n=3 ;; 555 *) echo unknown cua device $i ;; 556 esac 557 M cua$u c 12 $(($n+128)) 660 dialer root 558 ;; 559 560st*) 561 n=$(($U*16)) 562 for pre in " " n e en 563 do 564 M ${pre}rst$U c 18 $n 660 operator 565 n=$(($n+1)) 566 done 567 ;; 568 569ch*) 570 M ch$U c 19 $U 660 operator 571 ;; 572 573vnd*) 574 dodisk vnd $U 8 110 $U 0 575 ;; 576 577rd*) 578 dodisk2 rd $U 5 61 $U 0 579 ;; 580 581fd*) 582 typnam=$U${i#fd[01]*} 583 case $typnam in 584 0|1) typnum=0;; # no type specified, assume A 585 *A) typnum=0; typnam=0;; 586 *B) typnum=1;; 587 *C) typnum=2;; 588 *D) typnum=3;; 589 *E) typnum=4;; 590 *F) typnum=5;; 591 *G) typnum=6;; 592 *H) typnum=7;; 593 *) echo bad type $typnam for $i; exit 1;; 594 esac 595 case $U in 596 0|1) blk=16; chr=54;; 597 *) echo bad unit $U for $i; exit 1;; 598 esac 599 nam=fd${typnam} 600 n=$(($(($U*128))+$(($typnum*16)))) 601 M ${nam}a b $blk $n 640 operator 602 M ${nam}b b $blk $(($n+1)) 640 operator 603 M ${nam}c b $blk $(($n+2)) 640 operator 604 M ${nam}i b $blk $(($n+8)) 640 operator 605 M r${nam}a c $chr $n 640 operator 606 M r${nam}b c $chr $(($n+1)) 640 operator 607 M r${nam}c c $chr $(($n+2)) 640 operator 608 M r${nam}i c $chr $(($n+8)) 640 operator 609 ;; 610 611cd*) 612 dodisk2 cd $U 18 58 $U 0 613 ;; 614 615local) 616 test -s $T.local && sh $T.local 617 ;; 618 619all) 620 R vdsp0 vdsp1 vdsp2 vdsp3 vdsp4 vdsp5 vdsp6 vdsp7 vdsp8 vdsp9 621 R vdsp10 vdsp11 vdsp12 vdsp13 vdsp14 vdsp15 ldom0 ldom1 ldom2 622 R ldom3 ldom4 ldom5 ldom6 ldom7 spds hvctl ttyV0 ttyV1 ttyV2 623 R ttyV3 ttyV4 ttyV5 ttyV6 ttyV7 cuaa cuab cuac cuad ttya ttyb 624 R ttyc ttyd switch0 switch1 switch2 switch3 drm0 drm1 drm2 625 R drm3 bpp0 vnd0 vnd1 vnd2 vnd3 sd0 sd1 sd2 sd3 sd4 sd5 sd6 626 R sd7 sd8 sd9 cd0 cd1 rd0 tap0 tap1 tap2 tap3 tun0 tun1 tun2 627 R tun3 bio pty0 fd1 fd1B fd1C fd1D fd1E fd1F fd1G fd1H fd0 628 R fd0B fd0C fd0D fd0E fd0F fd0G fd0H diskmap vscsi0 ch0 audio0 629 R audio1 audio2 bpf fuse pppx hotplug ptm local wscons pci0 630 R pci1 pci2 pci3 uall rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 631 R rmidi5 rmidi6 rmidi7 video0 video1 uk0 random lpa0 lpa1 lpa2 632 R lpt0 lpt1 lpt2 tty00 tty01 tty02 tty03 tty04 tty05 tty06 633 R tty07 tty08 tty09 tty0a tty0b ttyh0 ttyh1 pf wd0 wd1 wd2 wd3 634 R std st0 st1 fd 635 ;; 636 637wd*|sd*) 638 case $i in 639 wd*) dodisk wd $U 12 26 $U 0;; 640 sd*) dodisk sd $U 7 17 $U 0;; 641 esac 642 ;; 643 644*) 645 echo $i: unknown device 646 ;; 647esac 648done 649} 650R "$@" 651{ 652echo -n ${RMlist[*]} 653echo -n ${mklist[*]} 654echo -n ${MKlist[*]} 655echo -n ${whlist[*]} 656echo ${oplist[*]} 657} | if [ "$eo" = "echo" ]; then 658 cat 659else 660 sh 661fi 662