svn commit: r261005 - head/sys/dev/usb
Hans Petter Selasky
hselasky at FreeBSD.org
Wed Jan 22 07:48:40 UTC 2014
Author: hselasky
Date: Wed Jan 22 07:48:39 2014
New Revision: 261005
URL: http://svnweb.freebsd.org/changeset/base/261005
Log:
Ensure that the DMA delay does not get rounded down to zero ticks when
a timeout value of a single tick is given. With FreeBSD-10 and newer
the current system time is used as a starting point, and the minimum
callout time of a single tick will be guaranteed. This patch mostly
affect the DMA delay timeouts, which are typically in the range from
0.125 to 2ms.
MFC after: 1 week
Modified:
head/sys/dev/usb/usb_freebsd.h
head/sys/dev/usb/usb_freebsd_loader.h
head/sys/dev/usb/usb_transfer.c
Modified: head/sys/dev/usb/usb_freebsd.h
==============================================================================
--- head/sys/dev/usb/usb_freebsd.h Wed Jan 22 07:32:55 2014 (r261004)
+++ head/sys/dev/usb/usb_freebsd.h Wed Jan 22 07:48:39 2014 (r261005)
@@ -50,6 +50,13 @@
#define USB_HAVE_FIXED_CONFIG 0
#define USB_HAVE_FIXED_PORT 0
+/* define zero ticks callout value */
+#if (__FreeBSD_version >= 1000029)
+#define USB_CALLOUT_ZERO_TICKS 0
+#else
+#define USB_CALLOUT_ZERO_TICKS 1
+#endif
+
#define USB_TD_GET_PROC(td) (td)->td_proc
#define USB_PROC_GET_GID(td) (td)->p_pgid
Modified: head/sys/dev/usb/usb_freebsd_loader.h
==============================================================================
--- head/sys/dev/usb/usb_freebsd_loader.h Wed Jan 22 07:32:55 2014 (r261004)
+++ head/sys/dev/usb/usb_freebsd_loader.h Wed Jan 22 07:48:39 2014 (r261005)
@@ -50,6 +50,8 @@
#define USB_HAVE_FIXED_CONFIG 0
#define USB_HAVE_FIXED_PORT 0
+#define USB_CALLOUT_ZERO_TICKS 1
+
#define USB_TD_GET_PROC(td) (td)->td_proc
#define USB_PROC_GET_GID(td) (td)->p_pgid
Modified: head/sys/dev/usb/usb_transfer.c
==============================================================================
--- head/sys/dev/usb/usb_transfer.c Wed Jan 22 07:32:55 2014 (r261004)
+++ head/sys/dev/usb/usb_transfer.c Wed Jan 22 07:48:39 2014 (r261005)
@@ -2723,7 +2723,7 @@ usbd_transfer_timeout_ms(struct usb_xfer
/* defer delay */
usb_callout_reset(&xfer->timeout_handle,
- USB_MS_TO_TICKS(ms), cb, xfer);
+ USB_MS_TO_TICKS(ms) + USB_CALLOUT_ZERO_TICKS, cb, xfer);
}
/*------------------------------------------------------------------------*
More information about the svn-src-head
mailing list