Add 64-bit DMA support in the XHCI controller driver.
- Fix some comments and whitespace while at it. MFC after: 1 month Submitted by: marius@
This commit is contained in:
parent
f045564dbb
commit
b217d18412
@ -119,6 +119,7 @@ a10_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,
|
||||
|
@ -102,6 +102,7 @@ ehci_ebus_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,
|
||||
|
@ -91,6 +91,7 @@ ohci_ec_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,
|
||||
|
@ -259,6 +259,7 @@ vybrid_ehci_attach(device_t dev)
|
||||
sc->sc_bus.parent = dev;
|
||||
sc->sc_bus.devices = sc->sc_devices;
|
||||
sc->sc_bus.devices_max = EHCI_MAX_DEVICES;
|
||||
sc->sc_bus.dma_bits = 32;
|
||||
|
||||
if (bus_alloc_resources(dev, vybrid_ehci_spec, esc->res)) {
|
||||
device_printf(dev, "could not allocate resources\n");
|
||||
|
@ -122,6 +122,7 @@ lpc_ohci_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;
|
||||
|
||||
if (usb_bus_mem_alloc_all(&sc->sc_bus, USB_GET_DMA_TAG(dev),
|
||||
&ohci_iterate_hw_softc))
|
||||
|
@ -259,6 +259,7 @@ exynos_ehci_attach(device_t dev)
|
||||
sc->sc_bus.parent = dev;
|
||||
sc->sc_bus.devices = sc->sc_devices;
|
||||
sc->sc_bus.devices_max = EHCI_MAX_DEVICES;
|
||||
sc->sc_bus.dma_bits = 32;
|
||||
|
||||
if (bus_alloc_resources(dev, exynos_ehci_spec, esc->res)) {
|
||||
device_printf(dev, "could not allocate resources\n");
|
||||
|
@ -335,6 +335,7 @@ musbotg_attach(device_t dev)
|
||||
sc->sc_otg[i].sc_bus.parent = dev;
|
||||
sc->sc_otg[i].sc_bus.devices = sc->sc_otg[i].sc_devices;
|
||||
sc->sc_otg[i].sc_bus.devices_max = MUSB2_MAX_DEVICES;
|
||||
sc->sc_otg[i].sc_bus.dma_bits = 32;
|
||||
|
||||
/* get all DMA memory */
|
||||
if (usb_bus_mem_alloc_all(&sc->sc_otg[i].sc_bus,
|
||||
|
@ -780,7 +780,8 @@ omap_ehci_attach(device_t dev)
|
||||
sc->sc_bus.parent = dev;
|
||||
sc->sc_bus.devices = sc->sc_devices;
|
||||
sc->sc_bus.devices_max = EHCI_MAX_DEVICES;
|
||||
|
||||
sc->sc_bus.dma_bits = 32;
|
||||
|
||||
/* save the device */
|
||||
isc->sc_dev = dev;
|
||||
|
||||
|
@ -216,6 +216,7 @@ zy7_ehci_attach(device_t dev)
|
||||
sc->sc_bus.parent = dev;
|
||||
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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -99,6 +99,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 USB mode, if any */
|
||||
if (OF_getprop(ofw_bus_get_node(dev), "dr_mode",
|
||||
|
@ -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))
|
||||
|
@ -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");
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -282,6 +282,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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -213,6 +213,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),
|
||||
|
@ -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),
|
||||
|
@ -85,6 +85,7 @@ saf1761_otg_fdt_attach(device_t dev)
|
||||
sc->sc_bus.parent = dev;
|
||||
sc->sc_bus.devices = sc->sc_devices;
|
||||
sc->sc_bus.devices_max = SOTG_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), NULL))
|
||||
|
@ -174,6 +174,7 @@ saf1761_otg_fdt_attach(device_t dev)
|
||||
sc->sc_bus.parent = dev;
|
||||
sc->sc_bus.devices = sc->sc_devices;
|
||||
sc->sc_bus.devices_max = SOTG_MAX_DEVICES;
|
||||
sc->sc_bus.dma_bits = 32;
|
||||
|
||||
/* get all DMA memory */
|
||||
if (usb_bus_mem_alloc_all(&sc->sc_bus,
|
||||
|
@ -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),
|
||||
|
@ -915,7 +915,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) ||
|
||||
|
@ -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,
|
||||
|
@ -319,7 +319,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];
|
||||
@ -349,34 +349,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);
|
||||
|
||||
@ -416,7 +393,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);
|
||||
@ -449,7 +426,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));
|
||||
@ -528,7 +505,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];
|
||||
|
||||
@ -601,7 +578,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 */
|
||||
@ -610,7 +591,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;
|
||||
|
||||
@ -618,9 +599,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,
|
||||
@ -628,10 +634,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);
|
||||
}
|
||||
@ -1811,7 +1821,7 @@ xhci_setup_generic_chain_sub(struct xhci_std_temp *temp)
|
||||
npkt_off += buf_res.length;
|
||||
}
|
||||
|
||||
/* setup npkt */
|
||||
/* set up npkt */
|
||||
npkt = (len_old - npkt_off + temp->max_packet_size - 1) /
|
||||
temp->max_packet_size;
|
||||
|
||||
@ -1928,7 +1938,7 @@ xhci_setup_generic_chain_sub(struct xhci_std_temp *temp)
|
||||
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 {
|
||||
@ -2106,7 +2116,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);
|
||||
@ -2697,7 +2707,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++) {
|
||||
|
||||
@ -3081,7 +3091,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,
|
||||
|
@ -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);
|
||||
|
||||
|
@ -115,6 +115,7 @@ struct usb_bus {
|
||||
uint8_t devices_max; /* maximum number of USB devices */
|
||||
uint8_t do_probe; /* set if USB should be re-probed */
|
||||
uint8_t no_explore; /* don't explore USB ports */
|
||||
uint8_t dma_bits; /* number of DMA address lines */
|
||||
};
|
||||
|
||||
#endif /* _USB_BUS_H_ */
|
||||
|
@ -960,7 +960,8 @@ usbd_transfer_setup(struct usb_device *udev,
|
||||
#if USB_HAVE_BUSDMA
|
||||
usb_dma_tag_setup(&info->dma_parent_tag,
|
||||
parm->dma_tag_p, udev->bus->dma_parent_tag[0].tag,
|
||||
xfer_mtx, &usb_bdma_done_event, 32, parm->dma_tag_max);
|
||||
xfer_mtx, &usb_bdma_done_event, udev->bus->dma_bits,
|
||||
parm->dma_tag_max);
|
||||
#endif
|
||||
|
||||
info->bus = udev->bus;
|
||||
|
@ -90,6 +90,7 @@ ar71xx_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,
|
||||
|
@ -76,6 +76,7 @@ ar71xx_ohci_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,
|
||||
|
@ -103,6 +103,7 @@ octusb_octeon_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 = OCTUSB_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,
|
||||
|
@ -93,6 +93,7 @@ ehci_xls_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,
|
||||
|
@ -92,6 +92,7 @@ dotg_obio_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 = DOTG_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,
|
||||
|
@ -89,7 +89,9 @@ ehci_ps3_attach(device_t dev)
|
||||
sc->sc_bus.parent = dev;
|
||||
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,
|
||||
USB_GET_DMA_TAG(dev), &ehci_iterate_hw_softc))
|
||||
return (ENOMEM);
|
||||
|
@ -85,7 +85,9 @@ ohci_ps3_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), &ohci_iterate_hw_softc))
|
||||
return (ENOMEM);
|
||||
|
Loading…
Reference in New Issue
Block a user