Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/usb/controller/generic_xhci.c
| Show First 20 Lines • Show All 60 Lines • ▼ Show 20 Lines | |||||
| #include "generic_xhci.h" | #include "generic_xhci.h" | ||||
| #define IS_DMA_32B 1 | #define IS_DMA_32B 1 | ||||
| int | int | ||||
| generic_xhci_attach(device_t dev) | generic_xhci_attach(device_t dev) | ||||
| { | { | ||||
| int err = 0; | |||||
| err = generic_xhci_init_resources(dev); | |||||
| if (err != 0) | |||||
| return (err); | |||||
| return (generic_xhci_init_controller(dev)); | |||||
| } | |||||
| int | |||||
| generic_xhci_init_resources(device_t dev) | |||||
| { | |||||
| struct xhci_softc *sc = device_get_softc(dev); | struct xhci_softc *sc = device_get_softc(dev); | ||||
| int err = 0, rid = 0; | int err = 0, rid = 0; | ||||
| sc->sc_bus.parent = dev; | sc->sc_bus.parent = dev; | ||||
| sc->sc_bus.devices = sc->sc_devices; | sc->sc_bus.devices = sc->sc_devices; | ||||
| sc->sc_bus.devices_max = XHCI_MAX_DEVICES; | sc->sc_bus.devices_max = XHCI_MAX_DEVICES; | ||||
| sc->sc_io_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, | sc->sc_io_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, | ||||
| Show All 31 Lines | generic_xhci_init_resources(device_t dev) | ||||
| err = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, | err = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_BIO | INTR_MPSAFE, | ||||
| NULL, (driver_intr_t *)xhci_interrupt, sc, &sc->sc_intr_hdl); | NULL, (driver_intr_t *)xhci_interrupt, sc, &sc->sc_intr_hdl); | ||||
| if (err != 0) { | if (err != 0) { | ||||
| device_printf(dev, "Failed to setup error IRQ, %d\n", err); | device_printf(dev, "Failed to setup error IRQ, %d\n", err); | ||||
| sc->sc_intr_hdl = NULL; | sc->sc_intr_hdl = NULL; | ||||
| generic_xhci_detach(dev); | generic_xhci_detach(dev); | ||||
| return (err); | return (err); | ||||
| } | } | ||||
| return (0); | |||||
| } | |||||
| int | |||||
| generic_xhci_init_controller(device_t dev) | |||||
| { | |||||
| struct xhci_softc *sc = device_get_softc(dev); | |||||
| int err = 0; | |||||
| err = xhci_init(sc, dev, IS_DMA_32B); | err = xhci_init(sc, dev, IS_DMA_32B); | ||||
| if (err != 0) { | if (err != 0) { | ||||
| device_printf(dev, "Failed to init XHCI, with error %d\n", err); | device_printf(dev, "Failed to init XHCI, with error %d\n", err); | ||||
| generic_xhci_detach(dev); | generic_xhci_detach(dev); | ||||
| return (ENXIO); | return (ENXIO); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines | |||||