Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/nick-nhusb]: src/sys/dev/usb Remove an item and use a union to reduce th...
details: https://anonhg.NetBSD.org/src/rev/e006fa6270d8
branches: nick-nhusb
changeset: 334090:e006fa6270d8
user: skrll <skrll%NetBSD.org@localhost>
date: Tue Dec 23 19:31:44 2014 +0000
description:
Remove an item and use a union to reduce the size of ehci_xfer
diffstat:
sys/dev/usb/ehci.c | 76 +++++++++++++++++++++++++-------------------------
sys/dev/usb/ehcivar.h | 26 ++++++++++++-----
2 files changed, 56 insertions(+), 46 deletions(-)
diffs (173 lines):
diff -r 777ec27d3c34 -r e006fa6270d8 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c Tue Dec 23 11:24:31 2014 +0000
+++ b/sys/dev/usb/ehci.c Tue Dec 23 19:31:44 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci.c,v 1.234.2.18 2014/12/22 08:24:20 skrll Exp $ */
+/* $NetBSD: ehci.c,v 1.234.2.19 2014/12/23 19:31:44 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.234.2.18 2014/12/22 08:24:20 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.19 2014/12/23 19:31:44 skrll Exp $");
#include "ohci.h"
#include "uhci.h"
@@ -1130,6 +1130,7 @@
xfer->ux_status = USBD_NORMAL_COMPLETION;
goto end;
}
+ KASSERT(xfertype != UE_ISOCHRONOUS);
/* Continue processing xfers using queue heads */
@@ -3272,37 +3273,42 @@
xfer->ux_status = status;
callout_stop(&xfer->ux_callout);
- for (itd = exfer->itdstart; itd != NULL; itd = itd->xfer_next) {
- usb_syncmem(&itd->dma,
- itd->offs + offsetof(ehci_itd_t, itd_ctl),
- sizeof(itd->itd.itd_ctl),
- BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
-
- for (i = 0; i < 8; i++) {
- trans_status = le32toh(itd->itd.itd_ctl[i]);
- trans_status &= ~EHCI_ITD_ACTIVE;
- itd->itd.itd_ctl[i] = htole32(trans_status);
+ if (xfer->ux_pipe->up_dev->ud_speed == USB_SPEED_HIGH) {
+ for (itd = exfer->itdstart; itd != NULL;
+ itd = itd->xfer_next) {
+ usb_syncmem(&itd->dma,
+ itd->offs + offsetof(ehci_itd_t, itd_ctl),
+ sizeof(itd->itd.itd_ctl),
+ BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
+
+ for (i = 0; i < 8; i++) {
+ trans_status = le32toh(itd->itd.itd_ctl[i]);
+ trans_status &= ~EHCI_ITD_ACTIVE;
+ itd->itd.itd_ctl[i] = htole32(trans_status);
+ }
+
+ usb_syncmem(&itd->dma,
+ itd->offs + offsetof(ehci_itd_t, itd_ctl),
+ sizeof(itd->itd.itd_ctl),
+ BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
}
-
- usb_syncmem(&itd->dma,
- itd->offs + offsetof(ehci_itd_t, itd_ctl),
- sizeof(itd->itd.itd_ctl),
- BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- }
- for (sitd = exfer->sitdstart; sitd != NULL; sitd = sitd->xfer_next) {
- usb_syncmem(&sitd->dma,
- sitd->offs + offsetof(ehci_sitd_t, sitd_buffer),
- sizeof(sitd->sitd.sitd_buffer),
- BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
-
- trans_status = le32toh(sitd->sitd.sitd_trans);
- trans_status &= ~EHCI_SITD_ACTIVE;
- sitd->sitd.sitd_trans = htole32(trans_status);
-
- usb_syncmem(&sitd->dma,
- sitd->offs + offsetof(ehci_sitd_t, sitd_buffer),
- sizeof(sitd->sitd.sitd_buffer),
- BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
+ } else {
+ for (sitd = exfer->sitdstart; sitd != NULL;
+ sitd = sitd->xfer_next) {
+ usb_syncmem(&sitd->dma,
+ sitd->offs + offsetof(ehci_sitd_t, sitd_buffer),
+ sizeof(sitd->sitd.sitd_buffer),
+ BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD);
+
+ trans_status = le32toh(sitd->sitd.sitd_trans);
+ trans_status &= ~EHCI_SITD_ACTIVE;
+ sitd->sitd.sitd_trans = htole32(trans_status);
+
+ usb_syncmem(&sitd->dma,
+ sitd->offs + offsetof(ehci_sitd_t, sitd_buffer),
+ sizeof(sitd->sitd.sitd_buffer),
+ BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
+ }
}
sc->sc_softwake = 1;
@@ -4242,7 +4248,6 @@
stop = sitd;
stop->xfer_next = NULL;
- exfer->isoc_len = total_length;
usb_syncmem(&exfer->xfer.ux_dmabuf, 0, total_length,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
@@ -4314,8 +4319,6 @@
exfer->sitdstart = start;
exfer->sitdend = stop;
- exfer->sqtdstart = NULL;
- exfer->sqtdstart = NULL;
ehci_add_intr_list(sc, exfer);
xfer->ux_status = USBD_IN_PROGRESS;
@@ -4572,7 +4575,6 @@
stop = itd;
stop->xfer_next = NULL;
- exfer->isoc_len = total_length;
usb_syncmem(&exfer->xfer.ux_dmabuf, 0, total_length,
BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
@@ -4647,8 +4649,6 @@
exfer->itdstart = start;
exfer->itdend = stop;
- exfer->sqtdstart = NULL;
- exfer->sqtdend = NULL;
ehci_add_intr_list(sc, exfer);
xfer->ux_status = USBD_IN_PROGRESS;
diff -r 777ec27d3c34 -r e006fa6270d8 sys/dev/usb/ehcivar.h
--- a/sys/dev/usb/ehcivar.h Tue Dec 23 11:24:31 2014 +0000
+++ b/sys/dev/usb/ehcivar.h Tue Dec 23 19:31:44 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehcivar.h,v 1.42.14.5 2014/12/05 13:23:38 skrll Exp $ */
+/* $NetBSD: ehcivar.h,v 1.42.14.6 2014/12/23 19:31:44 skrll Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -94,13 +94,23 @@
struct usbd_xfer xfer;
struct usb_task abort_task;
TAILQ_ENTRY(ehci_xfer) inext; /* list of active xfers */
- ehci_soft_qtd_t *sqtdstart;
- ehci_soft_qtd_t *sqtdend;
- ehci_soft_itd_t *itdstart;
- ehci_soft_itd_t *itdend;
- ehci_soft_sitd_t *sitdstart;
- ehci_soft_sitd_t *sitdend;
- u_int isoc_len;
+ union {
+ /* ctrl/bulk/intr */
+ struct {
+ ehci_soft_qtd_t *sqtdstart;
+ ehci_soft_qtd_t *sqtdend;
+ };
+ /* isoc */
+ struct {
+ ehci_soft_itd_t *itdstart;
+ ehci_soft_itd_t *itdend;
+ };
+ /* split isoc */
+ struct {
+ ehci_soft_sitd_t *sitdstart;
+ ehci_soft_sitd_t *sitdend;
+ };
+ };
int isdone; /* used only when DIAGNOSTIC is defined */
};
#define EXFER(xfer) ((struct ehci_xfer *)(xfer))
Home |
Main Index |
Thread Index |
Old Index