# $NetBSD: MAKEDEV.conf,v 1.19.16.1 2024/02/03 14:33:15 martin Exp $

all_md)
	makedev mt0 mt1 ts0 ts1 st0 st1 uk0 ss0 cd0 vt0
	makedev ra0 ra1 ra2 ra3 hp0 hp1 hp2 hp3 sd0 sd1 sd2 sd3 rd0 rd1 rd2
	makedev dz0 dl0 dhu0 racd0 racd1 rx0 rx1
	makedev scsibus0 scsibus1 scsibus2 scsibus3
	makedev ses0 ses1 ses2 ses3
	makedev audio speaker
	makedev usbs
	makedev std_vax
	makedev wscons
	;;

ramdisk)
	makedev std bpf md0 ipty mt0 st0 rd0 rd1 dz0 dl0 dhu0
	makedev rx0 ra0 ra1 ra2 ra3 hp0 hp1
	makedev sd0 sd1 sd2
	makedev cd0 cd1 racd0 racd1
	;;

std_vax)
	mkdev ttyg0		c 25 0
	mkdev ttyg1		c 25 1
	mkdev ttyg2		c 25 2
	mkdev ttyg3		c 25 3
	mkdev floppy		c 8 0
	mkdev crl		c 35 0
	mkdev csa1		c 51 0
	mkdev csa2		c 51 1
	mkdev tu0		b 8 0
	mkdev tu1		b 8 1
	mkdev kUmem		c 3 3
	mkdev leds		c 3 13	666
	;;

ht[0-9]*|tm[0-9]*|mt[0-9]*|ts[0-9]*|ut[0-9]*)
	case $i in
	ht*) name=ht;	unit=${i#ht};	blk=1; chr=5 ;;
	mt*) name=mt;	unit=${i#mt};	blk=15;	chr=38;;
	tm*) name=tm;	unit=${i#tm};	blk=5; chr=14;;
	ts*) name=ts;	unit=${i#ts};	blk=6; chr=16;;
	ut*) name=ut;	unit=${i#ut};	blk=10; chr=17;;
	esac
	case $unit in
	[0-7])
		four=$(($unit + 4)) ; eight=$(($unit + 8))
		twelve=$(($unit + 12)) ; twenty=$(($unit + 20))
		mkdev $name$unit	b $blk $unit	660 $g_operator
		mkdev $name$four	b $blk $four	660 $g_operator
		mkdev $name$eight	b $blk $eight	660 $g_operator
		mkdev $name$twelve	b $blk $twelve	660 $g_operator
			# next 4 are for sanity with pdp11 v7
		mkdev n$name$unit	b $blk $four	660 $g_operator
		mkdev n$name$eight	b $blk $twelve	660 $g_operator
		mkdev nr$name$unit	c $chr $four	660 $g_operator
		mkdev nr$name$eight	c $chr $twelve	660 $g_operator
		mkdev r$name$unit	c $chr $unit	660 $g_operator
		mkdev r$name$four	c $chr $four	660 $g_operator
		mkdev r$name$eight	c $chr $eight	660 $g_operator
		mkdev r$name$twelve	c $chr $twelve	660 $g_operator
		if [ $i = ut ]; then
			mkdev $name$twenty	b $blk $twenty	660 $g_operator
			mkdev r$name$twenty	c $chr $twenty	660 $g_operator
		fi
		;;
	*)
		warn "bad unit for tape in: $1"
		;;
	esac
	;;

hp[0-9]*|hk[0-9]*|up[0-9]*|ra[0-9]*|racd[0-9]*|rl[0-9]*|rb[0-9]*|rd[0-9]*|rx[0-9]*)
	case $i in
	hp*) name=hp;	unit=${i#hp};	blk=0; chr=4;;
	hk*) name=hk;	unit=${i#hk};	blk=3; chr=11;;
	up*) name=up;	unit=${i#up};	blk=2; chr=13;;
	racd*) name=racd; unit=${i#racd}; blk=28; chr=28;; # before ra*
	ra*) name=ra;	unit=${i#ra};	blk=9;	chr=9;;
	rb*) name=rb;	unit=${i#rb};	blk=11; chr=23;;
	rx*) name=rx;	unit=${i#rx};	blk=12; chr=30;;
	rl*) name=rl;	unit=${i#rl};	blk=14; chr=32;;
	rd*) name=rd;	unit=${i#rd};	blk=19; chr=58;;
	esac
	%MKDISK% $name $unit $blk $chr
	;;

uu[0-9]*)
	unit=${i#uu}
	name=uu; blk=13
	case $unit in
	[0-3])
		mkdev ${name}${unit}	b $blk $(($unit * 2 + 0))
		mkdev ${name}${unit}a	b $blk $(($unit * 2 + 1))
		;;
	*)
		warn "bad unit for uu in: $i"
		;;
	esac
	;;

