diff options
Diffstat (limited to 'sys/dev/usb/controller')
-rw-r--r-- | sys/dev/usb/controller/at91dci_atmelarm.c | 1 | ||||
-rw-r--r-- | sys/dev/usb/controller/at91dci_fdt.c | 1 | ||||
-rw-r--r-- | sys/dev/usb/controller/atmegadci_atmelarm.c | 1 | ||||
-rw-r--r-- | sys/dev/usb/controller/dwc_otg_atmelarm.c | 1 | ||||
-rw-r--r-- | sys/dev/usb/controller/dwc_otg_fdt.c | 1 | ||||
-rw-r--r-- | sys/dev/usb/controller/ehci_fsl.c | 1 | ||||
-rw-r--r-- | sys/dev/usb/controller/ehci_imx.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/controller/ehci_ixp4xx.c | 1 | ||||
-rw-r--r-- | sys/dev/usb/controller/ehci_mv.c | 1 | ||||
-rw-r--r-- | sys/dev/usb/controller/ehci_pci.c | 1 | ||||
-rw-r--r-- | sys/dev/usb/controller/musb_otg_atmelarm.c | 1 | ||||
-rw-r--r-- | sys/dev/usb/controller/ohci_atmelarm.c | 1 | ||||
-rw-r--r-- | sys/dev/usb/controller/ohci_fdt.c | 1 | ||||
-rw-r--r-- | sys/dev/usb/controller/ohci_pci.c | 1 | ||||
-rw-r--r-- | sys/dev/usb/controller/ohci_s3c24x0.c | 1 | ||||
-rw-r--r-- | sys/dev/usb/controller/uhci_pci.c | 1 | ||||
-rw-r--r-- | sys/dev/usb/controller/usb_controller.c | 2 | ||||
-rw-r--r-- | sys/dev/usb/controller/uss820dci_atmelarm.c | 1 | ||||
-rw-r--r-- | sys/dev/usb/controller/xhci.c | 92 | ||||
-rw-r--r-- | sys/dev/usb/controller/xhci_pci.c | 26 |
20 files changed, 82 insertions, 56 deletions
diff --git a/sys/dev/usb/controller/at91dci_atmelarm.c b/sys/dev/usb/controller/at91dci_atmelarm.c index 8ea4ef9..e352cc8 100644 --- a/sys/dev/usb/controller/at91dci_atmelarm.c +++ b/sys/dev/usb/controller/at91dci_atmelarm.c @@ -156,6 +156,7 @@ at91_udp_attach(device_t dev) sc->sc_dci.sc_bus.parent = dev; sc->sc_dci.sc_bus.devices = sc->sc_dci.sc_devices; sc->sc_dci.sc_bus.devices_max = AT91_MAX_DEVICES; + sc->sc_dci.sc_bus.dma_bits = 32; /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_dci.sc_bus, diff --git a/sys/dev/usb/controller/at91dci_fdt.c b/sys/dev/usb/controller/at91dci_fdt.c index 7329a39..ba5ce27 100644 --- a/sys/dev/usb/controller/at91dci_fdt.c +++ b/sys/dev/usb/controller/at91dci_fdt.c @@ -162,6 +162,7 @@ at91_udp_attach(device_t dev) sc->sc_dci.sc_bus.parent = dev; sc->sc_dci.sc_bus.devices = sc->sc_dci.sc_devices; sc->sc_dci.sc_bus.devices_max = AT91_MAX_DEVICES; + sc->sc_dci.sc_bus.dma_bits = 32; /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_dci.sc_bus, diff --git a/sys/dev/usb/controller/atmegadci_atmelarm.c b/sys/dev/usb/controller/atmegadci_atmelarm.c index 6c380b6..7c052e6 100644 --- a/sys/dev/usb/controller/atmegadci_atmelarm.c +++ b/sys/dev/usb/controller/atmegadci_atmelarm.c @@ -101,6 +101,7 @@ atmegadci_attach(device_t dev) sc->sc_otg.sc_bus.parent = dev; sc->sc_otg.sc_bus.devices = sc->sc_otg.sc_devices; sc->sc_otg.sc_bus.devices_max = ATMEGA_MAX_DEVICES; + sc->sc_otg.sc_bus.dma_bits = 32; /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_otg.sc_bus, diff --git a/sys/dev/usb/controller/dwc_otg_atmelarm.c b/sys/dev/usb/controller/dwc_otg_atmelarm.c index 33c5bec..46067f9 100644 --- a/sys/dev/usb/controller/dwc_otg_atmelarm.c +++ b/sys/dev/usb/controller/dwc_otg_atmelarm.c @@ -85,6 +85,7 @@ dwc_otg_attach(device_t dev) sc->sc_otg.sc_bus.parent = dev; sc->sc_otg.sc_bus.devices = sc->sc_otg.sc_devices; sc->sc_otg.sc_bus.devices_max = DWC_OTG_MAX_DEVICES; + sc->sc_otg.sc_bus.dma_bits = 32; /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_otg.sc_bus, diff --git a/sys/dev/usb/controller/dwc_otg_fdt.c b/sys/dev/usb/controller/dwc_otg_fdt.c index 824327a..d6d54c8 100644 --- a/sys/dev/usb/controller/dwc_otg_fdt.c +++ b/sys/dev/usb/controller/dwc_otg_fdt.c @@ -98,6 +98,7 @@ dwc_otg_attach(device_t dev) sc->sc_otg.sc_bus.parent = dev; sc->sc_otg.sc_bus.devices = sc->sc_otg.sc_devices; sc->sc_otg.sc_bus.devices_max = DWC_OTG_MAX_DEVICES; + sc->sc_otg.sc_bus.dma_bits = 32; /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_otg.sc_bus, diff --git a/sys/dev/usb/controller/ehci_fsl.c b/sys/dev/usb/controller/ehci_fsl.c index 7e728d2..ed6c25937 100644 --- a/sys/dev/usb/controller/ehci_fsl.c +++ b/sys/dev/usb/controller/ehci_fsl.c @@ -239,6 +239,7 @@ fsl_ehci_attach(device_t self) sc->sc_bus.parent = self; sc->sc_bus.devices = sc->sc_devices; sc->sc_bus.devices_max = EHCI_MAX_DEVICES; + sc->sc_bus.dma_bits = 32; if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self), &ehci_iterate_hw_softc)) diff --git a/sys/dev/usb/controller/ehci_imx.c b/sys/dev/usb/controller/ehci_imx.c index b36e7e6..4473ebc 100644 --- a/sys/dev/usb/controller/ehci_imx.c +++ b/sys/dev/usb/controller/ehci_imx.c @@ -237,7 +237,9 @@ imx_ehci_attach(device_t dev) esc->sc_bus.parent = dev; esc->sc_bus.devices = esc->sc_devices; esc->sc_bus.devices_max = EHCI_MAX_DEVICES; + esc->sc_bus.dma_bits = 32; + /* allocate all DMA memory */ if (usb_bus_mem_alloc_all(&esc->sc_bus, USB_GET_DMA_TAG(dev), &ehci_iterate_hw_softc) != 0) { device_printf(dev, "usb_bus_mem_alloc_all() failed\n"); diff --git a/sys/dev/usb/controller/ehci_ixp4xx.c b/sys/dev/usb/controller/ehci_ixp4xx.c index 45113d9..956f739 100644 --- a/sys/dev/usb/controller/ehci_ixp4xx.c +++ b/sys/dev/usb/controller/ehci_ixp4xx.c @@ -107,6 +107,7 @@ ehci_ixp_attach(device_t self) sc->sc_bus.parent = self; sc->sc_bus.devices = sc->sc_devices; sc->sc_bus.devices_max = EHCI_MAX_DEVICES; + sc->sc_bus.dma_bits = 32; /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_bus, diff --git a/sys/dev/usb/controller/ehci_mv.c b/sys/dev/usb/controller/ehci_mv.c index 32a24b5..8053102 100644 --- a/sys/dev/usb/controller/ehci_mv.c +++ b/sys/dev/usb/controller/ehci_mv.c @@ -126,6 +126,7 @@ mv_ehci_attach(device_t self) sc->sc_bus.parent = self; sc->sc_bus.devices = sc->sc_devices; sc->sc_bus.devices_max = EHCI_MAX_DEVICES; + sc->sc_bus.dma_bits = 32; /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_bus, diff --git a/sys/dev/usb/controller/ehci_pci.c b/sys/dev/usb/controller/ehci_pci.c index 240af81..7952c8b 100644 --- a/sys/dev/usb/controller/ehci_pci.c +++ b/sys/dev/usb/controller/ehci_pci.c @@ -280,6 +280,7 @@ ehci_pci_attach(device_t self) sc->sc_bus.parent = self; sc->sc_bus.devices = sc->sc_devices; sc->sc_bus.devices_max = EHCI_MAX_DEVICES; + sc->sc_bus.dma_bits = 32; /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_bus, diff --git a/sys/dev/usb/controller/musb_otg_atmelarm.c b/sys/dev/usb/controller/musb_otg_atmelarm.c index 4e446eb..3f1b9f8 100644 --- a/sys/dev/usb/controller/musb_otg_atmelarm.c +++ b/sys/dev/usb/controller/musb_otg_atmelarm.c @@ -137,6 +137,7 @@ musbotg_attach(device_t dev) sc->sc_otg.sc_bus.parent = dev; sc->sc_otg.sc_bus.devices = sc->sc_otg.sc_devices; sc->sc_otg.sc_bus.devices_max = MUSB2_MAX_DEVICES; + sc->sc_otg.sc_bus.dma_bits = 32; /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_otg.sc_bus, diff --git a/sys/dev/usb/controller/ohci_atmelarm.c b/sys/dev/usb/controller/ohci_atmelarm.c index 0da8414..3e39f51 100644 --- a/sys/dev/usb/controller/ohci_atmelarm.c +++ b/sys/dev/usb/controller/ohci_atmelarm.c @@ -93,6 +93,7 @@ ohci_atmelarm_attach(device_t dev) sc->sc_ohci.sc_bus.parent = dev; sc->sc_ohci.sc_bus.devices = sc->sc_ohci.sc_devices; sc->sc_ohci.sc_bus.devices_max = OHCI_MAX_DEVICES; + sc->sc_ohci.sc_bus.dma_bits = 32; /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_ohci.sc_bus, diff --git a/sys/dev/usb/controller/ohci_fdt.c b/sys/dev/usb/controller/ohci_fdt.c index ff6500c..de3d357 100644 --- a/sys/dev/usb/controller/ohci_fdt.c +++ b/sys/dev/usb/controller/ohci_fdt.c @@ -99,6 +99,7 @@ ohci_at91_fdt_attach(device_t dev) sc->sc_ohci.sc_bus.parent = dev; sc->sc_ohci.sc_bus.devices = sc->sc_ohci.sc_devices; sc->sc_ohci.sc_bus.devices_max = OHCI_MAX_DEVICES; + sc->sc_ohci.sc_bus.dma_bits = 32; /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_ohci.sc_bus, diff --git a/sys/dev/usb/controller/ohci_pci.c b/sys/dev/usb/controller/ohci_pci.c index 36ca677..257f20d 100644 --- a/sys/dev/usb/controller/ohci_pci.c +++ b/sys/dev/usb/controller/ohci_pci.c @@ -211,6 +211,7 @@ ohci_pci_attach(device_t self) sc->sc_bus.parent = self; sc->sc_bus.devices = sc->sc_devices; sc->sc_bus.devices_max = OHCI_MAX_DEVICES; + sc->sc_bus.dma_bits = 32; /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self), diff --git a/sys/dev/usb/controller/ohci_s3c24x0.c b/sys/dev/usb/controller/ohci_s3c24x0.c index 225a2d2..d4a2997 100644 --- a/sys/dev/usb/controller/ohci_s3c24x0.c +++ b/sys/dev/usb/controller/ohci_s3c24x0.c @@ -84,6 +84,7 @@ ohci_s3c24x0_attach(device_t dev) sc->sc_bus.parent = dev; sc->sc_bus.devices = sc->sc_devices; sc->sc_bus.devices_max = OHCI_MAX_DEVICES; + sc->sc_bus.dma_bits = 32; /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(dev), diff --git a/sys/dev/usb/controller/uhci_pci.c b/sys/dev/usb/controller/uhci_pci.c index 454b904..4ac0d54 100644 --- a/sys/dev/usb/controller/uhci_pci.c +++ b/sys/dev/usb/controller/uhci_pci.c @@ -261,6 +261,7 @@ uhci_pci_attach(device_t self) sc->sc_bus.parent = self; sc->sc_bus.devices = sc->sc_devices; sc->sc_bus.devices_max = UHCI_MAX_DEVICES; + sc->sc_bus.dma_bits = 32; /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(self), diff --git a/sys/dev/usb/controller/usb_controller.c b/sys/dev/usb/controller/usb_controller.c index 331bd725..5addc9d 100644 --- a/sys/dev/usb/controller/usb_controller.c +++ b/sys/dev/usb/controller/usb_controller.c @@ -917,7 +917,7 @@ usb_bus_mem_alloc_all(struct usb_bus *bus, bus_dma_tag_t dmat, #if USB_HAVE_BUSDMA usb_dma_tag_setup(bus->dma_parent_tag, bus->dma_tags, - dmat, &bus->bus_mtx, NULL, 32, USB_BUS_DMA_TAG_MAX); + dmat, &bus->bus_mtx, NULL, bus->dma_bits, USB_BUS_DMA_TAG_MAX); #endif if ((bus->devices_max > USB_MAX_DEVICES) || (bus->devices_max < USB_MIN_DEVICES) || diff --git a/sys/dev/usb/controller/uss820dci_atmelarm.c b/sys/dev/usb/controller/uss820dci_atmelarm.c index 49b2b1a..395bcde 100644 --- a/sys/dev/usb/controller/uss820dci_atmelarm.c +++ b/sys/dev/usb/controller/uss820dci_atmelarm.c @@ -107,6 +107,7 @@ uss820_atmelarm_attach(device_t dev) sc->sc_bus.parent = dev; sc->sc_bus.devices = sc->sc_devices; sc->sc_bus.devices_max = USS820_MAX_DEVICES; + sc->sc_bus.dma_bits = 32; /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_bus, diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c index 9845f2c..66e6957 100644 --- a/sys/dev/usb/controller/xhci.c +++ b/sys/dev/usb/controller/xhci.c @@ -323,7 +323,7 @@ xhci_reset_command_queue_locked(struct xhci_softc *sc) usbd_get_page(&sc->sc_hw.root_pc, 0, &buf_res); - /* setup command ring control base address */ + /* set up command ring control base address */ addr = buf_res.physaddr; phwr = buf_res.buffer; addr += (uintptr_t)&((struct xhci_hw_root *)0)->hwr_commands[0]; @@ -353,34 +353,11 @@ xhci_start_controller(struct xhci_softc *sc) DPRINTF("\n"); - sc->sc_capa_off = 0; - sc->sc_oper_off = XREAD1(sc, capa, XHCI_CAPLENGTH); - sc->sc_runt_off = XREAD4(sc, capa, XHCI_RTSOFF) & ~0x1F; - sc->sc_door_off = XREAD4(sc, capa, XHCI_DBOFF) & ~0x3; - - DPRINTF("CAPLENGTH=0x%x\n", sc->sc_oper_off); - DPRINTF("RUNTIMEOFFSET=0x%x\n", sc->sc_runt_off); - DPRINTF("DOOROFFSET=0x%x\n", sc->sc_door_off); - sc->sc_event_ccs = 1; sc->sc_event_idx = 0; sc->sc_command_ccs = 1; sc->sc_command_idx = 0; - DPRINTF("xHCI version = 0x%04x\n", XREAD2(sc, capa, XHCI_HCIVERSION)); - - temp = XREAD4(sc, capa, XHCI_HCSPARAMS0); - - DPRINTF("HCS0 = 0x%08x\n", temp); - - if (XHCI_HCS0_CSZ(temp)) { - sc->sc_ctx_is_64_byte = 1; - device_printf(sc->sc_bus.parent, "64 byte context size.\n"); - } else { - sc->sc_ctx_is_64_byte = 0; - device_printf(sc->sc_bus.parent, "32 byte context size.\n"); - } - /* Reset controller */ XWRITE4(sc, oper, XHCI_USBCMD, XHCI_CMD_HCRST); @@ -420,7 +397,7 @@ xhci_start_controller(struct xhci_softc *sc) if (sc->sc_noslot > XHCI_MAX_DEVICES) sc->sc_noslot = XHCI_MAX_DEVICES; - /* setup number of device slots */ + /* set up number of device slots */ DPRINTF("CONFIG=0x%08x -> 0x%08x\n", XREAD4(sc, oper, XHCI_CONFIG), sc->sc_noslot); @@ -453,7 +430,7 @@ xhci_start_controller(struct xhci_softc *sc) /* disable all device notifications */ XWRITE4(sc, oper, XHCI_DNCTRL, 0); - /* setup device context base address */ + /* set up device context base address */ usbd_get_page(&sc->sc_hw.ctx_pc, 0, &buf_res); pdctxa = buf_res.buffer; memset(pdctxa, 0, sizeof(*pdctxa)); @@ -532,7 +509,7 @@ xhci_start_controller(struct xhci_softc *sc) temp |= XHCI_IMAN_INTR_ENA; XWRITE4(sc, runt, XHCI_IMAN(0), temp); - /* setup command ring control base address */ + /* set up command ring control base address */ addr = buf_res.physaddr; addr += (uintptr_t)&((struct xhci_hw_root *)0)->hwr_commands[0]; @@ -605,7 +582,11 @@ xhci_halt_controller(struct xhci_softc *sc) usb_error_t xhci_init(struct xhci_softc *sc, device_t self) { - /* initialise some bus fields */ + uint32_t temp; + + DPRINTF("\n"); + + /* initialize some bus fields */ sc->sc_bus.parent = self; /* set the bus revision */ @@ -614,7 +595,7 @@ xhci_init(struct xhci_softc *sc, device_t self) /* set up the bus struct */ sc->sc_bus.methods = &xhci_bus_methods; - /* setup devices array */ + /* set up devices array */ sc->sc_bus.devices = sc->sc_devices; sc->sc_bus.devices_max = XHCI_MAX_DEVICES; @@ -622,9 +603,34 @@ xhci_init(struct xhci_softc *sc, device_t self) sc->sc_event_ccs = 1; sc->sc_command_ccs = 1; - /* setup command queue mutex and condition varible */ - cv_init(&sc->sc_cmd_cv, "CMDQ"); - sx_init(&sc->sc_cmd_sx, "CMDQ lock"); + /* set up bus space offsets */ + sc->sc_capa_off = 0; + sc->sc_oper_off = XREAD1(sc, capa, XHCI_CAPLENGTH); + sc->sc_runt_off = XREAD4(sc, capa, XHCI_RTSOFF) & ~0x1F; + sc->sc_door_off = XREAD4(sc, capa, XHCI_DBOFF) & ~0x3; + + DPRINTF("CAPLENGTH=0x%x\n", sc->sc_oper_off); + DPRINTF("RUNTIMEOFFSET=0x%x\n", sc->sc_runt_off); + DPRINTF("DOOROFFSET=0x%x\n", sc->sc_door_off); + + DPRINTF("xHCI version = 0x%04x\n", XREAD2(sc, capa, XHCI_HCIVERSION)); + + temp = XREAD4(sc, capa, XHCI_HCSPARAMS0); + + DPRINTF("HCS0 = 0x%08x\n", temp); + + /* set up context size */ + if (XHCI_HCS0_CSZ(temp)) { + sc->sc_ctx_is_64_byte = 1; + } else { + sc->sc_ctx_is_64_byte = 0; + } + + /* get DMA bits */ + sc->sc_bus.dma_bits = XHCI_HCS0_AC64(temp) ? 64 : 32; + + device_printf(self, "%d bytes context size, %d-bit DMA\n", + sc->sc_ctx_is_64_byte ? 64 : 32, (int)sc->sc_bus.dma_bits); /* get all DMA memory */ if (usb_bus_mem_alloc_all(&sc->sc_bus, @@ -632,10 +638,14 @@ xhci_init(struct xhci_softc *sc, device_t self) return (ENOMEM); } - sc->sc_config_msg[0].hdr.pm_callback = &xhci_configure_msg; - sc->sc_config_msg[0].bus = &sc->sc_bus; - sc->sc_config_msg[1].hdr.pm_callback = &xhci_configure_msg; - sc->sc_config_msg[1].bus = &sc->sc_bus; + /* set up command queue mutex and condition varible */ + cv_init(&sc->sc_cmd_cv, "CMDQ"); + sx_init(&sc->sc_cmd_sx, "CMDQ lock"); + + sc->sc_config_msg[0].hdr.pm_callback = &xhci_configure_msg; + sc->sc_config_msg[0].bus = &sc->sc_bus; + sc->sc_config_msg[1].hdr.pm_callback = &xhci_configure_msg; + sc->sc_config_msg[1].bus = &sc->sc_bus; return (0); } @@ -1815,7 +1825,7 @@ restart: npkt_off += buf_res.length; } - /* setup npkt */ + /* set up npkt */ npkt = (len_old - npkt_off + temp->max_packet_size - 1) / temp->max_packet_size; @@ -1932,7 +1942,7 @@ restart: if (precompute) { precompute = 0; - /* setup alt next pointer, if any */ + /* set up alt next pointer, if any */ if (temp->last_frame) { td_alt_next = NULL; } else { @@ -2110,7 +2120,7 @@ xhci_setup_generic_chain(struct usb_xfer *xfer) } if (x != xfer->nframes) { - /* setup page_cache pointer */ + /* set up page_cache pointer */ temp.pc = xfer->frbuffers + x; /* set endpoint direction */ temp.direction = UE_GET_DIR(xfer->endpointno); @@ -2701,7 +2711,7 @@ xhci_alloc_device_ext(struct usb_device *udev) goto error; } - /* initialise all endpoint LINK TRBs */ + /* initialize all endpoint LINK TRBs */ for (i = 0; i != XHCI_MAX_ENDPOINTS; i++) { @@ -3085,7 +3095,7 @@ xhci_device_generic_enter(struct usb_xfer *xfer) { DPRINTF("\n"); - /* setup TD's and QH */ + /* set up TD's and QH */ xhci_setup_generic_chain(xfer); xhci_device_generic_multi_enter(xfer->endpoint, diff --git a/sys/dev/usb/controller/xhci_pci.c b/sys/dev/usb/controller/xhci_pci.c index c39842c..b39782a 100644 --- a/sys/dev/usb/controller/xhci_pci.c +++ b/sys/dev/usb/controller/xhci_pci.c @@ -181,26 +181,26 @@ xhci_pci_attach(device_t self) struct xhci_softc *sc = device_get_softc(self); int count, err, rid; - /* XXX check for 64-bit capability */ - - if (xhci_init(sc, self)) { - device_printf(self, "Could not initialize softc\n"); - goto error; - } - - pci_enable_busmaster(self); - rid = PCI_XHCI_CBMEM; sc->sc_io_res = bus_alloc_resource_any(self, SYS_RES_MEMORY, &rid, RF_ACTIVE); if (!sc->sc_io_res) { device_printf(self, "Could not map memory\n"); - goto error; + return (ENOMEM); } sc->sc_io_tag = rman_get_bustag(sc->sc_io_res); sc->sc_io_hdl = rman_get_bushandle(sc->sc_io_res); sc->sc_io_size = rman_get_size(sc->sc_io_res); + if (xhci_init(sc, self)) { + device_printf(self, "Could not initialize softc\n"); + bus_release_resource(self, SYS_RES_MEMORY, PCI_XHCI_CBMEM, + sc->sc_io_res); + return (ENXIO); + } + + pci_enable_busmaster(self); + usb_callout_init_mtx(&sc->sc_callout, &sc->sc_bus.bus_mtx, 0); rid = 0; @@ -299,10 +299,8 @@ xhci_pci_detach(device_t self) /* during module unload there are lots of children leftover */ device_delete_children(self); - if (sc->sc_io_res) { - usb_callout_drain(&sc->sc_callout); - xhci_halt_controller(sc); - } + usb_callout_drain(&sc->sc_callout); + xhci_halt_controller(sc); pci_disable_busmaster(self); |