[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree

zrouter-src-freebsd at zrouter.org zrouter-src-freebsd at zrouter.org
Sat Jan 21 22:36:12 UTC 2012


details:   http://zrouter.org/hg/FreeBSD/head//rev/6ace9965d408
changeset: 291:6ace9965d408
user:      ray at terran.dlink.ua
date:      Sun Jan 22 00:37:59 2012 +0200
description:
update cavium/usb to r230440.

diffstat:

 head/sys/mips/cavium/usb/octusb.c |  41 +++++++++++++++++++++++---------------
 head/sys/mips/cavium/usb/octusb.h |   4 +-
 2 files changed, 27 insertions(+), 18 deletions(-)

diffs (162 lines):

diff -r 80860a9d89c9 -r 6ace9965d408 head/sys/mips/cavium/usb/octusb.c
--- a/head/sys/mips/cavium/usb/octusb.c	Sun Jan 22 00:35:53 2012 +0200
+++ b/head/sys/mips/cavium/usb/octusb.c	Sun Jan 22 00:37:59 2012 +0200
@@ -1,5 +1,5 @@
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/mips/cavium/usb/octusb.c 229408 2012-01-03 19:10:37Z gonzo $");
+__FBSDID("$FreeBSD: head/sys/mips/cavium/usb/octusb.c 230405 2012-01-20 23:37:04Z gonzo $");
 
 /*-
  * Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
@@ -159,7 +159,7 @@
 	sc = td->qh->sc;
 
 	ep_handle = cvmx_usb_open_pipe(
-	    &sc->sc_port[td->qh->port_index].state,
+	    &sc->sc_port[td->qh->root_port_index].state,
 	    0,
 	    td->qh->dev_addr,
 	    td->qh->ep_num & UE_ADDR,
@@ -173,11 +173,13 @@
 	    td->qh->hs_hub_addr,
 	    td->qh->hs_hub_port);
 
-	if (ep_handle < 0)
+	if (ep_handle < 0) {
+		DPRINTFN(1, "cvmx_usb_open_pipe failed: %d\n", ep_handle);
 		return (1);		/* busy */
+	}
 
 	cvmx_usb_set_toggle(
-	    &sc->sc_port[td->qh->port_index].state,
+	    &sc->sc_port[td->qh->root_port_index].state,
 	    ep_handle, td->qh->ep_toggle_next);
 
 	td->qh->fixup_handle = -1;
@@ -206,10 +208,10 @@
 
 	if (td->qh->fixup_handle >= 0) {
 		/* cancel, if any */
-		cvmx_usb_cancel(&sc->sc_port[td->qh->port_index].state,
+		cvmx_usb_cancel(&sc->sc_port[td->qh->root_port_index].state,
 		    td->qh->ep_handle, td->qh->fixup_handle);
 	}
-	cvmx_usb_close_pipe(&sc->sc_port[td->qh->port_index].state, td->qh->ep_handle);
+	cvmx_usb_close_pipe(&sc->sc_port[td->qh->root_port_index].state, td->qh->ep_handle);
 
 	td->qh->ep_allocated = 0;
 }
@@ -301,7 +303,7 @@
 		usb_pc_cpu_flush(td->qh->fixup_pc);
 
 		status = cvmx_usb_submit_control(
-		    &sc->sc_port[td->qh->port_index].state,
+		    &sc->sc_port[td->qh->root_port_index].state,
 		    td->qh->ep_handle, td->qh->fixup_phys,
 		    td->qh->fixup_phys + 8, td->qh->fixup_len,
 		    &octusb_complete_cb, td);
@@ -410,7 +412,7 @@
 
 		/* start USB transfer */
 		status = cvmx_usb_submit_control(
-		    &sc->sc_port[td->qh->port_index].state,
+		    &sc->sc_port[td->qh->root_port_index].state,
 		    td->qh->ep_handle, td->qh->fixup_phys,
 		    td->qh->fixup_phys + 8, td->qh->fixup_len,
 		    &octusb_complete_cb, td);
@@ -493,19 +495,19 @@
 		td->qh->iso_pkt.length = rem;
 		td->qh->iso_pkt.status = 0;
 		/* start USB transfer */
