PERFORCE change 181770 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Tue Aug 3 15:41:36 UTC 2010
http://p4web.freebsd.org/@@181770?ac=10
Change 181770 by hselasky at hselasky_laptop001 on 2010/08/03 15:41:21
USB core:
- add support for event driven DMA delay.
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#180 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_transfer.h#16 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#180 (text+ko) ====
@@ -109,7 +109,6 @@
static void usb_callback_proc(struct usb_proc_msg *);
static void usbd_callback_ss_done_defer(struct usb_xfer *);
static void usbd_callback_wrapper(struct usb_xfer_queue *);
-static void usb_dma_delay_done_cb(void *);
static void usbd_transfer_start_cb(void *);
static uint8_t usbd_callback_wrapper_sub(struct usb_xfer *);
static void usbd_get_std_packet_size(struct usb_std_packet_size *ptr,
@@ -2195,11 +2194,9 @@
* transfer. This code path is ususally only used when there is an USB
* error like USB_ERR_CANCELLED.
*------------------------------------------------------------------------*/
-static void
-usb_dma_delay_done_cb(void *arg)
+void
+usb_dma_delay_done_cb(struct usb_xfer *xfer)
{
- struct usb_xfer *xfer = arg;
-
USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED);
DPRINTFN(3, "Completed %p\n", xfer);
@@ -2600,8 +2597,18 @@
if (temp != 0) {
USB_BUS_LOCK(xfer->xroot->bus);
- usbd_transfer_timeout_ms(xfer,
- &usb_dma_delay_done_cb, temp);
+ /*
+ * Some hardware solutions have dedicated
+ * events when it is safe to free DMA'ed
+ * memory. For the other hardware platforms we
+ * use a static delay.
+ */
+ if (xfer->endpoint->methods->dma_delay != NULL) {
+ (xfer->endpoint->methods->dma_delay) (xfer);
+ } else {
+ usbd_transfer_timeout_ms(xfer,
+ (void *)&usb_dma_delay_done_cb, temp);
+ }
USB_BUS_UNLOCK(xfer->xroot->bus);
return (1); /* wait for new callback */
}
==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.h#16 (text+ko) ====
@@ -114,6 +114,7 @@
uint8_t usbd_transfer_setup_sub_malloc(struct usb_setup_params *parm,
struct usb_page_cache **ppc, usb_size_t size, usb_size_t align,
usb_size_t count);
+void usb_dma_delay_done_cb(struct usb_xfer *);
void usb_command_wrapper(struct usb_xfer_queue *pq,
struct usb_xfer *xfer);
void usbd_pipe_enter(struct usb_xfer *xfer);
More information about the p4-projects
mailing list