1139743Simp/*	$NetBSD: rum_at_usb.c,v 1.3 2010/02/10 02:26:24 pooka Exp $	*/
243412Snewton
343412Snewton#include <sys/param.h>
443412Snewton#include <sys/types.h>
543412Snewton#include <sys/conf.h>
643412Snewton#include <sys/device.h>
743412Snewton#include <sys/kmem.h>
843412Snewton
943412Snewton/*
1043412Snewton * rum @ usb
1143412Snewton *
1243412Snewton * handwritten device configuration.... 'nuf said
1343412Snewton *
1443412Snewton * I could convert this to use the new ioconf keyword in config,
1543412Snewton * except I don't have the hardware for testing anymore ...
1643412Snewton */
1743412Snewton
1843412Snewtonstatic const struct cfiattrdata uroothub_iattrdata = {
1943412Snewton	"usbroothubif", 0, {
2043412Snewton		{ NULL, NULL, 0 },
2143412Snewton	}
2243412Snewton};
2343412Snewtonstatic const struct cfiattrdata *const usb_attrs[] = {
2443412Snewton	&uroothub_iattrdata,
2543412Snewton	NULL,
2643412Snewton};
2743412SnewtonCFDRIVER_DECL(usb, DV_DULL, usb_attrs);
2843412Snewton
29116174Sobrienstatic const struct cfiattrdata usbdevif_iattrdata = {
30116174Sobrien	"usbdevif", 0, {
31116174Sobrien		{ NULL, NULL, 0 },
3243412Snewton	}
3343412Snewton};
3443412Snewtonstatic const struct cfiattrdata usbifif_iattrdata = {
35280258Srwatson	"usbifif", 0, {
3643412Snewton		{ NULL, NULL, 0 },
3743412Snewton	}
3890002Salfred};
3943412Snewtonstatic const struct cfiattrdata *const uhub_attrs[] = {
4043412Snewton	&usbdevif_iattrdata,
4143412Snewton	&usbifif_iattrdata,
4243412Snewton	NULL,
4390002Salfred};
4443412SnewtonCFDRIVER_DECL(uhub, DV_DULL, uhub_attrs);
4543412Snewton
4643412SnewtonCFDRIVER_DECL(rum, DV_IFNET, NULL);
4765302Sobrien
4865302Sobrienstruct cfparent ugenhc_pspec = {
4965302Sobrien	"usbus",
5065302Sobrien	"ugenhc",
5165302Sobrien	DVUNIT_ANY
5265302Sobrien};
5365302Sobrien
5443412Snewtonstruct cfdata usb_cfdata[] = {
5543412Snewton	{ "usb", "usb", 0, FSTATE_STAR, NULL, 0, &ugenhc_pspec },
5643412Snewton};
5743412Snewton
5883366Sjulianstruct cfparent usb_pspec = {
5983366Sjulian	"usbroothubif",
6043412Snewton	"usb",
6143412Snewton	DVUNIT_ANY
6243412Snewton};
6343412Snewton
6443412Snewtonstruct cfdata uhub_cfdata[] = {
6543412Snewton	{ "uhub", "uroothub", 0, FSTATE_STAR, NULL, 0, &usb_pspec },
6643412Snewton};
6743412Snewton
68210197Straszstruct cfparent usbifif_pspec = {
69125454Sjhb	"usbifif",
70121275Stjr	"uhub",
71107849Salfred	DVUNIT_ANY
72107849Salfred};
73107849Salfred
7443412Snewtonstruct cfparent usbdevif_pspec = {
75107849Salfred	"usbdevif",
76111119Simp	"uhub",
7743412Snewton	DVUNIT_ANY
78225617Skmacy};
7943412Snewton
80107849Salfredstruct cfdata rum_cfdata[] = {
8143412Snewton	{ "rum", "rum", 0, FSTATE_STAR, NULL, 0, &usbdevif_pspec },
8243412Snewton};
8343412Snewton
8443412Snewton#include "rump_private.h"
85107849Salfred#include "rump_dev_private.h"
8643412Snewton
8743412Snewton#define FLAWLESSCALL(call)						\
8843412Snewtondo {									\
8943412Snewton	int att_error;							\
90107849Salfred	if ((att_error = call) != 0)					\
9143412Snewton		panic("\"%s\" failed", #call);				\
9243412Snewton} while (/*CONSTCOND*/0)
9343412Snewton
9443412SnewtonRUMP_COMPONENT(RUMP_COMPONENT_DEV)
9543412Snewton{
9643412Snewton	extern struct cfattach usb_ca, uhub_ca, uroothub_ca, rum_ca;
9743412Snewton
9843412Snewton	FLAWLESSCALL(config_cfdriver_attach(&usb_cd));
9943412Snewton	FLAWLESSCALL(config_cfattach_attach("usb", &usb_ca));
10043412Snewton	FLAWLESSCALL(config_cfdata_attach(usb_cfdata, 0));
10143412Snewton
10283366Sjulian	FLAWLESSCALL(config_cfdriver_attach(&uhub_cd));
10383366Sjulian	FLAWLESSCALL(config_cfattach_attach("uhub", &uhub_ca));
10443412Snewton	FLAWLESSCALL(config_cfdata_attach(uhub_cfdata, 0));
10543412Snewton
10643412Snewton	FLAWLESSCALL(config_cfdriver_attach(&rum_cd));
107255219Spjd	FLAWLESSCALL(config_cfattach_attach("rum", &rum_ca));
10843412Snewton	FLAWLESSCALL(config_cfdata_attach(rum_cfdata, 0));
10943412Snewton
11043412Snewton	FLAWLESSCALL(config_cfattach_attach("uhub", &uroothub_ca));
11143412Snewton}
11243412Snewton