Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb various debug updates for some usb drivers
details: https://anonhg.NetBSD.org/src/rev/e3c4f8cc8808
branches: trunk
changeset: 378112:e3c4f8cc8808
user: mrg <mrg%NetBSD.org@localhost>
date: Thu Jul 20 20:00:34 2023 +0000
description:
various debug updates for some usb drivers
- several new *_DEBUG_DEFAULT options that allow usb debug values to
be set to a default that is non-zero:
EHCI_DEBUG_DEFAULT, UGEN_DEBUG_DEFAULT, URTWN_DEBUG_DEFAULT,
UMS_DEBUG_DEFAULT, and USB_DEBUG_DEFAULT
- ugen debug uses fewer usbhist lines for the same info
- ums.c converted from printf() to usbhist
diffstat:
sys/dev/usb/ehci.c | 11 +++-
sys/dev/usb/files.usb | 7 ++-
sys/dev/usb/if_urtwn.c | 12 ++++-
sys/dev/usb/ugen.c | 110 +++++++++++++++++++++++++++---------------------
sys/dev/usb/ums.c | 68 +++++++++++++++++++++++++----
sys/dev/usb/usb.c | 10 +++-
6 files changed, 148 insertions(+), 70 deletions(-)
diffs (truncated from 540 to 300 lines):
diff -r ce24a2f3c502 -r e3c4f8cc8808 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c Thu Jul 20 20:00:07 2023 +0000
+++ b/sys/dev/usb/ehci.c Thu Jul 20 20:00:34 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ehci.c,v 1.315 2022/12/13 21:29:04 jakllsch Exp $ */
+/* $NetBSD: ehci.c,v 1.316 2023/07/20 20:00:34 mrg Exp $ */
/*
* Copyright (c) 2004-2012,2016,2020 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.315 2022/12/13 21:29:04 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.316 2023/07/20 20:00:34 mrg Exp $");
#include "ohci.h"
#include "uhci.h"
@@ -95,7 +95,12 @@
#ifndef EHCI_DEBUG
#define ehcidebug 0
#else
-static int ehcidebug = 0;
+
+#ifndef EHCI_DEBUG_DEFAULT
+#define EHCI_DEBUG_DEFAULT 0
+#endif
+
+static int ehcidebug = EHCI_DEBUG_DEFAULT;
SYSCTL_SETUP(sysctl_hw_ehci_setup, "sysctl hw.ehci setup")
{
diff -r ce24a2f3c502 -r e3c4f8cc8808 sys/dev/usb/files.usb
--- a/sys/dev/usb/files.usb Thu Jul 20 20:00:07 2023 +0000
+++ b/sys/dev/usb/files.usb Thu Jul 20 20:00:34 2023 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.usb,v 1.178 2022/06/30 06:30:44 macallan Exp $
+# $NetBSD: files.usb,v 1.179 2023/07/20 20:00:34 mrg Exp $
#
# Config file and device description for machine-independent USB code.
# Included by ports that need it. Ports that use it must provide
@@ -6,9 +6,11 @@
defflag USBVERBOSE
defflag opt_usb.h USB_FRAG_DMA_WORKAROUND
+defparam opt_usb.h USB_DEBUG_DEFAULT: USB_DEBUG
# HC controllers
defflag opt_usb.h EHCI_DEBUG: USB_DEBUG
+defparam opt_usb.h EHCI_DEBUG_DEFAULT: EHCI_DEBUG
defflag opt_usb.h OHCI_DEBUG: USB_DEBUG
defflag opt_usb.h UHCI_DEBUG: USB_DEBUG
defflag opt_usb.h DWC2_DEBUG: USB_DEBUG
@@ -46,6 +48,7 @@ defflag opt_usb.h UDSBR_DEBUG: USB_DEBUG
defflag opt_usb.h UFTDI_DEBUG: USB_DEBUG
defflag opt_usb.h UGENSA_DEBUG: USB_DEBUG
defflag opt_usb.h UGEN_DEBUG: USB_DEBUG
+defparam opt_usb.h UGEN_DEBUG_DEFAULT: UGEN_DEBUG
defflag opt_usb.h UHIDEV_DEBUG: USB_DEBUG
defflag opt_usb.h UHID_DEBUG: USB_DEBUG
defflag opt_usb.h UHMODEM_DEBUG: USB_DEBUG
@@ -62,6 +65,7 @@ defflag opt_usb.h UMIDIQUIRK_DEBUG: USB_
defflag opt_usb.h UMIDI_DEBUG: USB_DEBUG
defflag opt_usb.h UMODEM_DEBUG: USB_DEBUG
defflag opt_usb.h UMS_DEBUG: USB_DEBUG
+defparam opt_usb.h UMS_DEBUG_DEFAULT: UMS_DEBUG
defflag opt_usb.h UPGT_DEBUG: USB_DEBUG
defflag opt_usb.h UPLCOM_DEBUG: USB_DEBUG
defflag opt_usb.h UPL_DEBUG: USB_DEBUG
@@ -69,6 +73,7 @@ defflag opt_usb.h URAL_DEBUG: USB_DEBUG
defflag opt_usb.h URL_DEBUG: USB_DEBUG
defflag opt_usb.h URNDIS_DEBUG: USB_DEBUG
defflag opt_usb.h URTWN_DEBUG: USB_DEBUG
+defparam opt_usb.h URTWN_DEBUG_DEFAULT: URTWN_DEBUG
defflag opt_usb.h URTW_DEBUG: USB_DEBUG
defflag opt_usb.h USBNET_DEBUG: USB_DEBUG
defflag opt_usb.h USCANNER_DEBUG: USB_DEBUG
diff -r ce24a2f3c502 -r e3c4f8cc8808 sys/dev/usb/if_urtwn.c
--- a/sys/dev/usb/if_urtwn.c Thu Jul 20 20:00:07 2023 +0000
+++ b/sys/dev/usb/if_urtwn.c Thu Jul 20 20:00:34 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_urtwn.c,v 1.105 2022/07/31 12:59:26 mlelstv Exp $ */
+/* $NetBSD: if_urtwn.c,v 1.106 2023/07/20 20:00:34 mrg Exp $ */
/* $OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $ */
/*-
@@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.105 2022/07/31 12:59:26 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.106 2023/07/20 20:00:34 mrg Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -95,7 +95,13 @@
#define DBG_RF __BIT(5)
#define DBG_REG __BIT(6)
#define DBG_ALL 0xffffffffU
-u_int urtwn_debug = 0;
+
+#ifndef URTWN_DEBUG_DEFAULT
+#define URTWN_DEBUG_DEFAULT 0
+#endif
+
+u_int urtwn_debug = URTWN_DEBUG_DEFAULT;
+
#define DPRINTFN(n, fmt, a, b, c, d) do { \
if (urtwn_debug & (n)) { \
KERNHIST_LOG(usbhist, fmt, a, b, c, d); \
diff -r ce24a2f3c502 -r e3c4f8cc8808 sys/dev/usb/ugen.c
--- a/sys/dev/usb/ugen.c Thu Jul 20 20:00:07 2023 +0000
+++ b/sys/dev/usb/ugen.c Thu Jul 20 20:00:34 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ugen.c,v 1.171 2022/10/23 11:06:37 riastradh Exp $ */
+/* $NetBSD: ugen.c,v 1.172 2023/07/20 20:00:34 mrg Exp $ */
/*
* Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.171 2022/10/23 11:06:37 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.172 2023/07/20 20:00:34 mrg Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -72,7 +72,12 @@
#ifndef UGEN_DEBUG
#define ugendebug 0
#else
-int ugendebug = 0;
+
+#ifndef UGEN_DEBUG_DEFAULT
+#define UGEN_DEBUG_DEFAULT 0
+#endif
+
+int ugendebug = UGEN_DEBUG_DEFAULT;
SYSCTL_SETUP(sysctl_hw_ugen_setup, "sysctl hw.ugen setup")
{
@@ -108,6 +113,10 @@ fail:
#define DPRINTFN(N,FMT,A,B,C,D) USBHIST_LOGN(ugendebug,N,FMT,A,B,C,D)
#define UGENHIST_FUNC() USBHIST_FUNC()
#define UGENHIST_CALLED(name) USBHIST_CALLED(ugendebug)
+#define UGENHIST_CALLARGS(FMT,A,B,C,D) \
+ USBHIST_CALLARGS(ugendebug,FMT,A,B,C,D)
+#define UGENHIST_CALLARGSN(N,FMT,A,B,C,D) \
+ USBHIST_CALLARGSN(ugendebug,N,FMT,A,B,C,D)
#define UGEN_CHUNK 128 /* chunk size for read */
#define UGEN_IBSIZE 1020 /* buffer size */
@@ -471,10 +480,9 @@ ugen_set_config(struct ugen_softc *sc, i
usbd_status err;
int dir;
- UGENHIST_FUNC(); UGENHIST_CALLED();
-
- DPRINTFN(1, "ugen%jd: to configno %jd, sc=%jx",
- device_unit(sc->sc_dev), configno, (uintptr_t)sc, 0);
+ UGENHIST_FUNC();
+ UGENHIST_CALLARGSN(1, "ugen%jd: to configno %jd, sc=%jx",
+ device_unit(sc->sc_dev), configno, (uintptr_t)sc, 0);
KASSERT(KERNEL_LOCKED_P()); /* sc_is_open */
@@ -564,16 +572,15 @@ ugenopen(dev_t dev, int flag, int mode,
int error;
int opened = 0;
- UGENHIST_FUNC(); UGENHIST_CALLED();
+ UGENHIST_FUNC();
+ UGENHIST_CALLARGS("flag=%jd, mode=%jd, unit=%jd endpt=%jd",
+ flag, mode, unit, endpt);
KASSERT(KERNEL_LOCKED_P()); /* sc_is_open */
if ((sc = ugenif_acquire(unit)) == NULL)
return ENXIO;
- DPRINTFN(5, "flag=%jd, mode=%jd, unit=%jd endpt=%jd",
- flag, mode, unit, endpt);
-
/* The control endpoint allows multiple opens. */
if (endpt == USB_CONTROL_ENDPOINT) {
opened = sc->sc_is_open[USB_CONTROL_ENDPOINT] = 1;
@@ -735,7 +742,8 @@ ugen_do_close(struct ugen_softc *sc, int
int dir;
int i;
- UGENHIST_FUNC(); UGENHIST_CALLED();
+ UGENHIST_FUNC();
+ UGENHIST_CALLARGS("flag=%jd endpt=%jd", flag, endpt, 0, 0);
KASSERT(KERNEL_LOCKED_P()); /* sc_is_open */
@@ -809,10 +817,9 @@ ugenclose(dev_t dev, int flag, int mode,
int endpt = UGENENDPOINT(dev);
struct ugen_softc *sc;
- UGENHIST_FUNC(); UGENHIST_CALLED();
-
- DPRINTFN(5, "flag=%jd, mode=%jd, unit=%jd, endpt=%jd",
- flag, mode, UGENUNIT(dev), endpt);
+ UGENHIST_FUNC();
+ UGENHIST_CALLARGS("flag=%jd, mode=%jd, unit=%jd, endpt=%jd",
+ flag, mode, UGENUNIT(dev), endpt);
KASSERT(KERNEL_LOCKED_P()); /* ugen_do_close */
@@ -837,9 +844,8 @@ ugen_do_read(struct ugen_softc *sc, int
usbd_status err;
int error = 0;
- UGENHIST_FUNC(); UGENHIST_CALLED();
-
- DPRINTFN(5, "ugen%d: %jd", device_unit(sc->sc_dev), endpt, 0, 0);
+ UGENHIST_FUNC();
+ UGENHIST_CALLARGS("ugen%d: %jd", device_unit(sc->sc_dev), endpt, 0, 0);
if (endpt == USB_CONTROL_ENDPOINT)
return ENODEV;
@@ -1050,9 +1056,9 @@ ugen_do_write(struct ugen_softc *sc, int
struct usbd_xfer *xfer;
usbd_status err;
- UGENHIST_FUNC(); UGENHIST_CALLED();
-
- DPRINTFN(5, "ugen%jd: %jd", device_unit(sc->sc_dev), endpt, 0, 0);
+ UGENHIST_FUNC();
+ UGENHIST_CALLARGSN(5, "ugen%jd: %jd",
+ device_unit(sc->sc_dev), endpt, 0, 0);
if (endpt == USB_CONTROL_ENDPOINT)
return ENODEV;
@@ -1229,9 +1235,8 @@ ugen_detach(device_t self, int flags)
int i, dir;
int maj, mn;
- UGENHIST_FUNC(); UGENHIST_CALLED();
-
- DPRINTF("sc=%ju flags=%ju", (uintptr_t)sc, flags, 0, 0);
+ UGENHIST_FUNC();
+ UGENHIST_CALLARGS("sc=%ju flags=%ju", (uintptr_t)sc, flags, 0, 0);
KASSERT(KERNEL_LOCKED_P()); /* sc_is_open */
@@ -1325,7 +1330,8 @@ ugenintr(struct usbd_xfer *xfer, void *a
uint32_t count;
u_char *ibuf;
- UGENHIST_FUNC(); UGENHIST_CALLED();
+ UGENHIST_FUNC();
+ UGENHIST_CALLARGS("xfer %jx status %d", (uintptr_t)xfer, status, 0, 0);
if (status == USBD_CANCELLED)
return;
@@ -1362,7 +1368,8 @@ ugen_isoc_rintr(struct usbd_xfer *xfer,
uint32_t count, n;
int i, isize;
- UGENHIST_FUNC(); UGENHIST_CALLED();
+ UGENHIST_FUNC();
+ UGENHIST_CALLARGS("xfer=%jx status=%jd", (uintptr_t)xfer, status, 0, 0);
/* Return if we are aborting. */
if (status == USBD_CANCELLED)
@@ -1423,7 +1430,8 @@ ugen_bulkra_intr(struct usbd_xfer *xfer,
char const *tbuf;
usbd_status err;
- UGENHIST_FUNC(); UGENHIST_CALLED();
+ UGENHIST_FUNC();
+ UGENHIST_CALLARGS("xfer=%jx status=%jd", (uintptr_t)xfer, status, 0, 0);
/* Return if we are aborting. */
if (status == USBD_CANCELLED)
@@ -1491,7 +1499,8 @@ ugen_bulkwb_intr(struct usbd_xfer *xfer,
char *tbuf;
usbd_status err;
- UGENHIST_FUNC(); UGENHIST_CALLED();
+ UGENHIST_FUNC();
+ UGENHIST_CALLARGS("xfer=%jx status=%jd", (uintptr_t)xfer, status, 0, 0);
/* Return if we are aborting. */
if (status == USBD_CANCELLED)
@@ -1558,9 +1567,8 @@ ugen_set_interface(struct ugen_softc *sc
uint8_t niface, nendpt, endptno, endpt;
int dir;
- UGENHIST_FUNC(); UGENHIST_CALLED();
-
- DPRINTFN(15, "%d %d", ifaceidx, altno, 0, 0);
+ UGENHIST_FUNC();
+ UGENHIST_CALLARGSN(15, "ifaceidx=%jd altno=%jd", ifaceidx, altno, 0, 0);
err = usbd_interface_count(sc->sc_udev, &niface);
if (err)
Home |
Main Index |
Thread Index |
Old Index