svn commit: r278279 - in stable/9/sys: arm/econa dev/usb dev/usb/controller mips/atheros mips/cavium/usb mips/rmi mips/rt305x powerpc/ps3

Hans Petter Selasky hselasky at FreeBSD.org
Thu Feb 5 20:15:50 UTC 2015


Author: hselasky
Date: Thu Feb  5 20:15:42 2015
New Revision: 278279
URL: https://svnweb.freebsd.org/changeset/base/278279

Log:
  MFC r266969 and r276717:
  Add 64-bit DMA support in the XHCI controller driver.
  - Fix some comments and whitespaces while at it.
  - Add support for PAE.

Modified:
  stable/9/sys/arm/econa/ehci_ebus.c
  stable/9/sys/arm/econa/ohci_ec.c
  stable/9/sys/dev/usb/controller/at91dci_atmelarm.c
  stable/9/sys/dev/usb/controller/atmegadci_atmelarm.c
  stable/9/sys/dev/usb/controller/ehci_ixp4xx.c
  stable/9/sys/dev/usb/controller/ehci_mv.c
  stable/9/sys/dev/usb/controller/ehci_pci.c
  stable/9/sys/dev/usb/controller/musb_otg_atmelarm.c
  stable/9/sys/dev/usb/controller/ohci_atmelarm.c
  stable/9/sys/dev/usb/controller/ohci_pci.c
  stable/9/sys/dev/usb/controller/ohci_s3c24x0.c
  stable/9/sys/dev/usb/controller/uhci_pci.c
  stable/9/sys/dev/usb/controller/usb_controller.c
  stable/9/sys/dev/usb/controller/uss820dci_atmelarm.c
  stable/9/sys/dev/usb/controller/xhci.c
  stable/9/sys/dev/usb/controller/xhci_pci.c
  stable/9/sys/dev/usb/usb_bus.h
  stable/9/sys/dev/usb/usb_busdma.h
  stable/9/sys/dev/usb/usb_transfer.c
  stable/9/sys/mips/atheros/ar71xx_ehci.c
  stable/9/sys/mips/atheros/ar71xx_ohci.c
  stable/9/sys/mips/cavium/usb/octusb_octeon.c
  stable/9/sys/mips/rmi/xls_ehci.c
  stable/9/sys/mips/rt305x/rt305x_dotg.c
  stable/9/sys/powerpc/ps3/ehci_ps3.c
  stable/9/sys/powerpc/ps3/ohci_ps3.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/dev/   (props changed)

Modified: stable/9/sys/arm/econa/ehci_ebus.c
==============================================================================
--- stable/9/sys/arm/econa/ehci_ebus.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/arm/econa/ehci_ebus.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -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: stable/9/sys/arm/econa/ohci_ec.c
==============================================================================
--- stable/9/sys/arm/econa/ohci_ec.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/arm/econa/ohci_ec.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -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: stable/9/sys/dev/usb/controller/at91dci_atmelarm.c
==============================================================================
--- stable/9/sys/dev/usb/controller/at91dci_atmelarm.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/dev/usb/controller/at91dci_atmelarm.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -159,6 +159,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: stable/9/sys/dev/usb/controller/atmegadci_atmelarm.c
==============================================================================
--- stable/9/sys/dev/usb/controller/atmegadci_atmelarm.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/dev/usb/controller/atmegadci_atmelarm.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -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: stable/9/sys/dev/usb/controller/ehci_ixp4xx.c
==============================================================================
--- stable/9/sys/dev/usb/controller/ehci_ixp4xx.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/dev/usb/controller/ehci_ixp4xx.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -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: stable/9/sys/dev/usb/controller/ehci_mv.c
==============================================================================
--- stable/9/sys/dev/usb/controller/ehci_mv.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/dev/usb/controller/ehci_mv.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -123,6 +123,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: stable/9/sys/dev/usb/controller/ehci_pci.c
==============================================================================
--- stable/9/sys/dev/usb/controller/ehci_pci.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/dev/usb/controller/ehci_pci.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -278,6 +278,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: stable/9/sys/dev/usb/controller/musb_otg_atmelarm.c
==============================================================================
--- stable/9/sys/dev/usb/controller/musb_otg_atmelarm.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/dev/usb/controller/musb_otg_atmelarm.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -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: stable/9/sys/dev/usb/controller/ohci_atmelarm.c
==============================================================================
--- stable/9/sys/dev/usb/controller/ohci_atmelarm.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/dev/usb/controller/ohci_atmelarm.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -91,6 +91,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: stable/9/sys/dev/usb/controller/ohci_pci.c
==============================================================================
--- stable/9/sys/dev/usb/controller/ohci_pci.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/dev/usb/controller/ohci_pci.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -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),