dz[0-9]*)
	unit=${i#dz}
	case $unit in
	[0-7])
		i=0
		while [ $i -lt 8 ]
		do
			oi=$(($unit * 8 + $i))
			zoi=00$oi
			zoi=${zoi#${zoi%??}}
			mkdev tty$zoi c 1 $oi
			i=$(($i + 1))
		done
		;;
	*)
		warn "bad unit for dz in: $i"
		;;
	esac
	;;

dhu[0-9]*|dh[0-9]*|dmf[0-9]*|dmz[0-9]*|vt[0-9]*)
	case $i in
	vt*)	name=vt; major=68; count=8
		unit=${i#vt}
		case $unit in
		0) ch=w ;;
		*) warn "bad unit for $name in: $i" ;;
		esac
		;;
	dmz*)	name=dmz; major=37; count=24
		unit=${i#dmz}
		case $unit in
		0) ch=a ;;
		1) ch=b ;;
		2) ch=c ;;
		3) ch=e ;;
		4) ch=f ;;
		*) warn "bad unit for $name in: $i" ;;
		esac
		;;
	dmf*)	name=dmf; major=22; count=8
		unit=${i#dmf}
		case $unit in
		0) ch=A ;;
		1) ch=B ;;
		2) ch=C ;;
		3) ch=E ;;
		4) ch=F ;;
		5) ch=G ;;
		6) ch=H ;;
		7) ch=I ;;
		*) warn "bad unit for $name in: $i" ;;
		esac
		;;
	dhu*)	name=dhu; major=34; count=16
		unit=${i#dhu}
		case $unit in
		0) ch=S ;;
		1) ch=T ;;
		2) ch=U ;;
		3) ch=V ;;
		4) ch=W ;;
		5) ch=X ;;
		6) ch=Y ;;
		7) ch=Z ;;
		*) warn "bad unit for $name in: $i" ;;
		esac
		;;
	dh*)	name=dh; major=12; count=16
		unit=${i#dh}
		case $unit in
		0) ch=h ;;
		1) ch=i ;;
		2) ch=j ;;
		3) ch=k ;;
		4) ch=l ;;
		5) ch=m ;;
		6) ch=n ;;
		7) ch=o ;;
		*) warn "bad unit for $name in: $i" ;;
		esac
		;;
	esac
	i=0
	while [ $i -lt $count ]
	do
		mkdev tty$ch$(hexprint $i) c $major $(($unit * $count + $i))
		i=$(($i + 1))
	done

	;;

dl[0-9]*)
	unit=${i#dl}
	mkdev ttyJ$(hexprint $unit) c 66 $unit
	;;

lp[0-9]*|va[0-9]*|vp[0-9]*)
	case $i in
	lp*) name=lp; unit=${i#lp}; major=15;;
	va*) name=va; unit=${i#va}; major=10;;
	vp*) name=vp; unit=${i#vp}; major=6;;
	esac
	case $unit in
	[0-7])
		mkdev $i c $major $unit 666
		;;
	*)
		warn "bad unit for $name in: $i"
		;;
	esac
	;;

np[0-9]*)
	class=${i#np}
	case $class in
	0) offset=0 name=0;;
	1) offset=16 name=1;;
	2) offset=32 name=2;;
	*) warn "bad unit for np in: $i" ;;
	esac
	case $class in
	0|1|2)
	i=0
	while [ $i -lt 4 ]
	do
		oi=$(($offset + $i))
		zoi=$(zeropad 2 $oi)
		mkdev np$zoi c 39 $oi
		i=$(($i + 1))
	done
	esac
	;;

dn[0-9]*|ik[0-9]*|ps[0-9]*|ad[0-9]*|ct[0-9]*)
	case $i in
	ct*) name=ct; unit=${i#ct}; chr=18;;
	dn*) name=cu; unit=${i#dn}; chr=24;;
	ps*) name=ps; unit=${i#ps}; chr=27;;
	ad*) name=ad; unit=${i#ad}; chr=29;;
	ik*) name=ik; unit=${i#ik}; chr=31;;
	esac
	case $unit in
	[0-7])
		mkdev ${name}${unit} c ${chr} ${unit} 666
		;;
	*)
		warn "bad unit for $name in: $i"
		;;
	esac
	;;

qd[0-9]*)
	unit=${i#qd}
	mkdev qc$unit c 40 $(($unit * 4))
	mkdev qd$unit c 40 $(($unit * 4 + 2))
	;;

qv0)
	mkdev qv0 c 40 0
	mkdev qvcons c 40 1
	mkdev mouse c 40 2
	;;
