Annotation of src/etc/MAKEDEV.mi, Revision 1.13
1.1 todd 1: include(MAKEDEV.sub)dnl
2: dnl
1.13 ! todd 3: vers(a,{-$OpenBSD: MAKEDEV.mi,v 1.12 2002/01/08 01:33:19 todd Exp $-})dnl
1.1 todd 4: dnl
5: divert(1)dnl
6: {-#-}
7: {-#-} Copyright (c) 2001 Todd T. Fries <todd@OpenBSD.org>
8: {-#-} All rights reserved.
9: {-#-}
10: {-#-} Redistribution and use in source and binary forms, with or without
11: {-#-} modification, are permitted provided that the following conditions
12: {-#-} are met:
13: {-#-} 1. Redistributions of source code must retain the above copyright
14: {-#-} notice, this list of conditions and the following disclaimer.
15: {-#-} 2. The name of the author may not be used to endorse or promote products
16: {-#-} derived from this software without specific prior written permission.
17: {-#-}
18: {-#-} THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19: {-#-} INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20: {-#-} AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21: {-#-} THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22: {-#-} EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23: {-#-} PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
24: {-#-} OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
25: {-#-} WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
26: {-#-} OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
27: {-#-} ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28: {-#-}
29: dnl
30: dnl Diversions: (upon termination, concatenated output queues)
31: dnl
32: dnl 0 - very top
33: dnl 1 - descriptions of devices
34: dnl 2 - init of script, function definitions, etc
35: dnl 3 - beginning of global recursive R() function
36: dnl 7 - body of MAKEDEV, device creations, etc
37: dnl 9 - end
38: dnl
39: dnl HOW TO ADD A DEVICE:
40: dnl
41: dnl In this file, you must use at least two macros:
42: dnl
43: dnl Use '__devitem(uniqueid,name-pattern,description)' to create an entry
44: dnl in the description at the top of the generated MAKEDEV file:
45: dnl
46: dnl __devitem(sca,sca*,Sugar Generic device)dnl
47: dnl
48: dnl This is ultimately shown as:
49: dnl
50: dnl # sca* Sugar Generic device
51: dnl
52: dnl Use '_mkdev(uniqueid,shell-pattern,{-shell-script-})dnl' to create
53: dnl a shell script fragment used to 'create' the device (be sure to match
54: dnl the uniqueid from above):
55: dnl
56: dnl _mkdev(sca,sca*,{-M sca$U c major_sca_c $U
57: dnl M rsca$U b major_sca_b Add($U,128)-})dnl
58: dnl
59: dnl This is ultimately expanded into:
60: dnl
61: dnl sca*) M sca$U c 24 $U
62: dnl M sca$U b 42 $(($U+128));;
63: dnl
64: dnl In the MAKEDEV.md file, add a '_DEV(uniqueid,charmajor,blockmajor)'
65: dnl entry:
66: dnl
67: dnl _DEV(sca,24,42)
68: dnl
69: dnl Final step is to add an entry to the 'all' entry below. For a short
70: dnl example:
71: dnl
1.4 todd 72: dnl _mkdev({-all-},{-all-},{-dnl
1.1 todd 73: dnl _dl({-std-},{-std-},{-sca-},{-sca0 sca1 sca2 sca3-})-})dnl
74: dnl
75: dnl would expand to:
76: dnl
77: dnl all)
78: dnl R std sca0 sca1 sca2 sca3
79: dnl ;;
80: dnl
81: dnl presuming '_DEV(sca..' and '_DEV(std)' were in the MAKEDEV.md file.
82: dnl
83: dnl
84: dnl Everything is 'automatically' added to 'MAKEDEV' based on whether or
85: dnl not the '_DEV()' entry has a corresponding _mkdev() and __devitem()
86: dnl entry in MAKEDEV.sub (this file).
87: dnl
88: dnl Note: be very wary of adding whitespace, carriage returns, or not
89: dnl finishing a macro with ')dnl' .. otherwise, extra blank lines show up
90: dnl in the output.
91: dnl
92: _mkdev(loc,local,{-test -s $T.local && sh $T.local-})dnl
93: dnl
94: __devtitle(make,Device "make" file. Valid arguments)dnl
1.4 todd 95: __devitem({-all-},{-all-},
96: {-makes all known devices{-,-} including local devices.
1.1 todd 97: {-#-} Tries to make the ``standard'' number of each type.-})dnl
98: dnl
99: dnl 'all' is special. The 'D'evice 'L'ist (or _dl) macro checks to see if
100: dnl a particular devices is in the MAKEDEV.md file, and if so, includes the
101: dnl necessary devices. Otherwise the devices are not included in the 'all'
102: dnl target. Note this keeps line lengths to less than column 70. For the
103: dnl gory details see the definition of '_dl' in MAKEDEV.sub
104: dnl
105: _mkdev(all,{-all-},{-dnl
106: _dl({-std-},{-std-},
107: {-fdesc-},{-fd-},
108: {-sd-},{-sd0 sd1 sd2 sd3 sd4-},
1.12 todd 109: {-attyB-},{-sd5 sd6 sd7 sd8 sd9-},
1.1 todd 110: {-pty-},{-pty0 pty1-},
111: {-st-},{-st0 st1-},
112: {-ch-},{-ch0-},
113: {-cd-},{-cd0 cd1-},
114: {-mcd-},{-mcd0-},
115: {-vnd-},{-vnd0 vnd1 vnd2 vnd3-},
116: {-ccd-},{-ccd0 ccd1 ccd2 ccd3-},
117: {-wd-},{-wd0 wd1 wd2 wd3-},
118: {-raid-},{-raid0 raid1 raid2 raid3-},
1.4 todd 119: {-ofdisk-},{-ofdisk0 ofdisk1 ofdisk2 ofdisk3 ofdisk4-},
1.10 todd 120: {-xy-},{-xy0 xy1 xy2 xy3-},
121: {-xd-},{-xd0 xd1 xd2 xd3-},
1.4 todd 122: {-hd-},{-hd0 hd1 hd2 hd3 hd4-},
123: {-rz-},{-rz0 rz1 rz2 rz3 rz4-},
124: {-rd-},{-rd0-},
125: {-flo-},{-fd0 fd0B fd0C fd0D fd0E fd0F fd0G fd0H-},
126: {-flo-},{-fd1 fd1B fd1C fd1D fd1E fd1F fd1G fd1H-},
1.9 todd 127: {-aflo-},{-fd0 fd1 fd2 fd3-},
1.1 todd 128: {-bpf-},{-bpf0 bpf1 bpf2 bpf3 bpf4 bpf5 bpf6 bpf7 bpf8 bpf9-},
129: {-tun-},{-tun0 tun1 tun2 tun3-},
1.8 todd 130: {-pctr-},{-pctr-},
131: {-bktr-},{-bktr0-},
1.1 todd 132: {-altq-},{-altq-},
133: {-pf-},{-pf-},
134: {-cry-},{-crypto-},
1.4 todd 135: {-apm-},{-apm-},
136: {-tth-},{-ttyh0 ttyh1-},
1.12 todd 137: {-ttyA-},{-ttyA0 ttyA1-},
1.9 todd 138: {-ttyB-},{-ttyB0 ttyB1 ttyB2 ttyB3 ttyB4 ttyB5-},
139: {-attyB-},{-ttyB0 ttyB1 ttyB2 ttyB3 ttyB4-},
1.1 todd 140: {-tty0-},{-tty00 tty01 tty02 tty03-},
1.13 ! todd 141: {-mac_tty0-},{-tty00 tty01-},
1.1 todd 142: {-tzs-},{-ttya ttyb ttyc ttyd-},
1.7 todd 143: {-czs-},{-cuaa cuab cuac cuad-},
1.13 ! todd 144: {-ttyc-},{-ttyc0 ttyc1 ttyc2 ttyc3 ttyc4 ttyc5 ttyc6 ttyc7-},
! 145: {-com-},{-tty00 tty01 tty02 tty03-},
! 146: {-mac_ttye-},{-ttye0-},
! 147: {-ttye-},{-ttye0 ttye1 ttye2 ttye3 ttye4 ttye5 ttye6-},
1.1 todd 148: {-lkm-},{-lkm-},
149: {-mmcl-},{-mmclock-},dnl
1.8 todd 150: {-lpt-},{-lpa0 lpt0 lpa1 lpt1 lpa2 lpt2-},
151: {-joy-},{-joy0 joy1-},
1.1 todd 152: {-rnd-},{-random-},
153: {-ses-},{-ses0-},
154: {-uk-},{-uk0 uk1-},
155: {-ss-},{-ss0 ss1-},
1.8 todd 156: {-wt-},{-wt0-},
157: {-wdt-},{-wdt0-},
1.1 todd 158: {-xfs-},{-xfs0-},
159: {-au-},{-audio0-},
1.13 ! todd 160: {-asc-},{-asc0-},
1.8 todd 161: {-music-},{-music0-},
162: {-radio-},{-radio0-},
163: {-tuner-},{-tuner0-},
164: {-rmidi-},{-rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7-},
1.1 todd 165: {-usbs-},{-usbs-},
1.13 ! todd 166: {-adb-},{-adb-},
! 167: {-iop-},{-iop0 iop1-},
1.9 todd 168: {-pci-},{-pci-},
1.1 todd 169: {-wsmouse-},{-wscons-},
1.10 todd 170: {-btw-},{-bwtwo0-},
1.11 todd 171: {-ctw-},{-cgtwo0-},
1.10 todd 172: {-cfr-},{-cgfour0-},
1.13 ! todd 173: {-mac_grf-},{-grf0 grf1 grf2 grf3-},
1.9 todd 174: {-grf-},{-grf0 grf1 grf2 grf3 grf4 grf5 grf6-},
175: {-par-},{-par0-},
176: {-amouse-},{-mouse0 mouse1-},
177: {-akbd-},{-kbd-},
178: {-ppi-},{-ppi0-},
1.12 todd 179: {-view-},{-view00 view01 view02 view03 view04 view05-},
1.1 todd 180: {-local-},{-local-})-})dnl
181: __devitem(floppy,floppy,devices to be put on install floppies)dnl
182: __devitem(std,{-std-},standard devices)dnl
183: dnl
184: dnl _std
185: dnl
186: dnl $1: tty
187: dnl $2: memstuff
188: dnl $3: ksyms
189: dnl $4: drum
190: dnl $5: klog
191: dnl
192: define({-_std-},{-dnl
193: std)
194: M console c 0 0 600
195: M tty c $1 0
196: M mem c $2 0 640 kmem
197: M kmem c $2 1 640 kmem
198: M null c $2 2
199: M zero c $2 12
200: M stdin c major_fdesc_c 0
201: M stdout c major_fdesc_c 1
202: M stderr c major_fdesc_c 2
203: M ksyms c $3 0 640 kmem
204: M drum c $4 0 640 kmem
205: M klog c $5 0 600-})dnl
206: dnl
207: __devitem({-usbs-},usbs,make USB devices)dnl
208: _mkdev(usbs,usbs,{-dnl
209: _dl({-usb-},{-usb0 usb1-},
210: {-urio-},{-urio-},
1.2 todd 211: {-uscan-},{-uscanner0-},
1.1 todd 212: {-uhid-},{-uhid0 uhid1 uhid2 uhid3-},
213: {-ulpt-},{-ulpt0 ulpt1-},
214: {-ugen-},{-ugen0 ugen1-},
215: {-utty-},{-utty0 utty1-})-})dnl
216: __devtitle(tap,Tapes)dnl
217: __devitem(wt,{-wt* -},QIC-interface (e.g. not SCSI) 3M cartridge tape)dnl
218: _mkdev(wt,wt*,
219: {-name=wt
220: n=Mult($U,8) m=Add($n,4)
221: M $name$U b major_wt_b $n 640 operator
222: M r$name$U c major_wt_c $n 640 operator
223: M n$name$U b major_wt_b $m 640 operator
224: M nr$name$U c major_wt_c $m 640 operator-})dnl
225: __devitem(tz,tz*,{-SCSI tapes{-,-} DEC TK50 cartridge tape-})dnl
226: __devitem(st,{-st*-},SCSI tapes)dnl
227: _mkdev(st,st*,{-n=Mult($U,16)
228: for pre in " " n e en
229: do
230: M ${pre}st$U b major_st_b $n 660 operator
231: M ${pre}rst$U c major_st_c $n 660 operator
232: n=Add($n,1)
233: done-})dnl
234: _mkdev(st_hp300,ct*|mt*|st*,
235: {-case $i in
236: ct*) name=ct blk=major_ct_b chr=major_ct_c;;
237: mt*) name=mt blk=major_mt_b chr=major_mt_c;;
238: st*) name=st blk=major_st_hp300_b chr=major_st_hp300_c;;
239: esac
240: case $U in
241: [0-7])
242: four=Add($U,4) eight=Add($U,8)
243: twelve=Add($U,12) twenty=Add($U,20)
244: M r$name$U c $chr $U 660 operator
245: M r$name$four c $chr $four 660 operator
246: M r$name$eight c $chr $eight 660 operator
247: M r$name$twelve c $chr $twelve 660 operator
248: MKlist="$MKlist;ln r$name$four nr$name$U";: sanity w/pdp11 v7
249: MKlist="$MKlist;ln r$name$twelve nr$name$eight";: ditto
250: RMlist="$RMlist nr$name$U nr$name$eight"
251: ;;
252: *)
253: echo bad unit for tape in: $1
254: ;;
255: esac-})dnl
256: __devitem(st_hp300,st*,Exabyte tape)dnl
257: __devitem(ct,ct*,HP300 HP-IB cartridge tape)dnl
258: __devitem(mt,mt*,(Magnetic) 9-track reel tape)dnl
259: __devtitle(dis,Disks)dnl
260: __devitem(rz,rz*,SCSI disks)dnl
261: __devitem(sd,{-sd*-},SCSI disks{-,-} includes flopticals)dnl
262: __devitem(ofdisk,ofdisk*,OpenFirmware disks)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
1.6 todd 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
1.1 todd 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 $U 440 operator
276: RMlist="$RMlist scan$U"
277: MKlist="$MKlist;umask 77;ln -s ss$U scan$U"-})dnl
278: __devitem(ses,ses*,SES/SAF-TE SCSI devices)dnl
279: _mkdev(ses,ses*,{-M ses$U c major_ses_c $U 640 operator-})dnl
280: __devitem(ramd,ramdisk,makes all devices for a ramdisk kernel)dnl arc
281: __devitem(rd,{-rd*-},"ramdisk" pseudo-disks)dnl
1.6 todd 282: _mkdev(rd,rd*,{-dodisk2 rd $U major_rd_b major_rd_c $U 0{--}ifstep(rd)-})dnl
1.1 todd 283: __devitem(xd,xd*,Xylogic 753/7053 disks)dnl
284: __devitem(xy,xy*,{- Xylogic 450/451 disks-})dnl
285: __devitem(flo,{-fd*-},{-Floppy disk drives (3 1/2"{-,-} 5 1/4")-})dnl
286: _mkdev(flo,fd*,
287: {-typnam=$U${i#fd[01]*}
288: case $typnam in
289: 0|1) typnum=0;; # no type specified, assume A
290: *A) typnam=0; typnum=0;;
291: *B) typnum=1;;
292: *C) typnum=2;;
293: *D) typnum=3;;
294: *E) typnum=4;;
295: *F) typnum=5;;
296: *G) typnum=6;;
297: *H) typnum=7;;
298: *) echo bad type $typnam for $i; exit 1;;
299: esac
300: case $U in
301: 0|1) blk=major_flo_b; chr=major_flo_c;;
302: *) echo bad unit $U for $i; exit 1;;
303: esac
304: nam=fd${typnam}
305: n=Add(Mult($U,128),Mult($typnum,16))
306: M ${nam}a b $blk $n 640 operator
307: M ${nam}b b $blk Add($n,1) 640 operator
308: M ${nam}c b $blk Add($n,2) 640 operator
309: M r${nam}a c $chr $n 640 operator
310: M r${nam}b c $chr Add($n,1) 640 operator
311: M r${nam}c c $chr Add($n,2) 640 operator-},664)dnl
312: __devitem(aflo,floppy,devices needed for install floppies)dnl
313: _mkdev(aflo,fd*,{-case $U in 0|1|2|3)
314: M fd${U}a b major_aflo_b Mult($U,16) 640 operator
315: M fd${U}b b major_aflo_b Add(Mult($U,16),1) 640 operator
316: M rfd${U}a c major_aflo_c Mult($U,16) 640 operator
317: M rfd${U}b c major_aflo_c Add(Mult($U,16),1) 640 operator;;
318: *) echo bad unit for floppy disk in: $i;;
319: esac-})dnl
320: __devitem(iop,iop*,I2O controller device)dnl
321: _mcdev(iop,iop*,iop,{-major_iop_c-},660)dnl
322: __devitem(wdt,wdt0,watchdog timer)dnl
323: _mcdev(wdt,wdt0,wdt,{-major_wdt_c-},440,operator)dnl
324: __devitem(local,local,configuration specific devices)dnl
325: __devitem(wd,{-wd*-},{-"winchester" disk drives (ST506,IDE,ESDI,RLL,...)-})dnl
326: __devitem(ccd,ccd*,concatenated disk devices)dnl
327: __devitem(raid,raid*,RAIDframe disk devices)dnl
328: __devitem(vnd,vnd*,"file" pseudo-disks)dnl
1.6 todd 329: _mkdev(vnd,vnd*,{-dodisk vnd $U major_vnd_b major_vnd_c $U 0{--}ifstep(vnd)
330: dodisk svnd $U major_vnd_b major_vnd_c $U 128{--}ifstep(vnd)-})dnl
1.1 todd 331: dnl
332: dnl For normal disk devices, add a disk_q entry; anything else define like
333: dnl the rest (such as vnd above).
334: dnl
335: disk_q({-xy-})dnl
336: disk_q({-xd-})dnl
337: disk_q({-hd-})dnl
338: disk_q({-ofdisk-})dnl
339: disk_q({-rz-})dnl
340: disk_q({-wd-})dnl
341: disk_q({-raid-})dnl
342: disk_q({-ccd-})dnl
343: disk_q({-sd-})dnl
344: dnl
345: __devitem(loc,local,configuration specific devices)dnl
346: _mkdev(loc,local,{-test -s $T.local && sh $T.local-})dnl
347: _mkdev({-disks-},{-undefine({-C_ase-})show_disks()undefine({-C_ase-})-},
348: {-case $i in
349: show_disks2()dnl
1.6 todd 350: esac-})dnl
1.1 todd 351: __mkdev({-disks-}){--}dnl
352: dnl
353: __devtitle(cons,Console ports)dnl
354: __devitem(ttyv0,ttyv0,pccons or pcvt screen 0)dnl
355: __devitem(ttyv,ttyv*,pcvt)dnl
356: __devitem(ttye,ttye*,ite bitmapped consoles)dnl
1.13 ! todd 357: __devitem(mac_ttye,ttye*,ite bitmapped consoles)dnl
1.1 todd 358: __devitem(wscons,ttyC0,wscons screen 0)dnl
359: _mkdev({-wscons-},{-wscons-},{-dnl
360: _dl(dnl
361: {-wscons-},{-ttyCcfg-},
1.3 todd 362: {-wsdisp-},{-ttyC0 ttyC1 ttyC2 ttyC3 ttyC4 ttyC5 ttyC6 ttyC7 ttyC8 ttyC9-},
363: {-wsdisp-},{-ttyCa ttyCb-},
1.1 todd 364: {-wsmux-},{-wsmux-},
365: {-wskbd-},{-wskbd0 wskbd1 wskbd2 wskbd3-},
366: {-wsmouse-},{-wsmouse0 wsmouse1 wsmouse2 wsmouse3-})-})dnl
1.3 todd 367: __devitem(wsdisp,ttyC*,wscons virtual consoles)dnl
368: _mkdev({-wsdisp-},ttyC*,{-U=${i##ttyC}
369: case $U in
1.8 todd 370: [0-9a-f]) M ttyC$U c major_wsdisp_c {-$(( 16#$U ))-} 600;;
371: cfg) M ttyCcfg c major_wsdisp_c 255 600;;
1.3 todd 372: *) echo bad unit $U for $i; exit 1;;
1.6 todd 373: esac-})dnl
1.1 todd 374: __devitem(wskbd,wskbd*,wscons keyboards)dnl
375: _mkdev(wskbd,wskbd*,{-M wskbd$U c major_wskbd_c $U 600-})dnl
376: __devitem(wsmux,wsmux,wscons keyboard/mouse mux devices)dnl
377: _mkdev(wsmux,wsmux|wsmouse|wskbd,{-M wsmouse c major_wsmux_c 0 600
378: M wskbd c major_wsmux_c 1 600-})dnl
379: __devitem(pcons,console,PROM console)dnl
380: __devtitle(point,Pointing devices)dnl
381: __devitem(wsmouse,wsmouse*,wscons mice)dnl
382: _mkdev(wsmouse,wsmouse*,{-M wsmouse$U c major_wsmouse_c $U 600-})dnl
383: __devitem(quad,quadmouse,"quadrature mouse")dnl
384: __devtitle(pty,Pseudo terminals)dnl
385: __devitem(tty,tty*,set of 16 slave psuedo terminals)dnl
386: __devitem(pty,pty*,set of 16 master pseudo terminals)dnl
387: _mkdev(pty,pty*,{-case $U in
388: 0) off=0 name=p;;
389: 1) off=16 name=q;;
390: 2) off=32 name=r;;
391: 3) off=48 name=s;;
392: # Note that telnetd, rlogind, and xterm (at least) only look at p-s.
393: 4) off=64 name=t;;
394: 5) off=80 name=u;;
395: 6) off=96 name=v;;
396: 7) off=112 name=w;;
397: 8) off=128 name=x;;
398: 9) off=144 name=y;;
399: 10) off=160 name=z;;
400: 11) off=176 name=P;;
401: 12) off=192 name=Q;;
402: 13) off=206 name=R;;
403: 14) off=224 name=S;;
404: 15) off=240 name=T;;
405: *) echo bad unit for pty in: $i; continue;;
406: esac
407: n=0
408: while [ $n -lt 16 ]
409: do
410: nam=$name$(hex $n)
411: M tty$nam c major_tty_c Add($off,$n)
412: M pty$nam c major_pty_c Add($off,$n)
413: n=Add($n,1)
414: done-})dnl
415: __devitem(dc,dc*,{-4 channel serial interface (keyboard{-,-} mouse{-,-}modem{-,-} printer)-})dnl
416: __devtitle(prn,Printers)dnl
417: __devitem(par,par*,motherboard parallel port)dnl
418: __devitem(lpt,lpt*,IEEE 1284 centronics printer)dnl
419: _mkdev(lpt,lpt*|lpa*,
420: {-case $i in
421: lpt*) n=lpt f=0;;
422: lpa*) n=lpa f=128;;
423: esac
424: M $n$U c major_lpt_c Add($U,$f) 600-})dnl
425: __devitem(lpa,lpa*,interruptless lp)dnl
426: __devitem(ppi,ppi*,HP-IB plotters)dnl
427: __devtitle({-usb-},USB devices)dnl
428: __devitem({-usb-},usb*,Bus control devices used by usbd for attach/detach)dnl
429: _mkdev({-usb-},usb*,{-[ "$i" = "usb" ] && u= || u=$U
430: M usb$u c major_usb_c $U 660-})dnl
431: __devitem(uhid,uhid*,Generic HID devices)dnl
432: _mcdev({-uhid-},uhid*,{-uhid-},{-major_uhid_c-},660)dnl
433: __devitem(ulpt,ulpt*,Printer devices)dnl
434: _mcdev({-ulpt-},ulpt*,{-ulpt-},{-major_ulpt_c-},660)dnl
435: __devitem(utty,utty*,Serial ports)dnl
436: _mcdev({-utty-},utty*,{-utty-},{-major_utty_c-},660)dnl
437: __devitem(urio,urio*,Diamond Multimedia Rio 500)dnl
438: _mcdev({-urio-},urio*,{-urio-},{-major_urio_c-},660)dnl
1.2 todd 439: __devitem(uscan,uscanner*,Scanners)dnl
440: _mcdev({-uscan-},uscanner*,{-uscanner-},{-major_uscan_c-},660)dnl
1.1 todd 441: __devitem(ugen,ugen*,Generic device)dnl
442: _mkdev(ugen,ugen*,{-n=Mult($U,16)
443: for j in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
444: do
445: M ugen$U.$j c major_ugen_c Add($n,$j) 660
446: done-})dnl
447: __devtitle(cpu,Cpus)dnl
448: __devitem(cpu,cpu*,cpus)dnl
449: __devtitle(call,Call units)dnl
450: __devtitle(term,Terminal ports)dnl
451: __devtitle(termp,Terminal multiplexers)dnl
452: __devitem(dca,dca*,HP200/300 single port serial interface)dnl
453: __devitem(dcm,dcm*,HP200/300 4 port serial mux interface)dnl
454: __devitem(apci,apci*,HP400 4 port serial mux interface)dnl
455: __devitem({-com-},{-tty0*-},NS16x50 serial ports)dnl
456: _mkdev(com,{-tty0*-},{-M tty$U c major_com_c $U 660 dialer uucp
457: M cua$U c major_com_c Add($U,128) 660 dialer uucp-})dnl
458: __devitem(ttyc,ttyc*,Cyclades serial ports)dnl
459: __devitem(tzs,tty[a-z]*,Zilog 8530 Serial Port)dnl
460: _mkdev(tzs,{-tty[a-z]-},{-u=${i#tty*}
461: case $u in
462: a) n=0 ;;
463: b) n=1 ;;
464: c) n=4 ;;
465: d) n=5 ;;
466: *) echo unknown tty device $i ;;
467: esac
468: M tty$u c major_tzs_c $n 660 dialer uucp-})dnl
469: __devitem(tth,ttyh*,Sab82532 serial devices)dnl
470: _mkdev(tth,ttyh*,{-M ttyh$U c major_tth_c $U 660 dialer uucp-})dnl
471: __devitem(czs,cua[a-z]*,Zilog 8530 Serial Port)dnl
472: _mkdev(czs,cua[a-z],{-u=${i#cua*}
473: case $u in
474: a) n=0 ;;
475: b) n=1 ;;
476: c) n=4 ;;
477: d) n=5 ;;
478: *) echo unknown cua device $i ;;
479: esac
480: M cua$u c major_czs_c Add($n,128) 660 dialer uucp-})dnl
481: __devitem(arm_tty,tty*,{-alias for PC COM ports{-,-} this is what the system really wants-})dnl
482: __devitem(tty0,tty00,standard serial port)dnl
1.13 ! todd 483: __devitem(mac_tty0,tty00,standard serial port)dnl
1.1 todd 484: __devitem(ttyA,ttyA*,mfc serial ports)dnl
485: __devitem(attyB,ttyB*,ISA COM ports)dnl amiga
486: __devitem(ttyz,tty[a-d],onboard zs serial ports)dnl
487: __devitem(cuaz,cua[a-d],onboard zs serial ports)dnl
488: __devitem(ttyB,ttyB?,DEC 3000 ZS8530 ("scc") serial ports)dnl
489: __devitem(scc,scc*,82530 serial interface)dnl
490: __devitem(arc_ttyC,ttyC0,pccons)dnl
491: __devitem(i386_ttyC,ttyC*,pcvt)dnl
492: __devitem(ttyC,ttyC?,{-AlphaStation NS16550 ("com serial ports")-})dnl
493: __devitem(ttyE,ttyE?,Workstation console (framebuffer & keyboard) tty emulators)dnl
494: __devitem(ser02,ser02,{-serial2 port (channel A on 8530)-})dnl
495: __devitem(mdm02,mdm02,{-modem2 port (channel B on 8530)-})dnl
496: __devtitle(spec,Special purpose devices)dnl
497: __devitem(apm,apm ,power management device)dnl
498: _mkdev(apm,apm*,{-M apm c major_apm_c 0 644
499: M apmctl c major_apm_c 8 644-})dnl
500: __devitem(pcmcia,pcmcia*,PCMCIA card drivers)dnl
501: __devitem(pctr,pctr*,PC Performance Tuning Register access device)dnl
502: _mkdev(pctr,pctr,{-M pctr c major_pctr_c 0 644-})dnl
503: __devitem(au,audio*,audio device)dnl
504: _mkdev(au,audio*,{-M sound$U c major_au_c $U
505: M mixer$U c major_au_c Add($U,16)
506: M audio$U c major_au_c Add($U,128)
507: M audioctl$U c major_au_c Add($U,192)
508: MKlist="$MKlist;[ -e audio ] || ln -s audio$U audio"
509: MKlist="$MKlist;[ -e mixer ] || ln -s mixer$U mixer"
510: MKlist="$MKlist;[ -e sound ] || ln -s sound$U sound"
511: MKlist="$MKlist;[ -e audioctl ] || ln -s audioctl$U audioctl"-})dnl
1.13 ! todd 512: __devitem(asc,asc*,ASC Audio device)dnl
! 513: _mkdev(asc,asc*,{-M asc$U major_asc_c 0-})dnl
1.1 todd 514: __devitem(music,music*,midi devices)dnl
515: _mkdev(music,music*,{-M music$U c major_music_c $U
516: M sequencer$U c major_music_c Add($U,128)
517: MKlist="$MKlist;[ -e music ] || ln -s music$U music"
518: MKlist="$MKlist;[ -e sequencer ] || ln -s sequencer$U sequencer"-})dnl
1.8 todd 519: __devitem(radio,radio*,FM tuner device)dnl
520: _mkdev(radio,radio*,{-M radio$U c major_radio_c $U 644
521: MKlist="$MKlist;[ -e radio ] || ln -s radio$U radio"-})dnl
1.1 todd 522: __devitem(fdesc,fd,makes fd/* for the fdescfs)dnl
523: _mkdev(fdesc,fd,{-RMlist="mkdir -p fd;$RMlist" n=0
524: while [ $n -lt 64 ];do M fd/$n c major_fdesc_c $n;n=Add($n,1);done
525: MKlist="$MKlist;chmod 555 fd"-})dnl
526: __devtitle(graph,Graphics devices)dnl
1.13 ! todd 527: __devitem(mac_grf,grf*,{-custom chip (grf0){-,-} Retina Z2/Z3 (grf1/grf2){-,-}
1.1 todd 528: {-#-} Cirrus boards (grf3){-,-} A2410 (grf4) video or
529: {-#-} CyberVision 64 (grf5)-})dnl
530: __devitem(grf_amiga,grf*,{-Motherboard bitmapped video.-})dnl
531: __devitem(grf_hp300,grf*,raw interface to HP300 graphics devices)dnl
532: __devitem(ite,ite*,terminal emulator interface to HP300 graphics devices)dnl
533: __devitem({-hil-},{-hil-},HP300 HIL input devices)dnl
534: __devitem(oppr,openprom)dnl
535: _cdev(oppr,openprom,70,0)dnl
536: __devitem(btw,bwtwo*)dnl
537: _mcdev(btw,bwtwo*,bwtwo,{-major_btw_c-},666)dnl
538: __devitem(ctw,cgtwo*)dnl
539: _mcdev(ctw,cgtwo*,cgtwo,{-major_ctw_c-},666)dnl
540: __devitem(ctr,cgthree*)dnl
541: _mcdev(ctr,cgthree*,cgthree,{-major_ctr_c-},666)dnl
542: __devitem(cfr,cgfour*)dnl
543: _mcdev(cfr,cgfour*,cgfour,{-major_cfr_c-},666)dnl
544: __devitem(csx,cgsix*)dnl
545: _mcdev(csx,cgsix*,cgsix,{-major_csx_c-},666)dnl
546: __devitem(ceg,cgeight*)dnl
547: _mcdev(ceg,cgeight*,cgeight,{-major_ceg_c-},666)dnl
548: __devitem(cfo,cgfourteen*)dnl
549: _mcdev(cfo,cgfourteen*,cgfourteen,{-major_cfo_c-})dnl
550: __devitem(tcx,tcx*)dnl
551: _mcdev(tcx,tcx*,tcx,{-major_tcx_c-})dnl
552: __devitem(cry,crypto,hardware crypto access driver)dnl
553: _mkdev(cry,crypto,{-M crypto c major_cry_c-} 0)dnl
554: __devitem(pf,pf*,Packet Filter)dnl
555: _mkdev(pf,{-pf*-},{-M pf c major_pf_c 0 600-})dnl
556: __devitem(bpf,bpf*,Berkeley Packet Filter)dnl
557: _mkdev(bpf,{-bpf*-},{-M bpf$U c major_bpf_c $U 600-},600)dnl
558: _mkdev(tun,{-tun*-},{-M tun$U c major_tun_c $U 600-},600)dnl
559: __devitem(altq,altq/,ALTQ control interface)dnl
560: _mkdev(altq,altq,{-RMlist="mkdir -p altq;$RMlist"
561: for d in altq cbq wfq afm fifoq red rio localq hfsc cdnr blue priq; do
562: M altq/$d c major_altq_c $U 644
563: U=Add($U,1)
564: done-})dnl
565: __devitem(speak,speaker,pc speaker)dnl
1.8 todd 566: _mcdev(speak,speaker,speaker,{-major_speak_c-},600)dnl
1.1 todd 567: __devitem(kbd,kbd,keyboard (provides events, for X11))dnl
568: _cdev(kbd,kbd,{-major_kbd_c-},0,600)dnl
569: __devitem(kbd_atari,kbd,Atari keyboard)dnl
570: __devitem(akbd,kbd,Amiga keyboard)dnl
571: __devitem(rkbd,kbd,raw keyboard)dnl
572: __devitem(kbdctl,kbdctl,keyboard control)dnl
573: __devitem(beep,beep,riscpc speaker)dnl
574: __devitem(iic,iic*,IIC bus device)dnl
575: __devitem(rtc,rtc*,RTC device)dnl
576: __devitem(view,view*,generic interface to graphic displays)dnl
577: __devitem(aconf,aconf,{-autoconfig information (not yet)-})dnl
578: __devitem(mouse-,mouse-*,"mouse link")dnl
579: __devitem(mouse,mouse,mouse (provides events, for X11))dnl
580: __devitem(amouse,mouse*,Amiga mice)dnl
581: __devitem(lkm,lkm,loadable kernel modules interface)dnl
582: _cdev(lkm,lkm,{-major_lkm_c-},0,640,kmem)dnl
583: __devitem(mmcl,mmclock,memory mapped clock)dnl
584: __devitem(tun,tun*,network tunnel driver)dnl
585: __devitem(rnd,*random,inkernel random data source)dnl
586: _mkdev(rnd,*random,{-n=0
587: for pre in " " s u p a
588: do
589: M ${pre}random c major_rnd_c $n 644
590: n=Add($n,1)
591: done-},644)dnl
592: __devitem(joy,joy*,joystick driver)dnl
1.8 todd 593: _mcdev(joy,joy*,joy,{-major_joy_c-},666)dnl
1.1 todd 594: __devitem(mag,magma*,magma card (makes 16 tty and 2 bpp))dnl
595: __devitem(xfs,xfs*,XFS filesystem devices)dnl
596: _mcdev(xfs,xfs*,xfs,{-major_xfs_c-},600)dnl
597: __devitem(hil,hil,HIL input devices)dnl
598: __devitem(rmidi,rmidi*,raw midi devices)dnl
599: _mcdev(rmidi,rmidi*,rmidi,{-major_rmidi_c-},666)dnl
600: __devtitle(plat,Platform-specific devices)dnl
601: __devitem(fb,fb*,framebuffer device)dnl
602: __devitem(bktr,bktr*,video capturing)dnl
603: _mcdev(bktr,bktr*,bktr,{-major_bktr_c-},644)dnl
604: __devitem(tuner,tuner*,tuner device)dnl
605: _mkdev(tuner,tuner*,{-M tuner$U c major_tuner_c Add(Mult($U,2),16) 644-},644)dnl
1.7 todd 606: __devitem(pci,pci,PCI bus device)dnl
607: _mkdev(pci,pci,{-M pci c major_pci_c 0 664-},664)dnl
1.13 ! todd 608: __devitem(adb,adb,Apple Desktop bus event interface)dnl
! 609: _mkdev(adb,adb,{-M adb c major_adb_c 0-})dnl
1.1 todd 610: _mkdev(local,local,{-test -s $T.local && sh $T.local-},666)dnl
611: dnl
612: divert(1)dnl
613: include(etc.MACHINE/MAKEDEV.md)dnl
614: dnl
615: dnl
616: divert(0)dnl
617: #!/bin/sh -
618: #
619: # THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
620: # generated from:
621: #
622: show_vers()dnl <-- now that all files are included, show versions
623: #
1.6 todd 624: {-#-} $Open{--}BSD$
1.1 todd 625: dnl
626: divert(2)dnl
627: PATH=/sbin:/usr/sbin:/bin:/usr/bin
628: T=$0
629:
630: # set this to echo for Echo-Only debugging
631: [ "$eo" ] || eo=
632:
633: hex()
634: {
635: case ${--}1 in
636: [0-9]) echo -n {-$-}1;;
637: 10) echo -n a;;
638: 11) echo -n b;;
639: 12) echo -n c;;
640: 13) echo -n d;;
641: 14) echo -n e;;
642: 15) echo -n f;;
643: esac
644: }
645: trunc()
646: {
647: # XXX pdksh can't seem to deal with locally scoped variables
648: # in ${foo#$bar} expansions
649: arg1="{-$-}1"
650: arg2="{-$-}2"
651: case {-$-}3 in
652: l) echo ${arg2#$arg1} ;;
653: r|*) echo ${arg1#$arg2} ;;
654: esac
655: }
656: unt()
657: {
658: # XXX pdksh can't seem to deal with locally scoped variables
659: # in ${foo#$bar} expansions
660: arg="{-$-}1"
661: tmp="${arg#[a-zA-Z]*}"
662: tmp="${tmp%*[a-zA-Z]}"
663: while [ "$tmp" != "$arg" ]
664: do
665: arg=$tmp
666: tmp="${arg#[a-zA-Z]*}"
667: tmp="${tmp%*[a-zA-Z]}"
668: done
669: echo $arg
670: }
671: dnl
1.5 todd 672: dnl dodisk(name,unit,blkmaj,chrmaj,unit,off[,stepping])
673: dnl arg: 1 2 3 4 5 6 7
1.1 todd 674: dnl
675: dodisk()
676: {
1.5 todd 677: n=Add(Mult(${5},${7:-16}),${6}) count=0
1.1 todd 678: RMlist="$RMlist {-$-}1{-$-}2? r{-$-}1{-$-}2?"
1.13 ! todd 679: [ 0$7 -ne 8 ] && l="i j k l m n o p"
! 680: for d in a b c d e f g h $l
1.1 todd 681: do
682: M {-$-}1{-$-}2$d b {-$-}3 Add($n,$count) 640
683: M r{-$-}1{-$-}2$d c {-$-}4 Add($n,$count) 640
684: let count=count+1
685: done
686: MKlist="$MKlist;chown root.operator {-$-}1{-$-}2? r{-$-}1{-$-}2?"
687: }
688: dnl
1.5 todd 689: dnl dodisk2(name,unit,blkmaj,chrmaj,unit,off[,stepping])
1.1 todd 690: dnl
691: dnl 1. name - prefix name of the device
692: dnl 2. unit - beginning unit number for block devices
693: dnl 3. blkmaj - block device major number
694: dnl 4. chrmaj - character device major number
695: dnl 5. unit - beginning unit number for character devices
696: dnl 6. off - offset from 0 for all minor numbers (see svnd for an example)
1.5 todd 697: dnl 7. step - optional, defaults to 16, number of partitions per device
1.1 todd 698: dnl
699: dodisk2()
700: {
1.5 todd 701: n=Add(Mult({-$-}5,${7:-16}),{-$-}6)
1.1 todd 702: M {-$-}1{-$-}2a b {-$-}3 $n 640 operator
703: M r{-$-}1{-$-}2a c {-$-}4 $n 640 operator
704: n=Add($n,2)
705: M {-$-}1{-$-}2c b {-$-}3 $n 640 operator
706: M r{-$-}1{-$-}2c c {-$-}4 $n 640 operator
707: }
708:
709: # M name b/c major minor [mode] [group]
710: RMlist="rm -f"
711: MKlist=":"
712: mkl() {
713: dnl
714: dnl uncomment if multi mknod happens
715: dnl
716: ifelse(1,0,
717: [ "${mklist[{-$-}1]}" ] && mklist[{-$-}1]="${mklist[{-$-}1]} {-$-}2 {-$-}3 {-$-}4 {-$-}5" || {
718: mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
719: modes="$modes {-$-}1"
720: },
721: dnl
722: dnl non multi mknod
723: dnl
724: [ "${mklist[{-$-}1]}" ] && {
725: mklist[{-$-}1]="${mklist[{-$-}1]};mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
726: } || {
727: mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
728: modes="$modes {-$-}1"
729: })
730: }
731: M() {
732: RMlist="$RMlist {-$-}1"
733: mkl ${5-666} {-$-}1 {-$-}2 {-$-}3 {-$-}4
734: mklist="$mklist {-$-}1"
735: G={-$-}{6:-wheel}
736: [ "{-$-}7" ] && {
737: MKlist="$MKlist;chown {-$-}7.{-$-}G {-$-}1"
738: } || {
739: case $G in
740: wheel)g=0;;kmem)g=2;;operator)g=5;;tty)g=4;;dialer)g=117;;
741: esac
742: [ "${grplist[$g]}" ] && {
743: grplist[$g]="${grplist[$g]} {-$-}1"
744: } || {
745: groups="$groups $g"
746: grplist[$g]="chgrp $G {-$-}1"
747: }
748: }
749: return 0
750: }
751: divert(7)dnl
752: dnl
753: dnl there is no blank line at the end of etc.arch/MAKEDEV.md files, so add one
754: dnl on the following line:
755:
756: show_devs()dnl
757: dnl
758: divert(9)dnl
759: *)
760: echo $i: unknown device
761: ;;
762: esac
763: done
764: }
765: _recurse "$@"
766: if [ "$os" = "SunOS" ]; then
767: eo=transform
768: transform() {
769: case $mode in
770: 600) mask=077;;
771: 640) mask=027;;
772: 660) mask=007;;
773: 644) mask=022;;
774: 666) mask=0;;
775: 440) mask=227;;
776: esac
777: echo `echo "$@"|sed \
778: 's/mknod -m \([0-9]*\) /umask '$mask';mknod /;s/-m [0-9]* //g;\
779: s/operator/5/g;s/root.kmem/root.2/g;s/root\./root:/g'`
780: }
781: fi
782: list="$RMlist"
783: for mode in $modes; do
784: list="$list;${mklist[$mode]}"
785: done
786: for group in $groups; do
787: list="$list;${grplist[$group]}"
788: done
789: list="$list;$MKlist"
790: if [ "$eo" = "echo" -o "$eo" = "transform" ]; then
791: $eo "$list"
792: else
793: echo "$list" | sh
794: fi
795: divert(3)dnl
796: dnl
797: R() {
798: for i in "$@"
799: do
800: U=`unt $i`
801: [ "$U" ] || U=0
802:
803: case $i in
804: dnl