Modified: stable/9/sys/dev/usb/controller/ohci_s3c24x0.c
==============================================================================
--- stable/9/sys/dev/usb/controller/ohci_s3c24x0.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/dev/usb/controller/ohci_s3c24x0.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -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: stable/9/sys/dev/usb/controller/uhci_pci.c
==============================================================================
--- stable/9/sys/dev/usb/controller/uhci_pci.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/dev/usb/controller/uhci_pci.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -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: stable/9/sys/dev/usb/controller/usb_controller.c
==============================================================================
--- stable/9/sys/dev/usb/controller/usb_controller.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/dev/usb/controller/usb_controller.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -890,7 +890,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: stable/9/sys/dev/usb/controller/uss820dci_atmelarm.c
==============================================================================
--- stable/9/sys/dev/usb/controller/uss820dci_atmelarm.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/dev/usb/controller/uss820dci_atmelarm.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -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: stable/9/sys/dev/usb/controller/xhci.c
==============================================================================
--- stable/9/sys/dev/usb/controller/xhci.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/dev/usb/controller/xhci.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -312,7 +312,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];
@@ -342,34 +342,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);
 
@@ -409,7 +386,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);
@@ -442,7 +419,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));
@@ -521,7 +498,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];
 
@@ -594,7 +571,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 */
@@ -603,7 +584,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;
 
@@ -611,9 +592,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,
@@ -621,16 +627,20 @@ 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");
 
 	if (usb_proc_create(&sc->sc_config_proc,
 	    &sc->sc_bus.bus_mtx, device_get_nameunit(self), USB_PRI_MED)) {
                 printf("WARNING: Creation of XHCI configure "
                     "callback process failed.\n");
         }
+	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);
 }
 
@@ -1795,7 +1805,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;
 
@@ -1912,7 +1922,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 {
@@ -2089,7 +2099,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);
@@ -3020,7 +3030,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, xfer);

Modified: stable/9/sys/dev/usb/controller/xhci_pci.c
==============================================================================
--- stable/9/sys/dev/usb/controller/xhci_pci.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/dev/usb/controller/xhci_pci.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -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: stable/9/sys/dev/usb/usb_bus.h
==============================================================================
--- stable/9/sys/dev/usb/usb_bus.h	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/dev/usb/usb_bus.h	Thu Feb  5 20:15:42 2015	(r278279)
@@ -104,6 +104,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: stable/9/sys/dev/usb/usb_busdma.h
==============================================================================
--- stable/9/sys/dev/usb/usb_busdma.h	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/dev/usb/usb_busdma.h	Thu Feb  5 20:15:42 2015	(r278279)
@@ -60,7 +60,7 @@ typedef void (usb_dma_callback_t)(struct
  */
 struct usb_page {
 #if USB_HAVE_BUSDMA
-	bus_size_t physaddr;
+	bus_addr_t physaddr;
 	void   *buffer;			/* non Kernel Virtual Address */
 #endif
 };
@@ -73,7 +73,7 @@ struct usb_page {
 struct usb_page_search {
 	void   *buffer;
 #if USB_HAVE_BUSDMA
-	bus_size_t physaddr;
+	bus_addr_t physaddr;
 #endif
 	usb_size_t length;
 };

Modified: stable/9/sys/dev/usb/usb_transfer.c
==============================================================================
--- stable/9/sys/dev/usb/usb_transfer.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/dev/usb/usb_transfer.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -915,7 +915,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: stable/9/sys/mips/atheros/ar71xx_ehci.c
==============================================================================
--- stable/9/sys/mips/atheros/ar71xx_ehci.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/mips/atheros/ar71xx_ehci.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -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: stable/9/sys/mips/atheros/ar71xx_ohci.c
==============================================================================
--- stable/9/sys/mips/atheros/ar71xx_ohci.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/mips/atheros/ar71xx_ohci.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -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: stable/9/sys/mips/cavium/usb/octusb_octeon.c
==============================================================================
--- stable/9/sys/mips/cavium/usb/octusb_octeon.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/mips/cavium/usb/octusb_octeon.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -101,6 +101,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: stable/9/sys/mips/rmi/xls_ehci.c
==============================================================================
--- stable/9/sys/mips/rmi/xls_ehci.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/mips/rmi/xls_ehci.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -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: stable/9/sys/mips/rt305x/rt305x_dotg.c
==============================================================================
--- stable/9/sys/mips/rt305x/rt305x_dotg.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/mips/rt305x/rt305x_dotg.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -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: stable/9/sys/powerpc/ps3/ehci_ps3.c
==============================================================================
--- stable/9/sys/powerpc/ps3/ehci_ps3.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/powerpc/ps3/ehci_ps3.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -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: stable/9/sys/powerpc/ps3/ohci_ps3.c
==============================================================================
--- stable/9/sys/powerpc/ps3/ohci_ps3.c	Thu Feb  5 20:03:02 2015	(r278278)
+++ stable/9/sys/powerpc/ps3/ohci_ps3.c	Thu Feb  5 20:15:42 2015	(r278279)
@@ -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);


More information about the svn-src-stable-9 mailing list