Annotation of src/etc/MAKEDEV.mi, Revision 1.9
1.1 todd 1: include(MAKEDEV.sub)dnl
2: dnl
1.9 ! todd 3: vers(a,{-$OpenBSD: MAKEDEV.mi,v 1.8 2002/01/07 07:50:48 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.9 ! todd 109: {-aflo-},{-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-},
120: {-xy-},{-xy0 xy1 xy2 xy3 xy4-},
121: {-xd-},{-xd0 xd1 xd2 xd3 xd4-},
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.9 ! todd 137: {-ttyB-},{-ttyB0 ttyB1 ttyB2 ttyB3 ttyB4 ttyB5-},
! 138: {-attyB-},{-ttyB0 ttyB1 ttyB2 ttyB3 ttyB4-},
1.1 todd 139: {-tty0-},{-tty00 tty01 tty02 tty03-},
140: {-tzs-},{-ttya ttyb ttyc ttyd-},
1.7 todd 141: {-czs-},{-cuaa cuab cuac cuad-},
1.1 todd 142: {-lkm-},{-lkm-},
143: {-iop-},{-iop0 iop1-},
144: {-mmcl-},{-mmclock-},dnl
1.8 todd 145: {-lpt-},{-lpa0 lpt0 lpa1 lpt1 lpa2 lpt2-},
146: {-joy-},{-joy0 joy1-},
1.1 todd 147: {-rnd-},{-random-},
148: {-ses-},{-ses0-},
149: {-uk-},{-uk0 uk1-},
150: {-ss-},{-ss0 ss1-},
1.8 todd 151: {-wt-},{-wt0-},
152: {-wdt-},{-wdt0-},
1.1 todd 153: {-ttyc-},{-ttyc0 ttyc1 ttyc2 ttyc3 ttyc4 ttyc5 ttyc6 ttyc7-},
154: {-com-},{-tty00 tty01 tty02 tty03-},
1.9 ! todd 155: {-ttye-},{-ttye0 ttye1 ttye2 ttye3 ttye4 ttye5 ttye6-},
1.1 todd 156: {-xfs-},{-xfs0-},
157: {-au-},{-audio0-},
1.8 todd 158: {-music-},{-music0-},
159: {-radio-},{-radio0-},
160: {-tuner-},{-tuner0-},
161: {-rmidi-},{-rmidi0 rmidi1 rmidi2 rmidi3 rmidi4 rmidi5 rmidi6 rmidi7-},
1.1 todd 162: {-usbs-},{-usbs-},
1.9 ! todd 163: {-pci-},{-pci-},
1.1 todd 164: {-wsmouse-},{-wscons-},
1.9 ! todd 165: {-grf-},{-grf0 grf1 grf2 grf3 grf4 grf5 grf6-},
! 166: {-par-},{-par0-},
! 167: {-amouse-},{-mouse0 mouse1-},
! 168: {-akbd-},{-kbd-},
! 169: {-ppi-},{-ppi0-},
! 170: {-view-},{-view00 view01-},
1.1 todd 171: {-local-},{-local-})-})dnl
172: __devitem(floppy,floppy,devices to be put on install floppies)dnl
173: __devitem(std,{-std-},standard devices)dnl
174: dnl
175: dnl _std
176: dnl
177: dnl $1: tty
178: dnl $2: memstuff
179: dnl $3: ksyms
180: dnl $4: drum
181: dnl $5: klog
182: dnl
183: define({-_std-},{-dnl
184: std)
185: M console c 0 0 600
186: M tty c $1 0
187: M mem c $2 0 640 kmem
188: M kmem c $2 1 640 kmem
189: M null c $2 2
190: M zero c $2 12
191: M stdin c major_fdesc_c 0
192: M stdout c major_fdesc_c 1
193: M stderr c major_fdesc_c 2
194: M ksyms c $3 0 640 kmem
195: M drum c $4 0 640 kmem
196: M klog c $5 0 600-})dnl
197: dnl
198: __devitem({-usbs-},usbs,make USB devices)dnl
199: _mkdev(usbs,usbs,{-dnl
200: _dl({-usb-},{-usb0 usb1-},
201: {-urio-},{-urio-},
1.2 todd 202: {-uscan-},{-uscanner0-},
1.1 todd 203: {-uhid-},{-uhid0 uhid1 uhid2 uhid3-},
204: {-ulpt-},{-ulpt0 ulpt1-},
205: {-ugen-},{-ugen0 ugen1-},
206: {-utty-},{-utty0 utty1-})-})dnl
207: __devtitle(tap,Tapes)dnl
208: __devitem(wt,{-wt* -},QIC-interface (e.g. not SCSI) 3M cartridge tape)dnl
209: _mkdev(wt,wt*,
210: {-name=wt
211: n=Mult($U,8) m=Add($n,4)
212: M $name$U b major_wt_b $n 640 operator
213: M r$name$U c major_wt_c $n 640 operator
214: M n$name$U b major_wt_b $m 640 operator
215: M nr$name$U c major_wt_c $m 640 operator-})dnl
216: __devitem(tz,tz*,{-SCSI tapes{-,-} DEC TK50 cartridge tape-})dnl
217: __devitem(st,{-st*-},SCSI tapes)dnl
218: _mkdev(st,st*,{-n=Mult($U,16)
219: for pre in " " n e en
220: do
221: M ${pre}st$U b major_st_b $n 660 operator
222: M ${pre}rst$U c major_st_c $n 660 operator
223: n=Add($n,1)
224: done-})dnl
225: _mkdev(st_hp300,ct*|mt*|st*,
226: {-case $i in
227: ct*) name=ct blk=major_ct_b chr=major_ct_c;;
228: mt*) name=mt blk=major_mt_b chr=major_mt_c;;
229: st*) name=st blk=major_st_hp300_b chr=major_st_hp300_c;;
230: esac
231: case $U in
232: [0-7])
233: four=Add($U,4) eight=Add($U,8)
234: twelve=Add($U,12) twenty=Add($U,20)
235: M r$name$U c $chr $U 660 operator
236: M r$name$four c $chr $four 660 operator
237: M r$name$eight c $chr $eight 660 operator
238: M r$name$twelve c $chr $twelve 660 operator
239: MKlist="$MKlist;ln r$name$four nr$name$U";: sanity w/pdp11 v7
240: MKlist="$MKlist;ln r$name$twelve nr$name$eight";: ditto
241: RMlist="$RMlist nr$name$U nr$name$eight"
242: ;;
243: *)
244: echo bad unit for tape in: $1
245: ;;
246: esac-})dnl
247: __devitem(st_hp300,st*,Exabyte tape)dnl
248: __devitem(ct,ct*,HP300 HP-IB cartridge tape)dnl
249: __devitem(mt,mt*,(Magnetic) 9-track reel tape)dnl
250: __devtitle(dis,Disks)dnl
251: __devitem(rz,rz*,SCSI disks)dnl
252: __devitem(sd,{-sd*-},SCSI disks{-,-} includes flopticals)dnl
253: __devitem(ofdisk,ofdisk*,OpenFirmware disks)dnl
254: __devitem(hd,{-hd*-},HP300 HP-IB disks)dnl
255: __devitem(cd,{-cd*-},SCSI cdrom drives)dnl
256: __devitem(acd,acd*,ATAPI cdrom drives)dnl
1.6 todd 257: _mkdev(cd,cd*,{-dodisk2 cd $U major_cd_b major_cd_c $U 0{--}ifstep(cd)-})dnl
258: __devitem(mcd,mcd*,Mitsumi cdrom drives)dnl
259: _mkdev(mcd,mcd*,{-dodisk2 mcd $U major_mcd_b major_mcd_c $U 0{--}ifstep(mcd)dnl
1.1 todd 260: -})dnl
261: __devitem(ch,{-ch*-},SCSI media changer)dnl
262: _mcdev(ch,ch*,ch,{-major_ch_c-},660,operator)dnl
263: __devitem(uk,uk*,SCSI Unknown device)dnl
264: _mcdev(uk,uk*,uk,{-major_uk_c-},640,operator)dnl
265: __devitem(ss,ss*,SCSI scanners)dnl
266: _mkdev(ss,ss*,{-M ss$U c major_ss_c $U 440 operator
267: RMlist="$RMlist scan$U"
268: MKlist="$MKlist;umask 77;ln -s ss$U scan$U"-})dnl
269: __devitem(ses,ses*,SES/SAF-TE SCSI devices)dnl
270: _mkdev(ses,ses*,{-M ses$U c major_ses_c $U 640 operator-})dnl
271: __devitem(ramd,ramdisk,makes all devices for a ramdisk kernel)dnl arc
272: __devitem(rd,{-rd*-},"ramdisk" pseudo-disks)dnl
1.6 todd 273: _mkdev(rd,rd*,{-dodisk2 rd $U major_rd_b major_rd_c $U 0{--}ifstep(rd)-})dnl
1.1 todd 274: __devitem(xd,xd*,Xylogic 753/7053 disks)dnl
275: __devitem(xy,xy*,{- Xylogic 450/451 disks-})dnl
276: __devitem(flo,{-fd*-},{-Floppy disk drives (3 1/2"{-,-} 5 1/4")-})dnl
277: _mkdev(flo,fd*,
278: {-typnam=$U${i#fd[01]*}
279: case $typnam in
280: 0|1) typnum=0;; # no type specified, assume A
281: *A) typnam=0; typnum=0;;
282: *B) typnum=1;;
283: *C) typnum=2;;
284: *D) typnum=3;;
285: *E) typnum=4;;
286: *F) typnum=5;;
287: *G) typnum=6;;
288: *H) typnum=7;;
289: *) echo bad type $typnam for $i; exit 1;;
290: esac
291: case $U in
292: 0|1) blk=major_flo_b; chr=major_flo_c;;
293: *) echo bad unit $U for $i; exit 1;;
294: esac
295: nam=fd${typnam}
296: n=Add(Mult($U,128),Mult($typnum,16))
297: M ${nam}a b $blk $n 640 operator
298: M ${nam}b b $blk Add($n,1) 640 operator
299: M ${nam}c b $blk Add($n,2) 640 operator
300: M r${nam}a c $chr $n 640 operator
301: M r${nam}b c $chr Add($n,1) 640 operator
302: M r${nam}c c $chr Add($n,2) 640 operator-},664)dnl
303: __devitem(aflo,floppy,devices needed for install floppies)dnl
304: _mkdev(aflo,fd*,{-case $U in 0|1|2|3)
305: M fd${U}a b major_aflo_b Mult($U,16) 640 operator
306: M fd${U}b b major_aflo_b Add(Mult($U,16),1) 640 operator
307: M rfd${U}a c major_aflo_c Mult($U,16) 640 operator
308: M rfd${U}b c major_aflo_c Add(Mult($U,16),1) 640 operator;;
309: *) echo bad unit for floppy disk in: $i;;
310: esac-})dnl
311: __devitem(iop,iop*,I2O controller device)dnl
312: _mcdev(iop,iop*,iop,{-major_iop_c-},660)dnl
313: __devitem(wdt,wdt0,watchdog timer)dnl
314: _mcdev(wdt,wdt0,wdt,{-major_wdt_c-},440,operator)dnl
315: __devitem(local,local,configuration specific devices)dnl
316: __devitem(wd,{-wd*-},{-"winchester" disk drives (ST506,IDE,ESDI,RLL,...)-})dnl
317: __devitem(ccd,ccd*,concatenated disk devices)dnl
318: __devitem(raid,raid*,RAIDframe disk devices)dnl
319: __devitem(vnd,vnd*,"file" pseudo-disks)dnl
1.6 todd 320: _mkdev(vnd,vnd*,{-dodisk vnd $U major_vnd_b major_vnd_c $U 0{--}ifstep(vnd)
321: dodisk svnd $U major_vnd_b major_vnd_c $U 128{--}ifstep(vnd)-})dnl
1.1 todd 322: dnl
323: dnl For normal disk devices, add a disk_q entry; anything else define like
324: dnl the rest (such as vnd above).
325: dnl
326: disk_q({-xy-})dnl
327: disk_q({-xd-})dnl
328: disk_q({-hd-})dnl
329: disk_q({-ofdisk-})dnl
330: disk_q({-rz-})dnl
331: disk_q({-wd-})dnl
332: disk_q({-raid-})dnl
333: disk_q({-ccd-})dnl
334: disk_q({-sd-})dnl
335: dnl
336: __devitem(loc,local,configuration specific devices)dnl
337: _mkdev(loc,local,{-test -s $T.local && sh $T.local-})dnl
338: _mkdev({-disks-},{-undefine({-C_ase-})show_disks()undefine({-C_ase-})-},
339: {-case $i in
340: show_disks2()dnl
1.6 todd 341: esac-})dnl
1.1 todd 342: __mkdev({-disks-}){--}dnl
343: dnl
344: __devtitle(cons,Console ports)dnl
345: __devitem(ttyv0,ttyv0,pccons or pcvt screen 0)dnl
346: __devitem(ttyv,ttyv*,pcvt)dnl
347: __devitem(ttye,ttye*,ite bitmapped consoles)dnl
348: __devitem(wscons,ttyC0,wscons screen 0)dnl
349: _mkdev({-wscons-},{-wscons-},{-dnl
350: _dl(dnl
351: {-wscons-},{-ttyCcfg-},
1.3 todd 352: {-wsdisp-},{-ttyC0 ttyC1 ttyC2 ttyC3 ttyC4 ttyC5 ttyC6 ttyC7 ttyC8 ttyC9-},
353: {-wsdisp-},{-ttyCa ttyCb-},
1.1 todd 354: {-wsmux-},{-wsmux-},
355: {-wskbd-},{-wskbd0 wskbd1 wskbd2 wskbd3-},
356: {-wsmouse-},{-wsmouse0 wsmouse1 wsmouse2 wsmouse3-})-})dnl
1.3 todd 357: __devitem(wsdisp,ttyC*,wscons virtual consoles)dnl
358: _mkdev({-wsdisp-},ttyC*,{-U=${i##ttyC}
359: case $U in
1.8 todd 360: [0-9a-f]) M ttyC$U c major_wsdisp_c {-$(( 16#$U ))-} 600;;
361: cfg) M ttyCcfg c major_wsdisp_c 255 600;;
1.3 todd 362: *) echo bad unit $U for $i; exit 1;;
1.6 todd 363: esac-})dnl
1.1 todd 364: __devitem(wskbd,wskbd*,wscons keyboards)dnl
365: _mkdev(wskbd,wskbd*,{-M wskbd$U c major_wskbd_c $U 600-})dnl
366: __devitem(wsmux,wsmux,wscons keyboard/mouse mux devices)dnl
367: _mkdev(wsmux,wsmux|wsmouse|wskbd,{-M wsmouse c major_wsmux_c 0 600
368: M wskbd c major_wsmux_c 1 600-})dnl
369: __devitem(pcons,console,PROM console)dnl
370: __devtitle(point,Pointing devices)dnl
371: __devitem(wsmouse,wsmouse*,wscons mice)dnl
372: _mkdev(wsmouse,wsmouse*,{-M wsmouse$U c major_wsmouse_c $U 600-})dnl
373: __devitem(quad,quadmouse,"quadrature mouse")dnl
374: __devtitle(pty,Pseudo terminals)dnl
375: __devitem(tty,tty*,set of 16 slave psuedo terminals)dnl
376: __devitem(pty,pty*,set of 16 master pseudo terminals)dnl
377: _mkdev(pty,pty*,{-case $U in
378: 0) off=0 name=p;;
379: 1) off=16 name=q;;
380: 2) off=32 name=r;;
381: 3) off=48 name=s;;
382: # Note that telnetd, rlogind, and xterm (at least) only look at p-s.
383: 4) off=64 name=t;;
384: 5) off=80 name=u;;
385: 6) off=96 name=v;;
386: 7) off=112 name=w;;
387: 8) off=128 name=x;;
388: 9) off=144 name=y;;
389: 10) off=160 name=z;;
390: 11) off=176 name=P;;
391: 12) off=192 name=Q;;
392: 13) off=206 name=R;;
393: 14) off=224 name=S;;
394: 15) off=240 name=T;;
395: *) echo bad unit for pty in: $i; continue;;
396: esac
397: n=0
398: while [ $n -lt 16 ]
399: do
400: nam=$name$(hex $n)
401: M tty$nam c major_tty_c Add($off,$n)
402: M pty$nam c major_pty_c Add($off,$n)
403: n=Add($n,1)
404: done-})dnl
405: __devitem(dc,dc*,{-4 channel serial interface (keyboard{-,-} mouse{-,-}modem{-,-} printer)-})dnl
406: __devtitle(prn,Printers)dnl
407: __devitem(par,par*,motherboard parallel port)dnl
408: __devitem(lpt,lpt*,IEEE 1284 centronics printer)dnl
409: _mkdev(lpt,lpt*|lpa*,
410: {-case $i in
411: lpt*) n=lpt f=0;;
412: lpa*) n=lpa f=128;;
413: esac
414: M $n$U c major_lpt_c Add($U,$f) 600-})dnl
415: __devitem(lpa,lpa*,interruptless lp)dnl
416: __devitem(ppi,ppi*,HP-IB plotters)dnl
417: __devtitle({-usb-},USB devices)dnl
418: __devitem({-usb-},usb*,Bus control devices used by usbd for attach/detach)dnl
419: _mkdev({-usb-},usb*,{-[ "$i" = "usb" ] && u= || u=$U
420: M usb$u c major_usb_c $U 660-})dnl
421: __devitem(uhid,uhid*,Generic HID devices)dnl
422: _mcdev({-uhid-},uhid*,{-uhid-},{-major_uhid_c-},660)dnl
423: __devitem(ulpt,ulpt*,Printer devices)dnl
424: _mcdev({-ulpt-},ulpt*,{-ulpt-},{-major_ulpt_c-},660)dnl
425: __devitem(utty,utty*,Serial ports)dnl
426: _mcdev({-utty-},utty*,{-utty-},{-major_utty_c-},660)dnl
427: __devitem(urio,urio*,Diamond Multimedia Rio 500)dnl
428: _mcdev({-urio-},urio*,{-urio-},{-major_urio_c-},660)dnl
1.2 todd 429: __devitem(uscan,uscanner*,Scanners)dnl
430: _mcdev({-uscan-},uscanner*,{-uscanner-},{-major_uscan_c-},660)dnl
1.1 todd 431: __devitem(ugen,ugen*,Generic device)dnl
432: _mkdev(ugen,ugen*,{-n=Mult($U,16)
433: for j in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
434: do
435: M ugen$U.$j c major_ugen_c Add($n,$j) 660
436: done-})dnl
437: __devtitle(cpu,Cpus)dnl
438: __devitem(cpu,cpu*,cpus)dnl
439: __devtitle(call,Call units)dnl
440: __devtitle(term,Terminal ports)dnl
441: __devtitle(termp,Terminal multiplexers)dnl
442: __devitem(dca,dca*,HP200/300 single port serial interface)dnl
443: __devitem(dcm,dcm*,HP200/300 4 port serial mux interface)dnl
444: __devitem(apci,apci*,HP400 4 port serial mux interface)dnl
445: __devitem({-com-},{-tty0*-},NS16x50 serial ports)dnl
446: _mkdev(com,{-tty0*-},{-M tty$U c major_com_c $U 660 dialer uucp
447: M cua$U c major_com_c Add($U,128) 660 dialer uucp-})dnl
448: __devitem(ttyc,ttyc*,Cyclades serial ports)dnl
449: __devitem(tzs,tty[a-z]*,Zilog 8530 Serial Port)dnl
450: _mkdev(tzs,{-tty[a-z]-},{-u=${i#tty*}
451: case $u in
452: a) n=0 ;;
453: b) n=1 ;;
454: c) n=4 ;;
455: d) n=5 ;;
456: *) echo unknown tty device $i ;;
457: esac
458: M tty$u c major_tzs_c $n 660 dialer uucp-})dnl
459: __devitem(tth,ttyh*,Sab82532 serial devices)dnl
460: _mkdev(tth,ttyh*,{-M ttyh$U c major_tth_c $U 660 dialer uucp-})dnl
461: __devitem(czs,cua[a-z]*,Zilog 8530 Serial Port)dnl
462: _mkdev(czs,cua[a-z],{-u=${i#cua*}
463: case $u in
464: a) n=0 ;;
465: b) n=1 ;;
466: c) n=4 ;;
467: d) n=5 ;;
468: *) echo unknown cua device $i ;;
469: esac
470: M cua$u c major_czs_c Add($n,128) 660 dialer uucp-})dnl
471: __devitem(arm_tty,tty*,{-alias for PC COM ports{-,-} this is what the system really wants-})dnl
472: __devitem(tty0,tty00,standard serial port)dnl
473: __devitem(ttyA,ttyA*,mfc serial ports)dnl
474: __devitem(attyB,ttyB*,ISA COM ports)dnl amiga
475: __devitem(ttyz,tty[a-d],onboard zs serial ports)dnl
476: __devitem(cuaz,cua[a-d],onboard zs serial ports)dnl
477: __devitem(ttyB,ttyB?,DEC 3000 ZS8530 ("scc") serial ports)dnl
478: __devitem(scc,scc*,82530 serial interface)dnl
479: __devitem(arc_ttyC,ttyC0,pccons)dnl
480: __devitem(i386_ttyC,ttyC*,pcvt)dnl
481: __devitem(ttyC,ttyC?,{-AlphaStation NS16550 ("com serial ports")-})dnl
482: __devitem(ttyE,ttyE?,Workstation console (framebuffer & keyboard) tty emulators)dnl
483: __devitem(ser02,ser02,{-serial2 port (channel A on 8530)-})dnl
484: __devitem(mdm02,mdm02,{-modem2 port (channel B on 8530)-})dnl
485: __devtitle(spec,Special purpose devices)dnl
486: __devitem(apm,apm ,power management device)dnl
487: _mkdev(apm,apm*,{-M apm c major_apm_c 0 644
488: M apmctl c major_apm_c 8 644-})dnl
489: __devitem(pcmcia,pcmcia*,PCMCIA card drivers)dnl
490: __devitem(pctr,pctr*,PC Performance Tuning Register access device)dnl
491: _mkdev(pctr,pctr,{-M pctr c major_pctr_c 0 644-})dnl
492: __devitem(au,audio*,audio device)dnl
493: _mkdev(au,audio*,{-M sound$U c major_au_c $U
494: M mixer$U c major_au_c Add($U,16)
495: M audio$U c major_au_c Add($U,128)
496: M audioctl$U c major_au_c Add($U,192)
497: MKlist="$MKlist;[ -e audio ] || ln -s audio$U audio"
498: MKlist="$MKlist;[ -e mixer ] || ln -s mixer$U mixer"
499: MKlist="$MKlist;[ -e sound ] || ln -s sound$U sound"
500: MKlist="$MKlist;[ -e audioctl ] || ln -s audioctl$U audioctl"-})dnl
501: __devitem(music,music*,midi devices)dnl
502: _mkdev(music,music*,{-M music$U c major_music_c $U
503: M sequencer$U c major_music_c Add($U,128)
504: MKlist="$MKlist;[ -e music ] || ln -s music$U music"
505: MKlist="$MKlist;[ -e sequencer ] || ln -s sequencer$U sequencer"-})dnl
1.8 todd 506: __devitem(radio,radio*,FM tuner device)dnl
507: _mkdev(radio,radio*,{-M radio$U c major_radio_c $U 644
508: MKlist="$MKlist;[ -e radio ] || ln -s radio$U radio"-})dnl
1.1 todd 509: __devitem(fdesc,fd,makes fd/* for the fdescfs)dnl
510: _mkdev(fdesc,fd,{-RMlist="mkdir -p fd;$RMlist" n=0
511: while [ $n -lt 64 ];do M fd/$n c major_fdesc_c $n;n=Add($n,1);done
512: MKlist="$MKlist;chmod 555 fd"-})dnl
513: __devtitle(graph,Graphics devices)dnl
514: __devitem(grf,grf*,{-custom chip (grf0){-,-} Retina Z2/Z3 (grf1/grf2){-,-}
515: {-#-} Cirrus boards (grf3){-,-} A2410 (grf4) video or
516: {-#-} CyberVision 64 (grf5)-})dnl
517: __devitem(grf_amiga,grf*,{-Motherboard bitmapped video.-})dnl
518: __devitem(grf_hp300,grf*,raw interface to HP300 graphics devices)dnl
519: __devitem(ite,ite*,terminal emulator interface to HP300 graphics devices)dnl
520: __devitem({-hil-},{-hil-},HP300 HIL input devices)dnl
521: __devitem(oppr,openprom)dnl
522: _cdev(oppr,openprom,70,0)dnl
523: __devitem(btw,bwtwo*)dnl
524: _mcdev(btw,bwtwo*,bwtwo,{-major_btw_c-},666)dnl
525: __devitem(ctw,cgtwo*)dnl
526: _mcdev(ctw,cgtwo*,cgtwo,{-major_ctw_c-},666)dnl
527: __devitem(ctr,cgthree*)dnl
528: _mcdev(ctr,cgthree*,cgthree,{-major_ctr_c-},666)dnl
529: __devitem(cfr,cgfour*)dnl
530: _mcdev(cfr,cgfour*,cgfour,{-major_cfr_c-},666)dnl
531: __devitem(csx,cgsix*)dnl
532: _mcdev(csx,cgsix*,cgsix,{-major_csx_c-},666)dnl
533: __devitem(ceg,cgeight*)dnl
534: _mcdev(ceg,cgeight*,cgeight,{-major_ceg_c-},666)dnl
535: __devitem(cfo,cgfourteen*)dnl
536: _mcdev(cfo,cgfourteen*,cgfourteen,{-major_cfo_c-})dnl
537: __devitem(tcx,tcx*)dnl
538: _mcdev(tcx,tcx*,tcx,{-major_tcx_c-})dnl
539: __devitem(cry,crypto,hardware crypto access driver)dnl
540: _mkdev(cry,crypto,{-M crypto c major_cry_c-} 0)dnl
541: __devitem(pf,pf*,Packet Filter)dnl
542: _mkdev(pf,{-pf*-},{-M pf c major_pf_c 0 600-})dnl
543: __devitem(bpf,bpf*,Berkeley Packet Filter)dnl
544: _mkdev(bpf,{-bpf*-},{-M bpf$U c major_bpf_c $U 600-},600)dnl
545: _mkdev(tun,{-tun*-},{-M tun$U c major_tun_c $U 600-},600)dnl
546: __devitem(altq,altq/,ALTQ control interface)dnl
547: _mkdev(altq,altq,{-RMlist="mkdir -p altq;$RMlist"
548: for d in altq cbq wfq afm fifoq red rio localq hfsc cdnr blue priq; do
549: M altq/$d c major_altq_c $U 644
550: U=Add($U,1)
551: done-})dnl
552: __devitem(speak,speaker,pc speaker)dnl
1.8 todd 553: _mcdev(speak,speaker,speaker,{-major_speak_c-},600)dnl
1.1 todd 554: __devitem(kbd,kbd,keyboard (provides events, for X11))dnl
555: _cdev(kbd,kbd,{-major_kbd_c-},0,600)dnl
556: __devitem(kbd_atari,kbd,Atari keyboard)dnl
557: __devitem(akbd,kbd,Amiga keyboard)dnl
558: __devitem(rkbd,kbd,raw keyboard)dnl
559: __devitem(kbdctl,kbdctl,keyboard control)dnl
560: __devitem(beep,beep,riscpc speaker)dnl
561: __devitem(iic,iic*,IIC bus device)dnl
562: __devitem(rtc,rtc*,RTC device)dnl
563: __devitem(view,view*,generic interface to graphic displays)dnl
564: __devitem(aconf,aconf,{-autoconfig information (not yet)-})dnl
565: __devitem(mouse-,mouse-*,"mouse link")dnl
566: __devitem(mouse,mouse,mouse (provides events, for X11))dnl
567: __devitem(amouse,mouse*,Amiga mice)dnl
568: __devitem(lkm,lkm,loadable kernel modules interface)dnl
569: _cdev(lkm,lkm,{-major_lkm_c-},0,640,kmem)dnl
570: __devitem(mmcl,mmclock,memory mapped clock)dnl
571: __devitem(tun,tun*,network tunnel driver)dnl
572: __devitem(rnd,*random,inkernel random data source)dnl
573: _mkdev(rnd,*random,{-n=0
574: for pre in " " s u p a
575: do
576: M ${pre}random c major_rnd_c $n 644
577: n=Add($n,1)
578: done-},644)dnl
579: __devitem(joy,joy*,joystick driver)dnl
1.8 todd 580: _mcdev(joy,joy*,joy,{-major_joy_c-},666)dnl
1.1 todd 581: __devitem(mag,magma*,magma card (makes 16 tty and 2 bpp))dnl
582: __devitem(xfs,xfs*,XFS filesystem devices)dnl
583: _mcdev(xfs,xfs*,xfs,{-major_xfs_c-},600)dnl
584: __devitem(hil,hil,HIL input devices)dnl
585: __devitem(rmidi,rmidi*,raw midi devices)dnl
586: _mcdev(rmidi,rmidi*,rmidi,{-major_rmidi_c-},666)dnl
587: __devtitle(plat,Platform-specific devices)dnl
588: __devitem(fb,fb*,framebuffer device)dnl
589: __devitem(bktr,bktr*,video capturing)dnl
590: _mcdev(bktr,bktr*,bktr,{-major_bktr_c-},644)dnl
591: __devitem(tuner,tuner*,tuner device)dnl
592: _mkdev(tuner,tuner*,{-M tuner$U c major_tuner_c Add(Mult($U,2),16) 644-},644)dnl
1.7 todd 593: __devitem(pci,pci,PCI bus device)dnl
594: _mkdev(pci,pci,{-M pci c major_pci_c 0 664-},664)dnl
1.1 todd 595: _mkdev(local,local,{-test -s $T.local && sh $T.local-},666)dnl
596: dnl
597: divert(1)dnl
598: include(etc.MACHINE/MAKEDEV.md)dnl
599: dnl
600: dnl
601: divert(0)dnl
602: #!/bin/sh -
603: #
604: # THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
605: # generated from:
606: #
607: show_vers()dnl <-- now that all files are included, show versions
608: #
1.6 todd 609: {-#-} $Open{--}BSD$
1.1 todd 610: dnl
611: divert(2)dnl
612: PATH=/sbin:/usr/sbin:/bin:/usr/bin
613: T=$0
614:
615: # set this to echo for Echo-Only debugging
616: [ "$eo" ] || eo=
617:
618: hex()
619: {
620: case ${--}1 in
621: [0-9]) echo -n {-$-}1;;
622: 10) echo -n a;;
623: 11) echo -n b;;
624: 12) echo -n c;;
625: 13) echo -n d;;
626: 14) echo -n e;;
627: 15) echo -n f;;
628: esac
629: }
630: trunc()
631: {
632: # XXX pdksh can't seem to deal with locally scoped variables
633: # in ${foo#$bar} expansions
634: arg1="{-$-}1"
635: arg2="{-$-}2"
636: case {-$-}3 in
637: l) echo ${arg2#$arg1} ;;
638: r|*) echo ${arg1#$arg2} ;;
639: esac
640: }
641: unt()
642: {
643: # XXX pdksh can't seem to deal with locally scoped variables
644: # in ${foo#$bar} expansions
645: arg="{-$-}1"
646: tmp="${arg#[a-zA-Z]*}"
647: tmp="${tmp%*[a-zA-Z]}"
648: while [ "$tmp" != "$arg" ]
649: do
650: arg=$tmp
651: tmp="${arg#[a-zA-Z]*}"
652: tmp="${tmp%*[a-zA-Z]}"
653: done
654: echo $arg
655: }
656: dnl
1.5 todd 657: dnl dodisk(name,unit,blkmaj,chrmaj,unit,off[,stepping])
658: dnl arg: 1 2 3 4 5 6 7
1.1 todd 659: dnl
660: dodisk()
661: {
1.5 todd 662: n=Add(Mult(${5},${7:-16}),${6}) count=0
1.1 todd 663: RMlist="$RMlist {-$-}1{-$-}2? r{-$-}1{-$-}2?"
664: for d in a b c d e f g h i j k l m n o p
665: do
666: M {-$-}1{-$-}2$d b {-$-}3 Add($n,$count) 640
667: M r{-$-}1{-$-}2$d c {-$-}4 Add($n,$count) 640
668: let count=count+1
669: done
670: MKlist="$MKlist;chown root.operator {-$-}1{-$-}2? r{-$-}1{-$-}2?"
671: }
672: dnl
1.5 todd 673: dnl dodisk2(name,unit,blkmaj,chrmaj,unit,off[,stepping])
1.1 todd 674: dnl
675: dnl 1. name - prefix name of the device
676: dnl 2. unit - beginning unit number for block devices
677: dnl 3. blkmaj - block device major number
678: dnl 4. chrmaj - character device major number
679: dnl 5. unit - beginning unit number for character devices
680: dnl 6. off - offset from 0 for all minor numbers (see svnd for an example)
1.5 todd 681: dnl 7. step - optional, defaults to 16, number of partitions per device
1.1 todd 682: dnl
683: dodisk2()
684: {
1.5 todd 685: n=Add(Mult({-$-}5,${7:-16}),{-$-}6)
1.1 todd 686: M {-$-}1{-$-}2a b {-$-}3 $n 640 operator
687: M r{-$-}1{-$-}2a c {-$-}4 $n 640 operator
688: n=Add($n,2)
689: M {-$-}1{-$-}2c b {-$-}3 $n 640 operator
690: M r{-$-}1{-$-}2c c {-$-}4 $n 640 operator
691: }
692:
693: # M name b/c major minor [mode] [group]
694: RMlist="rm -f"
695: MKlist=":"
696: mkl() {
697: dnl
698: dnl uncomment if multi mknod happens
699: dnl
700: ifelse(1,0,
701: [ "${mklist[{-$-}1]}" ] && mklist[{-$-}1]="${mklist[{-$-}1]} {-$-}2 {-$-}3 {-$-}4 {-$-}5" || {
702: mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
703: modes="$modes {-$-}1"
704: },
705: dnl
706: dnl non multi mknod
707: dnl
708: [ "${mklist[{-$-}1]}" ] && {
709: mklist[{-$-}1]="${mklist[{-$-}1]};mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
710: } || {
711: mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
712: modes="$modes {-$-}1"
713: })
714: }
715: M() {
716: RMlist="$RMlist {-$-}1"
717: mkl ${5-666} {-$-}1 {-$-}2 {-$-}3 {-$-}4
718: mklist="$mklist {-$-}1"
719: G={-$-}{6:-wheel}
720: [ "{-$-}7" ] && {
721: MKlist="$MKlist;chown {-$-}7.{-$-}G {-$-}1"
722: } || {
723: case $G in
724: wheel)g=0;;kmem)g=2;;operator)g=5;;tty)g=4;;dialer)g=117;;
725: esac
726: [ "${grplist[$g]}" ] && {
727: grplist[$g]="${grplist[$g]} {-$-}1"
728: } || {
729: groups="$groups $g"
730: grplist[$g]="chgrp $G {-$-}1"
731: }
732: }
733: return 0
734: }
735: divert(7)dnl
736: dnl
737: dnl there is no blank line at the end of etc.arch/MAKEDEV.md files, so add one
738: dnl on the following line:
739:
740: show_devs()dnl
741: dnl
742: divert(9)dnl
743: *)
744: echo $i: unknown device
745: ;;
746: esac
747: done
748: }
749: _recurse "$@"
750: if [ "$os" = "SunOS" ]; then
751: eo=transform
752: transform() {
753: case $mode in
754: 600) mask=077;;
755: 640) mask=027;;
756: 660) mask=007;;
757: 644) mask=022;;
758: 666) mask=0;;
759: 440) mask=227;;
760: esac
761: echo `echo "$@"|sed \
762: 's/mknod -m \([0-9]*\) /umask '$mask';mknod /;s/-m [0-9]* //g;\
763: s/operator/5/g;s/root.kmem/root.2/g;s/root\./root:/g'`
764: }
765: fi
766: list="$RMlist"
767: for mode in $modes; do
768: list="$list;${mklist[$mode]}"
769: done
770: for group in $groups; do
771: list="$list;${grplist[$group]}"
772: done
773: list="$list;$MKlist"
774: if [ "$eo" = "echo" -o "$eo" = "transform" ]; then
775: $eo "$list"
776: else
777: echo "$list" | sh
778: fi
779: divert(3)dnl
780: dnl
781: R() {
782: for i in "$@"
783: do
784: U=`unt $i`
785: [ "$U" ] || U=0
786:
787: case $i in
788: dnl