Date: Mon, 5 Jan 2015 20:22:19 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r276717 - in head/sys: arm/allwinner arm/cavium/cns11xx arm/freescale/vybrid arm/lpc arm/samsung/exynos arm/ti/am335x arm/ti/usb arm/xilinx dev/usb dev/usb/controller mips/atheros mips/... Message-ID: <201501052022.t05KMJfc023032@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Mon Jan 5 20:22:18 2015 New Revision: 276717 URL: https://svnweb.freebsd.org/changeset/base/276717 Log: 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@ Modified: head/sys/arm/allwinner/a10_ehci.c head/sys/arm/cavium/cns11xx/ehci_ebus.c head/sys/arm/cavium/cns11xx/ohci_ec.c head/sys/arm/freescale/vybrid/vf_ehci.c head/sys/arm/lpc/lpc_ohci.c head/sys/arm/samsung/exynos/exynos5_ehci.c head/sys/arm/ti/am335x/am335x_usbss.c head/sys/arm/ti/usb/omap_ehci.c head/sys/arm/xilinx/zy7_ehci.c head/sys/dev/usb/controller/at91dci_atmelarm.c head/sys/dev/usb/controller/at91dci_fdt.c head/sys/dev/usb/controller/atmegadci_atmelarm.c head/sys/dev/usb/controller/dwc_otg_fdt.c head/sys/dev/usb/controller/ehci_fsl.c head/sys/dev/usb/controller/ehci_imx.c head/sys/dev/usb/controller/ehci_ixp4xx.c head/sys/dev/usb/controller/ehci_mv.c head/sys/dev/usb/controller/ehci_pci.c head/sys/dev/usb/controller/musb_otg_atmelarm.c head/sys/dev/usb/controller/ohci_atmelarm.c head/sys/dev/usb/controller/ohci_fdt.c head/sys/dev/usb/controller/ohci_pci.c head/sys/dev/usb/controller/ohci_s3c24x0.c head/sys/dev/usb/controller/saf1761_otg_boot.c head/sys/dev/usb/controller/saf1761_otg_fdt.c head/sys/dev/usb/controller/uhci_pci.c head/sys/dev/usb/controller/usb_controller.c head/sys/dev/usb/controller/uss820dci_atmelarm.c head/sys/dev/usb/controller/xhci.c head/sys/dev/usb/controller/xhci_pci.c head/sys/dev/usb/usb_bus.h head/sys/dev/usb/usb_transfer.c head/sys/mips/atheros/ar71xx_ehci.c head/sys/mips/atheros/ar71xx_ohci.c head/sys/mips/cavium/usb/octusb_octeon.c head/sys/mips/rmi/xls_ehci.c head/sys/mips/rt305x/rt305x_dotg.c head/sys/powerpc/ps3/ehci_ps3.c head/sys/powerpc/ps3/ohci_ps3.c Modified: head/sys/arm/allwinner/a10_ehci.c ============================================================================== --- head/sys/arm/allwinner/a10_ehci.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/arm/allwinner/a10_ehci.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/arm/cavium/cns11xx/ehci_ebus.c ============================================================================== --- head/sys/arm/cavium/cns11xx/ehci_ebus.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/arm/cavium/cns11xx/ehci_ebus.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/arm/cavium/cns11xx/ohci_ec.c ============================================================================== --- head/sys/arm/cavium/cns11xx/ohci_ec.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/arm/cavium/cns11xx/ohci_ec.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/arm/freescale/vybrid/vf_ehci.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_ehci.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/arm/freescale/vybrid/vf_ehci.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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"); Modified: head/sys/arm/lpc/lpc_ohci.c ============================================================================== --- head/sys/arm/lpc/lpc_ohci.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/arm/lpc/lpc_ohci.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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)) Modified: head/sys/arm/samsung/exynos/exynos5_ehci.c ============================================================================== --- head/sys/arm/samsung/exynos/exynos5_ehci.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/arm/samsung/exynos/exynos5_ehci.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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"); Modified: head/sys/arm/ti/am335x/am335x_usbss.c ============================================================================== --- head/sys/arm/ti/am335x/am335x_usbss.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/arm/ti/am335x/am335x_usbss.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/arm/ti/usb/omap_ehci.c ============================================================================== --- head/sys/arm/ti/usb/omap_ehci.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/arm/ti/usb/omap_ehci.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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; Modified: head/sys/arm/xilinx/zy7_ehci.c ============================================================================== --- head/sys/arm/xilinx/zy7_ehci.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/arm/xilinx/zy7_ehci.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/dev/usb/controller/at91dci_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/at91dci_atmelarm.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/at91dci_atmelarm.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/dev/usb/controller/at91dci_fdt.c ============================================================================== --- head/sys/dev/usb/controller/at91dci_fdt.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/at91dci_fdt.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/dev/usb/controller/atmegadci_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/atmegadci_atmelarm.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/atmegadci_atmelarm.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/dev/usb/controller/dwc_otg_fdt.c ============================================================================== --- head/sys/dev/usb/controller/dwc_otg_fdt.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/dwc_otg_fdt.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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", Modified: head/sys/dev/usb/controller/ehci_fsl.c ============================================================================== --- head/sys/dev/usb/controller/ehci_fsl.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/ehci_fsl.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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)) Modified: head/sys/dev/usb/controller/ehci_imx.c ============================================================================== --- head/sys/dev/usb/controller/ehci_imx.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/ehci_imx.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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"); Modified: head/sys/dev/usb/controller/ehci_ixp4xx.c ============================================================================== --- head/sys/dev/usb/controller/ehci_ixp4xx.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/ehci_ixp4xx.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/dev/usb/controller/ehci_mv.c ============================================================================== --- head/sys/dev/usb/controller/ehci_mv.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/ehci_mv.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/dev/usb/controller/ehci_pci.c ============================================================================== --- head/sys/dev/usb/controller/ehci_pci.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/ehci_pci.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/dev/usb/controller/musb_otg_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg_atmelarm.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/musb_otg_atmelarm.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/dev/usb/controller/ohci_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/ohci_atmelarm.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/ohci_atmelarm.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/dev/usb/controller/ohci_fdt.c ============================================================================== --- head/sys/dev/usb/controller/ohci_fdt.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/ohci_fdt.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/dev/usb/controller/ohci_pci.c ============================================================================== --- head/sys/dev/usb/controller/ohci_pci.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/ohci_pci.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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), Modified: head/sys/dev/usb/controller/ohci_s3c24x0.c ============================================================================== --- head/sys/dev/usb/controller/ohci_s3c24x0.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/ohci_s3c24x0.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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), Modified: head/sys/dev/usb/controller/saf1761_otg_boot.c ============================================================================== --- head/sys/dev/usb/controller/saf1761_otg_boot.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/saf1761_otg_boot.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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)) Modified: head/sys/dev/usb/controller/saf1761_otg_fdt.c ============================================================================== --- head/sys/dev/usb/controller/saf1761_otg_fdt.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/saf1761_otg_fdt.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/dev/usb/controller/uhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/uhci_pci.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/uhci_pci.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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), Modified: head/sys/dev/usb/controller/usb_controller.c ============================================================================== --- head/sys/dev/usb/controller/usb_controller.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/usb_controller.c Mon Jan 5 20:22:18 2015 (r276717) @@ -915,7 +915,7 @@ usb_bus_mem_alloc_all(struct usb_bus *bu #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) || Modified: head/sys/dev/usb/controller/uss820dci_atmelarm.c ============================================================================== --- head/sys/dev/usb/controller/uss820dci_atmelarm.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/uss820dci_atmelarm.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/dev/usb/controller/xhci.c ============================================================================== --- head/sys/dev/usb/controller/xhci.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/xhci.c Mon Jan 5 20:22:18 2015 (r276717) @@ -319,7 +319,7 @@ xhci_reset_command_queue_locked(struct x 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 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 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 /* 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 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 * 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_ /* 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_ 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_ 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 @@ 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; @@ -1928,7 +1938,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 { @@ -2106,7 +2116,7 @@ xhci_setup_generic_chain(struct usb_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 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_xfe { 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, Modified: head/sys/dev/usb/controller/xhci_pci.c ============================================================================== --- head/sys/dev/usb/controller/xhci_pci.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/controller/xhci_pci.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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); Modified: head/sys/dev/usb/usb_bus.h ============================================================================== --- head/sys/dev/usb/usb_bus.h Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/usb_bus.h Mon Jan 5 20:22:18 2015 (r276717) @@ -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_ */ Modified: head/sys/dev/usb/usb_transfer.c ============================================================================== --- head/sys/dev/usb/usb_transfer.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/dev/usb/usb_transfer.c Mon Jan 5 20:22:18 2015 (r276717) @@ -960,7 +960,8 @@ usbd_transfer_setup(struct usb_device *u #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; Modified: head/sys/mips/atheros/ar71xx_ehci.c ============================================================================== --- head/sys/mips/atheros/ar71xx_ehci.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/mips/atheros/ar71xx_ehci.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/mips/atheros/ar71xx_ohci.c ============================================================================== --- head/sys/mips/atheros/ar71xx_ohci.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/mips/atheros/ar71xx_ohci.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/mips/cavium/usb/octusb_octeon.c ============================================================================== --- head/sys/mips/cavium/usb/octusb_octeon.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/mips/cavium/usb/octusb_octeon.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/mips/rmi/xls_ehci.c ============================================================================== --- head/sys/mips/rmi/xls_ehci.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/mips/rmi/xls_ehci.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/mips/rt305x/rt305x_dotg.c ============================================================================== --- head/sys/mips/rt305x/rt305x_dotg.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/mips/rt305x/rt305x_dotg.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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, Modified: head/sys/powerpc/ps3/ehci_ps3.c ============================================================================== --- head/sys/powerpc/ps3/ehci_ps3.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/powerpc/ps3/ehci_ps3.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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); Modified: head/sys/powerpc/ps3/ohci_ps3.c ============================================================================== --- head/sys/powerpc/ps3/ohci_ps3.c Mon Jan 5 19:54:40 2015 (r276716) +++ head/sys/powerpc/ps3/ohci_ps3.c Mon Jan 5 20:22:18 2015 (r276717) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201501052022.t05KMJfc023032>