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