PERFORCE change 181781 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Tue Aug 3 16:26:27 UTC 2010
http://p4web.freebsd.org/@@181781?ac=10
Change 181781 by hselasky at hselasky_laptop001 on 2010/08/03 16:26:07
USB core:
- add support for high level set address (required by XHCI chipset)
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/controller/xhci.c#11 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_bus.h#19 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_request.c#38 edit
.. //depot/projects/usb/src/sys/dev/usb/usbdi.h#20 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/controller/xhci.c#11 (text+ko) ====
@@ -347,6 +347,12 @@
sc->sc_bus.devices = sc->sc_devices;
sc->sc_bus.devices_max = XHCI_MAX_DEVICES;
+ /*
+ * The XHCI is very high level at this point and requires
+ * special handling.
+ */
+ sc->sc_bus.no_set_address = 1;
+
/* setup command queue mutex and condition varible */
cv_init(&sc->sc_cmd_cv, "CMDQ");
sx_init(&sc->sc_cmd_sx, "CMDQ lock");
==== //depot/projects/usb/src/sys/dev/usb/usb_bus.h#19 (text+ko) ====
@@ -91,6 +91,7 @@
uint16_t isoc_time_last; /* in milliseconds */
+ uint8_t no_set_address; /* Do not send set address requests */
uint8_t alloc_failed; /* Set if memory allocation failed. */
uint8_t driver_added_refcount; /* Current driver generation count */
enum usb_revision usbrev; /* USB revision. See "USB_REV_XXX". */
==== //depot/projects/usb/src/sys/dev/usb/usb_request.c#38 (text+ko) ====
@@ -445,6 +445,12 @@
if (hr_func != NULL) {
DPRINTF("Handle Request function is set\n");
+ /* check for dry run */
+ if (flags & USB_DRY_RUN) {
+ DPRINTF("Dry run\n");
+ goto done;
+ }
+
desc = NULL;
temp = 0;
@@ -501,6 +507,11 @@
err = USB_ERR_NOMEM;
goto done;
}
+ /* check for dry run */
+ if (flags & USB_DRY_RUN) {
+ DPRINTF("Dry run\n");
+ goto done;
+ }
#ifdef USB_REQ_DEBUG
/* Get debug bits */
@@ -1349,6 +1360,7 @@
usbd_req_set_address(struct usb_device *udev, struct mtx *mtx, uint16_t addr)
{
struct usb_device_request req;
+ uint16_t flags;
DPRINTFN(6, "setting device address=%d\n", addr);
@@ -1358,9 +1370,15 @@
USETW(req.wIndex, 0);
USETW(req.wLength, 0);
+ flags = USB_DELAY_STATUS_STAGE;
+
+ /* check if USB controller handles set address */
+ if ((udev->parent_hub != NULL) && (udev->bus->no_set_address != 0))
+ flags |= USB_DRY_RUN;
+
/* Setting the address should not take more than 1 second ! */
return (usbd_do_request_flags(udev, mtx, &req, NULL,
- USB_DELAY_STATUS_STAGE, NULL, 1000));
+ flags, NULL, 1000));
}
/*------------------------------------------------------------------------*
==== //depot/projects/usb/src/sys/dev/usb/usbdi.h#20 (text+ko) ====
@@ -81,6 +81,7 @@
#define USB_USER_DATA_PTR 0x0020 /* internal flag */
#define USB_MULTI_SHORT_OK 0x0040 /* allow multiple short frames */
#define USB_MANUAL_STATUS 0x0080 /* manual ctrl status */
+#define USB_DRY_RUN 0x0100 /* only setup control endpoint */
#define USB_NO_TIMEOUT 0
#define USB_DEFAULT_TIMEOUT 5000 /* 5000 ms = 5 seconds */
More information about the p4-projects
mailing list