From owner-p4-projects@FreeBSD.ORG Tue Aug 3 16:26:27 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8CB0A1065758; Tue, 3 Aug 2010 16:26:26 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 389331065742 for ; Tue, 3 Aug 2010 16:26:26 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 252E98FC1F for ; Tue, 3 Aug 2010 16:26:26 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.4/8.14.4) with ESMTP id o73GQQac007433 for ; Tue, 3 Aug 2010 16:26:26 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.4/8.14.4/Submit) id o73GQQeR007431 for perforce@freebsd.org; Tue, 3 Aug 2010 16:26:26 GMT (envelope-from hselasky@FreeBSD.org) Date: Tue, 3 Aug 2010 16:26:26 GMT Message-Id: <201008031626.o73GQQeR007431@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 181781 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Aug 2010 16:26:27 -0000 http://p4web.freebsd.org/@@181781?ac=10 Change 181781 by hselasky@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 */