Sync usage with man page.
[netbsd-mini2440.git] / sys / rump / dev / wip / libumass / sd_at_scsibus_at_umass.c
blob40b766cbcc9e11af878ebf386b7df3f9b82ddbe6
1 /* $NetBSD: sd_at_scsibus_at_umass.c,v 1.5 2009/12/19 11:55:23 pooka Exp $ */
3 /*
4 * MACHINE GENERATED: DO NOT EDIT
6 * ioconf.c, from the following config:
8 * === SNIP ===
10 include "conf/files"
11 include "dev/usb/files.usb"
12 include "dev/scsipi/files.scsipi"
14 device mainbus { }
15 attach mainbus at root
16 device rumpusbhc: usbus, usbroothub
17 attach rumpusbhc at mainbus
19 mainbus0 at root
20 rumpusbhc* at mainbus0
22 # USB bus support
23 usb* at rumpusbhc?
25 # USB Hubs
26 uhub* at usb?
27 uhub* at uhub? port ?
29 # USB Mass Storage
30 umass* at uhub? port ? configuration ? interface ?
31 scsibus* at scsi?
32 sd* at scsibus? target ? lun ?
34 * === UNSNIP ===
37 #include <sys/param.h>
38 #include <sys/conf.h>
39 #include <sys/device.h>
40 #include <sys/mount.h>
42 static const struct cfiattrdata gpibdevcf_iattrdata = {
43 "gpibdev", 1,
45 { "address", "-1", -1 },
48 static const struct cfiattrdata acpibuscf_iattrdata = {
49 "acpibus", 0, {
50 { NULL, NULL, 0 },
53 static const struct cfiattrdata caccf_iattrdata = {
54 "cac", 1,
56 { "unit", "-1", -1 },
59 static const struct cfiattrdata spicf_iattrdata = {
60 "spi", 1,
62 { "slave", "NULL", 0 },
65 static const struct cfiattrdata radiodevcf_iattrdata = {
66 "radiodev", 0, {
67 { NULL, NULL, 0 },
70 static const struct cfiattrdata mlxcf_iattrdata = {
71 "mlx", 1,
73 { "unit", "-1", -1 },
76 static const struct cfiattrdata scsibuscf_iattrdata = {
77 "scsibus", 2,
79 { "target", "-1", -1 },
80 { "lun", "-1", -1 },
83 static const struct cfiattrdata ucombuscf_iattrdata = {
84 "ucombus", 1,
86 { "portno", "-1", -1 },
89 static const struct cfiattrdata videobuscf_iattrdata = {
90 "videobus", 0, {
91 { NULL, NULL, 0 },
94 static const struct cfiattrdata isabuscf_iattrdata = {
95 "isabus", 0, {
96 { NULL, NULL, 0 },
99 static const struct cfiattrdata i2cbuscf_iattrdata = {
100 "i2cbus", 0, {
101 { NULL, NULL, 0 },
104 static const struct cfiattrdata ata_hlcf_iattrdata = {
105 "ata_hl", 1,
107 { "drive", "-1", -1 },
110 static const struct cfiattrdata depcacf_iattrdata = {
111 "depca", 0, {
112 { NULL, NULL, 0 },
115 static const struct cfiattrdata ppbuscf_iattrdata = {
116 "ppbus", 0, {
117 { NULL, NULL, 0 },
120 static const struct cfiattrdata eisabuscf_iattrdata = {
121 "eisabus", 0, {
122 { NULL, NULL, 0 },
125 static const struct cfiattrdata atapicf_iattrdata = {
126 "atapi", 0, {
127 { NULL, NULL, 0 },
130 static const struct cfiattrdata atapibuscf_iattrdata = {
131 "atapibus", 1,
133 { "drive", "-1", -1 },
136 static const struct cfiattrdata usbroothubifcf_iattrdata = {
137 "usbroothubif", 0, {
138 { NULL, NULL, 0 },
141 static const struct cfiattrdata altmemdevcf_iattrdata = {
142 "altmemdev", 0, {
143 { NULL, NULL, 0 },
146 static const struct cfiattrdata tcbuscf_iattrdata = {
147 "tcbus", 0, {
148 { NULL, NULL, 0 },
151 static const struct cfiattrdata onewirebuscf_iattrdata = {
152 "onewirebus", 0, {
153 { NULL, NULL, 0 },
156 static const struct cfiattrdata gpiocf_iattrdata = {
157 "gpio", 2,
159 { "offset", "-1", -1 },
160 { "mask", "0", 0 },
163 static const struct cfiattrdata cbbuscf_iattrdata = {
164 "cbbus", 0, {
165 { NULL, NULL, 0 },
168 static const struct cfiattrdata gpiobuscf_iattrdata = {
169 "gpiobus", 0, {
170 { NULL, NULL, 0 },
173 static const struct cfiattrdata drmcf_iattrdata = {
174 "drm", 0, {
175 { NULL, NULL, 0 },
178 static const struct cfiattrdata pckbportcf_iattrdata = {
179 "pckbport", 1,
181 { "slot", "-1", -1 },
184 static const struct cfiattrdata irbuscf_iattrdata = {
185 "irbus", 0, {
186 { NULL, NULL, 0 },
189 static const struct cfiattrdata aaccf_iattrdata = {
190 "aac", 1,
192 { "unit", "-1", -1 },
195 static const struct cfiattrdata pcibuscf_iattrdata = {
196 "pcibus", 1,
198 { "bus", "-1", -1 },
201 static const struct cfiattrdata usbififcf_iattrdata = {
202 "usbifif", 6,
204 { "port", "-1", -1 },
205 { "configuration", "-1", -1 },
206 { "interface", "-1", -1 },
207 { "vendor", "-1", -1 },
208 { "product", "-1", -1 },
209 { "release", "-1", -1 },
212 static const struct cfiattrdata upccf_iattrdata = {
213 "upc", 1,
215 { "offset", "-1", -1 },
218 static const struct cfiattrdata iiccf_iattrdata = {
219 "iic", 2,
221 { "addr", "-1", -1 },
222 { "size", "-1", -1 },
225 static const struct cfiattrdata onewirecf_iattrdata = {
226 "onewire", 0, {
227 { NULL, NULL, 0 },
230 static const struct cfiattrdata mcabuscf_iattrdata = {
231 "mcabus", 0, {
232 { NULL, NULL, 0 },
235 static const struct cfiattrdata wsdisplaydevcf_iattrdata = {
236 "wsdisplaydev", 1,
238 { "kbdmux", "1", 1 },
241 static const struct cfiattrdata miicf_iattrdata = {
242 "mii", 1,
244 { "phy", "-1", -1 },
247 static const struct cfiattrdata cpcbuscf_iattrdata = {
248 "cpcbus", 2,
250 { "addr", "NULL", 0 },
251 { "irq", "-1", -1 },
254 static const struct cfiattrdata parportcf_iattrdata = {
255 "parport", 0, {
256 { NULL, NULL, 0 },
259 static const struct cfiattrdata dbcoolcf_iattrdata = {
260 "dbcool", 0, {
261 { NULL, NULL, 0 },
264 static const struct cfiattrdata usbdevifcf_iattrdata = {
265 "usbdevif", 6,
267 { "port", "-1", -1 },
268 { "configuration", "-1", -1 },
269 { "interface", "-1", -1 },
270 { "vendor", "-1", -1 },
271 { "product", "-1", -1 },
272 { "release", "-1", -1 },
275 static const struct cfiattrdata wskbddevcf_iattrdata = {
276 "wskbddev", 2,
278 { "console", "-1", -1 },
279 { "mux", "1", 1 },
282 static const struct cfiattrdata audiobuscf_iattrdata = {
283 "audiobus", 0, {
284 { NULL, NULL, 0 },
287 static const struct cfiattrdata btbuscf_iattrdata = {
288 "btbus", 0, {
289 { NULL, NULL, 0 },
292 static const struct cfiattrdata midibuscf_iattrdata = {
293 "midibus", 0, {
294 { NULL, NULL, 0 },
297 static const struct cfiattrdata vmebuscf_iattrdata = {
298 "vmebus", 0, {
299 { NULL, NULL, 0 },
302 static const struct cfiattrdata wsemuldisplaydevcf_iattrdata = {
303 "wsemuldisplaydev", 2,
305 { "console", "-1", -1 },
306 { "kbdmux", "1", 1 },
309 static const struct cfiattrdata uhidbuscf_iattrdata = {
310 "uhidbus", 1,
312 { "reportid", "-1", -1 },
315 static const struct cfiattrdata icpcf_iattrdata = {
316 "icp", 1,
318 { "unit", "-1", -1 },
321 static const struct cfiattrdata sdmmcbuscf_iattrdata = {
322 "sdmmcbus", 0, {
323 { NULL, NULL, 0 },
326 static const struct cfiattrdata comcf_iattrdata = {
327 "com", 0, {
328 { NULL, NULL, 0 },
331 static const struct cfiattrdata spiflashbuscf_iattrdata = {
332 "spiflashbus", 0, {
333 { NULL, NULL, 0 },
336 static const struct cfiattrdata fwbuscf_iattrdata = {
337 "fwbus", 0, {
338 { NULL, NULL, 0 },
341 static const struct cfiattrdata pcmciaslotcf_iattrdata = {
342 "pcmciaslot", 0, {
343 { NULL, NULL, 0 },
346 static const struct cfiattrdata usbuscf_iattrdata = {
347 "usbus", 0, {
348 { NULL, NULL, 0 },
351 static const struct cfiattrdata wsmousedevcf_iattrdata = {
352 "wsmousedev", 1,
354 { "mux", "0", 0 },
357 static const struct cfiattrdata scsicf_iattrdata = {
358 "scsi", 1,
360 { "channel", "-1", -1 },
363 static const struct cfiattrdata atacf_iattrdata = {
364 "ata", 1,
366 { "channel", "-1", -1 },
369 static const struct cfiattrdata spibuscf_iattrdata = {
370 "spibus", 0, {
371 { NULL, NULL, 0 },
374 static const struct cfiattrdata pcmciabuscf_iattrdata = {
375 "pcmciabus", 2,
377 { "controller", "-1", -1 },
378 { "socket", "-1", -1 },
382 static const struct cfiattrdata * const usb_attrs[] = { &usbroothubifcf_iattrdata, NULL };
383 CFDRIVER_DECL(usb, DV_DULL, usb_attrs);
385 static const struct cfiattrdata * const uhub_attrs[] = { &usbififcf_iattrdata, &usbdevifcf_iattrdata, NULL };
386 CFDRIVER_DECL(uhub, DV_DULL, uhub_attrs);
388 static const struct cfiattrdata * const umass_attrs[] = { &scsicf_iattrdata, NULL };
389 CFDRIVER_DECL(umass, DV_DULL, umass_attrs);
391 static const struct cfiattrdata * const scsibus_attrs[] = { &scsibuscf_iattrdata, NULL };
392 CFDRIVER_DECL(scsibus, DV_DULL, scsibus_attrs);
394 CFDRIVER_DECL(sd, DV_DISK, NULL);
396 static const struct cfiattrdata * const rumpusbhc_attrs[] = { &usbuscf_iattrdata, NULL };
397 CFDRIVER_DECL(rumpusbhc, DV_DULL, rumpusbhc_attrs);
401 extern struct cfattach usb_ca;
402 extern struct cfattach uroothub_ca;
403 extern struct cfattach uhub_ca;
404 extern struct cfattach umass_ca;
405 extern struct cfattach scsibus_ca;
406 extern struct cfattach sd_ca;
407 extern struct cfattach rumpusbhc_ca;
409 /* locators */
410 static int loc[15] = {
411 -1, -1, -1, -1, -1, -1, -1, -1,
412 -1, -1, -1, -1, -1, -1, -1,
415 static const struct cfparent pspec1 = {
416 "usbus", "rumpusbhc", DVUNIT_ANY
418 static const struct cfparent pspec2 = {
419 "usbroothubif", "usb", DVUNIT_ANY
421 static const struct cfparent pspec3 = {
422 "usbdevif", "uhub", DVUNIT_ANY
424 static const struct cfparent pspec4 = {
425 "usbifif", "uhub", DVUNIT_ANY
427 static const struct cfparent pspec5 = {
428 "scsi", NULL, 0
430 static const struct cfparent pspec6 = {
431 "scsibus", "scsibus", DVUNIT_ANY
434 #define NORM FSTATE_NOTFOUND
435 #define STAR FSTATE_STAR
437 struct cfdata cfdata_umass[] = {
438 /* driver attachment unit state loc flags pspec */
439 /* 0: usb* at rumpusbhc? */
440 { "usb", "usb", 0, STAR, loc, 0, &pspec1 },
441 /* 1: uhub* at usb? */
442 { "uhub", "uroothub", 0, STAR, loc, 0, &pspec2 },
443 /* 2: uhub* at uhub? port -1 configuration -1 interface -1 vendor -1 product -1 release -1 */
444 { "uhub", "uhub", 0, STAR, loc, 0, &pspec3 },
445 /* 3: umass* at uhub? port -1 configuration -1 interface -1 vendor -1 product -1 release -1 */
446 { "umass", "umass", 0, STAR, loc+6, 0, &pspec4 },
447 /* 4: scsibus* at scsi? channel -1 */
448 { "scsibus", "scsibus", 0, STAR, loc+14, 0, &pspec5 },
449 /* 5: sd* at scsibus? target -1 lun -1 */
450 { "sd", "sd", 0, STAR, loc+12, 0, &pspec6 },
451 { NULL, NULL, 0, 0, NULL, 0, NULL }
454 /**** END AUTOGENERATED STUFF ****/
457 #include <sys/param.h>
458 #include <sys/conf.h>
459 #include <sys/device.h>
460 #include <sys/kmem.h>
461 #include <sys/stat.h>
463 #include "rump_dev_private.h"
464 #include "rump_vfs_private.h"
466 #define FLAWLESSCALL(call) \
467 do { \
468 int att_error; \
469 if ((att_error = call) != 0) \
470 panic("\"%s\" failed", #call); \
471 } while (/*CONSTCOND*/0)
473 void
474 rump_device_configuration(void)
476 extern struct cfattach usb_ca, uhub_ca, uroothub_ca, umass_ca;
477 extern struct cfattach scsibus_ca, sd_ca;
478 extern struct bdevsw sd_bdevsw;
479 extern struct cdevsw sd_cdevsw;
480 devmajor_t bmaj, cmaj;
482 FLAWLESSCALL(config_cfdata_attach(cfdata_umass, 0));
484 FLAWLESSCALL(config_cfdriver_attach(&usb_cd));
485 FLAWLESSCALL(config_cfattach_attach("usb", &usb_ca));
487 FLAWLESSCALL(config_cfdriver_attach(&uhub_cd));
488 FLAWLESSCALL(config_cfattach_attach("uhub", &uhub_ca));
490 FLAWLESSCALL(config_cfdriver_attach(&umass_cd));
491 FLAWLESSCALL(config_cfattach_attach("umass", &umass_ca));
493 FLAWLESSCALL(config_cfdriver_attach(&scsibus_cd));
494 FLAWLESSCALL(config_cfattach_attach("scsibus", &scsibus_ca));
496 FLAWLESSCALL(config_cfdriver_attach(&sd_cd));
497 FLAWLESSCALL(config_cfattach_attach("sd", &sd_ca));
499 FLAWLESSCALL(config_cfattach_attach("uhub", &uroothub_ca));
501 bmaj = cmaj = -1;
502 FLAWLESSCALL(devsw_attach("sd", &sd_bdevsw, &bmaj, &sd_cdevsw, &cmaj));
504 FLAWLESSCALL(rump_vfs_makedevnodes(S_IFBLK, "/dev/sd0", 'a',
505 bmaj, 0, 8));
506 FLAWLESSCALL(rump_vfs_makedevnodes(S_IFCHR, "/dev/rsd0", 'a',
507 cmaj, 0, 8));