Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Make sure to honor the USBD_FORCE_SHORT_XFER fla...



details:   https://anonhg.NetBSD.org/src/rev/fad5802521d9
branches:  trunk
changeset: 580712:fad5802521d9
user:      augustss <augustss%NetBSD.org@localhost>
date:      Thu May 05 20:40:20 2005 +0000

description:
Make sure to honor the USBD_FORCE_SHORT_XFER flag and generate an empty
transfer when necessary.

diffstat:

 sys/dev/usb/ehci.c |  16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diffs (51 lines):

diff -r b22e967a8464 -r fad5802521d9 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Thu May 05 18:03:04 2005 +0000
+++ b/sys/dev/usb/ehci.c        Thu May 05 20:40:20 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.101 2005/05/01 21:47:11 wiz Exp $ */
+/*     $NetBSD: ehci.c,v 1.102 2005/05/05 20:40:20 augustss Exp $ */
 
 /*
  * Copyright (c) 2004,2005 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
 */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.101 2005/05/01 21:47:11 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.102 2005/05/05 20:40:20 augustss Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -2266,6 +2266,7 @@
        int len, curlen, mps;
        int i, tog;
        usb_dma_t *dma = &xfer->dmabuf;
+       u_int16_t flags = xfer->flags;
 
        DPRINTFN(alen<4*4096,("ehci_alloc_sqtd_chain: start len=%d\n", alen));
 
@@ -2327,7 +2328,14 @@
                            len, curlen));
                len -= curlen;
 
-               if (len != 0) {
+               /*
+                * Allocate another transfer if there's more data left, 
+                * or if force last short transfer flag is set and we're 
+                * allocating a multiple of the max packet size.
+                */
+               if (len != 0 ||
+                   ((curlen % mps) == 0 && !rd && curlen != 0 &&
+                    (flags & USBD_FORCE_SHORT_XFER))) {
                        next = ehci_alloc_sqtd(sc);
                        if (next == NULL)
                                goto nomem;
@@ -2364,7 +2372,7 @@
                        tog ^= 1;
                        qtdstatus ^= EHCI_QTD_TOGGLE_MASK;
                }
-               if (len == 0)
+               if (next == NULL)
                        break;
                DPRINTFN(10,("ehci_alloc_sqtd_chain: extend chain\n"));
                dataphys += curlen;



Home | Main Index | Thread Index | Old Index