Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Update ux_length in usbd_setup_isoc_xfer and use this to...
details: https://anonhg.NetBSD.org/src/rev/d50c109537df
branches: trunk
changeset: 932752:d50c109537df
user: skrll <skrll%NetBSD.org@localhost>
date: Fri May 15 06:15:42 2020 +0000
description:
Update ux_length in usbd_setup_isoc_xfer and use this to usb_syncmem
in the HCDs
diffstat:
sys/dev/usb/ehci.c | 20 ++++++++------------
sys/dev/usb/ohci.c | 9 +++++----
sys/dev/usb/uhci.c | 9 +++++----
sys/dev/usb/usbdi.c | 7 +++++--
sys/external/bsd/dwc2/dwc2.c | 10 ++++++++--
5 files changed, 31 insertions(+), 24 deletions(-)
diffs (211 lines):
diff -r 4a80bf7819e5 -r d50c109537df sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c Fri May 15 06:01:26 2020 +0000
+++ b/sys/dev/usb/ehci.c Fri May 15 06:15:42 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci.c,v 1.278 2020/04/05 20:59:38 skrll Exp $ */
+/* $NetBSD: ehci.c,v 1.279 2020/05/15 06:15:42 skrll Exp $ */
/*
* Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.278 2020/04/05 20:59:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.279 2020/05/15 06:15:42 skrll Exp $");
#include "ohci.h"
#include "uhci.h"
@@ -4301,14 +4301,13 @@
ehci_soft_sitd_t *sitd;
usb_dma_t *dma_buf;
int i, j, k, frames;
- int offs, total_length;
+ int offs;
int frindex;
u_int dir;
EHCIHIST_FUNC(); EHCIHIST_CALLED();
sitd = NULL;
- total_length = 0;
DPRINTF("xfer %#jx len %jd flags %jd", (uintptr_t)xfer, xfer->ux_length,
xfer->ux_flags, 0);
@@ -4354,7 +4353,6 @@
/* Set page0 index and offset - TP and T-offset are set below */
sitd->sitd.sitd_buffer[0] = htole32(DMAADDR(dma_buf, offs));
- total_length += xfer->ux_frlengths[i];
offs += xfer->ux_frlengths[i];
sitd->sitd.sitd_buffer[1] =
@@ -4432,8 +4430,8 @@
sizeof(sitd->sitd.sitd_trans),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- if (total_length)
- usb_syncmem(&exfer->ex_xfer.ux_dmabuf, 0, total_length,
+ if (xfer->ux_length)
+ usb_syncmem(&exfer->ex_xfer.ux_dmabuf, 0, xfer->ux_length,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
/*
@@ -4672,7 +4670,7 @@
usb_dma_t *dma_buf;
int i, j;
int frames, uframes, ufrperframe;
- int trans_count, offs, total_length;
+ int trans_count, offs;
int frindex;
EHCIHIST_FUNC(); EHCIHIST_CALLED();
@@ -4680,7 +4678,6 @@
prev = NULL;
itd = NULL;
trans_count = 0;
- total_length = 0;
DPRINTF("xfer %#jx flags %jd", (uintptr_t)xfer, xfer->ux_flags, 0, 0);
@@ -4765,7 +4762,6 @@
EHCI_ITD_SET_PG(addr) |
EHCI_ITD_SET_OFFS(EHCI_PAGE_OFFSET(DMAADDR(dma_buf,offs))));
- total_length += xfer->ux_frlengths[trans_count];
offs += xfer->ux_frlengths[trans_count];
trans_count++;
@@ -4820,8 +4816,8 @@
prev = itd;
} /* End of frame */
- if (total_length)
- usb_syncmem(&exfer->ex_xfer.ux_dmabuf, 0, total_length,
+ if (xfer->ux_length)
+ usb_syncmem(&exfer->ex_xfer.ux_dmabuf, 0, xfer->ux_length,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
/*
diff -r 4a80bf7819e5 -r d50c109537df sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c Fri May 15 06:01:26 2020 +0000
+++ b/sys/dev/usb/ohci.c Fri May 15 06:15:42 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci.c,v 1.303 2020/05/13 19:33:48 jakllsch Exp $ */
+/* $NetBSD: ohci.c,v 1.304 2020/05/15 06:15:42 skrll Exp $ */
/*
* Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.303 2020/05/13 19:33:48 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.304 2020/05/15 06:15:42 skrll Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -3463,8 +3463,9 @@
int isread =
(UE_GET_DIR(xfer->ux_pipe->up_endpoint->ue_edesc->bEndpointAddress) == UE_DIR_IN);
- usb_syncmem(&xfer->ux_dmabuf, 0, xfer->ux_bufsize,
- isread ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
+ if (xfer->ux_length)
+ usb_syncmem(&xfer->ux_dmabuf, 0, xfer->ux_bufsize,
+ isread ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
if (isoc->next == -1) {
/* Not in use yet, schedule it a few frames ahead. */
diff -r 4a80bf7819e5 -r d50c109537df sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c Fri May 15 06:01:26 2020 +0000
+++ b/sys/dev/usb/uhci.c Fri May 15 06:15:42 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhci.c,v 1.300 2020/04/05 20:59:38 skrll Exp $ */
+/* $NetBSD: uhci.c,v 1.301 2020/05/15 06:15:42 skrll Exp $ */
/*
* Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.300 2020/04/05 20:59:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.301 2020/05/15 06:15:42 skrll Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -2918,8 +2918,9 @@
KASSERT(xfer->ux_nframes != 0);
- usb_syncmem(&xfer->ux_dmabuf, 0, xfer->ux_length,
- rd ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
+ if (xfer->ux_length)
+ usb_syncmem(&xfer->ux_dmabuf, 0, xfer->ux_length,
+ rd ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE);
mutex_enter(&sc->sc_lock);
next = isoc->next;
diff -r 4a80bf7819e5 -r d50c109537df sys/dev/usb/usbdi.c
--- a/sys/dev/usb/usbdi.c Fri May 15 06:01:26 2020 +0000
+++ b/sys/dev/usb/usbdi.c Fri May 15 06:15:42 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usbdi.c,v 1.200 2020/04/05 20:59:38 skrll Exp $ */
+/* $NetBSD: usbdi.c,v 1.201 2020/05/15 06:15:42 skrll Exp $ */
/*
* Copyright (c) 1998, 2012, 2015 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.200 2020/04/05 20:59:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.201 2020/05/15 06:15:42 skrll Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -685,6 +685,9 @@
xfer->ux_rqflags &= ~URQ_REQUEST;
xfer->ux_frlengths = frlengths;
xfer->ux_nframes = nframes;
+
+ for (size_t i = 0; i < xfer->ux_nframes; i++)
+ xfer->ux_length += xfer->ux_frlengths[i];
}
void
diff -r 4a80bf7819e5 -r d50c109537df sys/external/bsd/dwc2/dwc2.c
--- a/sys/external/bsd/dwc2/dwc2.c Fri May 15 06:01:26 2020 +0000
+++ b/sys/external/bsd/dwc2/dwc2.c Fri May 15 06:15:42 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc2.c,v 1.73 2020/04/05 20:59:38 skrll Exp $ */
+/* $NetBSD: dwc2.c,v 1.74 2020/05/15 06:15:42 skrll Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.73 2020/04/05 20:59:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dwc2.c,v 1.74 2020/05/15 06:15:42 skrll Exp $");
#include "opt_usb.h"
@@ -1017,9 +1017,15 @@
" mps=%d dir %s\n", xfer, xfer->ux_nframes, xfer->ux_flags, addr,
epnum, mps, dir == UT_READ ? "in" :"out");
+#ifdef DIAGNOSTIC
len = 0;
for (size_t i = 0; i < xfer->ux_nframes; i++)
len += xfer->ux_frlengths[i];
+ if (len != xfer->ux_length)
+ panic("len (%d) != xfer->ux_length (%d)", len,
+ xfer->ux_length);
+#endif
+ len = xfer->ux_length;
} else {
DPRINTFN(3, "xfer=%p len=%d flags=%d addr=%d endpt=%d,"
" mps=%d dir %s\n", xfer, xfer->ux_length, xfer->ux_flags, addr,
Home |
Main Index |
Thread Index |
Old Index