MAKEDEV.common revision 1.72
1vers(a, {-$OpenBSD: MAKEDEV.common,v 1.72 2013/11/05 16:05:30 deraadt 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 devices are generated in 'all)' below. MAKEDEV.md contains
122dnl        its own extra list.
123dnl
124divert(1)dnl
125twrget(all, fdesc, fd)dnl
126target(all, st, 0, 1)dnl
127target(all, std)dnl
128target(all, ra, 0, 1, 2, 3)dnl
129target(all, rx, 0, 1)dnl
130target(all, wd, 0, 1, 2, 3)dnl
131target(all, xd, 0, 1, 2, 3)dnl
132target(all, systrace)dnl
133target(all, pctr)dnl
134target(all, pctr0)dnl
135target(all, pf)dnl
136twrget(all, cry, crypto)dnl
137target(all, apm)dnl
138target(all, acpi)dnl
139twrget(all, tth, ttyh, 0, 1)dnl
140target(all, ttyA, 0, 1)dnl
141target(all, ttyB, 0, 1, 2, 3, 4, 5)dnl
142twrget(all, attyB, ttyB, 0, 1, 2, 3, 4)dnl
143twrget(all, mac_tty0, tty0, 0, 1)dnl
144twrget(all, tzs, tty, a, b, c, d)dnl
145twrget(all, czs, cua, a, b, c, d)dnl
146target(all, ttyc, 0, 1, 2, 3, 4, 5, 6, 7)dnl
147twrget(all, com, tty0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b)dnl
148target(all, lkm)dnl
149twrget(all, mmcl, mmclock)dnl
150target(all, lpt, 0, 1, 2)dnl
151twrget(all, lpt, lpa, 0, 1, 2)dnl
152target(all, joy, 0, 1)dnl
153twrget(all, rnd, random)dnl
154target(all, uk, 0)dnl
155twrget(all, vi, video, 0, 1)dnl
156twrget(all, speak, speaker)dnl
157target(all, asc, 0)dnl
158target(all, radio, 0)dnl
159target(all, tuner, 0)dnl
160target(all, rmidi, 0, 1, 2, 3, 4, 5, 6, 7)dnl
161target(all, uall)dnl
162target(all, pci, 0, 1, 2, 3)dnl
163twrget(all, wsmouse, wscons)dnl
164target(all, par, 0)dnl
165target(all, apci, 0)dnl
166target(all, ppi, 0)dnl
167target(all, local)dnl
168target(all, gpr, 0)dnl
169target(all, ptm)dnl
170target(all, hotplug)dnl
171target(all, pppx)dnl
172target(all, fuse)dnl
173dnl
174_mkdev(all, {-all-}, {-dnl
175show_target(all)dnl
176-})dnl
177dnl
178dnl XXX some arches use ramd, others ramdisk - needs to be fixed eventually
179__devitem(ramdisk, ramdisk, Ramdisk kernel devices,nothing)dnl
180dnl
181target(usb, usb, 0, 1, 2, 3, 4, 5, 6, 7)dnl
182target(usb, urio, 0)dnl
183target(usb, uhid, 0, 1, 2, 3)dnl
184target(usb, ulpt, 0, 1)dnl
185target(usb, ugen, 0, 1, 2, 3, 4, 5, 6, 7)dnl
186target(usb, ttyU, 0, 1, 2, 3)dnl
187dnl
188__devitem({-uall-}, uall, All USB devices,usb)dnl
189_mkdev(uall, uall, {-dnl
190show_target({-usb-})dnl
191-})dnl
192__devtitle(tap, Tapes)dnl
193__devitem(tz, tz*, {-DEC TK50 cartridge tape drives-})dnl
194__devitem(st, {-st*-}, SCSI tape drives)dnl
195_mkdev(st, st*, {-n=Mult($U, 16)
196	for pre in " " n e en
197	do
198		M ${pre}st$U	b major_st_b $n 660 operator
199		M ${pre}rst$U	c major_st_c $n 660 operator
200		n=Add($n, 1)
201	done-})dnl
202__devitem(mt, mt*, (Magnetic) 9-track reel tape drives)dnl
203__devtitle(dis, Disks)dnl
204__devitem(sd, {-sd*-}, {-SCSI disks{-,-} including flopticals-})dnl
205__devitem(cd, {-cd*-}, ATAPI and SCSI CD-ROM drives)dnl
206_mkdev(cd, cd*, {-dodisk2 cd $U major_cd_b major_cd_c $U 0{--}ifstep(cd)-})dnl
207__devitem(bthub, {-bthub*-}, Bluetooth Hubs,nothing)dnl
208_mcdev(bthub, bthub*, bthub, {-major_bthub_c-})dnl
209__devitem(fuse, fuse, Userland Filesystem, fuse 4)dnl
210_mcdev(fuse, fuse, fuse, {-major_fuse_c-}, 600)dnl
211__devitem(ch, {-ch*-}, SCSI media changers)dnl
212_mcdev(ch, ch*, ch, {-major_ch_c-}, 660, operator)dnl
213__devitem(uk, uk*, Unknown SCSI devices)dnl
214_mcdev(uk, uk*, uk, {-major_uk_c-}, 640, operator)dnl
215dnl XXX see ramdisk above
216__devitem(ramd, ramdisk, Ramdisk kernel devices,nothing)dnl
217dnl
218_mkdev(ramd, ramdisk, {-dnl
219show_target(ramd)dnl
220-})dnl
221dnl
222target(ramd, std)dnl
223target(ramd, bpf, 0)dnl
224twrget(ramd, com, tty0, 0, 1)dnl
225target(ramd, sd, 0, 1, 2, 3, 4)dnl
226target(ramd, wd, 0, 1, 2, 3, 4)dnl
227target(ramd, st, 0, 1)dnl
228target(ramd, cd, 0, 1)dnl
229target(ramd, rd, 0)dnl
230dnl
231__devitem(rd, {-rd*-}, quote(rd)pseudo-disks)dnl
232_mkdev(rd, rd*, {-dodisk2 rd $U major_rd_b major_rd_c $U 0{--}ifstep(rd)-})dnl
233__devitem(xd, xd*, Xylogic 753/7053 disks)dnl
234__devitem(xy, xy*, {-	Xylogic 450/451 disks-})dnl
235__devitem(flo, {-fd*-}, {-Floppy disk drives (3 1/2"{-,-} 5 1/4")-},fd)dnl
236_mkdev(flo, fd*,
237{-typnam=$U${i#fd[01]*}
238	case $typnam in
239	0|1)	typnum=0;; # no type specified, assume A
240	*A)	typnum=0; typnam=0;;
241	*B)	typnum=1;;
242	*C)	typnum=2;;
243	*D)	typnum=3;;
244	*E)	typnum=4;;
245	*F)	typnum=5;;
246	*G)	typnum=6;;
247	*H)	typnum=7;;
248	*)	echo bad type $typnam for $i; exit 1;;
249	esac
250	case $U in
251	0|1)	blk=major_flo_b; chr=major_flo_c;;
252	*)	echo bad unit $U for $i; exit 1;;
253	esac
254	nam=fd${typnam}
255	n=Add(Mult($U, 128), Mult($typnum, 16))
256	M ${nam}a	b $blk $n 640 operator
257	M ${nam}b	b $blk Add($n, 1) 640 operator
258	M ${nam}c	b $blk Add($n, 2) 640 operator
259	M ${nam}i	b $blk Add($n, 8) 640 operator
260	M r${nam}a	c $chr $n 640 operator
261	M r${nam}b	c $chr Add($n, 1) 640 operator
262	M r${nam}c	c $chr Add($n, 2) 640 operator
263	M r${nam}i	c $chr Add($n, 8) 640 operator-}, 664)dnl
264__devitem(wd, {-wd*-}, {-quote(winchester)disk drives (ST506{-,-} IDE{-,-} ESDI{-,-} RLL{-,-} ...)-})dnl
265__devitem(vnd, vnd*, quote(file)pseudo-disk devices)dnl
266_mkdev(vnd, vnd*, {-dodisk vnd $U major_vnd_b major_vnd_c $U 0{--}ifstep(vnd)-})dnl
267__devitem(ra, ra*, {-MSCP disks-})dnl
268__devitem(rx, rx*, {-RX02 floppy disks-})dnl
269dnl
270dnl For normal disk devices, add a disk_q entry; anything else define like
271dnl the rest (such as vnd above).
272dnl
273disk_q({-hd-})dnl
274disk_q({-ra-})dnl
275disk_q({-rx-})dnl
276disk_q({-sd-})dnl
277disk_q({-xy-})dnl
278disk_q({-xd-})dnl
279disk_q({-wd-})dnl
280_mkdev({-disks-}, {-undefine({-C_ase-})show_disks()undefine({-C_ase-})-},
281{-case $i in
282show_disks2()dnl
283	esac-})dnl
284__mkdev({-disks-}){--}dnl
285dnl
286__devtitle(cons, Console ports)dnl
287__devitem(wscons, wscons, Minimal wscons devices)dnl
288twrget(wscons, wscons, ttyC, cfg, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b)dnl
289target(wscons, wsmux)dnl
290target(wscons, wskbd, 0, 1, 2, 3)dnl
291target(wscons, wsmouse, 0, 1, 2, 3)dnl
292_mkdev({-wscons-}, {-wscons-}, {-dnl
293show_target(wscons)dnl
294-})dnl
295__devitem(wsdisp, ttyC-J*, wscons display devices,wsdisplay)dnl
296_mkdev({-wsdisp-}, tty[C-J]*, {-U=${i##tty[C-J]}
297	case $i in
298	ttyC*) n=C m=expr(0*256);;
299	ttyD*) n=D m=expr(1*256);;
300	ttyE*) n=E m=expr(2*256);;
301	ttyF*) n=F m=expr(3*256);;
302	ttyG*) n=G m=expr(4*256);;
303	ttyH*) n=H m=expr(5*256);;
304	ttyI*) n=I m=expr(6*256);;
305	ttyJ*) n=J m=expr(7*256);;
306	esac
307	case $U in
308	[0-9a-f]) M tty$n$U c major_wsdisp_c Add(16#$U, $m) 600;;
309	cfg) M tty${n}cfg c major_wsdisp_c Add(255,$m) 600;;
310	*) echo bad unit $U for $i; exit 1;;
311	esac-})dnl
312__devitem(wskbd, wskbd*, wscons keyboards)dnl
313dnl XXX wskbd[0-9]* instead of wskbd* in case this appears before
314dnl XXX ``wsmux|wsmouse|wskbd'' in the final MAKEDEV.
315_mkdev(wskbd, wskbd[0-9]*, {-M wskbd$U c major_wskbd_c $U 600-})dnl
316__devitem(wsmux, wsmux, wscons keyboard/mouse mux devices)dnl
317_mkdev(wsmux, wsmux|wsmouse|wskbd, {-M wsmouse c major_wsmux_c 0 600
318	M wskbd c major_wsmux_c 1 600-})dnl
319__devitem(pcons, console, PROM console)dnl
320__devtitle(point, Pointing devices)dnl
321__devitem(wsmouse, wsmouse*, wscons mice)dnl
322dnl XXX wsmouse[0-9]* instead of wsmouse* in case this appears before
323dnl XXX ``wsmux|wsmouse|wskbd'' in the final MAKEDEV.
324_mkdev(wsmouse, wsmouse[0-9]*, {-M wsmouse$U c major_wsmouse_c $U 600-})dnl
325__devtitle(pty, Pseudo terminals)dnl
326__devitem(ptm, ptm, pty master device)dnl
327_mkdev(ptm, ptm, {-M ptm c major_ptm_c 0 666-})dnl
328__devitem(tty, tty*, Set of 62 slave pseudo terminals)dnl
329__devitem(pty, pty*, Set of 62 master pseudo terminals)dnl
330_mkdev(pty, pty*, {-if [ $U -gt 15 ]; then
331		echo bad unit for pty in: $i
332		continue
333	fi
334	set -A letters p q r s t u v w x y z P Q R S T
335	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 \
336	    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 \
337	    Y Z
338
339	name=${letters[$U]}
340	n=0
341	while [ $n -lt 62 ]
342	do
343		nam=$name${suffixes[$n]}
344		off=Mult($U, 62)
345		M tty$nam c major_tty_c Add($off, $n)
346		M pty$nam c major_pty_c Add($off, $n)
347		n=Add($n, 1)
348	done-})dnl
349__devitem(dc, dc*, {-4 channel serial interface (keyboard{-,-} mouse{-,-}modem{-,-} printer)-})dnl
350__devitem(drm, drm*, {-Direct Rendering Manager-})dnl
351_mcdev({-drm-}, drm*, {-drm-}, {-major_drm_c-}, 660)dnl
352__devtitle(prn, Printers)dnl
353__devitem(lpt, lpt*, IEEE 1284 centronics printer)dnl
354_mkdev(lpt, lpt*|lpa*,
355{-case $i in
356	lpt*) n=lpt f=0;;
357	lpa*) n=lpa f=128;;
358	esac
359	M $n$U c major_lpt_c Add($U, $f) 600-})dnl
360__devitem(lpa, lpa*, Polled printer port,lpt)dnl
361__devitem(ppi, ppi*, HP-IB plotters)dnl
362__devtitle({-usb-}, USB devices)dnl
363__devitem({-usb-}, usb*, Bus control devices used by usbd for attach/detach)dnl
364_mkdev({-usb-}, usb*, {-[ "$i" = "usb" ] && u= || u=$U
365	M usb$u c major_usb_c $U 660-})dnl
366__devitem(uhid, uhid*, Generic HID devices)dnl
367_mcdev({-uhid-}, uhid*, {-uhid-}, {-major_uhid_c-}, 660)dnl
368__devitem(ulpt, ulpt*, Printer devices)dnl
369_mcdev({-ulpt-}, ulpt*, {-ulpt-}, {-major_ulpt_c-}, 660)dnl
370__devitem(ttyU, ttyU*, USB serial ports,ucom)dnl
371_mkdev({-ttyU-}, {-ttyU[0-9a-zA-Z]-}, {-U=${i#ttyU*}
372	o=$(alph2d $U)
373	M ttyU$U c major_ttyU_c $o 660 dialer uucp
374	M cuaU$U c major_ttyU_c Add($o, 128) 660 dialer uucp-})dnl
375__devitem(urio, urio*, Diamond Multimedia Rio 500)dnl
376_mcdev({-urio-}, urio*, {-urio-}, {-major_urio_c-}, 660)dnl
377__devitem(ugen, ugen*, Generic USB devices)dnl
378_mkdev(ugen, ugen*, {-n=Mult($U, 16)
379	for j in 0{0,1,2,3,4,5,6,7,8,9} 1{0,1,2,3,4,5}
380	do
381		M ugen$U.$j c major_ugen_c Add($n, 10#$j) 660
382	done-})dnl
383__devtitle(call, Call units)dnl
384__devtitle(term, Terminal ports)dnl
385__devitem(dca, dca*, HP200/300 single port serial interface)dnl
386__devitem(dcm, dcm*, HP200/300 4 port serial mux interface)dnl
387__devitem(apci, apci*, HP400 4 port serial mux interface)dnl
388__devitem({-com-}, {-tty[0-7][0-9a-f]-}, NS16x50 serial ports)dnl
389_mkdev(com, {-tty[0-7][0-9a-f]-}, {-U=${i#tty*}
390	o=$(h2d $U)
391	M tty$U c major_com_c $o 660 dialer uucp
392	M cua$U c major_com_c Add($o, 128) 660 dialer uucp-})dnl
393__devitem(ttyc, ttyc*, Cyclades serial ports,cy)dnl
394__devitem(tzs, tty[a-z]*, Zilog 8530 Serial Port,zs)dnl
395_mkdev(tzs, {-tty[a-z]-}, {-u=${i#tty*}
396	case $u in
397	a) n=0 ;;
398	b) n=1 ;;
399	c) n=4 ;;
400	d) n=5 ;;
401	*) echo unknown tty device $i ;;
402	esac
403	M tty$u c major_tzs_c $n 660 dialer uucp-})dnl
404__devitem(tth, ttyh*, Sab82532 serial devices,sab)dnl
405_mkdev(tth, ttyh*, {-M ttyh$U c major_tth_c $U 660 dialer uucp-})dnl
406__devitem(czs, cua[a-z]*, Zilog 8530 Serial Port,zs)dnl
407_mkdev(czs, cua[a-z], {-u=${i#cua*}
408	case $u in
409	a) n=0 ;;
410	b) n=1 ;;
411	c) n=4 ;;
412	d) n=5 ;;
413	*) echo unknown cua device $i ;;
414	esac
415	M cua$u c major_czs_c Add($n, 128) 660 dialer uucp-})dnl
416__devitem(tty0, tty00, Standard serial port,com)dnl
417__devitem(mac_tty0, tty00, Standard serial port,zsc)dnl
418__devitem(ttyz, tty[a-d], On-board zs serial ports,zs)dnl
419__devitem(cuaz, cua[a-d], On-board zs serial ports,zs)dnl
420__devitem(ttyB, ttyB?, DEC 3000 ZS8530 ("scc") serial ports,scc)dnl
421__devitem(scc, scc*, 82530 serial interface,scc)dnl
422__devtitle(spec, Special purpose devices)dnl
423_mkdev(apm, apm*, {-M apm	c major_apm_c 0 644
424	M apmctl	c major_apm_c 8 644-})dnl
425_mkdev(acpi, acpi*, {-M acpi	c major_acpi_c 0 644-})dnl
426__devitem(pctr, pctr*, PC Performance Tuning Register access device)dnl
427_mkdev(pctr, pctr, {-M pctr c major_pctr_c 0 644-})dnl
428__devitem(systrace, systrace*, System call tracing device)dnl
429_mkdev(systrace, systrace, {-M systrace c major_systrace_c 0 644-})dnl
430__devitem(au, audio*, Audio devices,audio)dnl
431_mkdev(au, audio*, {-M sound$U	c major_au_c $U
432	M mixer$U	c major_au_c Add($U, 16)
433	M audio$U	c major_au_c Add($U, 128)
434	M audioctl$U	c major_au_c Add($U, 192)
435	MKlist[${#MKlist[*]}]=";[ -e audio ] || ln -s audio$U audio"
436	MKlist[${#MKlist[*]}]=";[ -e mixer ] || ln -s mixer$U mixer"
437	MKlist[${#MKlist[*]}]=";[ -e sound ] || ln -s sound$U sound"
438	MKlist[${#MKlist[*]}]=";[ -e audioctl ] || ln -s audioctl$U audioctl"-})dnl
439__devitem(vi, video*, Video V4L2 devices,video)dnl
440_mkdev(vi, video*, {-M video$U  c major_vi_c $U
441	MKlist[${#MKlist[*]}]=";[ -e video ] || ln -s video$U video"-})dnl
442__devitem(asc, asc*, ASC Audio device)dnl
443_mkdev(asc, asc*, {-M asc$U major_asc_c 0-})dnl
444__devitem(bio, bio, {-ioctl tunnel pseudo-device-})dnl
445_mkdev(bio, bio, {-M bio c major_bio_c 0 600-})dnl
446__devitem(radio, radio*, FM tuner devices)dnl
447_mkdev(radio, radio*, {-M radio$U     c major_radio_c $U
448	MKlist[${#MKlist[*]}]=";[ -e radio ] || ln -s radio$U radio"-})dnl
449__devitem(fdesc, fd, fd/* nodes, fd)dnl
450_mkdev(fdesc, fd, {-RMlist[${#RMlist[*]}]=";mkdir -p fd;rm -f" n=0
451	while [ $n -lt 64 ];do M fd/$n c major_fdesc_c $n;n=Add($n, 1);done
452	MKlist[${#MKlist[*]}]=";chmod 555 fd"-})dnl
453__devitem(oppr, openprom,PROM settings,openprom)dnl
454_cdev(oppr, openprom, 70, 0)dnl
455__devitem(cry, crypto, Hardware crypto access driver,crypto)dnl
456_mkdev(cry, crypto, {-M crypto c major_cry_c-} 0)dnl
457__devitem(pf, pf*, Packet Filter)dnl
458_mkdev(pf, {-pf*-}, {-M pf c major_pf_c 0 600-})dnl
459__devitem(bpf, bpf*, Berkeley Packet Filter)dnl
460_mkdev(bpf, {-bpf*-}, {-M bpf$U c major_bpf_c $U 600-}, 600)dnl
461_mkdev(tun, {-tun*-}, {-M tun$U c major_tun_c $U 600-}, 600)dnl
462__devitem(speak, speaker, PC speaker,spkr)dnl
463_mkdev(speak, speaker, {-M speaker c major_speak_c 0 600-})dnl
464__devitem(lkm, lkm, Loadable kernel modules interface)dnl
465_cdev(lkm, lkm, {-major_lkm_c-}, 0, 640, _lkm)dnl
466__devitem(tun, tun*, Network tunnel driver)dnl
467__devitem(rnd, *random, In-kernel random data source,random)dnl
468_mkdev(rnd, *random, {-n=0
469	for pre in " " s u a
470	do
471		M ${pre}random c major_rnd_c $n 644
472		n=Add($n, 1)
473	done-}, 644)dnl
474__devitem(joy, joy*, Joystick driver)dnl
475_mcdev(joy, joy*, joy, {-major_joy_c-}, 666)dnl
476__devitem(mag, magma*, Magma multiport cards,magma)dnl
477__devitem(bppmag, bppmag[mno], Magma parallel port,magma)dnl
478__devitem(spif, spif*, quote(spif)multiport cards)dnl
479__devitem(bppsp, bpp[jkl], quote(spif)parallel port,spif)dnl
480_mkdev(mag, magma*, {-case $U in
481	0)	offset=0  nam=m;;
482	1)	offset=16 nam=n;;
483	2)	offset=32 nam=o;;
484	*)	echo "bad unit for $i: $U"; exit 127;;
485	esac
486	offset=Mult($U, 64)
487	n=0
488	while [ $n -lt 16 ]
489	do
490		name=${nam}`hex $n`
491		M tty$name c major_mag_c Add($offset, $n) 660 dialer uucp
492		n=Add($n, 1)
493	done
494	M bpp${nam}0 c major_bppmag_c Add($offset, 0) 600
495	M bpp${nam}1 c major_bppmag_c Add($offset, 1) 600-})dnl
496_mkdev(spif, spif*, {-case $U in
497	0)	offset=0  nam=j;;
498	1)	offset=16 nam=k;;
499	2)	offset=32 nam=l;;
500	*)	echo "bad unit for $i: $U"; exit 127;;
501	esac
502	offset=Mult($U, 64)
503	n=0
504	while [ $n -lt 8 ]
505	do
506		name=${nam}`hex $n`
507		M tty$name c major_spif_c Add($offset, $n) 660 dialer uucp
508		n=Add($n, 1)
509	done
510	M bpp${nam}0 c major_bppsp_c Add($offset, 0) 600-})dnl
511__devitem(bpp, bpp*, Parallel port)dnl
512_mkdev(bpp, {-bpp*-}, {-M bpp$U c major_bpp_c $U 600-}, 600)dnl
513__devitem(vscsi, vscsi*, Virtual SCSI controller, vscsi 4)dnl
514_mcdev(vscsi, vscsi*, vscsi, {-major_vscsi_c-}, 600)dnl
515__devitem(rmidi, rmidi*, Raw MIDI devices,midi)dnl
516_mcdev(rmidi, rmidi*, rmidi, {-major_rmidi_c-}, 666)dnl
517__devitem(diskmap, diskmap, Disk mapper, diskmap)dnl
518_mkdev(diskmap, diskmap, {-M diskmap c major_diskmap_c 0 640 operator-})dnl
519__devitem(pppx, pppx*, PPP Multiplexer, pppx 4)dnl
520_mcdev(pppx, pppx*, pppx, {-major_pppx_c-}, 600)dnl
521__devtitle(plat, Platform-specific devices)dnl
522__devitem(bktr, bktr*, Video frame grabbers)dnl
523_mcdev(bktr, bktr*, bktr, {-major_bktr_c-}, 644)dnl
524__devitem(tuner, tuner*, Tuner devices, bktr)dnl
525_mkdev(tuner, tuner*, {-M tuner$U c major_bktr_c Add(Mult($U, 2), 16) 644-}, 644)dnl
526__devitem(pci, pci*, PCI bus devices)dnl
527_mkdev(pci, pci*, {-M pci$U	c major_pci_c $U 600
528	MKlist[${#MKlist[*]}]=";[ -h pci ] || ln -sf pci0 pci"-})dnl
529__devitem(pdc, pdc, PDC device)dnl
530__devitem(gpr, gpr*, GPR400 smartcard reader)dnl
531_mcdev(gpr, gpr*, gpr, {-major_gpr_c-})dnl
532__devitem(hotplug, hotplug, devices hot plugging)dnl
533_mkdev(hotplug, hotplug, {-M hotplug c major_hotplug_c $U 400-})dnl
534__devitem(gpio, gpio*, General Purpose Input/Output)dnl
535_mcdev(gpio, gpio*, gpio, {-major_gpio_c-}, 600)dnl
536_mkdev(local, local, {-test -s $T.local && sh $T.local-})dnl
537