Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Move EHCI_DEBUG, OHCI_DEBUG, UHCI_DEBUG, USB_DEB...
details: https://anonhg.NetBSD.org/src/rev/d80d5d9a14d7
branches: trunk
changeset: 765903:d80d5d9a14d7
user: matt <matt%NetBSD.org@localhost>
date: Thu Jun 09 19:08:31 2011 +0000
description:
Move EHCI_DEBUG, OHCI_DEBUG, UHCI_DEBUG, USB_DEBUG, UHUB_DEBUG to opt_usb.h
(ya dependencies).
Cleanup usb_mem.c a little more and add block tracking code. Help find
corruption problems.
Comment out the SPEED check for ETTF. XXX why doesn't that work right?
diffstat:
sys/dev/usb/ehci.c | 19 ++++---
sys/dev/usb/files.usb | 3 +-
sys/dev/usb/ohci.c | 6 +-
sys/dev/usb/uhci.c | 6 +-
sys/dev/usb/uhub.c | 8 ++-
sys/dev/usb/usb.c | 5 +-
sys/dev/usb/usb_mem.c | 117 ++++++++++++++++++++++++++++++++----------------
sys/dev/usb/usb_subr.c | 6 +-
sys/dev/usb/usbdi.c | 12 +++-
9 files changed, 116 insertions(+), 66 deletions(-)
diffs (truncated from 482 to 300 lines):
diff -r 32395ff15061 -r d80d5d9a14d7 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c Thu Jun 09 17:29:42 2011 +0000
+++ b/sys/dev/usb/ehci.c Thu Jun 09 19:08:31 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci.c,v 1.177 2011/05/28 15:47:17 tsutsui Exp $ */
+/* $NetBSD: ehci.c,v 1.178 2011/06/09 19:08:31 matt Exp $ */
/*
* Copyright (c) 2004-2008 The NetBSD Foundation, Inc.
@@ -52,10 +52,11 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.177 2011/05/28 15:47:17 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.178 2011/06/09 19:08:31 matt Exp $");
#include "ohci.h"
#include "uhci.h"
+#include "opt_usb.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -2270,9 +2271,10 @@
goto ret;
}
v = EOREAD4(sc, EHCI_PORTSC(index));
- DPRINTFN(8,("ehci_root_ctrl_start: port status=0x%04x\n",
- v));
-
+ DPRINTFN(8,("ehci_root_ctrl_start: port status=0x%04x\n", v));
+
+ i = UPS_HIGH_SPEED;
+#if 0
if (sc->sc_flags & EHCIF_ETTF) {
/*
* If we are doing embedded transaction translation,
@@ -2281,9 +2283,8 @@
* the same way as in USBSTATUS.
*/
i = __SHIFTOUT(v, EHCI_PS_PSPD) * UPS_LOW_SPEED;
- } else {
- i = UPS_HIGH_SPEED;
}
+#endif
if (v & EHCI_PS_CS) i |= UPS_CURRENT_CONNECT_STATUS;
if (v & EHCI_PS_PE) i |= UPS_PORT_ENABLED;
if (v & EHCI_PS_SUSP) i |= UPS_SUSPEND;
@@ -2351,9 +2352,9 @@
* terminate the reset sequence so there's no need to
* it.
*/
- if (!(sc->sc_flags & EHCIF_ETTF)) {
+ v = EOREAD4(sc, port);
+ if (v & EHCI_PS_PR) {
/* Terminate reset sequence. */
- v = EOREAD4(sc, port);
EOWRITE4(sc, port, v & ~EHCI_PS_PR);
/* Wait for HC to complete reset. */
usb_delay_ms(&sc->sc_bus,
diff -r 32395ff15061 -r d80d5d9a14d7 sys/dev/usb/files.usb
--- a/sys/dev/usb/files.usb Thu Jun 09 17:29:42 2011 +0000
+++ b/sys/dev/usb/files.usb Thu Jun 09 19:08:31 2011 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.usb,v 1.105 2011/03/20 17:54:03 tsutsui Exp $
+# $NetBSD: files.usb,v 1.106 2011/06/09 19:08:31 matt Exp $
#
# Config file and device description for machine-independent USB code.
# Included by ports that need it. Ports that use it must provide
@@ -6,6 +6,7 @@
defflag USBVERBOSE
defflag opt_usb.h USB_FRAG_DMA_WORKAROUND
+defflag opt_usb.h EHCI_DEBUG OHCI_DEBUG UHCI_DEBUG UHUB_DEBUG USB_DEBUG
defflag opt_uvideo.h UVIDEO_DEBUG
diff -r 32395ff15061 -r d80d5d9a14d7 sys/dev/usb/ohci.c
--- a/sys/dev/usb/ohci.c Thu Jun 09 17:29:42 2011 +0000
+++ b/sys/dev/usb/ohci.c Thu Jun 09 19:08:31 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ohci.c,v 1.215 2011/05/28 15:47:17 tsutsui Exp $ */
+/* $NetBSD: ohci.c,v 1.216 2011/06/09 19:08:31 matt Exp $ */
/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */
/*
@@ -41,7 +41,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.215 2011/05/28 15:47:17 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.216 2011/06/09 19:08:31 matt Exp $");
+
+#include "opt_usb.h"
#include <sys/param.h>
#include <sys/systm.h>
diff -r 32395ff15061 -r d80d5d9a14d7 sys/dev/usb/uhci.c
--- a/sys/dev/usb/uhci.c Thu Jun 09 17:29:42 2011 +0000
+++ b/sys/dev/usb/uhci.c Thu Jun 09 19:08:31 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhci.c,v 1.238 2011/05/28 15:47:17 tsutsui Exp $ */
+/* $NetBSD: uhci.c,v 1.239 2011/06/09 19:08:32 matt Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */
/*
@@ -42,7 +42,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.238 2011/05/28 15:47:17 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.239 2011/06/09 19:08:32 matt Exp $");
+
+#include "opt_usb.h"
#include <sys/param.h>
#include <sys/systm.h>
diff -r 32395ff15061 -r d80d5d9a14d7 sys/dev/usb/uhub.c
--- a/sys/dev/usb/uhub.c Thu Jun 09 17:29:42 2011 +0000
+++ b/sys/dev/usb/uhub.c Thu Jun 09 19:08:31 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uhub.c,v 1.113 2011/05/29 12:37:09 jmcneill Exp $ */
+/* $NetBSD: uhub.c,v 1.114 2011/06/09 19:08:32 matt Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $ */
/*
@@ -36,7 +36,9 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.113 2011/05/29 12:37:09 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhub.c,v 1.114 2011/06/09 19:08:32 matt Exp $");
+
+#include "opt_usb.h"
#include <sys/param.h>
#include <sys/systm.h>
@@ -546,7 +548,7 @@
dev->depth + 1, speed, port, up);
/* XXX retry a few times? */
if (err) {
- DPRINTFN(-1,("uhub_explore: usb_new_device failed, "
+ DPRINTFN(-1,("uhub_explore: usbd_new_device failed, "
"error=%s\n", usbd_errstr(err)));
/* Avoid addressing problems by disabling. */
/* usbd_reset_port(dev, port, &up->status); */
diff -r 32395ff15061 -r d80d5d9a14d7 sys/dev/usb/usb.c
--- a/sys/dev/usb/usb.c Thu Jun 09 17:29:42 2011 +0000
+++ b/sys/dev/usb/usb.c Thu Jun 09 19:08:31 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb.c,v 1.124 2011/05/23 21:50:44 joerg Exp $ */
+/* $NetBSD: usb.c,v 1.125 2011/06/09 19:08:32 matt Exp $ */
/*
* Copyright (c) 1998, 2002, 2008 The NetBSD Foundation, Inc.
@@ -37,9 +37,10 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.124 2011/05/23 21:50:44 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.125 2011/06/09 19:08:32 matt Exp $");
#include "opt_compat_netbsd.h"
+#include "opt_usb.h"
#include <sys/param.h>
#include <sys/systm.h>
diff -r 32395ff15061 -r d80d5d9a14d7 sys/dev/usb/usb_mem.c
--- a/sys/dev/usb/usb_mem.c Thu Jun 09 17:29:42 2011 +0000
+++ b/sys/dev/usb/usb_mem.c Thu Jun 09 19:08:31 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb_mem.c,v 1.47 2011/06/09 07:17:02 matt Exp $ */
+/* $NetBSD: usb_mem.c,v 1.48 2011/06/09 19:08:32 matt Exp $ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.47 2011/06/09 07:17:02 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_mem.c,v 1.48 2011/06/09 19:08:32 matt Exp $");
#ifdef _KERNEL_OPT
#include "opt_usb.h"
@@ -90,9 +90,16 @@
usb_dma_block_t **);
Static void usb_block_freemem(usb_dma_block_t *);
-Static LIST_HEAD(, usb_dma_block) usb_blk_freelist =
+LIST_HEAD(usb_dma_block_qh, usb_dma_block);
+Static struct usb_dma_block_qh usb_blk_freelist =
LIST_HEAD_INITIALIZER(usb_blk_freelist);
-Static int usb_blk_nfree = 0;
+#ifdef DEBUG
+Static struct usb_dma_block_qh usb_blk_fraglist =
+ LIST_HEAD_INITIALIZER(usb_blk_fraglist);
+Static struct usb_dma_block_qh usb_blk_fulllist =
+ LIST_HEAD_INITIALIZER(usb_blk_fulllist);
+#endif
+Static u_int usb_blk_nfree = 0;
/* XXX should have different free list for different tags (for speed) */
Static LIST_HEAD(, usb_frag_dma) usb_frag_freelist =
LIST_HEAD_INITIALIZER(usb_frag_freelist);
@@ -101,12 +108,11 @@
usb_block_allocmem(bus_dma_tag_t tag, size_t size, size_t align,
usb_dma_block_t **dmap)
{
+ usb_dma_block_t *b;
int error;
- usb_dma_block_t *p;
int s;
- DPRINTFN(5, ("usb_block_allocmem: size=%lu align=%lu\n",
- (u_long)size, (u_long)align));
+ DPRINTFN(5, ("usb_block_allocmem: size=%zu align=%zu\n", size, align));
#ifdef DIAGNOSTIC
if (cpu_intr_p()) {
@@ -117,14 +123,14 @@
s = splusb();
/* First check the free list. */
- LIST_FOREACH(p, &usb_blk_freelist, next) {
- if (p->tag == tag && p->size >= size && p->align >= align) {
- LIST_REMOVE(p, next);
+ LIST_FOREACH(b, &usb_blk_freelist, next) {
+ if (b->tag == tag && b->size >= size && b->align >= align) {
+ LIST_REMOVE(b, next);
usb_blk_nfree--;
splx(s);
- *dmap = p;
- DPRINTFN(6,("usb_block_allocmem: free list size=%lu\n",
- (u_long)p->size));
+ *dmap = b;
+ DPRINTFN(6,("usb_block_allocmem: free list size=%zu\n",
+ p->size));
return (USBD_NORMAL_COMPLETION);
}
}
@@ -138,54 +144,54 @@
#endif
DPRINTFN(6, ("usb_block_allocmem: no free\n"));
- p = malloc(sizeof *p, M_USB, M_NOWAIT);
- if (p == NULL)
+ b = malloc(sizeof *b, M_USB, M_NOWAIT | M_ZERO);
+ if (b == NULL)
return (USBD_NOMEM);
- p->tag = tag;
- p->size = size;
- p->align = align;
- error = bus_dmamem_alloc(tag, p->size, align, 0,
- p->segs, __arraycount(p->segs),
- &p->nsegs, BUS_DMA_NOWAIT);
+ b->tag = tag;
+ b->size = size;
+ b->align = align;
+ error = bus_dmamem_alloc(tag, b->size, align, 0,
+ b->segs, __arraycount(b->segs),
+ &b->nsegs, BUS_DMA_NOWAIT);
if (error)
goto free0;
- error = bus_dmamem_map(tag, p->segs, p->nsegs, p->size,
- &p->kaddr, BUS_DMA_NOWAIT|BUS_DMA_COHERENT);
+ error = bus_dmamem_map(tag, b->segs, b->nsegs, b->size,
+ &b->kaddr, BUS_DMA_NOWAIT|BUS_DMA_COHERENT);
if (error)
goto free1;
- error = bus_dmamap_create(tag, p->size, 1, p->size,
- 0, BUS_DMA_NOWAIT, &p->map);
+ error = bus_dmamap_create(tag, b->size, 1, b->size,
+ 0, BUS_DMA_NOWAIT, &b->map);
if (error)
goto unmap;
- error = bus_dmamap_load(tag, p->map, p->kaddr, p->size, NULL,
+ error = bus_dmamap_load(tag, b->map, b->kaddr, b->size, NULL,
BUS_DMA_NOWAIT);
if (error)
goto destroy;
- *dmap = p;
+ *dmap = b;
#ifdef USB_FRAG_DMA_WORKAROUND
- memset(p->kaddr, 0, p->size);
+ memset(b->kaddr, 0, b->size);
#endif
return (USBD_NORMAL_COMPLETION);
destroy:
- bus_dmamap_destroy(tag, p->map);
+ bus_dmamap_destroy(tag, b->map);
unmap:
- bus_dmamem_unmap(tag, p->kaddr, p->size);
+ bus_dmamem_unmap(tag, b->kaddr, b->size);
free1:
- bus_dmamem_free(tag, p->segs, p->nsegs);
Home |
Main Index |
Thread Index |
Old Index