MAKEDEV.common revision 1.38
1vers(a, {-$OpenBSD: MAKEDEV.common,v 1.38 2008/06/12 22:38:14 todd Exp $-})dnl
2dnl
3dnl Copyright (c) 2001-2006 Todd T. Fries <todd@OpenBSD.org>
4dnl
5dnl Permission to use, copy, modify, and distribute this software for any
6dnl purpose with or without fee is hereby granted, provided that the above
7dnl copyright notice and this permission notice appear in all copies.
8dnl
9dnl THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10dnl WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11dnl MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12dnl ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16dnl
17dnl Common device definitions.
18dnl
19dnl This file contains the MI device definitions (as well as some MD
20dnl definitions not cleaned up yet...)
21dnl
22dnl Diversions:  (upon termination, concatenated output queues)
23dnl
24dnl 0 - very top
25dnl 1 - descriptions of devices
26dnl 2 - init of script, function definitions, etc
27dnl 3 - beginning of global recursive R() function
28dnl 7 - body of MAKEDEV, device creations, etc
29dnl 9 - end
30dnl
31dnl Diversions 2, 3 and 7 are not filled when generating the manual page.
32dnl
33dnl HOW TO ADD A DEVICE:
34dnl
35dnl In this file, you must use at least two macros:
36dnl
37dnl  Use '__devitem(uniqueid, name-pattern, description)' to create an entry
38dnl  in the description at the top of the generated MAKEDEV file:
39dnl
40dnl    __devitem(sca, sca*, Sugar Generic device)dnl
41dnl    __devitem(cry, crypto, hardware crypto access driver)dnl
42dnl
43dnl  This is ultimately shown as:
44dnl
45dnl    #  sca*   Sugar Generic device
46dnl    #  crypto hardware crypto access driver
47dnl
48dnl  Use '_mkdev(uniqueid, shell-pattern, {-shell-script-})dnl' to create
49dnl  a shell script fragment used to 'create' the device (be sure to match
50dnl  the uniqueid from above):
51dnl
52dnl    _mkdev(sca, sca*, {-M sca$U c major_sca_c $U
53dnl           M rsca$U b major_sca_b Add($U, 128)-})dnl
54dnl    _mkdev(cry, crypto, {-M crypto c major_cry_c 0-})dnl
55dnl
56dnl  This is ultimately expanded into:
57dnl
58dnl    sca*)
59dnl           M sca$U c 24 $U
60dnl           M sca$U b 42 $(($U+128))
61dnl           ;;
62dnl
63dnl    crypto)
64dnl           M crypto c 47 0
65dnl           ;;
66dnl
67dnl In the MAKEDEV.md file, add a '_DEV(uniqueid, charmajor, blockmajor)'
68dnl entry:
69dnl
70dnl   _DEV(sca, 24, 42)
71dnl   _DEV(cry, 47)
72dnl
73dnl Final step is to use the 'target/twrget' macros to have the 'all)' target
74dnl generate one or more device(s).  Usage of 'target/twrget' is:
75dnl      target(target_name, device_name [, append_string ] .. )
76dnl      twrget(target_name, uniqueid, device_name, [, append_string ] .. )
77dnl
78dnl        target_name   a unique name that later is used as an argument to
79dnl                      'show_target()' (which expands all devices for a
80dnl                      given 'target_name').
81dnl        uniqueid      same as 'uniqueid' above
82dnl        device_name   string representing the device to be mknod'ed
83dnl        append_string for each append_string, `device_name' is prepended
84dnl
85dnl Note: 'target(a,b,c)' is equivalent to 'twrget(a,b,b,c)'
86dnl
87dnl
88dnl For a short example:
89dnl
90dnl   target(all, std)dnl
91dnl   target(all, sca, 0, 1, 2, 3)dnl
92dnl   twrget(all, cry, crypto)dnl
93dnl
94dnl would expand to:
95dnl
96dnl   all)
97dnl        R std sca0 sca1 sca2 sca3 crypto
98dnl        ;;
99dnl
100dnl presuming '_DEV(sca, ?, ?)' and '_DEV(std)' were in the MAKEDEV.md file.
101dnl
102dnl
103dnl Everything is 'automatically' added to 'MAKEDEV' based on whether or
104dnl not the '_DEV()' entry has a corresponding _mkdev() and __devitem()
105dnl entry in MAKEDEV.mi (this file).
106dnl
107dnl Note: be very wary of adding whitespace, carriage returns, or not
108dnl finishing a macro with ')dnl' .. otherwise, extra blank lines show up
109dnl in the output.
110dnl
111dnl TODO:
112dnl
113dnl make a 'disktgt' macro that automatically does:
114dnl disktgt(rd, {-rd-})
115dnl
116dnl	target(all,rd,0)
117dnl	target(ramd,rd,0)
118dnl	disk_q(rd)
119dnl	__devitem(rd, {-rd*-}, {-rd-})dnl
120dnl
121dnl  Note: not all disks are generated in 'all)'. (e.g. vax has a lot of
122dnl        disks that are not generated by 'all)')
123dnl
124divert(1)dnl
125target(all, mcd, 0)dnl
126twrget(all, fdesc, fd)dnl
127target(all, st, 0, 1)dnl
128target(all, std)dnl
129target(all, raid, 0, 1, 2, 3)dnl
130target(all, rz, 0, 1, 2, 3, 4)dnl
131target(all, hp, 0, 1, 2, 3)dnl
132target(all, ra, 0, 1, 2, 3)dnl
133target(all, rx, 0, 1)dnl
134target(all, wd, 0, 1, 2, 3)dnl
135target(all, xd, 0, 1, 2, 3)dnl
136target(all, systrace)dnl
137target(all, pctr)dnl
138target(all, pctr0)dnl
139target(all, pf)dnl
140twrget(all, cry, crypto)dnl
141target(all, apm)dnl
142target(all, acpi)dnl
143twrget(all, tth, ttyh, 0, 1)dnl
144target(all, ttyA, 0, 1)dnl
145target(all, ttyB, 0, 1, 2, 3, 4, 5)dnl
146twrget(all, attyB, ttyB, 0, 1, 2, 3, 4)dnl
147twrget(all, mac_tty0, tty0, 0, 1)dnl
148twrget(all, tzs, tty, a, b, c, d)dnl
149twrget(all, czs, cua, a, b, c, d)dnl
150target(all, ttyc, 0, 1, 2, 3, 4, 5, 6, 7)dnl
151twrget(all, com, tty0, 0, 1, 2, 3)dnl
152target(all, lkm)dnl
153twrget(all, mmcl, mmclock)dnl
154target(all, lpt, 0, 1, 2)dnl
155twrget(all, lpt, lpa, 0, 1, 2)dnl
156target(all, joy, 0, 1)dnl
157twrget(all, rnd, random)dnl
158target(all, uk, 0)dnl
159twrget(all, au, audio, 0)dnl
160twrget(all, vi, video, 0)dnl
161twrget(all, speak, speaker)dnl
162target(all, asc, 0)dnl
163target(all, music, 0)dnl
164target(all, radio, 0)dnl
165target(all, tuner, 0)dnl
166target(all, rmidi, 0, 1, 2, 3, 4, 5, 6, 7)dnl
167target(all, uall)dnl
168target(all, adb)dnl
169target(all, iop, 0, 1)dnl
170target(all, pci, 0, 1, 2, 3)dnl
171twrget(all, wsmouse, wscons)dnl
172twrget(all, grf_mac, grf, 0, 1, 2, 3)dnl
173target(all, par, 0)dnl
174twrget(all, amouse, mouse, 0, 1)dnl
175twrget(all, akbd, kbd)dnl
176target(all, apci, 0)dnl
177target(all, ppi, 0)dnl
178target(all, view0, 0, 1, 2, 3, 4, 5)dnl
179target(all, local)dnl
180target(all, gpr, 0)dnl
181target(all, ptm)dnl
182target(all, hotplug)dnl
183dnl
184_mkdev(all, {-all-}, {-dnl
185show_target(all)dnl
186-})dnl
187dnl
188dnl XXX some arches use ramd, others ramdisk - needs to be fixed eventually
189__devitem(ramdisk, ramdisk, Ramdisk kernel devices,nothing)dnl
190dnl
191target(usb, usb, 0, 1, 2, 3, 4, 5)dnl
192target(usb, urio, 0)dnl
193twrget(usb, uscan, uscanner, 0)dnl
194target(usb, uhid, 0, 1, 2, 3)dnl
195target(usb, ulpt, 0, 1)dnl
196target(usb, ugen, 0, 1)dnl
197target(usb, ttyU, 0, 1, 2, 3)dnl
198dnl
199__devitem({-uall-}, uall, All USB devices,usb)dnl
200_mkdev(uall, uall, {-dnl
201show_target({-usb-})dnl
202-})dnl
203__devtitle(tap, Tapes)dnl
204__devitem(tz, tz*, {-DEC TK50 cartridge tape drives-})dnl
205__devitem(st, {-st*-}, SCSI tape drives)dnl
206_mkdev(st, st*, {-n=Mult($U, 16)
207	for pre in " " n e en
208	do
209		M ${pre}st$U	b major_st_b $n 660 operator
210		M ${pre}rst$U	c major_st_c $n 660 operator
211		n=Add($n, 1)
212	done-})dnl
213__devitem(mt, mt*, (Magnetic) 9-track reel tape drives)dnl
214__devitem(ht, ht*, MASSBUS TM03 and TU?? devices)dnl
215__devitem(tm, tm*, UNIBUS TM11 and TE10 emulations (e.g. Emulex TC-11))dnl
216__devitem(ts, ts*, UNIBUS TS11)dnl
217__devitem(ut, ut*, UNIBUS TU45 emulations (e.g. 9700))dnl
218__devtitle(dis, Disks)dnl
219__devitem(sd, {-sd*-}, {-SCSI disks{-,-} including flopticals-})dnl
220__devitem(cd, {-cd*-}, ATAPI and SCSI CD-ROM drives)dnl
221_mkdev(cd, cd*, {-dodisk2 cd $U major_cd_b major_cd_c $U 0{--}ifstep(cd)-})dnl
222__devitem(mcd, mcd*, Mitsumi CD-ROM drives)dnl
223_mkdev(mcd, mcd*, {-dodisk2 mcd $U major_mcd_b major_mcd_c $U 0{--}ifstep(mcd)dnl
224-})dnl
225__devitem(bthub, {-bthub*-}, Bluetooth Hubs)dnl
226_mcdev(bthub, bthub*, bthub, {-major_bthub_c-})dnl
227__devitem(ch, {-ch*-}, SCSI media changers)dnl
228_mcdev(ch, ch*, ch, {-major_ch_c-}, 660, operator)dnl
229__devitem(uk, uk*, Unknown SCSI devices)dnl
230_mcdev(uk, uk*, uk, {-major_uk_c-}, 640, operator)dnl
231__devitem(ss, ss*, SCSI scanners)dnl
232_mkdev(ss, ss*, {-M ss$U c major_ss_c Mult($U,16) 640 operator
233	M nss$U c major_ss_c Add(Mult($U,16),1) 640 operator
234	M enss$U c major_ss_c Add(Mult($U,16),3) 640 operator
235	RMlist[${#RMlist[*]}]="scan$U"
236	MKlist[${#MKlist[*]}]=";umask 77;ln -s ss$U scan$U"-})dnl
237dnl XXX see ramdisk above
238__devitem(ramd, ramdisk, Ramdisk kernel devices,nothing)dnl
239dnl
240_mkdev(ramd, ramdisk, {-dnl
241show_target(ramd)dnl
242-})dnl
243dnl
244target(ramd, std)dnl
245target(ramd, bpf, 0)dnl
246twrget(ramd, com, tty0, 0, 1)dnl
247target(ramd, sd, 0, 1, 2, 3, 4)dnl
248target(ramd, wd, 0, 1, 2, 3, 4)dnl
249target(ramd, st, 0, 1)dnl
250target(ramd, cd, 0, 1)dnl
251target(ramd, rd, 0)dnl
252dnl
253__devitem(rd, {-rd*-}, quote(rd)pseudo-disks)dnl
254_mkdev(rd, rd*, {-dodisk2 rd $U major_rd_b major_rd_c $U 0{--}ifstep(rd)-})dnl
255__devitem(xd, xd*, Xylogic 753/7053 disks)dnl
256__devitem(xy, xy*, {-	Xylogic 450/451 disks-})dnl
257__devitem(flo, {-fd*-}, {-Floppy disk drives (3 1/2"{-,-} 5 1/4")-},fd)dnl
258_mkdev(flo, fd*,
259{-typnam=$U${i#fd[01]*}
260	case $typnam in
261	0|1)	typnum=0;; # no type specified, assume A
262	*A)	typnum=0; typnam=0;;
263	*B)	typnum=1;;
264	*C)	typnum=2;;
265	*D)	typnum=3;;
266	*E)	typnum=4;;
267	*F)	typnum=5;;
268	*G)	typnum=6;;
269	*H)	typnum=7;;
270	*)	echo bad type $typnam for $i; exit 1;;
271	esac
272	case $U in
273	0|1)	blk=major_flo_b; chr=major_flo_c;;
274	*)	echo bad unit $U for $i; exit 1;;
275	esac
276	nam=fd${typnam}
277	n=Add(Mult($U, 128), Mult($typnum, 16))
278	M ${nam}a	b $blk $n 640 operator
279	M ${nam}b	b $blk Add($n, 1) 640 operator
280	M ${nam}c	b $blk Add($n, 2) 640 operator
281	M ${nam}i	b $blk Add($n, 8) 640 operator
282	M r${nam}a	c $chr $n 640 operator
283	M r${nam}b	c $chr Add($n, 1) 640 operator
284	M r${nam}c	c $chr Add($n, 2) 640 operator
285	M r${nam}i	c $chr Add($n, 8) 640 operator-}, 664)dnl
286__devitem(iop, iop*, I2O controller devices)dnl
287_mcdev(iop, iop*, iop, {-major_iop_c-}, 660)dnl
288__devitem(wd, {-wd*-}, {-quote(winchester)disk drives (ST506{-,-} IDE{-,-} ESDI{-,-} RLL{-,-} ...)-})dnl
289__devitem(ccd, ccd*, Concatenated disk devices)dnl
290__devitem(raid, raid*, RAIDframe disk devices)dnl
291__devitem(vnd, vnd*, quote(file)pseudo-disk devices)dnl
292_mkdev(vnd, vnd*, {-dodisk vnd $U major_vnd_b major_vnd_c $U 0{--}ifstep(vnd)
293	dodisk svnd $U major_vnd_b major_vnd_c $U 2048{--}ifstep(vnd)-})dnl
294__devitem(ra, ra*, {-MSCP disks-})dnl
295__devitem(hp, hp*, {-MASSBUS disks-})dnl
296__devitem(hk, hk*, {-UNIBUS RK06 and RK07 disks-})dnl
297__devitem(up, up*, {-Other UNIBUS devices-})dnl
298__devitem(rb, rb*, {-730 IDC w/ RB80 and/or RB02-})dnl
299__devitem(rx, rx*, {-RX02 floppy disks-})dnl
300__devitem(rl, rl*, {-UNIBUS RL02-})dnl
301dnl
302dnl For normal disk devices, add a disk_q entry; anything else define like
303dnl the rest (such as vnd above).
304dnl
305disk_q({-ccd-})dnl
306disk_q({-hd-})dnl
307disk_q({-hk-})dnl
308disk_q({-hp-})dnl
309disk_q({-ra-})dnl
310disk_q({-raid-})dnl
311disk_q({-rb-})dnl
312disk_q({-rl-})dnl
313disk_q({-rx-})dnl
314disk_q({-sd-})dnl
315disk_q({-xy-})dnl
316disk_q({-xd-})dnl
317disk_q({-up-})dnl
318disk_q({-wd-})dnl
319disk_q({-rz-})dnl
320_mkdev({-disks-}, {-undefine({-C_ase-})show_disks()undefine({-C_ase-})-},
321{-case $i in
322show_disks2()dnl
323	esac-})dnl
324__mkdev({-disks-}){--}dnl
325dnl
326__devtitle(cons, Console ports)dnl
327__devitem(wscons, wscons, Minimal wscons devices)dnl
328twrget(wscons, wscons, ttyC, cfg, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b)dnl
329target(wscons, wsmux)dnl
330target(wscons, wskbd, 0, 1, 2, 3)dnl
331target(wscons, wsmouse, 0, 1, 2, 3)dnl
332_mkdev({-wscons-}, {-wscons-}, {-dnl
333show_target(wscons)dnl
334-})dnl
335__devitem(wsdisp, ttyC-J*, wscons display devices,wsdisplay)dnl
336_mkdev({-wsdisp-}, tty[C-J]*, {-U=${i##tty[C-J]}
337	case $i in
338	ttyC*) n=C m=expr(0*256);;
339	ttyD*) n=D m=expr(1*256);;
340	ttyE*) n=E m=expr(2*256);;
341	ttyF*) n=F m=expr(3*256);;
342	ttyG*) n=G m=expr(4*256);;
343	ttyH*) n=H m=expr(5*256);;
344	ttyI*) n=I m=expr(6*256);;
345	ttyJ*) n=J m=expr(7*256);;
346	esac
347	case $U in
348	[0-9a-f]) M tty$n$U c major_wsdisp_c Add(16#$U, $m) 600;;
349	cfg) M tty${n}cfg c major_wsdisp_c Add(255,$m) 600;;
350	*) echo bad unit $U for $i; exit 1;;
351	esac-})dnl
352__devitem(wskbd, wskbd*, wscons keyboards)dnl
353_mkdev(wskbd, wskbd*, {-M wskbd$U c major_wskbd_c $U 600-})dnl
354__devitem(wsmux, wsmux, wscons keyboard/mouse mux devices)dnl
355_mkdev(wsmux, wsmux|wsmouse|wskbd, {-M wsmouse c major_wsmux_c 0 600
356	M wskbd c major_wsmux_c 1 600-})dnl
357__devitem(pcons, console, PROM console)dnl
358__devtitle(point, Pointing devices)dnl
359__devitem(wsmouse, wsmouse*, wscons mice)dnl
360_mkdev(wsmouse, wsmouse*, {-M wsmouse$U c major_wsmouse_c $U 600-})dnl
361__devtitle(pty, Pseudo terminals)dnl
362__devitem(ptm, ptm, pty master device)dnl
363_mkdev(ptm, ptm, {-M ptm c major_ptm_c 0 666-})dnl
364__devitem(tty, tty*, Set of 62 slave pseudo terminals)dnl
365__devitem(pty, pty*, Set of 62 master pseudo terminals)dnl
366_mkdev(pty, pty*, {-if [ $U -gt 15 ]; then
367		echo bad unit for pty in: $i
368		continue
369	fi
370	set -A letters p q r s t u v w x y z P Q R S T
371	set -A suffixes 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q \
372	    r s t u v w x y z A B C D E F G H I J K L M N O P Q R S T U V W X \
373	    Y Z
374
375	name=${letters[$U]}
376	n=0
377	while [ $n -lt 62 ]
378	do
379		nam=$name${suffixes[$n]}
380		off=Mult($U, 62)
381		M tty$nam c major_tty_c Add($off, $n)
382		M pty$nam c major_pty_c Add($off, $n)
383		n=Add($n, 1)
384	done-})dnl
385__devitem(dc, dc*, {-4 channel serial interface (keyboard{-,-} mouse{-,-}modem{-,-} printer)-})dnl
386__devitem(drm, drm*, {-Direct Rendering Manager-})dnl
387_mcdev({-drm-}, drm*, {-drm-}, {-major_drm_c-}, 660)dnl
388__devtitle(prn, Printers)dnl
389__devitem(lpt, lpt*, IEEE 1284 centronics printer)dnl
390_mkdev(lpt, lpt*|lpa*,
391{-case $i in
392	lpt*) n=lpt f=0;;
393	lpa*) n=lpa f=128;;
394	esac
395	M $n$U c major_lpt_c Add($U, $f) 600-})dnl
396__devitem(lpa, lpa*, Polled printer port,lpt)dnl
397__devitem(ppi, ppi*, HP-IB plotters)dnl
398__devtitle({-usb-}, USB devices)dnl
399__devitem({-usb-}, usb*, Bus control devices used by usbd for attach/detach)dnl
400_mkdev({-usb-}, usb*, {-[ "$i" = "usb" ] && u= || u=$U
401	M usb$u c major_usb_c $U 660-})dnl
402__devitem(uhid, uhid*, Generic HID devices)dnl
403_mcdev({-uhid-}, uhid*, {-uhid-}, {-major_uhid_c-}, 660)dnl
404__devitem(ulpt, ulpt*, Printer devices)dnl
405_mcdev({-ulpt-}, ulpt*, {-ulpt-}, {-major_ulpt_c-}, 660)dnl
406__devitem(ttyU, ttyU*, USB serial ports,ucom)dnl
407_mkdev({-ttyU-}, {-ttyU[0-9a-zA-Z]-}, {-U=${i#ttyU*}
408	o=$(alph2d $U)
409	M ttyU$U c major_ttyU_c $o 660 dialer uucp
410	M cuaU$U c major_ttyU_c Add($o, 128) 660 dialer uucp-})dnl
411__devitem(urio, urio*, Diamond Multimedia Rio 500)dnl
412_mcdev({-urio-}, urio*, {-urio-}, {-major_urio_c-}, 660)dnl
413__devitem(uscan, uscanner*, Scanners,uscanner)dnl
414_mcdev({-uscan-}, uscanner*, {-uscanner-}, {-major_uscan_c-}, 660)dnl
415__devitem(ugen, ugen*, Generic USB devices)dnl
416_mkdev(ugen, ugen*, {-n=Mult($U, 16)
417	for j in 0{0,1,2,3,4,5,6,7,8,9} 1{0,1,2,3,4,5}
418	do
419		M ugen$U.$j c major_ugen_c Add($n, 10#$j) 660
420	done-})dnl
421__devtitle(call, Call units)dnl
422__devtitle(term, Terminal ports)dnl
423__devitem(dca, dca*, HP200/300 single port serial interface)dnl
424__devitem(dcm, dcm*, HP200/300 4 port serial mux interface)dnl
425__devitem(apci, apci*, HP400 4 port serial mux interface)dnl
426__devitem({-com-}, {-tty[0-7][0-9a-f]-}, NS16x50 serial ports)dnl
427_mkdev(com, {-tty[0-7][0-9a-f]-}, {-U=${i#tty*}
428	o=$(h2d $U)
429	M tty$U c major_com_c $o 660 dialer uucp
430	M cua$U c major_com_c Add($o, 128) 660 dialer uucp-})dnl
431__devitem(ttyc, ttyc*, Cyclades serial ports,cy)dnl
432__devitem(tzs, tty[a-z]*, Zilog 8530 Serial Port,zs)dnl
433_mkdev(tzs, {-tty[a-z]-}, {-u=${i#tty*}
434	case $u in
435	a) n=0 ;;
436	b) n=1 ;;
437	c) n=4 ;;
438	d) n=5 ;;
439	*) echo unknown tty device $i ;;
440	esac
441	M tty$u c major_tzs_c $n 660 dialer uucp-})dnl
442__devitem(tth, ttyh*, Sab82532 serial devices,sab)dnl
443_mkdev(tth, ttyh*, {-M ttyh$U c major_tth_c $U 660 dialer uucp-})dnl
444__devitem(czs, cua[a-z]*, Zilog 8530 Serial Port,zs)dnl
445_mkdev(czs, cua[a-z], {-u=${i#cua*}
446	case $u in
447	a) n=0 ;;
448	b) n=1 ;;
449	c) n=4 ;;
450	d) n=5 ;;
451	*) echo unknown cua device $i ;;
452	esac
453	M cua$u c major_czs_c Add($n, 128) 660 dialer uucp-})dnl
454__devitem(tty0, tty00, Standard serial port,com)dnl
455__devitem(mac_tty0, tty00, Standard serial port,zsc)dnl
456__devitem(ttyz, tty[a-d], On-board zs serial ports,zs)dnl
457__devitem(cuaz, cua[a-d], On-board zs serial ports,zs)dnl
458__devitem(ttyB, ttyB?, DEC 3000 ZS8530 ("scc") serial ports,scc)dnl
459__devitem(scc, scc*, 82530 serial interface,scc)dnl
460__devtitle(spec, Special purpose devices)dnl
461_mkdev(apm, apm*, {-M apm	c major_apm_c 0 644
462	M apmctl	c major_apm_c 8 644-})dnl
463_mkdev(acpi, acpi*, {-M acpi	c major_acpi_c 0 644-})dnl
464__devitem(pctr, pctr*, PC Performance Tuning Register access device)dnl
465_mkdev(pctr, pctr, {-M pctr c major_pctr_c 0 644-})dnl
466__devitem(systrace, systrace*, System call tracing device)dnl
467_mkdev(systrace, systrace, {-M systrace c major_systrace_c 0 644-})dnl
468__devitem(au, audio*, Audio devices,audio)dnl
469_mkdev(au, audio*, {-M sound$U	c major_au_c $U
470	M mixer$U	c major_au_c Add($U, 16)
471	M audio$U	c major_au_c Add($U, 128)
472	M audioctl$U	c major_au_c Add($U, 192)
473	MKlist[${#MKlist[*]}]=";[ -e audio ] || ln -s audio$U audio"
474	MKlist[${#MKlist[*]}]=";[ -e mixer ] || ln -s mixer$U mixer"
475	MKlist[${#MKlist[*]}]=";[ -e sound ] || ln -s sound$U sound"
476	MKlist[${#MKlist[*]}]=";[ -e audioctl ] || ln -s audioctl$U audioctl"-})dnl
477__devitem(vi, video*, Video V4L devices,video)dnl
478_mkdev(vi, video*, {-M video$U  c major_vi_c $U
479	MKlist[${#MKlist[*]}]=";[ -e video ] || ln -s video$U video"-})dnl
480__devitem(asc, asc*, ASC Audio device)dnl
481_mkdev(asc, asc*, {-M asc$U major_asc_c 0-})dnl
482__devitem(bio, bio, {-ioctl tunnel pseudo-device-})dnl
483_mkdev(bio, bio, {-M bio c major_bio_c 0 600-})dnl
484__devitem(music, music*, MIDI devices,midi)dnl
485_mkdev(music, music*, {-M music$U     c major_music_c $U
486	M sequencer$U c major_music_c Add($U, 128)
487	MKlist[${#MKlist[*]}]=";[ -e music ] || ln -s music$U music"
488	MKlist[${#MKlist[*]}]=";[ -e sequencer ] || ln -s sequencer$U sequencer"-})dnl
489__devitem(radio, radio*, FM tuner devices)dnl
490_mkdev(radio, radio*, {-M radio$U     c major_radio_c $U
491	MKlist[${#MKlist[*]}]=";[ -e radio ] || ln -s radio$U radio"-})dnl
492__devitem(fdesc, fd, fd/* nodes, fd)dnl
493_mkdev(fdesc, fd, {-RMlist[${#RMlist[*]}]=";mkdir -p fd;rm -f" n=0
494	while [ $n -lt 64 ];do M fd/$n c major_fdesc_c $n;n=Add($n, 1);done
495	MKlist[${#MKlist[*]}]=";chmod 555 fd"-})dnl
496__devitem(grf_mac, grf*, Raw interface to the mac68k graphics devices,grf)dnl
497__devitem(oppr, openprom,PROM settings,openprom)dnl
498_cdev(oppr, openprom, 70, 0)dnl
499__devitem(cry, crypto, Hardware crypto access driver,crypto)dnl
500_mkdev(cry, crypto, {-M crypto c major_cry_c-} 0)dnl
501__devitem(pf, pf*, Packet Filter)dnl
502_mkdev(pf, {-pf*-}, {-M pf c major_pf_c 0 600-})dnl
503__devitem(bpf, bpf*, Berkeley Packet Filter)dnl
504_mkdev(bpf, {-bpf*-}, {-M bpf$U c major_bpf_c $U 600-}, 600)dnl
505_mkdev(tun, {-tun*-}, {-M tun$U c major_tun_c $U 600-}, 600)dnl
506__devitem(speak, speaker, PC speaker,spkr)dnl
507_mkdev(speak, speaker, {-M speaker c major_speak_c 0 600-})dnl
508__devitem(lkm, lkm, Loadable kernel modules interface)dnl
509_cdev(lkm, lkm, {-major_lkm_c-}, 0, 640, _lkm)dnl
510__devitem(tun, tun*, Network tunnel driver)dnl
511__devitem(rnd, *random, In-kernel random data source,random)dnl
512_mkdev(rnd, *random, {-n=0
513	for pre in " " s u p a
514	do
515		M ${pre}random c major_rnd_c $n 644
516		n=Add($n, 1)
517	done-}, 644)dnl
518__devitem(joy, joy*, Joystick driver)dnl
519_mcdev(joy, joy*, joy, {-major_joy_c-}, 666)dnl
520__devitem(mag, magma*, Magma multiport cards,magma)dnl
521__devitem(bppmag, bppmag[mno], Magma parallel port,magma)dnl
522__devitem(spif, spif*, quote(spif)multiport cards)dnl
523__devitem(bppsp, bpp[jkl], quote(spif)parallel port,spif)dnl
524_mkdev(mag, magma*, {-case $U in
525	0)	offset=0  nam=m;;
526	1)	offset=16 nam=n;;
527	2)	offset=32 nam=o;;
528	*)	echo "bad unit for $i: $U"; exit 127;;
529	esac
530	offset=Mult($U, 64)
531	n=0
532	while [ $n -lt 16 ]
533	do
534		name=${nam}`hex $n`
535		M tty$name c major_mag_c Add($offset, $n) 660 dialer uucp
536		n=Add($n, 1)
537	done
538	M bpp${nam}0 c major_bppmag_c Add($offset, 0) 600
539	M bpp${nam}1 c major_bppmag_c Add($offset, 1) 600-})dnl
540_mkdev(spif, spif*, {-case $U in
541	0)	offset=0  nam=j;;
542	1)	offset=16 nam=k;;
543	2)	offset=32 nam=l;;
544	*)	echo "bad unit for $i: $U"; exit 127;;
545	esac
546	offset=Mult($U, 64)
547	n=0
548	while [ $n -lt 8 ]
549	do
550		name=${nam}`hex $n`
551		M tty$name c major_spif_c Add($offset, $n) 660 dialer uucp
552		n=Add($n, 1)
553	done
554	M bpp${nam}0 c major_bppsp_c Add($offset, 0) 600-})dnl
555__devitem(bpp, bpp*, Parallel port)dnl
556_mkdev(bpp, {-bpp*-}, {-M bpp$U c major_bpp_c $U 600-}, 600)dnl
557__devitem(xfs, xfs*, XFS filesystem node, mount_xfs 8)dnl
558_mcdev(xfs, xfs*, xfs, {-major_xfs_c-}, 600)dnl
559__devitem(rmidi, rmidi*, Raw MIDI devices,midi)dnl
560_mcdev(rmidi, rmidi*, rmidi, {-major_rmidi_c-}, 666)dnl
561__devtitle(plat, Platform-specific devices)dnl
562__devitem(bktr, bktr*, Video frame grabbers)dnl
563_mcdev(bktr, bktr*, bktr, {-major_bktr_c-}, 644)dnl
564__devitem(tuner, tuner*, Tuner devices)dnl
565_mkdev(tuner, tuner*, {-M tuner$U c major_bktr_c Add(Mult($U, 2), 16) 644-}, 644)dnl
566__devitem(pci, pci*, PCI bus devices)dnl
567_mkdev(pci, pci*, {-M pci$U	c major_pci_c $U 600
568	MKlist[${#MKlist[*]}]=";[ -h pci ] || ln -sf pci0 pci"-})dnl
569__devitem(adb, adb, Apple Desktop bus event interface)dnl
570_mkdev(adb, adb, {-M adb c major_adb_c 0-})dnl
571__devitem(pdc, pdc, PDC device)dnl
572__devitem(gpr, gpr*, GPR400 smartcard reader)dnl
573_mcdev(gpr, gpr*, gpr, {-major_gpr_c-})dnl
574__devitem(hotplug, hotplug, devices hot plugging)dnl
575_mkdev(hotplug, hotplug, {-M hotplug c major_hotplug_c $U 400-})dnl
576__devitem(gpio, gpio*, General Purpose Input/Output)dnl
577_mcdev(gpio, gpio*, gpio, {-major_gpio_c-}, 600)dnl
578_mkdev(local, local, {-test -s $T.local && sh $T.local-})dnl
579