autoconf.c 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. /* Automatically generated; do not edit */
  2. #include <types.h>
  3. #include <lib.h>
  4. #include "autoconf.h"
  5. static void autoconf_beep(struct beep_softc *, int);
  6. static void autoconf_con(struct con_softc *, int);
  7. static void autoconf_emu(struct emu_softc *, int);
  8. static void autoconf_lhd(struct lhd_softc *, int);
  9. static void autoconf_lrandom(struct lrandom_softc *, int);
  10. static void autoconf_lser(struct lser_softc *, int);
  11. static void autoconf_ltimer(struct ltimer_softc *, int);
  12. static void autoconf_ltrace(struct ltrace_softc *, int);
  13. static void autoconf_random(struct random_softc *, int);
  14. static void autoconf_rtclock(struct rtclock_softc *, int);
  15. static int nextunit_beep;
  16. static int nextunit_con;
  17. static int nextunit_emu;
  18. static int nextunit_lhd;
  19. static int nextunit_lrandom;
  20. static int nextunit_lser;
  21. static int nextunit_ltimer;
  22. static int nextunit_ltrace;
  23. static int nextunit_random;
  24. static int nextunit_rtclock;
  25. static
  26. int
  27. tryattach_emu_to_lamebus(int devunit, struct lamebus_softc *bus, int busunit)
  28. {
  29. struct emu_softc *dev;
  30. int result;
  31. dev = attach_emu_to_lamebus(devunit, bus);
  32. if (dev==NULL) {
  33. return -1;
  34. }
  35. kprintf("emu%d at lamebus%d", devunit, busunit);
  36. result = config_emu(dev, devunit);
  37. if (result != 0) {
  38. kprintf(": %s\n", strerror(result));
  39. /* should really clean up dev */
  40. return result;
  41. }
  42. kprintf("\n");
  43. nextunit_emu = devunit+1;
  44. autoconf_emu(dev, devunit);
  45. return 0;
  46. }
  47. static
  48. int
  49. tryattach_ltrace_to_lamebus(int devunit, struct lamebus_softc *bus, int busunit)
  50. {
  51. struct ltrace_softc *dev;
  52. int result;
  53. dev = attach_ltrace_to_lamebus(devunit, bus);
  54. if (dev==NULL) {
  55. return -1;
  56. }
  57. kprintf("ltrace%d at lamebus%d", devunit, busunit);
  58. result = config_ltrace(dev, devunit);
  59. if (result != 0) {
  60. kprintf(": %s\n", strerror(result));
  61. /* should really clean up dev */
  62. return result;
  63. }
  64. kprintf("\n");
  65. nextunit_ltrace = devunit+1;
  66. autoconf_ltrace(dev, devunit);
  67. return 0;
  68. }
  69. static
  70. int
  71. tryattach_ltimer_to_lamebus(int devunit, struct lamebus_softc *bus, int busunit)
  72. {
  73. struct ltimer_softc *dev;
  74. int result;
  75. dev = attach_ltimer_to_lamebus(devunit, bus);
  76. if (dev==NULL) {
  77. return -1;
  78. }
  79. kprintf("ltimer%d at lamebus%d", devunit, busunit);
  80. result = config_ltimer(dev, devunit);
  81. if (result != 0) {
  82. kprintf(": %s\n", strerror(result));
  83. /* should really clean up dev */
  84. return result;
  85. }
  86. kprintf("\n");
  87. nextunit_ltimer = devunit+1;
  88. autoconf_ltimer(dev, devunit);
  89. return 0;
  90. }
  91. static
  92. int
  93. tryattach_lrandom_to_lamebus(int devunit, struct lamebus_softc *bus, int busunit)
  94. {
  95. struct lrandom_softc *dev;
  96. int result;
  97. dev = attach_lrandom_to_lamebus(devunit, bus);
  98. if (dev==NULL) {
  99. return -1;
  100. }
  101. kprintf("lrandom%d at lamebus%d", devunit, busunit);
  102. result = config_lrandom(dev, devunit);
  103. if (result != 0) {
  104. kprintf(": %s\n", strerror(result));
  105. /* should really clean up dev */
  106. return result;
  107. }
  108. kprintf("\n");
  109. nextunit_lrandom = devunit+1;
  110. autoconf_lrandom(dev, devunit);
  111. return 0;
  112. }
  113. static
  114. int
  115. tryattach_lhd_to_lamebus(int devunit, struct lamebus_softc *bus, int busunit)
  116. {
  117. struct lhd_softc *dev;
  118. int result;
  119. dev = attach_lhd_to_lamebus(devunit, bus);
  120. if (dev==NULL) {
  121. return -1;
  122. }
  123. kprintf("lhd%d at lamebus%d", devunit, busunit);
  124. result = config_lhd(dev, devunit);
  125. if (result != 0) {
  126. kprintf(": %s\n", strerror(result));
  127. /* should really clean up dev */
  128. return result;
  129. }
  130. kprintf("\n");
  131. nextunit_lhd = devunit+1;
  132. autoconf_lhd(dev, devunit);
  133. return 0;
  134. }
  135. static
  136. int
  137. tryattach_lser_to_lamebus(int devunit, struct lamebus_softc *bus, int busunit)
  138. {
  139. struct lser_softc *dev;
  140. int result;
  141. dev = attach_lser_to_lamebus(devunit, bus);
  142. if (dev==NULL) {
  143. return -1;
  144. }
  145. kprintf("lser%d at lamebus%d", devunit, busunit);
  146. result = config_lser(dev, devunit);
  147. if (result != 0) {
  148. kprintf(": %s\n", strerror(result));
  149. /* should really clean up dev */
  150. return result;
  151. }
  152. kprintf("\n");
  153. nextunit_lser = devunit+1;
  154. autoconf_lser(dev, devunit);
  155. return 0;
  156. }
  157. static
  158. int
  159. tryattach_beep_to_ltimer(int devunit, struct ltimer_softc *bus, int busunit)
  160. {
  161. struct beep_softc *dev;
  162. int result;
  163. dev = attach_beep_to_ltimer(devunit, bus);
  164. if (dev==NULL) {
  165. return -1;
  166. }
  167. kprintf("beep%d at ltimer%d", devunit, busunit);
  168. result = config_beep(dev, devunit);
  169. if (result != 0) {
  170. kprintf(": %s\n", strerror(result));
  171. /* should really clean up dev */
  172. return result;
  173. }
  174. kprintf("\n");
  175. nextunit_beep = devunit+1;
  176. autoconf_beep(dev, devunit);
  177. return 0;
  178. }
  179. static
  180. int
  181. tryattach_con_to_lser(int devunit, struct lser_softc *bus, int busunit)
  182. {
  183. struct con_softc *dev;
  184. int result;
  185. dev = attach_con_to_lser(devunit, bus);
  186. if (dev==NULL) {
  187. return -1;
  188. }
  189. kprintf("con%d at lser%d", devunit, busunit);
  190. result = config_con(dev, devunit);
  191. if (result != 0) {
  192. kprintf(": %s\n", strerror(result));
  193. /* should really clean up dev */
  194. return result;
  195. }
  196. kprintf("\n");
  197. nextunit_con = devunit+1;
  198. autoconf_con(dev, devunit);
  199. return 0;
  200. }
  201. static
  202. int
  203. tryattach_rtclock_to_ltimer(int devunit, struct ltimer_softc *bus, int busunit)
  204. {
  205. struct rtclock_softc *dev;
  206. int result;
  207. dev = attach_rtclock_to_ltimer(devunit, bus);
  208. if (dev==NULL) {
  209. return -1;
  210. }
  211. kprintf("rtclock%d at ltimer%d", devunit, busunit);
  212. result = config_rtclock(dev, devunit);
  213. if (result != 0) {
  214. kprintf(": %s\n", strerror(result));
  215. /* should really clean up dev */
  216. return result;
  217. }
  218. kprintf("\n");
  219. nextunit_rtclock = devunit+1;
  220. autoconf_rtclock(dev, devunit);
  221. return 0;
  222. }
  223. static
  224. int
  225. tryattach_random_to_lrandom(int devunit, struct lrandom_softc *bus, int busunit)
  226. {
  227. struct random_softc *dev;
  228. int result;
  229. dev = attach_random_to_lrandom(devunit, bus);
  230. if (dev==NULL) {
  231. return -1;
  232. }
  233. kprintf("random%d at lrandom%d", devunit, busunit);
  234. result = config_random(dev, devunit);
  235. if (result != 0) {
  236. kprintf(": %s\n", strerror(result));
  237. /* should really clean up dev */
  238. return result;
  239. }
  240. kprintf("\n");
  241. nextunit_random = devunit+1;
  242. autoconf_random(dev, devunit);
  243. return 0;
  244. }
  245. static
  246. void
  247. autoconf_con(struct con_softc *bus, int busunit)
  248. {
  249. (void)bus; (void)busunit;
  250. }
  251. static
  252. void
  253. autoconf_lser(struct lser_softc *bus, int busunit)
  254. {
  255. (void)bus; (void)busunit;
  256. {
  257. if (nextunit_con <= 0) {
  258. tryattach_con_to_lser(0, bus, busunit);
  259. }
  260. }
  261. }
  262. static
  263. void
  264. autoconf_lhd(struct lhd_softc *bus, int busunit)
  265. {
  266. (void)bus; (void)busunit;
  267. }
  268. static
  269. void
  270. autoconf_emu(struct emu_softc *bus, int busunit)
  271. {
  272. (void)bus; (void)busunit;
  273. }
  274. static
  275. void
  276. autoconf_random(struct random_softc *bus, int busunit)
  277. {
  278. (void)bus; (void)busunit;
  279. }
  280. static
  281. void
  282. autoconf_ltimer(struct ltimer_softc *bus, int busunit)
  283. {
  284. (void)bus; (void)busunit;
  285. {
  286. if (nextunit_beep <= 0) {
  287. tryattach_beep_to_ltimer(0, bus, busunit);
  288. }
  289. }
  290. {
  291. if (nextunit_rtclock <= 0) {
  292. tryattach_rtclock_to_ltimer(0, bus, busunit);
  293. }
  294. }
  295. }
  296. void
  297. autoconf_lamebus(struct lamebus_softc *bus, int busunit)
  298. {
  299. (void)bus; (void)busunit;
  300. {
  301. int result, devunit=nextunit_emu;
  302. do {
  303. result = tryattach_emu_to_lamebus(devunit, bus, busunit);
  304. devunit++;
  305. } while (result==0);
  306. }
  307. {
  308. int result, devunit=nextunit_ltrace;
  309. do {
  310. result = tryattach_ltrace_to_lamebus(devunit, bus, busunit);
  311. devunit++;
  312. } while (result==0);
  313. }
  314. {
  315. int result, devunit=nextunit_ltimer;
  316. do {
  317. result = tryattach_ltimer_to_lamebus(devunit, bus, busunit);
  318. devunit++;
  319. } while (result==0);
  320. }
  321. {
  322. int result, devunit=nextunit_lrandom;
  323. do {
  324. result = tryattach_lrandom_to_lamebus(devunit, bus, busunit);
  325. devunit++;
  326. } while (result==0);
  327. }
  328. {
  329. int result, devunit=nextunit_lhd;
  330. do {
  331. result = tryattach_lhd_to_lamebus(devunit, bus, busunit);
  332. devunit++;
  333. } while (result==0);
  334. }
  335. {
  336. int result, devunit=nextunit_lser;
  337. do {
  338. result = tryattach_lser_to_lamebus(devunit, bus, busunit);
  339. devunit++;
  340. } while (result==0);
  341. }
  342. }
  343. static
  344. void
  345. autoconf_beep(struct beep_softc *bus, int busunit)
  346. {
  347. (void)bus; (void)busunit;
  348. }
  349. static
  350. void
  351. autoconf_lrandom(struct lrandom_softc *bus, int busunit)
  352. {
  353. (void)bus; (void)busunit;
  354. {
  355. if (nextunit_random <= 0) {
  356. tryattach_random_to_lrandom(0, bus, busunit);
  357. }
  358. }
  359. }
  360. static
  361. void
  362. autoconf_rtclock(struct rtclock_softc *bus, int busunit)
  363. {
  364. (void)bus; (void)busunit;
  365. }
  366. static
  367. void
  368. autoconf_ltrace(struct ltrace_softc *bus, int busunit)
  369. {
  370. (void)bus; (void)busunit;
  371. }
  372. void
  373. pseudoconfig(void)
  374. {
  375. }