Annotation of src/etc/MAKEDEV.mi, Revision 1.62
1.1 todd 1: include(MAKEDEV.sub)dnl
2: dnl
1.62 ! todd 3: vers(a, {-$OpenBSD: MAKEDEV.mi,v 1.61 2003/10/11 03:32:15 tedu Exp $-})dnl
1.1 todd 4: dnl
5: divert(1)dnl
6: {-#-}
1.60 todd 7: {-#-} Copyright (c) 2001,2002,2003 Todd T. Fries <todd@OpenBSD.org>
1.1 todd 8: {-#-}
1.60 todd 9: {-#-} Permission to use, copy, modify, and distribute this software for any
10: {-#-} purpose with or without fee is hereby granted, provided that the above
11: {-#-} copyright notice and this permission notice appear in all copies.
1.1 todd 12: {-#-}
1.60 todd 13: {-#-} THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14: {-#-} WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15: {-#-} MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16: {-#-} ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17: {-#-} WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18: {-#-} ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19: {-#-} OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1.1 todd 20: {-#-}
21: dnl
22: dnl Diversions: (upon termination, concatenated output queues)
23: dnl
24: dnl 0 - very top
25: dnl 1 - descriptions of devices
26: dnl 2 - init of script, function definitions, etc
27: dnl 3 - beginning of global recursive R() function
28: dnl 7 - body of MAKEDEV, device creations, etc
29: dnl 9 - end
30: dnl
31: dnl HOW TO ADD A DEVICE:
32: dnl
33: dnl In this file, you must use at least two macros:
34: dnl
1.29 todd 35: dnl Use '__devitem(uniqueid, name-pattern, description)' to create an entry
1.1 todd 36: dnl in the description at the top of the generated MAKEDEV file:
37: dnl
1.29 todd 38: dnl __devitem(sca, sca*, Sugar Generic device)dnl
1.41 todd 39: dnl __devitem(cry, crypto, hardware crypto access driver)dnl
1.1 todd 40: dnl
41: dnl This is ultimately shown as:
42: dnl
43: dnl # sca* Sugar Generic device
1.41 todd 44: dnl # crypto hardware crypto access driver
1.1 todd 45: dnl
1.29 todd 46: dnl Use '_mkdev(uniqueid, shell-pattern, {-shell-script-})dnl' to create
1.1 todd 47: dnl a shell script fragment used to 'create' the device (be sure to match
48: dnl the uniqueid from above):
49: dnl
1.29 todd 50: dnl _mkdev(sca, sca*, {-M sca$U c major_sca_c $U
51: dnl M rsca$U b major_sca_b Add($U, 128)-})dnl
1.41 todd 52: dnl _mkdev(cry, crypto, {-M crypto c major_cry_c 0-})dnl
1.1 todd 53: dnl
54: dnl This is ultimately expanded into:
55: dnl
1.41 todd 56: dnl sca*)
57: dnl M sca$U c 24 $U
58: dnl M sca$U b 42 $(($U+128))
59: dnl ;;
60: dnl
61: dnl crypto)
62: dnl M crypto c 47 0
63: dnl ;;
1.1 todd 64: dnl
1.29 todd 65: dnl In the MAKEDEV.md file, add a '_DEV(uniqueid, charmajor, blockmajor)'
1.1 todd 66: dnl entry:
67: dnl
1.29 todd 68: dnl _DEV(sca, 24, 42)
1.41 todd 69: dnl _DEV(cry, 47)
1.1 todd 70: dnl
1.41 todd 71: dnl Final step is to use the 'target/twrget' macros to have the 'all)' target
72: dnl generate one or more device(s). Usage of 'target/twrget' is:
73: dnl target(target_name, device_name [, append_string ] .. )
74: dnl twrget(target_name, uniqueid, device_name, [, append_string ] .. )
1.1 todd 75: dnl
1.41 todd 76: dnl target_name a unique name that later is used as an argument to
77: dnl 'show_target()' (which expands all devices for a
78: dnl given 'target_name').
79: dnl uniqueid same as 'uniqueid' above
80: dnl device_name string representing the device to be mknod'ed
81: dnl append_string for each append_string, `device_name' is prepended
82: dnl
83: dnl Note: 'target(a,b,c)' is equivalent to 'twrget(a,b,b,c)'
84: dnl
85: dnl
86: dnl For a short example:
87: dnl
88: dnl target(all, std)dnl
89: dnl target(all, sca, 0, 1, 2, 3)dnl
90: dnl twrget(all, cry, crypto)dnl
1.1 todd 91: dnl
92: dnl would expand to:
93: dnl
94: dnl all)
1.41 todd 95: dnl R std sca0 sca1 sca2 sca3 crypto
1.1 todd 96: dnl ;;
97: dnl
1.41 todd 98: dnl presuming '_DEV(sca, ?, ?)' and '_DEV(std)' were in the MAKEDEV.md file.
1.1 todd 99: dnl
100: dnl
101: dnl Everything is 'automatically' added to 'MAKEDEV' based on whether or
102: dnl not the '_DEV()' entry has a corresponding _mkdev() and __devitem()
1.41 todd 103: dnl entry in MAKEDEV.mi (this file).
1.1 todd 104: dnl
105: dnl Note: be very wary of adding whitespace, carriage returns, or not
106: dnl finishing a macro with ')dnl' .. otherwise, extra blank lines show up
107: dnl in the output.
108: dnl
1.31 todd 109: dnl TODO:
110: dnl
111: dnl make a 'disktgt' macro that automatically does:
1.34 deraadt 112: dnl disktgt(rd, {-rd-})
1.31 todd 113: dnl
114: dnl target(all,rd,0)
115: dnl target(ramd,rd,0)
116: dnl disk_q(rd)
1.34 deraadt 117: dnl __devitem(rd, {-rd*-}, {-rd-})dnl
1.31 todd 118: dnl
1.41 todd 119: dnl Note: not all disks are generated in 'all)'. (e.g. vax has a lot of
120: dnl disks that are not generated by 'all)')
121: dnl
1.31 todd 122: dnl
1.29 todd 123: _mkdev(loc, local, {-test -s $T.local && sh $T.local-})dnl
1.1 todd 124: dnl
1.29 todd 125: __devtitle(make, Device "make" file. Valid arguments)dnl
126: __devitem({-all-}, {-all-},
1.4 todd 127: {-makes all known devices{-,-} including local devices.
1.1 todd 128: {-#-} Tries to make the ``standard'' number of each type.-})dnl
129: dnl
130: dnl
1.29 todd 131: target(all, mcd, 0)dnl
132: twrget(all, fdesc, fd)dnl
133: target(all, st, 0, 1)dnl
134: target(all, std)dnl
135: target(all, raid, 0, 1, 2, 3)dnl
136: target(all, rz, 0, 1, 2, 3, 4)dnl
137: target(all, hp, 0, 1, 2, 3)dnl
138: target(all, ra, 0, 1, 2, 3)dnl
139: target(all, rx, 0, 1)dnl
140: target(all, wd, 0, 1, 2, 3)dnl
141: target(all, xd, 0, 1, 2, 3)dnl
142: twrget(all, aflo, fd, 0, 1, 2, 3)dnl
1.46 provos 143: target(all, systrace)dnl
1.29 todd 144: target(all, pctr)dnl
145: target(all, pctr0)dnl
146: target(all, pf)dnl
147: twrget(all, cry, crypto)dnl
148: target(all, apm)dnl
149: twrget(all, tth, ttyh, 0, 1)dnl
150: target(all, ttyA, 0, 1)dnl
151: target(all, ttyB, 0, 1, 2, 3, 4, 5)dnl
1.40 deraadt 152: twrget(all, attyB, ttyB, 0, 1, 2, 3, 4)dnl
1.29 todd 153: target(all, tty0, 0, 1, 2, 3)dnl
154: twrget(all, mac_tty0, tty0, 0, 1)dnl
155: twrget(all, tzs, tty, a, b, c, d)dnl
156: twrget(all, czs, cua, a, b, c, d)dnl
157: target(all, ttyc, 0, 1, 2, 3, 4, 5, 6, 7)dnl
158: twrget(all, com, tty0, 0, 1, 2, 3)dnl
159: twrget(all, mac_ttye, ttye, 0)dnl
160: target(all, ttye, 0, 1, 2, 3, 4, 5, 6)dnl
161: target(all, lkm)dnl
162: twrget(all, mmcl, mmclock)dnl
163: target(all, lpt, 0, 1, 2)dnl
164: twrget(all, lpt, lpa, 0, 1, 2)dnl
165: target(all, joy, 0, 1)dnl
1.41 todd 166: twrget(all, rnd, random)dnl
1.29 todd 167: target(all, uk, 0)dnl
168: target(all, wt, 0)dnl
169: target(all, wdt, 0)dnl
170: twrget(all, au, audio, 0)dnl
171: twrget(all, speak, speaker)dnl
172: target(all, asc, 0)dnl
173: target(all, music, 0)dnl
174: target(all, radio, 0)dnl
175: target(all, tuner, 0)dnl
176: target(all, rmidi, 0, 1, 2, 3, 4, 5, 6, 7)dnl
177: target(all, usbs)dnl
178: target(all, adb)dnl
179: target(all, iop, 0, 1)dnl
180: target(all, pci)dnl
181: twrget(all, wsmouse, wscons)dnl
1.40 deraadt 182: twrget(all, grf_mac, grf, 0, 1, 2, 3)dnl
1.29 todd 183: target(all, par, 0)dnl
184: twrget(all, amouse, mouse, 0, 1)dnl
185: twrget(all, akbd, kbd)dnl
186: target(all, apci, 0)dnl
187: target(all, ppi, 0)dnl
188: target(all, view0, 0, 1, 2, 3, 4, 5)dnl
189: target(all, local)dnl
1.49 fgsch 190: target(all, gpr, 0)dnl
1.18 todd 191: dnl
1.29 todd 192: _mkdev(all, {-all-}, {-dnl
1.18 todd 193: show_target(all)dnl
194: -})dnl
195: dnl
1.34 deraadt 196: __devitem(ramdisk, ramdisk, devices to be put on ramdisk-based media)dnl
1.29 todd 197: __devitem(std, {-std-}, standard devices)dnl
1.1 todd 198: dnl
1.18 todd 199: dnl
200: dnl
1.1 todd 201: dnl _std
202: dnl
203: dnl $1: tty
204: dnl $2: memstuff
205: dnl $3: ksyms
206: dnl $4: drum
207: dnl $5: klog
208: dnl
1.29 todd 209: define({-_std-}, {-dnl
1.1 todd 210: std)
211: M console c 0 0 600
212: M tty c $1 0
213: M mem c $2 0 640 kmem
214: M kmem c $2 1 640 kmem
215: M null c $2 2
216: M zero c $2 12
217: M stdin c major_fdesc_c 0
218: M stdout c major_fdesc_c 1
219: M stderr c major_fdesc_c 2
220: M ksyms c $3 0 640 kmem
221: M drum c $4 0 640 kmem
222: M klog c $5 0 600-})dnl
223: dnl
1.29 todd 224: target(usb, usb, 0, 1)dnl
225: target(usb, urio, 0)dnl
226: twrget(usb, uscan, uscanner, 0)dnl
227: target(usb, uhid, 0, 1, 2, 3)dnl
228: target(usb, ulpt, 0, 1)dnl
229: target(usb, ugen, 0, 1)dnl
230: target(usb, utty, 0, 1)dnl
1.18 todd 231: dnl
1.29 todd 232: __devitem({-usbs-}, usbs, make USB devices)dnl
233: _mkdev(usbs, usbs, {-dnl
1.18 todd 234: show_target({-usb-})dnl
235: -})dnl
1.29 todd 236: __devtitle(tap, Tapes)dnl
237: __devitem(wt, {-wt* -}, QIC-interface (e.g. not SCSI) 3M cartridge tape)dnl
238: _mkdev(wt, wt*,
1.1 todd 239: {-name=wt
1.29 todd 240: n=Mult($U, 8) m=Add($n, 4)
1.1 todd 241: M $name$U b major_wt_b $n 640 operator
242: M r$name$U c major_wt_c $n 640 operator
243: M n$name$U b major_wt_b $m 640 operator
244: M nr$name$U c major_wt_c $m 640 operator-})dnl
1.29 todd 245: __devitem(tz, tz*, {-SCSI tapes{-,-} DEC TK50 cartridge tape-})dnl
246: __devitem(st, {-st*-}, SCSI tapes)dnl
247: _mkdev(st, st*, {-n=Mult($U, 16)
1.1 todd 248: for pre in " " n e en
249: do
250: M ${pre}st$U b major_st_b $n 660 operator
251: M ${pre}rst$U c major_st_c $n 660 operator
1.29 todd 252: n=Add($n, 1)
1.1 todd 253: done-})dnl
1.29 todd 254: __devitem(ct, ct*, HP300 HP-IB cartridge tape)dnl
255: __devitem(mt, mt*, (Magnetic) 9-track reel tape)dnl
256: __devitem(ht, ht*, massbus tm03 & tu??)dnl
257: __devitem(tm, tm*, unibus tm11 & te10 emulations (e.g. Emulex tc-11))dnl
258: __devitem(ts, ts*, unibus ts11)dnl
259: __devitem(ut, ut*, unibus tu45 emulations (e.g.si 9700))dnl
260: __devtitle(dis, Disks)dnl
261: __devitem(rz, rz*, SCSI disks)dnl
1.31 todd 262: __devitem(sd, {-sd*-}, {-SCSI disks, includes flopticals-})dnl
1.29 todd 263: __devitem(hd, {-hd*-}, HP300 HP-IB disks)dnl
264: __devitem(cd, {-cd*-}, SCSI cdrom drives)dnl
265: __devitem(acd, acd*, ATAPI cdrom drives)dnl
266: _mkdev(cd, cd*, {-dodisk2 cd $U major_cd_b major_cd_c $U 0{--}ifstep(cd)-})dnl
267: __devitem(mcd, mcd*, Mitsumi cdrom drives)dnl
268: _mkdev(mcd, mcd*, {-dodisk2 mcd $U major_mcd_b major_mcd_c $U 0{--}ifstep(mcd)dnl
269: -})dnl
270: __devitem(ch, {-ch*-}, SCSI media changer)dnl
271: _mcdev(ch, ch*, ch, {-major_ch_c-}, 660, operator)dnl
272: __devitem(uk, uk*, SCSI Unknown device)dnl
273: _mcdev(uk, uk*, uk, {-major_uk_c-}, 640, operator)dnl
274: __devitem(ss, ss*, SCSI scanners)dnl
1.31 todd 275: _mkdev(ss, ss*, {-M ss$U c major_ss_c Mult($U,16) 640 operator
276: M nss$U c major_ss_c Add(Mult($U,16),1) 640 operator
277: M enss$U c major_ss_c Add(Mult($U,16),3) 640 operator
1.1 todd 278: RMlist="$RMlist scan$U"
279: MKlist="$MKlist;umask 77;ln -s ss$U scan$U"-})dnl
1.29 todd 280: __devitem(ses, ses*, SES/SAF-TE SCSI devices)dnl
281: _mkdev(ses, ses*, {-M ses$U c major_ses_c $U 640 operator-})dnl
282: __devitem(ramd, ramdisk, makes all devices for a ramdisk kernel)dnl arc
283: _mkdev(ramd, ramdisk, {-dnl
1.20 todd 284: show_target(ramd)dnl
1.29 todd 285: -})dnl
286: target(ramd, std)dnl
287: target(ramd, random)dnl
288: target(ramd, bpf, 0)dnl
1.34 deraadt 289: __devitem(rd, {-rd*-}, "rd" pseudo-disks)dnl
1.29 todd 290: _mkdev(rd, rd*, {-dodisk2 rd $U major_rd_b major_rd_c $U 0{--}ifstep(rd)-})dnl
291: __devitem(xd, xd*, Xylogic 753/7053 disks)dnl
292: __devitem(xy, xy*, {- Xylogic 450/451 disks-})dnl
293: __devitem(flo, {-fd*-}, {-Floppy disk drives (3 1/2"{-,-} 5 1/4")-})dnl
294: _mkdev(flo, fd*,
1.1 todd 295: {-typnam=$U${i#fd[01]*}
296: case $typnam in
297: 0|1) typnum=0;; # no type specified, assume A
1.26 deraadt 298: *A) typnum=0; typnam=0;;
299: *B) typnum=1;;
300: *C) typnum=2;;
301: *D) typnum=3;;
302: *E) typnum=4;;
303: *F) typnum=5;;
304: *G) typnum=6;;
305: *H) typnum=7;;
306: *) echo bad type $typnam for $i; exit 1;;
1.1 todd 307: esac
308: case $U in
309: 0|1) blk=major_flo_b; chr=major_flo_c;;
310: *) echo bad unit $U for $i; exit 1;;
311: esac
312: nam=fd${typnam}
1.29 todd 313: n=Add(Mult($U, 128), Mult($typnum, 16))
1.1 todd 314: M ${nam}a b $blk $n 640 operator
1.29 todd 315: M ${nam}b b $blk Add($n, 1) 640 operator
316: M ${nam}c b $blk Add($n, 2) 640 operator
1.1 todd 317: M r${nam}a c $chr $n 640 operator
1.29 todd 318: M r${nam}b c $chr Add($n, 1) 640 operator
319: M r${nam}c c $chr Add($n, 2) 640 operator-}, 664)dnl
320: __devitem(aflo, ramdisk, devices needed for install floppies)dnl
321: _mkdev(aflo, fd*, {-case $U in 0|1|2|3)
322: M fd${U}a b major_aflo_b Mult($U, 16) 640 operator
323: M fd${U}b b major_aflo_b Add(Mult($U, 16), 1) 640 operator
324: M rfd${U}a c major_aflo_c Mult($U, 16) 640 operator
325: M rfd${U}b c major_aflo_c Add(Mult($U, 16), 1) 640 operator;;
1.1 todd 326: *) echo bad unit for floppy disk in: $i;;
327: esac-})dnl
1.29 todd 328: __devitem(iop, iop*, I2O controller device)dnl
329: _mcdev(iop, iop*, iop, {-major_iop_c-}, 660)dnl
330: __devitem(wdt, wdt0, watchdog timer)dnl
331: _mcdev(wdt, wdt0, wdt, {-major_wdt_c-}, 440, operator)dnl
332: __devitem(local, local, configuration specific devices)dnl
333: __devitem(wd, {-wd*-}, {-"winchester" disk drives (ST506, IDE, ESDI, RLL, ...)-})dnl
334: __devitem(ccd, ccd*, concatenated disk devices)dnl
335: __devitem(raid, raid*, RAIDframe disk devices)dnl
336: __devitem(vnd, vnd*, "file" pseudo-disks)dnl
337: _mkdev(vnd, vnd*, {-dodisk vnd $U major_vnd_b major_vnd_c $U 0{--}ifstep(vnd)
1.61 tedu 338: dodisk svnd $U major_vnd_b major_vnd_c $U 2048{--}ifstep(vnd)-})dnl
1.29 todd 339: __devitem(ra, ra*, {-MSCP disks (ra??, hd??)-})dnl
340: __devitem(hp, hp*, {-massbuss rm??-})dnl
341: __devitem(hk, hk*, {-unibus rk06 and rk07-})dnl
342: __devitem(up, up*, {-other unibus devices (e.g. on Emulex sc-21v controller)-})dnl
343: __devitem(rb, rb*, {-730 idc w/ rb80 and/or rb02-})dnl
344: __devitem(rx, rx*, {-MSCP floppy disk (rx33/50/...)-})dnl
345: __devitem(rl, rl*, {-unibus r102-})dnl
346: __devitem(hd, hd*, {-HDC9224 hd disks on VS2000-})dnl
1.1 todd 347: dnl
348: dnl For normal disk devices, add a disk_q entry; anything else define like
349: dnl the rest (such as vnd above).
350: dnl
1.18 todd 351: disk_q({-ccd-})dnl
352: disk_q({-hd-})dnl
353: disk_q({-hk-})dnl
354: disk_q({-hp-})dnl
355: disk_q({-ra-})dnl
356: disk_q({-raid-})dnl
357: disk_q({-rb-})dnl
358: disk_q({-rl-})dnl
359: disk_q({-rx-})dnl
360: disk_q({-sd-})dnl
1.1 todd 361: disk_q({-xy-})dnl
362: disk_q({-xd-})dnl
1.18 todd 363: disk_q({-up-})dnl
364: disk_q({-wd-})dnl
1.1 todd 365: disk_q({-rz-})dnl
366: dnl
1.29 todd 367: __devitem(loc, local, configuration specific devices)dnl
368: _mkdev(loc, local, {-test -s $T.local && sh $T.local-})dnl
369: _mkdev({-disks-}, {-undefine({-C_ase-})show_disks()undefine({-C_ase-})-},
1.1 todd 370: {-case $i in
371: show_disks2()dnl
1.6 todd 372: esac-})dnl
1.1 todd 373: __mkdev({-disks-}){--}dnl
374: dnl
1.29 todd 375: __devtitle(cons, Console ports)dnl
376: __devitem(ttyv0, ttyv0, pccons or pcvt screen 0)dnl
377: __devitem(ttyv, ttyv*, pcvt)dnl
378: __devitem(ttye, ttye*, ite bitmapped consoles)dnl
379: __devitem(mac_ttye, ttye*, ite bitmapped consoles)dnl
380: __devitem(wscons, ttyC0, wscons screen 0)dnl
1.35 todd 381: twrget(wscons, wscons, ttyC, cfg, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b)dnl
382: target(wscons, wsmux)dnl
383: target(wscons, wskbd, 0, 1, 2, 3)dnl
384: target(wscons, wsmouse, 0, 1, 2, 3)dnl
1.29 todd 385: _mkdev({-wscons-}, {-wscons-}, {-dnl
1.35 todd 386: show_target(wscons)dnl
387: -})dnl
1.36 todd 388: __devitem(wsdisp, ttyC-F*, wscons virtual consoles)dnl
1.35 todd 389: _mkdev({-wsdisp-}, tty[C-F]*, {-U=${i##tty[C-F]}
390: case $i in
391: ttyC*) n=C m=expr(0*256);;
392: ttyD*) n=D m=expr(1*256);;
393: ttyE*) n=E m=expr(2*256);;
394: ttyF*) n=F m=expr(3*256);;
395: esac
1.3 todd 396: case $U in
1.35 todd 397: [0-9a-f]) M tty$n$U c major_wsdisp_c {-$(( 16#$U + $m ))-} 600;;
398: cfg) M tty${n}cfg c major_wsdisp_c Add(255,$m) 600;;
1.3 todd 399: *) echo bad unit $U for $i; exit 1;;
1.6 todd 400: esac-})dnl
1.29 todd 401: __devitem(wskbd, wskbd*, wscons keyboards)dnl
402: _mkdev(wskbd, wskbd*, {-M wskbd$U c major_wskbd_c $U 600-})dnl
403: __devitem(wsmux, wsmux, wscons keyboard/mouse mux devices)dnl
404: _mkdev(wsmux, wsmux|wsmouse|wskbd, {-M wsmouse c major_wsmux_c 0 600
1.1 todd 405: M wskbd c major_wsmux_c 1 600-})dnl
1.29 todd 406: __devitem(pcons, console, PROM console)dnl
407: __devtitle(point, Pointing devices)dnl
408: __devitem(wsmouse, wsmouse*, wscons mice)dnl
409: _mkdev(wsmouse, wsmouse*, {-M wsmouse$U c major_wsmouse_c $U 600-})dnl
410: __devitem(quad, quadmouse, "quadrature mouse")dnl
411: __devtitle(pty, Pseudo terminals)dnl
412: __devitem(tty, tty*, set of 16 slave psuedo terminals)dnl
413: __devitem(pty, pty*, set of 16 master pseudo terminals)dnl
1.31 todd 414: _mkdev(pty, pty*, {-if [ $U -gt 15 ]; then
415: echo bad unit for pty in: $i
416: continue
417: fi
418: set -A tbl p q r s t u v w x y z P Q R S T
419: name=${tbl[$U]}
1.1 todd 420: n=0
421: while [ $n -lt 16 ]
422: do
423: nam=$name$(hex $n)
1.31 todd 424: off=Mult($U, 16)
1.29 todd 425: M tty$nam c major_tty_c Add($off, $n)
426: M pty$nam c major_pty_c Add($off, $n)
427: n=Add($n, 1)
1.1 todd 428: done-})dnl
1.29 todd 429: __devitem(dc, dc*, {-4 channel serial interface (keyboard{-,-} mouse{-,-}modem{-,-} printer)-})dnl
430: __devtitle(prn, Printers)dnl
431: __devitem(par, par*, motherboard parallel port)dnl
432: __devitem(lpt, lpt*, IEEE 1284 centronics printer)dnl
433: _mkdev(lpt, lpt*|lpa*,
1.1 todd 434: {-case $i in
435: lpt*) n=lpt f=0;;
436: lpa*) n=lpa f=128;;
437: esac
1.29 todd 438: M $n$U c major_lpt_c Add($U, $f) 600-})dnl
439: __devitem(lpa, lpa*, interruptless lp)dnl
440: __devitem(ppi, ppi*, HP-IB plotters)dnl
441: __devtitle({-usb-}, USB devices)dnl
442: __devitem({-usb-}, usb*, Bus control devices used by usbd for attach/detach)dnl
443: _mkdev({-usb-}, usb*, {-[ "$i" = "usb" ] && u= || u=$U
1.1 todd 444: M usb$u c major_usb_c $U 660-})dnl
1.29 todd 445: __devitem(uhid, uhid*, Generic HID devices)dnl
446: _mcdev({-uhid-}, uhid*, {-uhid-}, {-major_uhid_c-}, 660)dnl
447: __devitem(ulpt, ulpt*, Printer devices)dnl
448: _mcdev({-ulpt-}, ulpt*, {-ulpt-}, {-major_ulpt_c-}, 660)dnl
449: __devitem(utty, utty*, Serial ports)dnl
450: _mcdev({-utty-}, utty*, {-utty-}, {-major_utty_c-}, 660)dnl
451: __devitem(urio, urio*, Diamond Multimedia Rio 500)dnl
452: _mcdev({-urio-}, urio*, {-urio-}, {-major_urio_c-}, 660)dnl
453: __devitem(uscan, uscanner*, Scanners)dnl
454: _mcdev({-uscan-}, uscanner*, {-uscanner-}, {-major_uscan_c-}, 660)dnl
455: __devitem(ugen, ugen*, Generic device)dnl
456: _mkdev(ugen, ugen*, {-n=Mult($U, 16)
1.1 todd 457: for j in 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15
458: do
1.29 todd 459: M ugen$U.$j c major_ugen_c Add($n, $j) 660
1.1 todd 460: done-})dnl
1.29 todd 461: __devtitle(cpu, Cpus)dnl
462: __devitem(cpu, cpu*, cpus)dnl
463: __devtitle(call, Call units)dnl
464: __devtitle(term, Terminal ports)dnl
465: __devtitle(termp, Terminal multiplexers)dnl
466: __devitem(dca, dca*, HP200/300 single port serial interface)dnl
467: __devitem(dcm, dcm*, HP200/300 4 port serial mux interface)dnl
468: __devitem(apci, apci*, HP400 4 port serial mux interface)dnl
1.62 ! todd 469: __devitem({-com-}, {-tty[0-7][0-9a-f]-}, NS16x50 serial ports)dnl
! 470: _mkdev(com, {-tty[0-7][0-9a-f]-}, {-U=${i#tty*}
! 471: o=$(hextod $U)
! 472: M tty$U c major_com_c $o 660 dialer uucp
! 473: M cua$U c major_com_c Add($o, 128) 660 dialer uucp-})dnl
1.29 todd 474: __devitem(ttyc, ttyc*, Cyclades serial ports)dnl
475: __devitem(tzs, tty[a-z]*, Zilog 8530 Serial Port)dnl
476: _mkdev(tzs, {-tty[a-z]-}, {-u=${i#tty*}
1.1 todd 477: case $u in
478: a) n=0 ;;
479: b) n=1 ;;
480: c) n=4 ;;
481: d) n=5 ;;
482: *) echo unknown tty device $i ;;
483: esac
484: M tty$u c major_tzs_c $n 660 dialer uucp-})dnl
1.29 todd 485: __devitem(tth, ttyh*, Sab82532 serial devices)dnl
486: _mkdev(tth, ttyh*, {-M ttyh$U c major_tth_c $U 660 dialer uucp-})dnl
487: __devitem(czs, cua[a-z]*, Zilog 8530 Serial Port)dnl
488: _mkdev(czs, cua[a-z], {-u=${i#cua*}
1.1 todd 489: case $u in
490: a) n=0 ;;
491: b) n=1 ;;
492: c) n=4 ;;
493: d) n=5 ;;
1.41 todd 494: *) echo unknown cua device $i ;;
1.1 todd 495: esac
1.29 todd 496: M cua$u c major_czs_c Add($n, 128) 660 dialer uucp-})dnl
497: __devitem(arm_tty, tty*, {-alias for PC COM ports{-,-} this is what the system really wants-})dnl
498: __devitem(tty0, tty00, standard serial port)dnl
499: __devitem(mac_tty0, tty00, standard serial port)dnl
500: __devitem(ttyA, ttyA*, mfc serial ports)dnl
501: __devitem(ttyz, tty[a-d], onboard zs serial ports)dnl
502: __devitem(cuaz, cua[a-d], onboard zs serial ports)dnl
503: __devitem(ttyB, ttyB?, DEC 3000 ZS8530 ("scc") serial ports)dnl
504: __devitem(scc, scc*, 82530 serial interface)dnl
505: __devitem(arc_ttyC, ttyC0, pccons)dnl
506: __devitem(i386_ttyC, ttyC*, pcvt)dnl
507: __devitem(ttyC, ttyC?, {-AlphaStation NS16550 ("com serial ports")-})dnl
508: __devitem(ttyE, ttyE?, Workstation console (framebuffer & keyboard) tty emulators)dnl
509: __devitem(ser02, ser02, {-serial2 port (channel A on 8530)-})dnl
510: __devitem(mdm02, mdm02, {-modem2 port (channel B on 8530)-})dnl
511: __devtitle(spec, Special purpose devices)dnl
512: __devitem(apm, apm , power management device)dnl
513: _mkdev(apm, apm*, {-M apm c major_apm_c 0 644
1.1 todd 514: M apmctl c major_apm_c 8 644-})dnl
1.29 todd 515: __devitem(pcmcia, pcmcia*, PCMCIA card drivers)dnl
516: __devitem(pctr, pctr*, PC Performance Tuning Register access device)dnl
517: _mkdev(pctr, pctr, {-M pctr c major_pctr_c 0 644-})dnl
1.46 provos 518: __devitem(systrace, systrace*, system call tracing device)dnl
519: _mkdev(systrace, systrace, {-M systrace c major_systrace_c 0 644-})dnl
1.29 todd 520: __devitem(au, audio*, audio device)dnl
521: _mkdev(au, audio*, {-M sound$U c major_au_c $U
522: M mixer$U c major_au_c Add($U, 16)
523: M audio$U c major_au_c Add($U, 128)
524: M audioctl$U c major_au_c Add($U, 192)
1.1 todd 525: MKlist="$MKlist;[ -e audio ] || ln -s audio$U audio"
526: MKlist="$MKlist;[ -e mixer ] || ln -s mixer$U mixer"
527: MKlist="$MKlist;[ -e sound ] || ln -s sound$U sound"
528: MKlist="$MKlist;[ -e audioctl ] || ln -s audioctl$U audioctl"-})dnl
1.29 todd 529: __devitem(asc, asc*, ASC Audio device)dnl
530: _mkdev(asc, asc*, {-M asc$U major_asc_c 0-})dnl
531: __devitem(music, music*, midi devices)dnl
532: _mkdev(music, music*, {-M music$U c major_music_c $U
533: M sequencer$U c major_music_c Add($U, 128)
1.1 todd 534: MKlist="$MKlist;[ -e music ] || ln -s music$U music"
535: MKlist="$MKlist;[ -e sequencer ] || ln -s sequencer$U sequencer"-})dnl
1.29 todd 536: __devitem(radio, radio*, FM tuner device)dnl
537: _mkdev(radio, radio*, {-M radio$U c major_radio_c $U
1.8 todd 538: MKlist="$MKlist;[ -e radio ] || ln -s radio$U radio"-})dnl
1.29 todd 539: __devitem(fdesc, fd, makes fd/* for the fdescfs)dnl
540: _mkdev(fdesc, fd, {-RMlist="mkdir -p fd;$RMlist" n=0
541: while [ $n -lt 64 ];do M fd/$n c major_fdesc_c $n;n=Add($n, 1);done
1.1 todd 542: MKlist="$MKlist;chmod 555 fd"-})dnl
1.29 todd 543: __devtitle(graph, Graphics devices)dnl
544: __devitem(grf_mac, grf*, {-custom chip (grf0){-,-} Retina Z2/Z3 (grf1/grf2){-,-}
1.1 todd 545: {-#-} Cirrus boards (grf3){-,-} A2410 (grf4) video or
546: {-#-} CyberVision 64 (grf5)-})dnl
1.29 todd 547: __devitem(ite, ite*, terminal emulator interface to HP300 graphics devices)dnl
548: __devitem({-hil-}, {-hil-}, HP300 HIL input devices)dnl
549: __devitem(oppr, openprom)dnl
550: _cdev(oppr, openprom, 70, 0)dnl
551: __devitem(cry, crypto, hardware crypto access driver)dnl
552: _mkdev(cry, crypto, {-M crypto c major_cry_c-} 0)dnl
553: __devitem(pf, pf*, Packet Filter)dnl
554: _mkdev(pf, {-pf*-}, {-M pf c major_pf_c 0 600-})dnl
555: __devitem(bpf, bpf*, Berkeley Packet Filter)dnl
556: _mkdev(bpf, {-bpf*-}, {-M bpf$U c major_bpf_c $U 600-}, 600)dnl
557: _mkdev(tun, {-tun*-}, {-M tun$U c major_tun_c $U 600-}, 600)dnl
558: __devitem(speak, speaker, pc speaker)dnl
559: _mkdev(speak, speaker, {-M speaker c major_speak_c 0 600-})dnl
560: __devitem(kbd, kbd, keyboard (provides events, for X11))dnl
561: _cdev(kbd, kbd, {-major_kbd_c-}, 0, 600)dnl
562: __devitem(kbd_atari, kbd, Atari keyboard)dnl
563: __devitem(akbd, kbd, Amiga keyboard)dnl
564: __devitem(rkbd, kbd, raw keyboard)dnl
565: __devitem(kbdctl, kbdctl, keyboard control)dnl
566: __devitem(beep, beep, riscpc speaker)dnl
567: __devitem(iic, iic*, IIC bus device)dnl
568: __devitem(rtc, rtc*, RTC device)dnl
569: __devitem(view, view*, generic interface to graphic displays)dnl
570: __devitem(aconf, aconf, {-autoconfig information (not yet)-})dnl
571: __devitem(mouse-, mouse-*, "mouse link")dnl
572: __devitem(mouse, mouse, mouse (provides events, for X11))dnl
573: __devitem(amouse, mouse*, Amiga mice)dnl
574: __devitem(lkm, lkm, loadable kernel modules interface)dnl
1.55 deraadt 575: _cdev(lkm, lkm, {-major_lkm_c-}, 0, 640, _lkm)dnl
1.29 todd 576: __devitem(mmcl, mmclock, memory mapped clock)dnl
577: __devitem(tun, tun*, network tunnel driver)dnl
578: __devitem(rnd, *random, inkernel random data source)dnl
579: _mkdev(rnd, *random, {-n=0
1.1 todd 580: for pre in " " s u p a
581: do
582: M ${pre}random c major_rnd_c $n 644
1.29 todd 583: n=Add($n, 1)
584: done-}, 644)dnl
585: __devitem(joy, joy*, joystick driver)dnl
586: _mcdev(joy, joy*, joy, {-major_joy_c-}, 666)dnl
587: __devitem(mag, magma*, magma card (makes 16 tty and 2 bpp))dnl
588: __devitem(bppmag, bppmag[mno], magma parallel port device)dnl
589: __devitem(spif, spif*, spif card (makes 8 tty and 1 bpp))dnl
590: __devitem(bppsp, bpp[jkl], spif parallel port device)dnl
591: _mkdev(mag, magma*, {-case $U in
1.18 todd 592: 0) offset=0 nam=m;;
593: 1) offset=16 nam=n;;
594: 2) offset=32 nam=o;;
595: *) echo "bad unit for $i: $U"; exit 127;;
596: esac
1.29 todd 597: offset=Mult($U, 64)
1.18 todd 598: n=0
599: while [ $n -lt 16 ]
600: do
601: name=${nam}`hex $n`
1.29 todd 602: M tty$name c major_mag_c Add($offset, $n) 660 dialer uucp
603: n=Add($n, 1)
1.18 todd 604: done
1.29 todd 605: M bpp${nam}0 c major_bppmag_c Add($offset, 0) 600
606: M bpp${nam}1 c major_bppmag_c Add($offset, 1) 600-})dnl
607: _mkdev(spif, spif*, {-case $U in
1.18 todd 608: 0) offset=0 nam=j;;
609: 1) offset=16 nam=k;;
610: 2) offset=32 nam=l;;
611: *) echo "bad unit for $i: $U"; exit 127;;
612: esac
1.29 todd 613: offset=Mult($U, 64)
1.18 todd 614: n=0
615: while [ $n -lt 8 ]
616: do
617: name=${nam}`hex $n`
1.29 todd 618: M tty$name c major_spif_c Add($offset, $n) 660 dialer uucp
619: n=Add($n, 1)
1.18 todd 620: done
1.29 todd 621: M bpp${nam}0 c major_bppsp_c Add($offset, 0) 600-})dnl
622: __devitem(bpp, bpp*, parallel port devices)dnl
1.59 jason 623: _mkdev(bpp, {-bpp*-}, {-M bpp$U c major_bpp_c $U 600-}, 600)dnl
1.29 todd 624: __devitem(xfs, xfs*, XFS filesystem devices)dnl
625: _mcdev(xfs, xfs*, xfs, {-major_xfs_c-}, 600)dnl
626: __devitem(hil, hil, HIL input devices)dnl
627: __devitem(rmidi, rmidi*, raw midi devices)dnl
628: _mcdev(rmidi, rmidi*, rmidi, {-major_rmidi_c-}, 666)dnl
629: __devtitle(plat, Platform-specific devices)dnl
630: __devitem(fb, fb*, framebuffer device)dnl
631: __devitem(bktr, bktr*, video capturing)dnl
632: _mcdev(bktr, bktr*, bktr, {-major_bktr_c-}, 644)dnl
633: __devitem(tuner, tuner*, tuner device)dnl
634: _mkdev(tuner, tuner*, {-M tuner$U c major_bktr_c Add(Mult($U, 2), 16) 644-}, 644)dnl
635: __devitem(pci, pci, PCI bus device)dnl
1.43 deraadt 636: _mkdev(pci, pci, {-M pci c major_pci_c 0 600-}, 600)dnl
1.29 todd 637: __devitem(adb, adb, Apple Desktop bus event interface)dnl
638: _mkdev(adb, adb, {-M adb c major_adb_c 0-})dnl
639: __devitem(pdc, pdc, PDC device)dnl
640: _mkdev(local, local, {-test -s $T.local && sh $T.local-}, 666)dnl
1.49 fgsch 641: __devitem(gpr, gpr*, gpr400 pcmcia device)dnl
642: _mcdev(gpr, gpr*, gpr, {-major_gpr_c-})dnl
1.1 todd 643: dnl
644: divert(1)dnl
645: include(etc.MACHINE/MAKEDEV.md)dnl
646: dnl
647: dnl
648: divert(0)dnl
649: #!/bin/sh -
650: #
651: # THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
652: # generated from:
653: #
654: show_vers()dnl <-- now that all files are included, show versions
655: #
656: dnl
657: divert(2)dnl
658: PATH=/sbin:/usr/sbin:/bin:/usr/bin
659: T=$0
660:
661: # set this to echo for Echo-Only debugging
662: [ "$eo" ] || eo=
663:
664: hex()
665: {
666: case ${--}1 in
1.26 deraadt 667: [0-9]) echo -n {-$-}1;;
668: 10) echo -n a;;
669: 11) echo -n b;;
670: 12) echo -n c;;
671: 13) echo -n d;;
672: 14) echo -n e;;
673: 15) echo -n f;;
1.1 todd 674: esac
675: }
1.26 deraadt 676:
1.62 ! todd 677: h2d()
1.1 todd 678: {
1.62 ! todd 679: local s="$1"
! 680: local f=${s%*[0-9a-f]} n=${s#[0-9a-f]*}
! 681:
! 682: echo $(($(_h2d $f)*16+ $(_h2d $n) ))
! 683: }
! 684:
! 685: _h2d()
! 686: {
! 687: case $1 in
! 688: [0-9]) echo -n $1;;
! 689: a) echo -n 10;;
! 690: b) echo -n 11;;
! 691: c) echo -n 12;;
! 692: d) echo -n 13;;
! 693: e) echo -n 14;;
! 694: f) echo -n 15;;
1.1 todd 695: esac
696: }
1.26 deraadt 697:
1.1 todd 698: unt()
699: {
700: # XXX pdksh can't seem to deal with locally scoped variables
701: # in ${foo#$bar} expansions
702: arg="{-$-}1"
703: tmp="${arg#[a-zA-Z]*}"
704: tmp="${tmp%*[a-zA-Z]}"
705: while [ "$tmp" != "$arg" ]
706: do
707: arg=$tmp
708: tmp="${arg#[a-zA-Z]*}"
709: tmp="${tmp%*[a-zA-Z]}"
710: done
711: echo $arg
712: }
713: dnl
1.29 todd 714: dnl dodisk(name, unit, blkmaj, chrmaj, unit, off[, stepping])
1.5 todd 715: dnl arg: 1 2 3 4 5 6 7
1.1 todd 716: dnl
1.26 deraadt 717:
1.1 todd 718: dodisk()
719: {
1.27 todd 720: [ "$DEBUG" ] && set -x
1.29 todd 721: n=Add(Mult(${5}, ${7:-16}), ${6}) count=0
1.1 todd 722: RMlist="$RMlist {-$-}1{-$-}2? r{-$-}1{-$-}2?"
1.13 todd 723: [ 0$7 -ne 8 ] && l="i j k l m n o p"
724: for d in a b c d e f g h $l
1.1 todd 725: do
1.29 todd 726: M {-$-}1{-$-}2$d b {-$-}3 Add($n, $count) 640
727: M r{-$-}1{-$-}2$d c {-$-}4 Add($n, $count) 640
1.1 todd 728: let count=count+1
729: done
1.58 millert 730: MKlist="$MKlist;chown root:operator {-$-}1{-$-}2? r{-$-}1{-$-}2?"
1.1 todd 731: }
732: dnl
1.29 todd 733: dnl dodisk2(name, unit, blkmaj, chrmaj, unit, off[, stepping])
1.1 todd 734: dnl
735: dnl 1. name - prefix name of the device
736: dnl 2. unit - beginning unit number for block devices
737: dnl 3. blkmaj - block device major number
738: dnl 4. chrmaj - character device major number
739: dnl 5. unit - beginning unit number for character devices
740: dnl 6. off - offset from 0 for all minor numbers (see svnd for an example)
1.5 todd 741: dnl 7. step - optional, defaults to 16, number of partitions per device
1.1 todd 742: dnl
1.26 deraadt 743:
1.1 todd 744: dodisk2()
745: {
1.29 todd 746: n=Add(Mult({-$-}5, ${7:-16}), {-$-}6)
1.1 todd 747: M {-$-}1{-$-}2a b {-$-}3 $n 640 operator
748: M r{-$-}1{-$-}2a c {-$-}4 $n 640 operator
1.29 todd 749: n=Add($n, 2)
1.1 todd 750: M {-$-}1{-$-}2c b {-$-}3 $n 640 operator
751: M r{-$-}1{-$-}2c c {-$-}4 $n 640 operator
752: }
753:
754: # M name b/c major minor [mode] [group]
755: RMlist="rm -f"
756: MKlist=":"
1.26 deraadt 757:
1.1 todd 758: mkl() {
759: dnl
760: dnl uncomment if multi mknod happens
761: dnl
1.29 todd 762: ifelse(1, 0,
1.1 todd 763: [ "${mklist[{-$-}1]}" ] && mklist[{-$-}1]="${mklist[{-$-}1]} {-$-}2 {-$-}3 {-$-}4 {-$-}5" || {
1.30 todd 764: mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
765: modes="$modes {-$-}1"
1.1 todd 766: },
767: dnl
768: dnl non multi mknod
769: dnl
1.26 deraadt 770: [ "${mklist[{-$-}1]}" ] && {
771: mklist[{-$-}1]="${mklist[{-$-}1]};mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
772: } || {
773: mklist[{-$-}1]="mknod -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
774: modes="$modes {-$-}1"
775: })
1.1 todd 776: }
1.26 deraadt 777:
1.1 todd 778: M() {
779: RMlist="$RMlist {-$-}1"
780: mkl ${5-666} {-$-}1 {-$-}2 {-$-}3 {-$-}4
781: mklist="$mklist {-$-}1"
782: G={-$-}{6:-wheel}
783: [ "{-$-}7" ] && {
1.58 millert 784: MKlist="$MKlist;chown {-$-}7:{-$-}G {-$-}1"
1.1 todd 785: } || {
786: case $G in
1.56 todd 787: wheel)g=0;;kmem)g=2;;operator)g=5;;tty)g=4;;dialer)g=117;;_lkm)g=61;;
1.1 todd 788: esac
789: [ "${grplist[$g]}" ] && {
790: grplist[$g]="${grplist[$g]} {-$-}1"
791: } || {
792: groups="$groups $g"
793: grplist[$g]="chgrp $G {-$-}1"
794: }
795: }
796: return 0
797: }
798: divert(7)dnl
799: dnl
800: dnl there is no blank line at the end of etc.arch/MAKEDEV.md files, so add one
801: dnl on the following line:
802:
803: show_devs()dnl
804: dnl
805: divert(9)dnl
806: *)
807: echo $i: unknown device
808: ;;
809: esac
810: done
811: }
812: _recurse "$@"
813: if [ "$os" = "SunOS" ]; then
814: eo=transform
815: transform() {
816: case $mode in
817: 600) mask=077;;
818: 640) mask=027;;
819: 660) mask=007;;
820: 644) mask=022;;
821: 666) mask=0;;
822: 440) mask=227;;
823: esac
824: echo `echo "$@"|sed \
1.26 deraadt 825: 's/mknod -m \([0-9]*\) /umask '$mask';mknod /;s/-m [0-9]* //g;\
826: s/operator/5/g;s/root.kmem/root.2/g;s/root\./root:/g'`
1.1 todd 827: }
828: fi
829: list="$RMlist"
830: for mode in $modes; do
831: list="$list;${mklist[$mode]}"
832: done
833: for group in $groups; do
834: list="$list;${grplist[$group]}"
835: done
836: list="$list;$MKlist"
837: if [ "$eo" = "echo" -o "$eo" = "transform" ]; then
838: $eo "$list"
839: else
840: echo "$list" | sh
841: fi
1.41 todd 842: divert(3)dnl
1.1 todd 843: dnl
1.26 deraadt 844:
1.1 todd 845: R() {
1.23 todd 846: [ "$DEBUG" ] && set -x
1.1 todd 847: for i in "$@"
848: do
849: U=`unt $i`
850: [ "$U" ] || U=0
851:
852: case $i in
853: dnl