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