Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

534 lines
19 KiB

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