From owner-p4-projects@FreeBSD.ORG Tue Jul 6 06:12:27 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id CF9021065672; Tue, 6 Jul 2010 06:12: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 8CC87106564A for ; Tue, 6 Jul 2010 06:12: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 789A28FC13 for ; Tue, 6 Jul 2010 06:12:26 +0000 (UTC) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id o666CQMp048875 for ; Tue, 6 Jul 2010 06:12:26 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id o666CQDU048873 for perforce@freebsd.org; Tue, 6 Jul 2010 06:12:26 GMT (envelope-from hselasky@FreeBSD.org) Date: Tue, 6 Jul 2010 06:12:26 GMT Message-Id: <201007060612.o666CQDU048873@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 180516 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, 06 Jul 2010 06:12:27 -0000 http://p4web.freebsd.org/@@180516?ac=10 Change 180516 by hselasky@hselasky_laptop001 on 2010/07/06 06:12:24 USB CORE (internal API change): - change argument for usbd_get_dma_delay() from USB bus to USB device, hence some embedded hardware needs to know exactly which device is in question, before it exactly can decide the required delay. - if the dma delay is zero, that means no delay. - patch by: HPS @ Affected files ... .. //depot/projects/usb/src/sys/dev/usb/controller/ehci.c#54 edit .. //depot/projects/usb/src/sys/dev/usb/controller/octusb.c#5 edit .. //depot/projects/usb/src/sys/dev/usb/controller/ohci.c#36 edit .. //depot/projects/usb/src/sys/dev/usb/controller/uhci.c#33 edit .. //depot/projects/usb/src/sys/dev/usb/usb_controller.h#19 edit .. //depot/projects/usb/src/sys/dev/usb/usb_hub.c#46 edit .. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#178 edit .. //depot/projects/usb/src/sys/dev/usb/usb_transfer.h#15 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/controller/ehci.c#54 (text+ko) ==== @@ -3804,7 +3804,7 @@ } 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 ==== //depot/projects/usb/src/sys/dev/usb/controller/octusb.c#5 (text+ko) ==== @@ -1876,7 +1876,7 @@ } static void -octusb_get_dma_delay(struct usb_bus *bus, uint32_t *pus) +octusb_get_dma_delay(struct usb_device *udev, uint32_t *pus) { /* DMA delay - wait until any use of memory is finished */ *pus = (2125); /* microseconds */ ==== //depot/projects/usb/src/sys/dev/usb/controller/ohci.c#36 (text+ko) ==== @@ -2630,7 +2630,7 @@ } 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 ==== //depot/projects/usb/src/sys/dev/usb/controller/uhci.c#33 (text+ko) ==== @@ -3084,7 +3084,7 @@ } 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 ==== //depot/projects/usb/src/sys/dev/usb/usb_controller.h#19 (text+ko) ==== @@ -62,7 +62,7 @@ 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 *); ==== //depot/projects/usb/src/sys/dev/usb/usb_hub.c#46 (text+ko) ==== @@ -2104,8 +2104,9 @@ (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 */ ==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#178 (text+ko) ==== @@ -158,12 +158,16 @@ * 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; + + mtod = udev->bus->methods; + temp = 0; - if (bus->methods->get_dma_delay) { - (bus->methods->get_dma_delay) (bus, &temp); + 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 @@ 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 @@ /* 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); ==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.h#15 (text+ko) ==== @@ -131,7 +131,7 @@ 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_ */