MAKEDEV.mi revision 1.33
1include(MAKEDEV.sub)dnl
2dnl
3vers(a, {-$OpenBSD: MAKEDEV.mi,v 1.33 2002/02/16 01:19:52 deraadt Exp $-})dnl
4dnl
5divert(1)dnl
6{-#-}
7{-#-} Copyright (c) 2001,2002 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{-#-}
29dnl
30dnl Diversions:  (upon termination, concatenated output queues)
31dnl
32dnl 0 - very top
33dnl 1 - descriptions of devices
34dnl 2 - init of script, function definitions, etc
35dnl 3 - beginning of global recursive R() function
36dnl 7 - body of MAKEDEV, device creations, etc
37dnl 9 - end
38dnl
39dnl HOW TO ADD A DEVICE:
40dnl
41dnl In this file, you must use at least two macros:
42dnl
43dnl  Use '__devitem(uniqueid, name-pattern, description)' to create an entry
44dnl  in the description at the top of the generated MAKEDEV file:
45dnl
46dnl    __devitem(sca, sca*, Sugar Generic device)dnl
47dnl
48dnl  This is ultimately shown as:
49dnl
50dnl    #  sca*   Sugar Generic device
51dnl
52dnl  Use '_mkdev(uniqueid, shell-pattern, {-shell-script-})dnl' to create
53dnl  a shell script fragment used to 'create' the device (be sure to match
54dnl  the uniqueid from above):
55dnl
56dnl    _mkdev(sca, sca*, {-M sca$U c major_sca_c $U
57dnl           M rsca$U b major_sca_b Add($U, 128)-})dnl
58dnl
59dnl  This is ultimately expanded into:
60dnl
61dnl    sca*)  M sca$U c 24 $U
62dnl           M sca$U b 42 $(($U+128));;
63dnl
64dnl In the MAKEDEV.md file, add a '_DEV(uniqueid, charmajor, blockmajor)'
65dnl entry:
66dnl
67dnl   _DEV(sca, 24, 42)
68dnl
69dnl Final step is to add an entry to the 'all' entry below. For a short
70dnl example:
71dnl
72dnl   _mkdev({-all-}, {-all-}, {-dnl
73dnl   _dl({-std-}, {-std-}, {-sca-}, {-sca0 sca1 sca2 sca3-})-})dnl
74dnl
75dnl would expand to:
76dnl
77dnl   all)
78dnl        R std sca0 sca1 sca2 sca3
79dnl        ;;
80dnl
81dnl presuming '_DEV(sca..' and '_DEV(std)' were in the MAKEDEV.md file.
82dnl
83dnl
84dnl Everything is 'automatically' added to 'MAKEDEV' based on whether or
85dnl not the '_DEV()' entry has a corresponding _mkdev() and __devitem()
86dnl entry in MAKEDEV.sub (this file).
87dnl
88dnl Note: be very wary of adding whitespace, carriage returns, or not
89dnl finishing a macro with ')dnl' .. otherwise, extra blank lines show up
90dnl in the output.
91dnl
92dnl TODO:
93dnl
94dnl make a 'disktgt' macro that automatically does:
95dnl disktgt(rd, {-Ramdisk-})
96dnl
97dnl	target(all,rd,0)
98dnl	target(ramd,rd,0)
99dnl	disk_q(rd)
100dnl	__devitem(rd, {-rd*-}, {-Ramdisk-})dnl
101dnl
102dnl
103_mkdev(loc, local, {-test -s $T.local && sh $T.local-})dnl
104dnl
105__devtitle(make, Device "make" file.  Valid arguments)dnl
106__devitem({-all-}, {-all-},
107{-makes all known devices{-,-} including local devices.
108{-#-}		Tries to make the ``standard'' number of each type.-})dnl
109dnl
110dnl 'all' is special.  The 'D'evice 'L'ist (or _dl) macro checks to see if
111dnl a particular devices is in the MAKEDEV.md file, and if so, includes the
112dnl necessary devices.  Otherwise the devices are not included in the 'all'
113dnl target.  Note this keeps line lengths to less than column 70.  For the
114dnl gory details see the definition of '_dl' in MAKEDEV.sub
115dnl
116target(all, mcd, 0)dnl
117twrget(all, fdesc, fd)dnl
118target(all, st, 0, 1)dnl
119target(all, mcd, 0)dnl
120target(all, std)dnl
121target(all, raid, 0, 1, 2, 3)dnl
122target(all, rz, 0, 1, 2, 3, 4)dnl
123target(all, hp, 0, 1, 2, 3)dnl
124target(all, ra, 0, 1, 2, 3)dnl
125target(all, rx, 0, 1)dnl
126target(all, wd, 0, 1, 2, 3)dnl
127target(all, xd, 0, 1, 2, 3)dnl
128twrget(all, aflo, fd, 0, 1, 2, 3)dnl
129target(all, pctr)dnl
130target(all, pctr0)dnl
131target(all, altq)dnl
132target(all, pf)dnl
133twrget(all, cry, crypto)dnl
134target(all, apm)dnl
135twrget(all, tth, ttyh, 0, 1)dnl
136target(all, ttyA, 0, 1)dnl
137target(all, ttyB, 0, 1, 2, 3, 4, 5)dnl
138twrget(all, attyB, ttyB, 0, 1, 2, 3, 4)dnl
139target(all, tty0, 0, 1, 2, 3)dnl
140twrget(all, mac_tty0, tty0, 0, 1)dnl
141twrget(all, tzs, tty, a, b, c, d)dnl
142twrget(all, czs, cua, a, b, c, d)dnl
143target(all, ttyc, 0, 1, 2, 3, 4, 5, 6, 7)dnl
144twrget(all, com, tty0, 0, 1, 2, 3)dnl
145twrget(all, mac_ttye, ttye, 0)dnl
146target(all, ttye, 0, 1, 2, 3, 4, 5, 6)dnl
147target(all, lkm)dnl
148twrget(all, mmcl, mmclock)dnl
149target(all, lpt, 0, 1, 2)dnl
150twrget(all, lpt, lpa, 0, 1, 2)dnl
151target(all, joy, 0, 1)dnl
152target(all, rnd, random)dnl
153target(all, uk, 0)dnl
154target(all, st, 0)dnl
155target(all, wt, 0)dnl
156target(all, wdt, 0)dnl
157twrget(all, au, audio, 0)dnl
158twrget(all, speak, speaker)dnl
159target(all, asc, 0)dnl
160target(all, music, 0)dnl
161target(all, radio, 0)dnl
162target(all, tuner, 0)dnl
163target(all, rmidi, 0, 1, 2, 3, 4, 5, 6, 7)dnl
164target(all, usbs)dnl
165target(all, adb)dnl
166target(all, iop, 0, 1)dnl
167target(all, pci)dnl
168twrget(all, wsmouse, wscons)dnl
169twrget(all, btw, bwtwo, 0)dnl
170twrget(all, ctw, cgtwo, 0)dnl
171twrget(all, ctr, cgthree, 0)dnl
172twrget(all, cfr, cgfour, 0)dnl
173twrget(all, csx, cgsix, 0)dnl
174twrget(all, ceg, cgeight, 0)dnl
175twrget(all, cfo, cgfourteen, 0)dnl
176target(all, tcx, 0)dnl
177twrget(all, grf_mac, grf, 0, 1, 2, 3)dnl
178twrget(all, grf_amiga, grf, 0, 1, 2, 3, 4, 5, 6)dnl
179target(all, par, 0)dnl
180twrget(all, amouse, mouse, 0, 1)dnl
181twrget(all, akbd, kbd)dnl
182target(all, apci, 0)dnl
183target(all, ppi, 0)dnl
184target(all, view0, 0, 1, 2, 3, 4, 5)dnl
185target(all, local)dnl
186dnl
187_mkdev(all, {-all-}, {-dnl
188show_target(all)dnl
189-})dnl
190dnl
191__devitem(ramdisk, ramdisk, devices to be put on install floppies)dnl
192__devitem(std, {-std-}, standard devices)dnl
193dnl
194dnl
195dnl
196dnl _std
197dnl
198dnl $1: tty
199dnl $2: memstuff
200dnl $3: ksyms
201dnl $4: drum
202dnl $5: klog
203dnl
204define({-_std-}, {-dnl
205std)
206	M console	c 0 0 600
207	M tty		c $1 0
208	M mem		c $2 0 640 kmem
209	M kmem		c $2 1 640 kmem
210	M null		c $2 2
211	M zero		c $2 12
212	M stdin		c major_fdesc_c 0
213	M stdout	c major_fdesc_c 1
214	M stderr	c major_fdesc_c 2
215	M ksyms		c $3 0 640 kmem
216	M drum		c $4 0 640 kmem
217	M klog		c $5 0 600-})dnl
218dnl
219target(usb, usb, 0, 1)dnl
220target(usb, urio, 0)dnl
221twrget(usb, uscan, uscanner, 0)dnl
222target(usb, uhid, 0, 1, 2, 3)dnl
223target(usb, ulpt, 0, 1)dnl
224target(usb, ugen, 0, 1)dnl
225target(usb, utty, 0, 1)dnl
226dnl
227__devitem({-usbs-}, usbs, make USB devices)dnl
228_mkdev(usbs, usbs, {-dnl
229show_target({-usb-})dnl
230-})dnl
231__devtitle(tap, Tapes)dnl
232__devitem(wt, {-wt*	-}, QIC-interface (e.g. not SCSI) 3M cartridge tape)dnl
233_mkdev(wt, wt*,
234{-name=wt
235	n=Mult($U, 8) m=Add($n, 4)
236	M $name$U	b major_wt_b $n 640 operator
237	M r$name$U	c major_wt_c $n 640 operator
238	M n$name$U	b major_wt_b $m 640 operator
239	M nr$name$U	c major_wt_c $m 640 operator-})dnl
240__devitem(tz, tz*, {-SCSI tapes{-,-} DEC TK50 cartridge tape-})dnl
241__devitem(st, {-st*-}, SCSI tapes)dnl
242_mkdev(st, st*, {-n=Mult($U, 16)
243	for pre in " " n e en
244	do
245		M ${pre}st$U	b major_st_b $n 660 operator
246		M ${pre}rst$U	c major_st_c $n 660 operator
247		n=Add($n, 1)
248	done-})dnl
249__devitem(ct, ct*, HP300 HP-IB cartridge tape)dnl
250__devitem(mt, mt*, (Magnetic) 9-track reel tape)dnl
251__devitem(ht, ht*, massbus tm03 & tu??)dnl
252__devitem(tm, tm*, unibus tm11 & te10 emulations (e.g. Emulex tc-11))dnl
253__devitem(ts, ts*, unibus ts11)dnl
254__devitem(ut, ut*, unibus tu45 emulations (e.g.si 9700))dnl
255__devtitle(dis, Disks)dnl
256__devitem(rz, rz*, SCSI disks)dnl
257__devitem(sd, {-sd*-}, {-SCSI disks, includes flopticals-})dnl
258__devitem(hd, {-hd*-}, HP300 HP-IB disks)dnl
259__devitem(cd, {-cd*-}, SCSI cdrom drives)dnl
260__devitem(acd, acd*, ATAPI cdrom drives)dnl
261_mkdev(cd, cd*, {-dodisk2 cd $U major_cd_b major_cd_c $U 0{--}ifstep(cd)-})dnl
262__devitem(mcd, mcd*, Mitsumi cdrom drives)dnl
263_mkdev(mcd, mcd*, {-dodisk2 mcd $U major_mcd_b major_mcd_c $U 0{--}ifstep(mcd)dnl
264-})dnl
265__devitem(ch, {-ch*-}, SCSI media changer)dnl
266_mcdev(ch, ch*, ch, {-major_ch_c-}, 660, operator)dnl
267__devitem(uk, uk*, SCSI Unknown device)dnl
268_mcdev(uk, uk*, uk, {-major_uk_c-}, 640, operator)dnl
269__devitem(ss, ss*, SCSI scanners)dnl
270_mkdev(ss, ss*, {-M ss$U c major_ss_c Mult($U,16) 640 operator
271	M nss$U c major_ss_c Add(Mult($U,16),1) 640 operator
272	M enss$U c major_ss_c Add(Mult($U,16),3) 640 operator
273	RMlist="$RMlist scan$U"
274	MKlist="$MKlist;umask 77;ln -s ss$U scan$U"-})dnl
275__devitem(ses, ses*, SES/SAF-TE SCSI devices)dnl
276_mkdev(ses, ses*, {-M ses$U c major_ses_c $U 640 operator-})dnl
277__devitem(ramd, ramdisk, makes all devices for a ramdisk kernel)dnl arc
278_mkdev(ramd, ramdisk, {-dnl
279show_target(ramd)dnl
280-})dnl
281ifelse(MACHINE, mvmeppc, {-dnl
282target(all, ses, 0)dnl
283target(all, ch, 0)dnl
284target(all, ss, 0, 1)dnl
285target(all, xfs, 0)dnl
286twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
287twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
288target(all, pty, 0, 1, 2)dnl
289target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
290target(all, tun, 0, 1, 2, 3)dnl
291target(all, xy, 0, 1, 2, 3)dnl
292target(all, rd, 0)dnl
293target(all, cd, 0, 1)dnl
294target(all, sd, 0, 1, 2, 3, 4)dnl
295target(all, vnd, 0, 1, 2, 3)dnl
296target(all, ccd, 0, 1, 2, 3)dnl
297target(ramd, tty0, 0, 1, 2, 3)dnl
298twrget(ramd, wsdisp, ttyC, 0)dnl
299target(ramd, rd, 0)dnl
300target(ramd, wd, 0, 1, 2, 3)dnl
301target(ramd, sd, 0, 1, 2, 3, 4)dnl
302target(ramd, cd, 0, 1)dnl
303target(ramd, st, 0, 1)dnl
304target(ramd, bpf, 0)dnl
305target(ramd, rd, 0)dnl
306-})dnl
307ifelse(MACHINE, sparc, {-dnl
308target(all, ses, 0)dnl
309target(all, ch, 0)dnl
310target(all, ss, 0, 1)dnl
311target(all, xfs, 0)dnl
312twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
313twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
314target(all, pty, 0, 1, 2)dnl
315target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
316target(all, tun, 0, 1, 2, 3)dnl
317target(all, xy, 0, 1, 2, 3)dnl
318target(all, hk, 0, 1, 2, 3)dnl
319target(all, rd, 0)dnl
320target(all, cd, 0, 1)dnl
321target(all, sd, 0, 1, 2, 3, 4)dnl
322target(all, vnd, 0, 1, 2, 3)dnl
323target(all, ccd, 0, 1, 2, 3)dnl
324target(ramd, fd, 0)dnl
325target(ramd, sd, 0, 1, 2, 3)dnl
326target(ramd, rd, 0)dnl
327target(ramd, cd, 0)dnl
328-})dnl
329ifelse(MACHINE, sparc64, {-dnl
330target(all, ccd, 0, 1, 2, 3)dnl
331target(all, ses, 0)dnl
332target(all, ch, 0)dnl
333target(all, ss, 0, 1)dnl
334target(all, xfs, 0)dnl
335twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
336twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
337target(all, pty, 0, 1, 2)dnl
338target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
339target(all, tun, 0, 1, 2, 3)dnl
340target(all, xy, 0, 1, 2, 3)dnl
341target(all, rd, 0)dnl
342target(all, cd, 0, 1)dnl
343target(all, sd, 0, 1, 2, 3, 4)dnl
344target(all, vnd, 0, 1, 2, 3)dnl
345target(ramd, fd, 0)dnl
346target(ramd, rd, 0)dnl
347target(ramd, sd, 0, 1, 2, 3)dnl
348target(ramd, wd, 0, 1, 2, 3)dnl
349target(ramd, cd, 0, 1)dnl
350target(ramd, st, 0, 1)dnl
351target(ramd, bpf, 0)dnl
352twrget(all, s64_tzs, tty, a, b, c, d)dnl
353twrget(all, s64_czs, cua, a, b, c, d)dnl
354__devitem(s64_tzs, tty[a-z]*, Zilog 8530 Serial Port)dnl
355__devitem(s64_czs, cua[a-z]*, Zilog 8530 Serial Port)dnl
356_mkdev(s64_tzs, {-tty[a-z]-}, {-u=${i#tty*}
357	case $u in
358	a) n=0 ;;
359	b) n=1 ;;
360	c) n=2 ;;
361	d) n=3 ;;
362	*) echo unknown tty device $i ;;
363	esac
364	M tty$u c major_s64_tzs_c $n 660 dialer uucp-})dnl
365_mkdev(s64_czs, cua[a-z], {-u=${i#cua*}
366	case $u in
367	a) n=0 ;;
368	b) n=1 ;;
369	c) n=2 ;;
370	d) n=3 ;;
371	*) echo unknown cua device $i ;;  
372	esac
373	M cua$u c major_s64_czs_c Add($n, 128) 660 dialer uucp-})dnl
374-})dnl
375ifelse(MACHINE, i386, {-dnl
376target(all, ses, 0)dnl
377target(all, ch, 0)dnl
378target(all, ss, 0, 1)dnl
379target(all, xfs, 0)dnl
380twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
381twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
382target(all, pty, 0, 1, 2)dnl
383target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
384target(all, tun, 0, 1, 2, 3)dnl
385target(all, xy, 0, 1, 2, 3)dnl
386target(all, rd, 0)dnl
387target(all, cd, 0, 1)dnl
388target(all, sd, 0, 1, 2, 3, 4)dnl
389target(all, vnd, 0, 1, 2, 3)dnl
390target(all, ccd, 0, 1, 2, 3)dnl
391target(ramd, tty0, 0, 1, 2, 3)dnl
392twrget(ramd, wsdisp, ttyC, 0)dnl
393target(ramd, wt, 0)dnl
394target(ramd, fd, 0)dnl
395target(ramd, rd, 0)dnl
396target(ramd, wd, 0, 1, 2, 3)dnl
397target(ramd, sd, 0, 1, 2, 3)dnl
398target(ramd, cd, 0, 1)dnl
399target(ramd, st, 0, 1)dnl
400target(ramd, mcd, 0)dnl
401-})dnl
402ifelse(MACHINE, alpha, {-dnl
403target(all, ses, 0)dnl
404target(all, ch, 0)dnl
405target(all, ss, 0, 1)dnl
406target(all, xfs, 0)dnl
407twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
408twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
409target(all, pty, 0, 1, 2)dnl
410target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
411target(all, tun, 0, 1, 2, 3)dnl
412target(all, xy, 0, 1, 2, 3)dnl
413target(all, rd, 0)dnl
414target(all, cd, 0, 1)dnl
415target(all, sd, 0, 1, 2, 3, 4)dnl
416target(all, vnd, 0, 1, 2, 3)dnl
417target(all, ccd, 0, 1, 2, 3)dnl
418target(ramd, sd, 0, 1, 2)dnl
419target(ramd, wd, 0)dnl
420target(ramd, tty0, 0, 1)dnl
421target(ramd, st, 0)dnl
422target(ramd, cd, 0)dnl
423target(ramd, ttyB, 0, 1)dnl
424target(ramd, ttyE, 0, 1)dnl
425-})dnl
426ifelse(MACHINE, amiga, {-dnl
427target(all, ses, 0)dnl
428target(all, ch, 0)dnl
429target(all, ss, 0, 1)dnl
430target(all, xfs, 0)dnl
431twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
432twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
433target(all, pty, 0, 1, 2)dnl
434target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
435target(all, tun, 0, 1, 2, 3)dnl
436target(all, xy, 0, 1, 2, 3)dnl
437target(all, rd, 0)dnl
438target(all, cd, 0, 1)dnl
439target(all, sd, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
440target(all, vnd, 0, 1, 2, 3)dnl
441target(all, ccd, 0, 1, 2, 3)dnl
442target(ramd, kbd)dnl
443target(ramd, pty, 0)dnl
444target(ramd, tty0, 0)dnl
445target(ramd, ttyA, 0, 1)dnl
446target(ramd, ttyB, 0, 1)dnl
447target(ramd, ttye, 0, 1, 2, 3, 4, 5, 6)dnl
448target(ramd, cd, 0, 1)dnl
449target(ramd, sd, 0, 1, 2, 3)dnl
450target(ramd, st, 0, 1)dnl
451target(ramd, fd, 0, 1)dnl
452target(ramd, wd, 0, 1)dnl
453target(ramd, rd, 0)dnl
454-})dnl
455ifelse(MACHINE, hp300, {-dnl
456target(all, ses, 0)dnl
457target(all, ch, 0)dnl
458target(all, ss, 0, 1)dnl
459target(all, xfs, 0)dnl
460twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
461twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
462target(all, pty, 0, 1, 2)dnl
463target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
464target(all, tun, 0, 1, 2, 3)dnl
465target(all, xy, 0, 1, 2, 3)dnl
466target(all, rd, 0)dnl
467target(all, cd, 0, 1)dnl
468target(all, sd, 0, 1, 2, 3, 4)dnl
469target(all, vnd, 0, 1, 2, 3)dnl
470_mkdev(st_hp300, ct*|mt*|st*,
471{-case $i in
472	ct*) name=ct blk=major_ct_b chr=major_ct_c;;
473	mt*) name=mt blk=major_mt_b chr=major_mt_c;;
474	st*) name=st blk=major_st_hp300_b chr=major_st_hp300_c;;
475	esac
476	case $U in
477	[0-7])
478		four=Add($U, 4) eight=Add($U, 8)
479		twelve=Add($U, 12) twenty=Add($U, 20)
480		M r$name$U	c $chr $U 660 operator
481		M r$name$four	c $chr $four 660 operator
482		M r$name$eight	c $chr $eight 660 operator
483		M r$name$twelve	c $chr $twelve 660 operator
484		MKlist="$MKlist;ln r$name$four nr$name$U";: sanity w/pdp11 v7
485		MKlist="$MKlist;ln r$name$twelve nr$name$eight";: ditto
486		RMlist="$RMlist nr$name$U nr$name$eight"
487		;;
488	*)
489		echo bad unit for tape in: $1
490		;;
491	esac-})dnl
492__devitem(st_hp300, st*, Exabyte tape)dnl
493__devitem(grf, grf*, raw interface to HP300 graphics devices)dnl
494target(all, ccd, 0, 1, 2, 3)dnl
495target( all, grf, 0)dnl
496dnl XXX target( all, hil, 0, 1, 2, 3, 4, 5, 6, 7)dnl
497target( all, hil, )dnl
498twrget( all, st_hp300, st, 0, 1)dnl
499target( all, dca, 0, 1)dnl
500target( all, dcm, 0, 1, 2, 3)dnl
501target( all, hd, 0, 1, 2)dnl
502target( all, ct, 0, 1)dnl
503target( all, ite, 0)dnl
504target(ramd, ct, 0, 1)dnl
505target(ramd, hd, 0, 1, 2)dnl
506target(ramd, sd, 0, 1, 2)dnl
507target(ramd, rd, 0, 1)dnl
508target(ramd, pty, 0)dnl
509target(ramd, hil, )dnl
510target(ramd, grf, 0)dnl
511target(ramd, apci, 0)dnl
512target(ramd, ite, 0)dnl
513target(ramd, dca, 0)dnl
514target(ramd, dcm, 0, 1)dnl
515target(ramd, bpf, 0, 1)dnl
516target(ramd, tun, 0, 1)dnl
517-})dnl
518ifelse(MACHINE, hppa, {-dnl
519target(all, ses, 0)dnl
520target(all, ch, 0)dnl
521target(all, ss, 0, 1)dnl
522target(all, xfs, 0)dnl
523twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
524twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
525target(all, pty, 0, 1, 2)dnl
526target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
527target(all, tun, 0, 1, 2, 3)dnl
528target(all, xy, 0, 1, 2, 3)dnl
529target(all, rd, 0)dnl
530target(all, cd, 0, 1)dnl
531target(all, sd, 0, 1, 2, 3, 4)dnl
532target(all, vnd, 0, 1, 2, 3)dnl
533target(all, ccd, 0, 1, 2, 3)dnl
534target(ramd, st, 0, 1)dnl
535target(ramd, sd, 0, 1, 2, 3)dnl
536target(ramd, rd, 0, 1)dnl
537target(ramd, pty, 0)dnl
538target(ramd, hil)dnl
539target(ramd, com, 0, 1)dnl
540target(ramd, bpf, 0, 1)dnl
541target(ramd, tun, 0, 1)dnl
542-})dnl
543ifelse(MACHINE, mac68k, {-dnl
544target(all, ses, 0)dnl
545target(all, sd, 0, 1, 2, 3, 4)dnl
546target(all, vnd, 0, 1, 2, 3)dnl
547target(all, ch, 0)dnl
548target(all, ss, 0, 1)dnl
549target(all, xfs, 0)dnl
550twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
551twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
552target(all, pty, 0, 1, 2)dnl
553target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
554target(all, tun, 0, 1, 2, 3)dnl
555target(all, xy, 0, 1, 2, 3)dnl
556target(all, rd, 0)dnl
557target(all, cd, 0, 1)dnl
558target(all, ccd, 0, 1, 2, 3)dnl
559target(ramd, sd, 0, 1, 2, 3)dnl
560target(ramd, st, 0, 1)dnl
561target(ramd, adb)dnl
562target(ramd, asc, 0)dnl
563target(ramd, grf, 0, 1)dnl
564target(ramd, ttye, 0)dnl
565twrget(ramd, mac_tty0, tty0, 0, 1)dnl
566target(ramd, pty, 0)dnl
567-})dnl
568ifelse(MACHINE, macppc, {-dnl
569target(all, ses, 0)dnl
570target(all, ch, 0)dnl
571target(all, ss, 0, 1)dnl
572target(all, xfs, 0)dnl
573twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
574twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
575target(all, pty, 0, 1, 2)dnl
576target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
577target(all, tun, 0, 1, 2, 3)dnl
578target(all, xy, 0, 1, 2, 3)dnl
579target(all, rd, 0)dnl
580target(all, cd, 0, 1)dnl
581target(all, sd, 0, 1, 2, 3, 4)dnl
582target(all, vnd, 0, 1, 2, 3)dnl
583target(all, ccd, 0, 1, 2, 3)dnl
584target(ramd, sd, 0, 1, 2, 3, 4)dnl
585target(ramd, wd, 0, 1, 2, 3, 4)dnl
586target(ramd, st, 0, 1)dnl
587target(ramd, cd, 0, 1)dnl)dnl
588target(ramd, rd, 0)dnl
589target(ramd, ttyE, 0)dnl
590target(ramd, tty0, 0, 1)dnl
591target(ramd, pty, 0)dnl
592-})dnl
593ifelse(MACHINE, sun3, {-
594target(all, ses, 0)dnl
595target(all, ch, 0)dnl
596target(all, ss, 0, 1)dnl
597target(all, xfs, 0)dnl
598twrget(all, flo, fd, 0, 0B, 0C, 0D, 0E, 0F, 0G, 0H)dnl
599twrget(all, flo, fd, 1, 1B, 1C, 1D, 1E, 1F, 1G, 1H)dnl
600target(all, pty, 0, 1, 2)dnl
601target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9)dnl
602target(all, tun, 0, 1, 2, 3)dnl
603target(all, xy, 0, 1, 2, 3)dnl
604target(all, hk, 0, 1, 2, 3)dnl
605target(all, rd, 0)dnl
606target(all, cd, 0, 1)dnl
607target(all, sd, 0, 1, 2, 3, 4)dnl
608target(all, vnd, 0, 1, 2, 3)dnl
609target(all, ccd, 0, 1, 2, 3)dnl
610-})dnl
611ifelse(MACHINE, vax, {-
612dnl target(all, ses, 0)dnl
613dnl target(all, ut, 0)dnl
614dnl target(all, ch, 0)dnl
615target(all, ss, 0)dnl
616dnl target(all, xfs, 0)dnl
617target(all, pty, 0, 1)dnl
618target(all, bpf, 0, 1, 2, 3, 4, 5, 6, 7)dnl
619target(all, tun, 0, 1)dnl
620dnl target(all, xy, 0, 1, 2, 3)dnl
621dnl target(all, hk, 0, 1, 2, 3)dnl
622dnl target(all, up, 0, 1, 2, 3)dnl
623dnl target(all, rd, 0)dnl
624target(all, cd, 0)dnl
625target(all, sd, 0, 1, 2, 3)dnl
626target(all, vnd, 0)dnl
627__devitem(dhu, dhu*, unibus dhu11)dnl
628__devitem(dmz, dmz*, unibus dmz32)dnl
629__devitem(dmf, dmf*, unibus dmf32)dnl
630__devitem(dh, dh*, {-unibus dh11 and emulations (e.g. Able dmax, Emulex cs-11)-})
631__devitem(vt, vt*, {-console-})dnl
632__devitem(dz, dz*, unibus dz11 and dz32)dnl
633__devitem(dl, dl*, unibus dl11)dnl
634_mkdev(dz, dz*,
635{-case $U in
636       [0-7])
637	       i=0
638	       while [ $i -lt 8 ]; do
639		       no=Add(Mult($U, 8), $i)
640		       if [ $no -lt 10 ]; then
641			       no="0${no}"
642		       fi
643		       M tty${no} c 1 $no 600
644		       let i=i+1
645	       done
646	       ;;
647	*)
648	       echo bad unit for dz in: $i
649	       ;;
650       esac-})dnl
651dnl XXX split this up abit?
652_mkdev(dhu, dhu*|dmz*|dmf*|dh*|vt*,
653{-set -A cnvtbl 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 r s t u v
654	case $i in
655	vt*)    name=vt; major=68; count=8;
656		case $U in
657		0) ch=w ;;
658		*) echo bad unit for $name in: $i ;;
659		esac;;
660	dmz*)   name=dmz; major=37; count=24;
661		case $U in
662		0) ch=a ;; 1) ch=b ;; 2) ch=c ;; 3) ch=e ;; 4) ch=f ;;
663		*) echo bad unit for $name in: $i ;;
664		esac;;
665	dmf*)   name=dmf; major=22; count=8;
666		case $U in
667		0) ch=A ;; 1) ch=B ;; 2) ch=C ;; 3) ch=E ;;
668		4) ch=F ;; 5) ch=G ;; 6) ch=H ;; 7) ch=I ;;
669		*) echo bad unit for $name in: $i ;;
670		esac;;
671	dhu*)   name=dhu; major=34; count=16;
672		case $U in
673		0) ch=S ;; 1) ch=T ;; 2) ch=U ;; 3) ch=V ;;
674		4) ch=W ;; 5) ch=X ;; 6) ch=Y ;; 7) ch=Z ;;
675		*) echo bad unit for $name in: $i ;;
676		esac;;
677	dh*)    name=dh; major=12; count=16;
678		case $U in
679		0) ch=h ;; 1) ch=i ;; 2) ch=j ;; 3) ch=k ;;
680		4) ch=l ;; 5) ch=m ;; 6) ch=n ;; 7) ch=o ;;
681		*) echo bad unit for $name in: $i ;;
682		esac;;
683	esac
684	i=0
685	while [ $i -lt $count ]; do
686		let=${cnvtbl[$i]}
687		if [ -n "$let" ] ;then
688			M tty${ch}${let} c $major Add(Mult($U, $count), $i) 600
689		else
690			echo bad count for ${name}: $U, $count, $i
691		fi
692		let i=i+1
693	done
694	;;
695
696dl*)
697	major=66
698	let=${cnvtbl[$U]}
699	if [ -n "$let" ] ;then
700		M ttyJ${let} c $major $U 600
701	else
702		echo bad number for ${name}: $U
703	fi-})dnl
704dnl
705target( all, ccd, 0)dnl
706target( all, hd, 0, 1, 2)dnl
707target( all, mt, 0, 1)dnl
708target( all, ts, 0, 1)dnl
709target( all, uu, 0)dnl
710target( all, st, 0, 1)dnl
711target( all, dhu, 0)dnl
712dnl target( all, dmz, 0)dnl
713dnl target( all, dmf, 0)dnl
714dnl target( all, dh, 0)dnl
715target( all, dz, 0)dnl
716target( all, dl, 0)dnl
717target( all, vt, 0)dnl
718target(ramd, fd, 0)dnl
719target(ramd, sd, 0, 1, 2, 3)dnl
720target(ramd, rd, 0)dnl
721target(ramd, cd, 0)dnl
722target(ramd, bpf, 0)dnl
723-})dnl
724target(ramd, std)dnl
725target(ramd, random)dnl
726target(ramd, bpf, 0)dnl
727__devitem(rd, {-rd*-}, "ramdisk" pseudo-disks)dnl
728_mkdev(rd, rd*, {-dodisk2 rd $U major_rd_b major_rd_c $U 0{--}ifstep(rd)-})dnl
729__devitem(xd, xd*, Xylogic 753/7053 disks)dnl
730__devitem(xy, xy*, {-	Xylogic 450/451 disks-})dnl
731__devitem(flo, {-fd*-}, {-Floppy disk drives (3 1/2"{-,-} 5 1/4")-})dnl
732_mkdev(flo, fd*,
733{-typnam=$U${i#fd[01]*}
734	case $typnam in
735	0|1)	typnum=0;; # no type specified, assume A
736	*A)	typnum=0; typnam=0;;
737	*B)	typnum=1;;
738	*C)	typnum=2;;
739	*D)	typnum=3;;
740	*E)	typnum=4;;
741	*F)	typnum=5;;
742	*G)	typnum=6;;
743	*H)	typnum=7;;
744	*)	echo bad type $typnam for $i; exit 1;;
745	esac
746	case $U in
747	0|1)	blk=major_flo_b; chr=major_flo_c;;
748	*)	echo bad unit $U for $i; exit 1;;
749	esac
750	nam=fd${typnam}
751	n=Add(Mult($U, 128), Mult($typnum, 16))
752	M ${nam}a	b $blk $n 640 operator
753	M ${nam}b	b $blk Add($n, 1) 640 operator
754	M ${nam}c	b $blk Add($n, 2) 640 operator
755	M r${nam}a	c $chr $n 640 operator
756	M r${nam}b	c $chr Add($n, 1) 640 operator
757	M r${nam}c	c $chr Add($n, 2) 640 operator-}, 664)dnl
758__devitem(aflo, ramdisk, devices needed for install floppies)dnl
759_mkdev(aflo, fd*, {-case $U in 0|1|2|3)
760	M fd${U}a b major_aflo_b Mult($U, 16) 640 operator
761	M fd${U}b b major_aflo_b Add(Mult($U, 16), 1) 640 operator
762	M rfd${U}a c major_aflo_c Mult($U, 16) 640 operator
763	M rfd${U}b c major_aflo_c Add(Mult($U, 16), 1) 640 operator;;
764	*) echo bad unit for floppy disk in: $i;;
765	esac-})dnl
766__devitem(iop, iop*, I2O controller device)dnl
767_mcdev(iop, iop*, iop, {-major_iop_c-}, 660)dnl
768__devitem(wdt, wdt0, watchdog timer)dnl
769_mcdev(wdt, wdt0, wdt, {-major_wdt_c-}, 440, operator)dnl
770__devitem(local, local, configuration specific devices)dnl
771__devitem(wd, {-wd*-}, {-"winchester" disk drives (ST506, IDE, ESDI, RLL, ...)-})dnl
772__devitem(ccd, ccd*, concatenated disk devices)dnl
773__devitem(raid, raid*, RAIDframe disk devices)dnl
774__devitem(vnd, vnd*, "file" pseudo-disks)dnl
775_mkdev(vnd, vnd*, {-dodisk vnd $U major_vnd_b major_vnd_c $U 0{--}ifstep(vnd)
776	dodisk svnd $U major_vnd_b major_vnd_c $U 128{--}ifstep(vnd)-})dnl
777__devitem(ra, ra*, {-MSCP disks (ra??, hd??)-})dnl
778__devitem(hp, hp*, {-massbuss rm??-})dnl
779__devitem(hk, hk*, {-unibus rk06 and rk07-})dnl
780__devitem(up, up*, {-other unibus devices (e.g. on Emulex sc-21v controller)-})dnl
781__devitem(rb, rb*, {-730 idc w/ rb80 and/or rb02-})dnl
782__devitem(rx, rx*, {-MSCP floppy disk (rx33/50/...)-})dnl
783__devitem(rl, rl*, {-unibus r102-})dnl
784__devitem(hd, hd*, {-HDC9224 hd disks on VS2000-})dnl
785dnl
786dnl For normal disk devices, add a disk_q entry; anything else define like
787dnl the rest (such as vnd above).
788dnl
789disk_q({-ccd-})dnl
790disk_q({-hd-})dnl
791disk_q({-hk-})dnl
792disk_q({-hp-})dnl
793disk_q({-ra-})dnl
794disk_q({-raid-})dnl
795disk_q({-rb-})dnl
796disk_q({-rl-})dnl
797disk_q({-rx-})dnl
798disk_q({-sd-})dnl
799disk_q({-xy-})dnl
800disk_q({-xd-})dnl
801disk_q({-up-})dnl
802disk_q({-wd-})dnl
803disk_q({-rz-})dnl
804dnl
805__devitem(loc, local, configuration specific devices)dnl
806_mkdev(loc, local, {-test -s $T.local && sh $T.local-})dnl
807_mkdev({-disks-}, {-undefine({-C_ase-})show_disks()undefine({-C_ase-})-},
808{-case $i in
809show_disks2()dnl
810	esac-})dnl
811__mkdev({-disks-}){--}dnl
812dnl
813__devtitle(cons, Console ports)dnl
814__devitem(ttyv0, ttyv0, pccons or pcvt screen 0)dnl
815__devitem(ttyv, ttyv*, pcvt)dnl
816__devitem(ttye, ttye*, ite bitmapped consoles)dnl
817__devitem(mac_ttye, ttye*, ite bitmapped consoles)dnl
818__devitem(wscons, ttyC0, wscons screen 0)dnl
819_mkdev({-wscons-}, {-wscons-}, {-dnl
820_dl(dnl
821{-wscons-}, {-ttyCcfg-},
822{-wsdisp-}, {-ttyC0 ttyC1 ttyC2 ttyC3 ttyC4 ttyC5 ttyC6 ttyC7 ttyC8 ttyC9-},
823{-wsdisp-}, {-ttyCa ttyCb-},
824{-wsmux-}, {-wsmux-},
825{-wskbd-}, {-wskbd0 wskbd1 wskbd2 wskbd3-},
826{-wsmouse-}, {-wsmouse0 wsmouse1 wsmouse2 wsmouse3-})-})dnl
827__devitem(wsdisp, ttyC*, wscons virtual consoles)dnl
828_mkdev({-wsdisp-}, ttyC*, {-U=${i##ttyC}
829	case $U in
830	[0-9a-f]) M ttyC$U c major_wsdisp_c {-$(( 16#$U ))-} 600;;
831	cfg) M ttyCcfg c major_wsdisp_c 255 600;;
832	*) echo bad unit $U for $i; exit 1;;
833	esac-})dnl
834__devitem(wskbd, wskbd*, wscons keyboards)dnl
835_mkdev(wskbd, wskbd*, {-M wskbd$U c major_wskbd_c $U 600-})dnl
836__devitem(wsmux, wsmux, wscons keyboard/mouse mux devices)dnl
837_mkdev(wsmux, wsmux|wsmouse|wskbd, {-M wsmouse c major_wsmux_c 0 600
838	M wskbd c major_wsmux_c 1 600-})dnl
839__devitem(pcons, console, PROM console)dnl
840__devtitle(point, Pointing devices)dnl
841__devitem(wsmouse, wsmouse*, wscons mice)dnl
842_mkdev(wsmouse, wsmouse*, {-M wsmouse$U c major_wsmouse_c $U 600-})dnl
843__devitem(quad, quadmouse, "quadrature mouse")dnl
844__devtitle(pty, Pseudo terminals)dnl
845__devitem(tty, tty*, set of 16 slave psuedo terminals)dnl
846__devitem(pty, pty*, set of 16 master pseudo terminals)dnl
847_mkdev(pty, pty*, {-if [ $U -gt 15 ]; then
848		echo bad unit for pty in: $i
849		continue
850	fi
851	set -A tbl p q r s t u v w x y z P Q R S T
852	name=${tbl[$U]}
853	n=0
854	while [ $n -lt 16 ]
855	do
856		nam=$name$(hex $n)
857		off=Mult($U, 16)
858		M tty$nam c major_tty_c Add($off, $n)
859		M pty$nam c major_pty_c Add($off, $n)
860		n=Add($n, 1)
861	done-})dnl
862__devitem(dc, dc*, {-4 channel serial interface (keyboard{-,-} mouse{-,-}modem{-,-} printer)-})dnl
863__devtitle(prn, Printers)dnl
864__devitem(par, par*, motherboard parallel port)dnl
865__devitem(lpt, lpt*, IEEE 1284 centronics printer)dnl
866_mkdev(lpt, lpt*|lpa*,
867{-case $i in
868	lpt*) n=lpt f=0;;
869	lpa*) n=lpa f=128;;
870	esac
871	M $n$U c major_lpt_c Add($U, $f) 600-})dnl
872__devitem(lpa, lpa*, interruptless lp)dnl
873__devitem(ppi, ppi*, HP-IB plotters)dnl
874__devtitle({-usb-}, USB devices)dnl
875__devitem({-usb-}, usb*, Bus control devices used by usbd for attach/detach)dnl
876_mkdev({-usb-}, usb*, {-[ "$i" = "usb" ] && u= || u=$U
877	M usb$u c major_usb_c $U 660-})dnl
878__devitem(uhid, uhid*, Generic HID devices)dnl
879_mcdev({-uhid-}, uhid*, {-uhid-}, {-major_uhid_c-}, 660)dnl
880__devitem(ulpt, ulpt*, Printer devices)dnl
881_mcdev({-ulpt-}, ulpt*, {-ulpt-}, {-major_ulpt_c-}, 660)dnl
882__devitem(utty, utty*, Serial ports)dnl
883_mcdev({-utty-}, utty*, {-utty-}, {-major_utty_c-}, 660)dnl
884__devitem(urio, urio*, Diamond Multimedia Rio 500)dnl
885_mcdev({-urio-}, urio*, {-urio-}, {-major_urio_c-}, 660)dnl
886__devitem(uscan, uscanner*, Scanners)dnl
887_mcdev({-uscan-}, uscanner*, {-uscanner-}, {-major_uscan_c-}, 660)dnl
888__devitem(ugen, ugen*, Generic device)dnl
889_mkdev(ugen, ugen*, {-n=Mult($U, 16)
890	for j in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
891	do
892		M ugen$U.$j c major_ugen_c Add($n, $j) 660
893	done-})dnl
894__devtitle(cpu, Cpus)dnl
895__devitem(cpu, cpu*, cpus)dnl
896__devtitle(call, Call units)dnl
897__devtitle(term, Terminal ports)dnl
898__devtitle(termp, Terminal multiplexers)dnl
899__devitem(dca, dca*, HP200/300 single port serial interface)dnl
900__devitem(dcm, dcm*, HP200/300 4 port serial mux interface)dnl
901__devitem(apci, apci*, HP400 4 port serial mux interface)dnl
902__devitem({-com-}, {-tty0*-}, NS16x50 serial ports)dnl
903_mkdev(com, {-tty0*-}, {-M tty$U c major_com_c $U 660 dialer uucp
904	M cua$U c major_com_c Add($U, 128) 660 dialer uucp-})dnl
905__devitem(ttyc, ttyc*, Cyclades serial ports)dnl
906__devitem(tzs, tty[a-z]*, Zilog 8530 Serial Port)dnl
907_mkdev(tzs, {-tty[a-z]-}, {-u=${i#tty*}
908	case $u in
909	a) n=0 ;;
910	b) n=1 ;;
911	c) n=4 ;;
912	d) n=5 ;;
913	*) echo unknown tty device $i ;;
914	esac
915	M tty$u c major_tzs_c $n 660 dialer uucp-})dnl
916__devitem(tth, ttyh*, Sab82532 serial devices)dnl
917_mkdev(tth, ttyh*, {-M ttyh$U c major_tth_c $U 660 dialer uucp-})dnl
918__devitem(czs, cua[a-z]*, Zilog 8530 Serial Port)dnl
919_mkdev(czs, cua[a-z], {-u=${i#cua*}
920	case $u in
921	a) n=0 ;;
922	b) n=1 ;;
923	c) n=4 ;;
924	d) n=5 ;;
925	*) echo unknown cua device $i ;;  
926	esac
927	M cua$u c major_czs_c Add($n, 128) 660 dialer uucp-})dnl
928__devitem(arm_tty, tty*, {-alias for PC COM ports{-,-} this is what the system really wants-})dnl
929__devitem(tty0, tty00, standard serial port)dnl
930__devitem(mac_tty0, tty00, standard serial port)dnl
931__devitem(ttyA, ttyA*, mfc serial ports)dnl
932__devitem(attyB, ttyB*, ISA COM ports)dnl  amiga
933__devitem(ttyz, tty[a-d], onboard zs serial ports)dnl
934__devitem(cuaz, cua[a-d], onboard zs serial ports)dnl
935__devitem(ttyB, ttyB?, DEC 3000 ZS8530 ("scc") serial ports)dnl
936__devitem(scc, scc*, 82530 serial interface)dnl
937__devitem(arc_ttyC, ttyC0, pccons)dnl
938__devitem(i386_ttyC, ttyC*, pcvt)dnl
939__devitem(ttyC, ttyC?, {-AlphaStation NS16550 ("com serial ports")-})dnl
940__devitem(ttyE, ttyE?, Workstation console (framebuffer & keyboard) tty emulators)dnl
941__devitem(ser02, ser02, {-serial2 port (channel A on 8530)-})dnl
942__devitem(mdm02, mdm02, {-modem2 port (channel B on 8530)-})dnl
943__devtitle(spec, Special purpose devices)dnl
944__devitem(apm, apm	, power management device)dnl
945_mkdev(apm, apm*, {-M apm	c major_apm_c 0 644
946	M apmctl	c major_apm_c 8 644-})dnl
947__devitem(pcmcia, pcmcia*, PCMCIA card drivers)dnl
948__devitem(pctr, pctr*, PC Performance Tuning Register access device)dnl
949_mkdev(pctr, pctr, {-M pctr c major_pctr_c 0 644-})dnl
950__devitem(au, audio*, audio device)dnl
951_mkdev(au, audio*, {-M sound$U	c major_au_c $U
952	M mixer$U	c major_au_c Add($U, 16)
953	M audio$U	c major_au_c Add($U, 128)
954	M audioctl$U	c major_au_c Add($U, 192)
955	MKlist="$MKlist;[ -e audio ] || ln -s audio$U audio"
956	MKlist="$MKlist;[ -e mixer ] || ln -s mixer$U mixer"
957	MKlist="$MKlist;[ -e sound ] || ln -s sound$U sound"
958	MKlist="$MKlist;[ -e audioctl ] || ln -s audioctl$U audioctl"-})dnl
959__devitem(asc, asc*, ASC Audio device)dnl
960_mkdev(asc, asc*, {-M asc$U major_asc_c 0-})dnl
961__devitem(music, music*, midi devices)dnl
962_mkdev(music, music*, {-M music$U     c major_music_c $U
963	M sequencer$U c major_music_c Add($U, 128)
964	MKlist="$MKlist;[ -e music ] || ln -s music$U music"
965	MKlist="$MKlist;[ -e sequencer ] || ln -s sequencer$U sequencer"-})dnl
966__devitem(radio, radio*, FM tuner device)dnl
967_mkdev(radio, radio*, {-M radio$U     c major_radio_c $U
968	MKlist="$MKlist;[ -e radio ] || ln -s radio$U radio"-})dnl
969__devitem(fdesc, fd, makes fd/* for the fdescfs)dnl
970_mkdev(fdesc, fd, {-RMlist="mkdir -p fd;$RMlist" n=0
971	while [ $n -lt 64 ];do M fd/$n c major_fdesc_c $n;n=Add($n, 1);done
972	MKlist="$MKlist;chmod 555 fd"-})dnl
973__devtitle(graph, Graphics devices)dnl
974__devitem(grf_mac, grf*, {-custom chip (grf0){-,-} Retina Z2/Z3 (grf1/grf2){-,-}
975{-#-}		Cirrus boards (grf3){-,-} A2410 (grf4) video or
976{-#-}		CyberVision 64 (grf5)-})dnl
977__devitem(grf_amiga, grf*, {-Motherboard bitmapped video.-})dnl
978__devitem(ite, ite*, terminal emulator interface to HP300 graphics devices)dnl
979__devitem({-hil-}, {-hil-}, HP300 HIL input devices)dnl
980__devitem(oppr, openprom)dnl
981_cdev(oppr, openprom, 70, 0)dnl
982__devitem(btw, bwtwo*)dnl
983_mcdev(btw, bwtwo*, bwtwo, {-major_btw_c-}, 666)dnl
984__devitem(ctw, cgtwo*)dnl
985_mcdev(ctw, cgtwo*, cgtwo, {-major_ctw_c-}, 666)dnl
986__devitem(ctr, cgthree*)dnl
987_mcdev(ctr, cgthree*, cgthree, {-major_ctr_c-}, 666)dnl
988__devitem(cfr, cgfour*)dnl
989_mcdev(cfr, cgfour*, cgfour, {-major_cfr_c-}, 666)dnl
990__devitem(csx, cgsix*)dnl
991_mcdev(csx, cgsix*, cgsix, {-major_csx_c-}, 666)dnl
992__devitem(ceg, cgeight*)dnl
993_mcdev(ceg, cgeight*, cgeight, {-major_ceg_c-}, 666)dnl
994__devitem(cfo, cgfourteen*)dnl
995_mcdev(cfo, cgfourteen*, cgfourteen, {-major_cfo_c-})dnl
996__devitem(tcx, tcx*)dnl
997_mcdev(tcx, tcx*, tcx, {-major_tcx_c-})dnl
998__devitem(cry, crypto, hardware crypto access driver)dnl
999_mkdev(cry, crypto, {-M crypto c major_cry_c-} 0)dnl
1000__devitem(pf, pf*, Packet Filter)dnl
1001_mkdev(pf, {-pf*-}, {-M pf c major_pf_c 0 600-})dnl
1002__devitem(bpf, bpf*, Berkeley Packet Filter)dnl
1003_mkdev(bpf, {-bpf*-}, {-M bpf$U c major_bpf_c $U 600-}, 600)dnl
1004_mkdev(tun, {-tun*-}, {-M tun$U c major_tun_c $U 600-}, 600)dnl
1005__devitem(altq, altq/, ALTQ control interface)dnl
1006_mkdev(altq, altq, {-RMlist="mkdir -p altq;$RMlist"
1007	for d in altq cbq wfq afm fifoq red rio localq hfsc cdnr blue priq; do
1008		M altq/$d c major_altq_c $U 644
1009		U=Add($U, 1)
1010	done-})dnl
1011__devitem(speak, speaker, pc speaker)dnl
1012_mkdev(speak, speaker, {-M speaker c major_speak_c 0 600-})dnl
1013__devitem(kbd, kbd, keyboard (provides events, for X11))dnl
1014_cdev(kbd, kbd, {-major_kbd_c-}, 0, 600)dnl
1015__devitem(kbd_atari, kbd, Atari keyboard)dnl
1016__devitem(akbd, kbd, Amiga keyboard)dnl
1017__devitem(rkbd, kbd, raw keyboard)dnl
1018__devitem(kbdctl, kbdctl, keyboard control)dnl
1019__devitem(beep, beep, riscpc speaker)dnl
1020__devitem(iic, iic*, IIC bus device)dnl
1021__devitem(rtc, rtc*, RTC device)dnl
1022__devitem(view, view*, generic interface to graphic displays)dnl
1023__devitem(aconf, aconf, {-autoconfig information (not yet)-})dnl
1024__devitem(mouse-, mouse-*, "mouse link")dnl
1025__devitem(mouse, mouse, mouse (provides events, for X11))dnl
1026__devitem(amouse, mouse*, Amiga mice)dnl
1027__devitem(lkm, lkm, loadable kernel modules interface)dnl
1028_cdev(lkm, lkm, {-major_lkm_c-}, 0, 640, kmem)dnl
1029__devitem(mmcl, mmclock, memory mapped clock)dnl
1030__devitem(tun, tun*, network tunnel driver)dnl
1031__devitem(rnd, *random, inkernel random data source)dnl
1032_mkdev(rnd, *random, {-n=0
1033	for pre in " " s u p a
1034	do
1035		M ${pre}random c major_rnd_c $n 644
1036		n=Add($n, 1)
1037	done-}, 644)dnl
1038__devitem(joy, joy*, joystick driver)dnl
1039_mcdev(joy, joy*, joy, {-major_joy_c-}, 666)dnl
1040__devitem(mag, magma*, magma card (makes 16 tty and 2 bpp))dnl
1041__devitem(bppmag, bppmag[mno], magma parallel port device)dnl
1042__devitem(spif, spif*, spif card (makes 8 tty and 1 bpp))dnl
1043__devitem(bppsp, bpp[jkl], spif parallel port device)dnl
1044_mkdev(mag, magma*, {-case $U in
1045	0)	offset=0  nam=m;;
1046	1)	offset=16 nam=n;;
1047	2)	offset=32 nam=o;;
1048	*)	echo "bad unit for $i: $U"; exit 127;;
1049	esac
1050	offset=Mult($U, 64)
1051	n=0
1052	while [ $n -lt 16 ]
1053	do
1054		name=${nam}`hex $n`
1055		M tty$name c major_mag_c Add($offset, $n) 660 dialer uucp
1056		n=Add($n, 1)
1057	done
1058	M bpp${nam}0 c major_bppmag_c Add($offset, 0) 600
1059	M bpp${nam}1 c major_bppmag_c Add($offset, 1) 600-})dnl
1060_mkdev(spif, spif*, {-case $U in
1061	0)	offset=0  nam=j;;
1062	1)	offset=16 nam=k;;
1063	2)	offset=32 nam=l;;
1064	*)	echo "bad unit for $i: $U"; exit 127;;
1065	esac
1066	offset=Mult($U, 64)
1067	n=0
1068	while [ $n -lt 8 ]
1069	do
1070		name=${nam}`hex $n`
1071		M tty$name c major_spif_c Add($offset, $n) 660 dialer uucp
1072		n=Add($n, 1)
1073	done
1074	M bpp${nam}0 c major_bppsp_c Add($offset, 0) 600-})dnl
1075__devitem(bpp, bpp*, parallel port devices)dnl
1076__devitem(xfs, xfs*, XFS filesystem devices)dnl
1077_mcdev(xfs, xfs*, xfs, {-major_xfs_c-}, 600)dnl
1078__devitem(hil, hil, HIL input devices)dnl
1079__devitem(rmidi, rmidi*, raw midi devices)dnl
1080_mcdev(rmidi, rmidi*, rmidi, {-major_rmidi_c-}, 666)dnl
1081__devtitle(plat, Platform-specific devices)dnl
1082__devitem(fb, fb*, framebuffer device)dnl
1083__devitem(bktr, bktr*, video capturing)dnl
1084_mcdev(bktr, bktr*, bktr, {-major_bktr_c-}, 644)dnl
1085__devitem(tuner, tuner*, tuner device)dnl
1086_mkdev(tuner, tuner*, {-M tuner$U c major_bktr_c Add(Mult($U, 2), 16) 644-}, 644)dnl
1087__devitem(pci, pci, PCI bus device)dnl
1088_mkdev(pci, pci, {-M pci c major_pci_c 0 664-}, 664)dnl
1089__devitem(adb, adb, Apple Desktop bus event interface)dnl
1090_mkdev(adb, adb, {-M adb c major_adb_c 0-})dnl
1091__devitem(pdc, pdc, PDC device)dnl
1092_mkdev(local, local, {-test -s $T.local && sh $T.local-}, 666)dnl
1093dnl
1094divert(1)dnl
1095include(etc.MACHINE/MAKEDEV.md)dnl
1096dnl
1097dnl
1098divert(0)dnl
1099#!/bin/sh -
1100#
1101# THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
1102# generated from:
1103#
1104show_vers()dnl <-- now that all files are included, show versions
1105#
1106{-#-}	$Open{--}BSD$
1107dnl
1108divert(2)dnl
1109PATH=/sbin:/usr/sbin:/bin:/usr/bin
1110T=$0
1111
1112# set this to echo for Echo-Only debugging
1113[ "$eo" ] || eo=
1114
1115hex()
1116{
1117	case ${--}1 in
1118	[0-9]) echo -n {-$-}1;;
1119	10) echo -n a;;
1120	11) echo -n b;;
1121	12) echo -n c;;
1122	13) echo -n d;;
1123	14) echo -n e;;
1124	15) echo -n f;;
1125	esac
1126}
1127
1128trunc()
1129{
1130	# XXX pdksh can't seem to deal with locally scoped variables
1131	# in ${foo#$bar} expansions
1132	arg1="{-$-}1"
1133	arg2="{-$-}2"
1134	case {-$-}3 in
1135	l)   echo ${arg2#$arg1} ;;
1136	r|*) echo ${arg1#$arg2} ;;
1137	esac
1138}
1139
1140unt()
1141{
1142	# XXX pdksh can't seem to deal with locally scoped variables
1143	# in ${foo#$bar} expansions
1144	arg="{-$-}1"
1145	tmp="${arg#[a-zA-Z]*}"
1146	tmp="${tmp%*[a-zA-Z]}"
1147	while [ "$tmp" != "$arg" ]
1148	do
1149		arg=$tmp
1150		tmp="${arg#[a-zA-Z]*}"
1151		tmp="${tmp%*[a-zA-Z]}"
1152	done
1153	echo $arg
1154}
1155dnl
1156dnl dodisk(name, unit, blkmaj, chrmaj, unit, off[, stepping])
1157dnl   arg: 1    2    3      4      5    6    7
1158dnl
1159
1160dodisk()
1161{
1162	[ "$DEBUG" ] && set -x
1163	n=Add(Mult(${5}, ${7:-16}), ${6}) count=0
1164	RMlist="$RMlist {-$-}1{-$-}2? r{-$-}1{-$-}2?"
1165	[ 0$7 -ne 8 ] && l="i j k l m n o p"
1166	for d in a b c d e f g h $l
1167	do
1168		M {-$-}1{-$-}2$d	b {-$-}3 Add($n, $count) 640
1169		M r{-$-}1{-$-}2$d	c {-$-}4 Add($n, $count) 640
1170		let count=count+1
1171	done
1172	MKlist="$MKlist;chown root.operator {-$-}1{-$-}2? r{-$-}1{-$-}2?"
1173}
1174dnl
1175dnl dodisk2(name, unit, blkmaj, chrmaj, unit, off[, stepping])
1176dnl
1177dnl 1. name    - prefix name of the device
1178dnl 2. unit    - beginning unit number for block devices
1179dnl 3. blkmaj  - block device major number
1180dnl 4. chrmaj  - character device major number
1181dnl 5. unit    - beginning unit number for character devices
1182dnl 6. off     - offset from 0 for all minor numbers (see svnd for an example)
1183dnl 7. step    - optional, defaults to 16, number of partitions per device
1184dnl
1185
1186dodisk2()
1187{
1188	n=Add(Mult({-$-}5, ${7:-16}), {-$-}6)
1189	M {-$-}1{-$-}2a b {-$-}3 $n 640 operator
1190	M r{-$-}1{-$-}2a c {-$-}4 $n 640 operator
1191	n=Add($n, 2)
1192	M {-$-}1{-$-}2c b {-$-}3 $n 640 operator
1193	M r{-$-}1{-$-}2c c {-$-}4 $n 640 operator
1194}
1195
1196# M name b/c major minor [mode] [group]
1197RMlist="rm -f"
1198MKlist=":"
1199
1200mkl() {
1201dnl
1202dnl uncomment if multi mknod happens
1203dnl
1204ifelse(1, 0,
1205[ "${mklist[{-$-}1]}" ] && mklist[{-$-}1]="${mklist[{-$-}1]} {-$-}2 {-$-}3 {-$-}4 {-$-}5" || {
1206	  mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
1207	  modes="$modes {-$-}1"
1208     },
1209dnl
1210dnl non multi mknod
1211dnl
1212	[ "${mklist[{-$-}1]}" ] && {
1213		mklist[{-$-}1]="${mklist[{-$-}1]};mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
1214	} || {
1215		mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
1216		modes="$modes {-$-}1"
1217	})
1218}
1219
1220M() {
1221	RMlist="$RMlist {-$-}1"
1222	mkl ${5-666} {-$-}1 {-$-}2 {-$-}3 {-$-}4
1223	mklist="$mklist {-$-}1"
1224	G={-$-}{6:-wheel}
1225	[ "{-$-}7" ] && {
1226		MKlist="$MKlist;chown {-$-}7.{-$-}G {-$-}1"
1227	} || {
1228		case $G in
1229		wheel)g=0;;kmem)g=2;;operator)g=5;;tty)g=4;;dialer)g=117;;
1230		esac
1231		[ "${grplist[$g]}" ] && {
1232			grplist[$g]="${grplist[$g]} {-$-}1"
1233		} || {
1234			groups="$groups $g"
1235			grplist[$g]="chgrp $G {-$-}1"
1236		}
1237	}
1238	return 0
1239}
1240divert(7)dnl
1241dnl
1242dnl there is no blank line at the end of etc.arch/MAKEDEV.md files, so add one
1243dnl on the following line:
1244
1245show_devs()dnl
1246dnl
1247divert(9)dnl
1248*)
1249	echo $i: unknown device
1250	;;
1251esac
1252done
1253}
1254_recurse "$@"
1255if [ "$os" = "SunOS" ]; then
1256	eo=transform
1257	transform() {
1258		case $mode in
1259		600) mask=077;;
1260		640) mask=027;;
1261		660) mask=007;;
1262		644) mask=022;;
1263		666) mask=0;;
1264		440) mask=227;;
1265		esac
1266		echo `echo "$@"|sed \
1267		    's/mknod -m \([0-9]*\) /umask '$mask';mknod /;s/-m [0-9]* //g;\
1268		    s/operator/5/g;s/root.kmem/root.2/g;s/root\./root:/g'`
1269	}
1270fi
1271list="$RMlist"
1272for mode in $modes; do
1273	list="$list;${mklist[$mode]}"
1274done
1275for group in $groups; do
1276	list="$list;${grplist[$group]}"
1277done
1278list="$list;$MKlist"
1279if [ "$eo" = "echo" -o "$eo" = "transform" ]; then
1280	$eo "$list"
1281else
1282	echo "$list" | sh
1283fi
1284divert(3)dnl  
1285dnl
1286
1287R() {
1288[ "$DEBUG" ] && set -x
1289for i in "$@"
1290do
1291U=`unt $i`
1292[ "$U" ] || U=0
1293
1294case $i in
1295dnl
1296