-		status = cvmx_usb_submit_isochronous(&sc->sc_port[td->qh->port_index].state,
+		status = cvmx_usb_submit_isochronous(&sc->sc_port[td->qh->root_port_index].state,
 		    td->qh->ep_handle, 1, CVMX_USB_ISOCHRONOUS_FLAGS_ALLOW_SHORT |
 		    CVMX_USB_ISOCHRONOUS_FLAGS_ASAP, 1, &td->qh->iso_pkt,
 		    td->qh->fixup_phys, rem, &octusb_complete_cb, td);
 		break;
 	case UE_BULK:
 		/* start USB transfer */
-		status = cvmx_usb_submit_bulk(&sc->sc_port[td->qh->port_index].state,
+		status = cvmx_usb_submit_bulk(&sc->sc_port[td->qh->root_port_index].state,
 		    td->qh->ep_handle, td->qh->fixup_phys, rem, &octusb_complete_cb, td);
 		break;
 	case UE_INTERRUPT:
 		/* start USB transfer (interrupt or interrupt) */
-		status = cvmx_usb_submit_interrupt(&sc->sc_port[td->qh->port_index].state,
+		status = cvmx_usb_submit_interrupt(&sc->sc_port[td->qh->root_port_index].state,
 		    td->qh->ep_handle, td->qh->fixup_phys, rem, &octusb_complete_cb, td);
 		break;
 	default:
@@ -612,19 +614,19 @@
 		td->qh->iso_pkt.length = rem;
 		td->qh->iso_pkt.status = 0;
 		/* start USB transfer */
-		status = cvmx_usb_submit_isochronous(&sc->sc_port[td->qh->port_index].state,
+		status = cvmx_usb_submit_isochronous(&sc->sc_port[td->qh->root_port_index].state,
 		    td->qh->ep_handle, 1, CVMX_USB_ISOCHRONOUS_FLAGS_ALLOW_SHORT |
 		    CVMX_USB_ISOCHRONOUS_FLAGS_ASAP, 1, &td->qh->iso_pkt,
 		    td->qh->fixup_phys, rem, &octusb_complete_cb, td);
 		break;
 	case UE_BULK:
 		/* start USB transfer */
-		status = cvmx_usb_submit_bulk(&sc->sc_port[td->qh->port_index].state,
+		status = cvmx_usb_submit_bulk(&sc->sc_port[td->qh->root_port_index].state,
 		    td->qh->ep_handle, td->qh->fixup_phys, rem, &octusb_complete_cb, td);
 		break;
 	case UE_INTERRUPT:
 		/* start USB transfer */
-		status = cvmx_usb_submit_interrupt(&sc->sc_port[td->qh->port_index].state,
+		status = cvmx_usb_submit_interrupt(&sc->sc_port[td->qh->root_port_index].state,
 		    td->qh->ep_handle, td->qh->fixup_phys, rem, &octusb_complete_cb, td);
 		break;
 	default:
@@ -798,7 +800,7 @@
 
 	xfer->endpoint->toggle_next =
 	    cvmx_usb_get_toggle(
-	    &sc->sc_port[qh->port_index].state,
+	    &sc->sc_port[qh->root_port_index].state,
 	    qh->ep_handle) ? 1 : 0;
 
 	octusb_device_done(xfer, error);
@@ -1729,6 +1731,7 @@
 	struct octusb_softc *sc;
 	struct octusb_qh *qh;
 	struct usb_xfer *xfer;
+	struct usb_device *hub;
 	void *last_obj;
 	uint32_t n;
 	uint32_t ntd;
@@ -1774,7 +1777,13 @@
 		qh->ep_type = xfer->endpoint->edesc->bmAttributes;
 		qh->dev_addr = xfer->address;
 		qh->dev_speed = usbd_get_speed(xfer->xroot->udev);
-		qh->port_index = xfer->xroot->udev->port_index;
+		qh->root_port_index = xfer->xroot->udev->port_index;
+		/* We need Octeon USB HUB's port index, not the local port */
+		hub = xfer->xroot->udev->parent_hub;
+		while(hub && hub->parent_hub) {
+			qh->root_port_index = hub->port_index;
+			hub = hub->parent_hub;
+		}
 
 		switch (xfer->endpoint->edesc->bmAttributes & UE_XFERTYPE) {
 		case UE_INTERRUPT:
diff -r 80860a9d89c9 -r 6ace9965d408 head/sys/mips/cavium/usb/octusb.h
--- a/head/sys/mips/cavium/usb/octusb.h	Sun Jan 22 00:35:53 2012 +0200
+++ b/head/sys/mips/cavium/usb/octusb.h	Sun Jan 22 00:37:59 2012 +0200
@@ -1,4 +1,4 @@
-/* $FreeBSD: head/sys/mips/cavium/usb/octusb.h 229168 2012-01-01 09:12:21Z gonzo $ */
+/* $FreeBSD: head/sys/mips/cavium/usb/octusb.h 230405 2012-01-20 23:37:04Z gonzo $ */
 
 /*-
  * Copyright (c) 2010 Hans Petter Selasky. All rights reserved.
@@ -80,7 +80,7 @@
 	uint8_t	ep_num;
 	uint8_t	ep_type;
 	uint8_t	ep_toggle_next;
-	uint8_t	port_index;
+	uint8_t	root_port_index;
 	uint8_t	fixup_complete;
 	uint8_t	fixup_pending;
 	uint8_t	hs_hub_addr;


More information about the Zrouter-src-freebsd mailing list