svn commit: r198657 - in stable/8/sys: . amd64/include/xen
cddl/contrib/opensolaris contrib/dev/acpica contrib/pf
dev/usb/serial dev/xen/xenpci
Andrew Thompson
thompsa at FreeBSD.org
Thu Oct 29 23:24:42 UTC 2009
Author: thompsa
Date: Thu Oct 29 23:24:41 2009
New Revision: 198657
URL: http://svn.freebsd.org/changeset/base/198657
Log:
MFC r197573
Add back endpoint swap detection that was disabled in an earlier driver
conversion.
Modified:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cddl/contrib/opensolaris/ (props changed)
stable/8/sys/contrib/dev/acpica/ (props changed)
stable/8/sys/contrib/pf/ (props changed)
stable/8/sys/dev/usb/serial/umct.c
stable/8/sys/dev/xen/xenpci/ (props changed)
Modified: stable/8/sys/dev/usb/serial/umct.c
==============================================================================
--- stable/8/sys/dev/usb/serial/umct.c Thu Oct 29 23:24:10 2009 (r198656)
+++ stable/8/sys/dev/usb/serial/umct.c Thu Oct 29 23:24:41 2009 (r198657)
@@ -115,6 +115,7 @@ struct umct_softc {
uint8_t sc_lcr;
uint8_t sc_mcr;
uint8_t sc_iface_no;
+ uint8_t sc_swap_cb;
uint8_t sc_name[16];
};
@@ -125,8 +126,10 @@ static device_attach_t umct_attach;
static device_detach_t umct_detach;
static usb_callback_t umct_intr_callback;
-static usb_callback_t umct_write_callback;
+static usb_callback_t umct_intr_callback_sub;
static usb_callback_t umct_read_callback;
+static usb_callback_t umct_read_callback_sub;
+static usb_callback_t umct_write_callback;
static void umct_cfg_do_request(struct umct_softc *sc, uint8_t request,
uint16_t len, uint32_t value);
@@ -240,7 +243,7 @@ umct_attach(device_t dev)
struct usb_attach_arg *uaa = device_get_ivars(dev);
struct umct_softc *sc = device_get_softc(dev);
int32_t error;
- //uint16_t maxp;
+ uint16_t maxp;
uint8_t iface_index;
sc->sc_udev = uaa->device;
@@ -263,13 +266,13 @@ umct_attach(device_t dev)
"transfers failed!\n");
goto detach;
}
+
/*
* The real bulk-in endpoint is also marked as an interrupt.
* The only way to differentiate it from the real interrupt
* endpoint is to look at the wMaxPacketSize field.
*/
-#ifdef XXX
- maxp = UGETW(sc->sc_xfer[UMCT_BULK_DT_RD]->endpoint->edesc->wMaxPacketSize);
+ maxp = usbd_xfer_max_framelen(sc->sc_xfer[UMCT_BULK_DT_RD]);
if (maxp == 0x2) {
/* guessed wrong - switch around endpoints */
@@ -278,11 +281,9 @@ umct_attach(device_t dev)
sc->sc_xfer[UMCT_INTR_DT_RD] = sc->sc_xfer[UMCT_BULK_DT_RD];
sc->sc_xfer[UMCT_BULK_DT_RD] = temp;
-
- sc->sc_xfer[UMCT_BULK_DT_RD]->callback = &umct_read_callback;
- sc->sc_xfer[UMCT_INTR_DT_RD]->callback = &umct_intr_callback;
+ sc->sc_swap_cb = 1;
}
-#endif
+
sc->sc_obufsize = usbd_xfer_max_len(sc->sc_xfer[UMCT_BULK_DT_WR]);
if (uaa->info.idProduct == USB_PRODUCT_MCT_SITECOM_USB232) {
@@ -342,7 +343,7 @@ umct_cfg_do_request(struct umct_softc *s
}
static void
-umct_intr_callback(struct usb_xfer *xfer, usb_error_t error)
+umct_intr_callback_sub(struct usb_xfer *xfer, usb_error_t error)
{
struct umct_softc *sc = usbd_xfer_softc(xfer);
struct usb_page_cache *pc;
@@ -547,6 +548,28 @@ umct_stop_write(struct ucom_softc *ucom)
}
static void
+umct_read_callback(struct usb_xfer *xfer, usb_error_t error)
+{
+ struct umct_softc *sc = usbd_xfer_softc(xfer);
+
+ if (sc->sc_swap_cb)
+ umct_intr_callback_sub(xfer, error);
+ else
+ umct_read_callback_sub(xfer, error);
+}
+
+static void
+umct_intr_callback(struct usb_xfer *xfer, usb_error_t error)
+{
+ struct umct_softc *sc = usbd_xfer_softc(xfer);
+
+ if (sc->sc_swap_cb)
+ umct_read_callback_sub(xfer, error);
+ else
+ umct_intr_callback_sub(xfer, error);
+}
+
+static void
umct_write_callback(struct usb_xfer *xfer, usb_error_t error)
{
struct umct_softc *sc = usbd_xfer_softc(xfer);
@@ -577,7 +600,7 @@ tr_setup:
}
static void
-umct_read_callback(struct usb_xfer *xfer, usb_error_t error)
+umct_read_callback_sub(struct usb_xfer *xfer, usb_error_t error)
{
struct umct_softc *sc = usbd_xfer_softc(xfer);
struct usb_page_cache *pc;
More information about the svn-src-stable-8
mailing list