Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/usb/controller/generic_ehci.c
Show First 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | |||||
#include <dev/usb/usb_process.h> | #include <dev/usb/usb_process.h> | ||||
#include <dev/usb/usb_util.h> | #include <dev/usb/usb_util.h> | ||||
#include <dev/usb/usb_controller.h> | #include <dev/usb/usb_controller.h> | ||||
#include <dev/usb/usb_bus.h> | #include <dev/usb/usb_bus.h> | ||||
#include <dev/usb/controller/ehci.h> | #include <dev/usb/controller/ehci.h> | ||||
#include <dev/usb/controller/ehcireg.h> | #include <dev/usb/controller/ehcireg.h> | ||||
#include <contrib/dev/acpica/include/acpi.h> | #include "generic_ehci.h" | ||||
#include <contrib/dev/acpica/include/accommon.h> | |||||
#include <dev/acpica/acpivar.h> | |||||
static device_attach_t generic_ehci_attach; | int | ||||
static device_detach_t generic_ehci_detach; | |||||
static int | |||||
generic_ehci_probe(device_t self) | |||||
{ | |||||
ACPI_HANDLE h; | |||||
if ((h = acpi_get_handle(self)) == NULL || | |||||
!acpi_MatchHid(h, "PNP0D20")) | |||||
return (ENXIO); | |||||
device_set_desc(self, "Generic EHCI Controller"); | |||||
return (BUS_PROBE_DEFAULT); | |||||
} | |||||
static int | |||||
generic_ehci_attach(device_t self) | generic_ehci_attach(device_t self) | ||||
{ | { | ||||
ehci_softc_t *sc = device_get_softc(self); | ehci_softc_t *sc = device_get_softc(self); | ||||
int err; | int err; | ||||
int rid; | int rid; | ||||
/* initialise some bus fields */ | /* initialise some bus fields */ | ||||
sc->sc_bus.parent = self; | sc->sc_bus.parent = self; | ||||
▲ Show 20 Lines • Show All 55 Lines • ▼ Show 20 Lines | generic_ehci_attach(device_t self) | ||||
return (0); | return (0); | ||||
error: | error: | ||||
generic_ehci_detach(self); | generic_ehci_detach(self); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
static int | int | ||||
generic_ehci_detach(device_t self) | generic_ehci_detach(device_t self) | ||||
{ | { | ||||
ehci_softc_t *sc = device_get_softc(self); | ehci_softc_t *sc = device_get_softc(self); | ||||
int err; | int err; | ||||
/* during module unload there are lots of children leftover */ | /* during module unload there are lots of children leftover */ | ||||
device_delete_children(self); | device_delete_children(self); | ||||
Show All 23 Lines | generic_ehci_detach(device_t self) | ||||
} | } | ||||
usb_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc); | usb_bus_mem_free_all(&sc->sc_bus, &ehci_iterate_hw_softc); | ||||
return (0); | return (0); | ||||
} | } | ||||
static device_method_t ehci_methods[] = { | static device_method_t ehci_methods[] = { | ||||
/* Device interface */ | /* Device interface */ | ||||
DEVMETHOD(device_probe, generic_ehci_probe), | |||||
DEVMETHOD(device_attach, generic_ehci_attach), | DEVMETHOD(device_attach, generic_ehci_attach), | ||||
DEVMETHOD(device_detach, generic_ehci_detach), | DEVMETHOD(device_detach, generic_ehci_detach), | ||||
DEVMETHOD(device_suspend, bus_generic_suspend), | DEVMETHOD(device_suspend, bus_generic_suspend), | ||||
DEVMETHOD(device_resume, bus_generic_resume), | DEVMETHOD(device_resume, bus_generic_resume), | ||||
DEVMETHOD(device_shutdown, bus_generic_shutdown), | DEVMETHOD(device_shutdown, bus_generic_shutdown), | ||||
DEVMETHOD_END | DEVMETHOD_END | ||||
}; | }; | ||||
static driver_t ehci_driver = { | driver_t generic_ehci_driver = { | ||||
andrew: I'm not sure this is the best name for it, but should be ok for testing. | |||||
Not Done Inline Actionsgeneric_ehci_driver ? manu: generic_ehci_driver ? | |||||
.name = "ehci", | .name = "ehci", | ||||
.methods = ehci_methods, | .methods = ehci_methods, | ||||
.size = sizeof(ehci_softc_t), | .size = sizeof(ehci_softc_t), | ||||
}; | }; | ||||
static devclass_t ehci_devclass; | |||||
DRIVER_MODULE(ehci, acpi, ehci_driver, ehci_devclass, 0, 0); | |||||
MODULE_DEPEND(ehci, usb, 1, 1, 1); |
I'm not sure this is the best name for it, but should be ok for testing.