From owner-svn-src-stable-8@FreeBSD.ORG Fri Nov 19 01:48:48 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1F5A7106564A; Fri, 19 Nov 2010 01:48:48 +0000 (UTC) (envelope-from thompsa@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0D2C48FC1C; Fri, 19 Nov 2010 01:48:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oAJ1mlra053049; Fri, 19 Nov 2010 01:48:47 GMT (envelope-from thompsa@svn.freebsd.org) Received: (from thompsa@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oAJ1mlBb053041; Fri, 19 Nov 2010 01:48:47 GMT (envelope-from thompsa@svn.freebsd.org) Message-Id: <201011190148.oAJ1mlBb053041@svn.freebsd.org> From: Andrew Thompson Date: Fri, 19 Nov 2010 01:48:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r215500 - in stable/8/sys/dev/usb: . controller X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Nov 2010 01:48:48 -0000 Author: thompsa Date: Fri Nov 19 01:48:47 2010 New Revision: 215500 URL: http://svn.freebsd.org/changeset/base/215500 Log: MFC r212134 Change argument for usbd_get_dma_delay() from USB bus to USB device, some embedded hardware needs to know exactly which device is in question before it exactly can decide the required delay. Modified: stable/8/sys/dev/usb/controller/ehci.c stable/8/sys/dev/usb/controller/ohci.c stable/8/sys/dev/usb/controller/uhci.c stable/8/sys/dev/usb/usb_controller.h stable/8/sys/dev/usb/usb_hub.c stable/8/sys/dev/usb/usb_transfer.c stable/8/sys/dev/usb/usb_transfer.h Directory Properties: 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/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/usb/controller/ehci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ehci.c Fri Nov 19 01:47:46 2010 (r215499) +++ stable/8/sys/dev/usb/controller/ehci.c Fri Nov 19 01:48:47 2010 (r215500) @@ -3804,7 +3804,7 @@ done: } static void -ehci_get_dma_delay(struct usb_bus *bus, uint32_t *pus) +ehci_get_dma_delay(struct usb_device *udev, uint32_t *pus) { /* * Wait until the hardware has finished any possible use of Modified: stable/8/sys/dev/usb/controller/ohci.c ============================================================================== --- stable/8/sys/dev/usb/controller/ohci.c Fri Nov 19 01:47:46 2010 (r215499) +++ stable/8/sys/dev/usb/controller/ohci.c Fri Nov 19 01:48:47 2010 (r215500) @@ -2630,7 +2630,7 @@ ohci_xfer_unsetup(struct usb_xfer *xfer) } static void -ohci_get_dma_delay(struct usb_bus *bus, uint32_t *pus) +ohci_get_dma_delay(struct usb_device *udev, uint32_t *pus) { /* * Wait until hardware has finished any possible use of the Modified: stable/8/sys/dev/usb/controller/uhci.c ============================================================================== --- stable/8/sys/dev/usb/controller/uhci.c Fri Nov 19 01:47:46 2010 (r215499) +++ stable/8/sys/dev/usb/controller/uhci.c Fri Nov 19 01:48:47 2010 (r215500) @@ -3084,7 +3084,7 @@ uhci_xfer_unsetup(struct usb_xfer *xfer) } static void -uhci_get_dma_delay(struct usb_bus *bus, uint32_t *pus) +uhci_get_dma_delay(struct usb_device *udev, uint32_t *pus) { /* * Wait until hardware has finished any possible use of the Modified: stable/8/sys/dev/usb/usb_controller.h ============================================================================== --- stable/8/sys/dev/usb/usb_controller.h Fri Nov 19 01:47:46 2010 (r215499) +++ stable/8/sys/dev/usb/usb_controller.h Fri Nov 19 01:48:47 2010 (r215500) @@ -62,7 +62,7 @@ struct usb_bus_methods { struct usb_endpoint_descriptor *, struct usb_endpoint *); void (*xfer_setup) (struct usb_setup_params *); void (*xfer_unsetup) (struct usb_xfer *); - void (*get_dma_delay) (struct usb_bus *, uint32_t *); + void (*get_dma_delay) (struct usb_device *, uint32_t *); void (*device_suspend) (struct usb_device *); void (*device_resume) (struct usb_device *); void (*set_hw_power) (struct usb_bus *); Modified: stable/8/sys/dev/usb/usb_hub.c ============================================================================== --- stable/8/sys/dev/usb/usb_hub.c Fri Nov 19 01:47:46 2010 (r215499) +++ stable/8/sys/dev/usb/usb_hub.c Fri Nov 19 01:48:47 2010 (r215500) @@ -2105,8 +2105,9 @@ repeat: (udev->bus->methods->device_suspend) (udev); /* do DMA delay */ - temp = usbd_get_dma_delay(udev->bus); - usb_pause_mtx(NULL, USB_MS_TO_TICKS(temp)); + temp = usbd_get_dma_delay(udev); + if (temp != 0) + usb_pause_mtx(NULL, USB_MS_TO_TICKS(temp)); } /* suspend current port */ Modified: stable/8/sys/dev/usb/usb_transfer.c ============================================================================== --- stable/8/sys/dev/usb/usb_transfer.c Fri Nov 19 01:47:46 2010 (r215499) +++ stable/8/sys/dev/usb/usb_transfer.c Fri Nov 19 01:48:47 2010 (r215500) @@ -158,12 +158,16 @@ usbd_update_max_frame_size(struct usb_xf * Else: milliseconds of DMA delay *------------------------------------------------------------------------*/ usb_timeout_t -usbd_get_dma_delay(struct usb_bus *bus) +usbd_get_dma_delay(struct usb_device *udev) { - uint32_t temp = 0; + struct usb_bus_methods *mtod; + uint32_t temp; - if (bus->methods->get_dma_delay) { - (bus->methods->get_dma_delay) (bus, &temp); + mtod = udev->bus->methods; + temp = 0; + + if (mtod->get_dma_delay) { + (mtod->get_dma_delay) (udev, &temp); /* * Round up and convert to milliseconds. Note that we use * 1024 milliseconds per second. to save a division. @@ -1094,9 +1098,11 @@ usbd_transfer_unsetup_sub(struct usb_xfe if (needs_delay) { usb_timeout_t temp; - temp = usbd_get_dma_delay(info->bus); - usb_pause_mtx(&info->bus->bus_mtx, - USB_MS_TO_TICKS(temp)); + temp = usbd_get_dma_delay(info->udev); + if (temp != 0) { + usb_pause_mtx(&info->bus->bus_mtx, + USB_MS_TO_TICKS(temp)); + } } /* make sure that our done messages are not queued anywhere */ @@ -2577,7 +2583,7 @@ usbd_callback_wrapper_sub(struct usb_xfe /* we can not cancel this delay */ xfer->flags_int.can_cancel_immed = 0; - temp = usbd_get_dma_delay(xfer->xroot->bus); + temp = usbd_get_dma_delay(xfer->xroot->udev); DPRINTFN(3, "DMA delay, %u ms, " "on %p\n", temp, xfer); Modified: stable/8/sys/dev/usb/usb_transfer.h ============================================================================== --- stable/8/sys/dev/usb/usb_transfer.h Fri Nov 19 01:47:46 2010 (r215499) +++ stable/8/sys/dev/usb/usb_transfer.h Fri Nov 19 01:48:47 2010 (r215500) @@ -131,7 +131,7 @@ usb_callback_t usb_handle_request_callba usb_callback_t usb_do_clear_stall_callback; void usbd_transfer_timeout_ms(struct usb_xfer *xfer, void (*cb) (void *arg), usb_timeout_t ms); -usb_timeout_t usbd_get_dma_delay(struct usb_bus *bus); +usb_timeout_t usbd_get_dma_delay(struct usb_device *udev); void usbd_transfer_power_ref(struct usb_xfer *xfer, int val); #endif /* _USB_TRANSFER_H_ */