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 Provide and use DPRINTF{, N} macros in the s...



details:   https://anonhg.NetBSD.org/src/rev/98b93b56b702
branches:  nick-nhusb
changeset: 804584:98b93b56b702
user:      skrll <skrll%NetBSD.org@localhost>
date:      Sun Mar 20 08:06:15 2016 +0000

description:
Provide and use DPRINTF{,N} macros in the same way as all other HCDs.

No functional change.

diffstat:

 sys/dev/usb/ehci.c |  610 ++++++++++++++++++++++++----------------------------
 1 files changed, 287 insertions(+), 323 deletions(-)

diffs (truncated from 1764 to 300 lines):

diff -r edd5ad2a5950 -r 98b93b56b702 sys/dev/usb/ehci.c
--- a/sys/dev/usb/ehci.c        Sat Mar 19 16:08:15 2016 +0000
+++ b/sys/dev/usb/ehci.c        Sun Mar 20 08:06:15 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ehci.c,v 1.234.2.92 2016/03/17 09:04:53 skrll Exp $ */
+/*     $NetBSD: ehci.c,v 1.234.2.93 2016/03/20 08:06:15 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.92 2016/03/17 09:04:53 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.93 2016/03/20 08:06:15 skrll Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -126,6 +126,11 @@
 #endif /* EHCI_DEBUG */
 #endif /* USB_DEBUG */
 
+#define        DPRINTF(FMT,A,B,C,D)    USBHIST_LOG(ehcidebug,FMT,A,B,C,D)
+#define        DPRINTFN(N,FMT,A,B,C,D) USBHIST_LOGN(ehcidebug,N,FMT,A,B,C,D)
+#define        EHCIHIST_FUNC()         USBHIST_FUNC()
+#define        EHCIHIST_CALLED()       USBHIST_CALLED(ehcidebug)
+
 struct ehci_pipe {
        struct usbd_pipe pipe;
        int nexttoggle;
@@ -400,7 +405,7 @@
        ehci_soft_qh_t *sqh;
        u_int ncomp;
 
-       USBHIST_FUNC(); USBHIST_CALLED(ehcidebug);
+       EHCIHIST_FUNC(); EHCIHIST_CALLED();
 #ifdef EHCI_DEBUG
        theehci = sc;
 #endif
@@ -427,7 +432,7 @@
            vers >> 8, vers & 0xff);
 
        sparams = EREAD4(sc, EHCI_HCSPARAMS);
-       USBHIST_LOG(ehcidebug, "sparams=%#x", sparams, 0, 0, 0);
+       DPRINTF("sparams=%#x", sparams, 0, 0, 0);
        sc->sc_npcomp = EHCI_HCS_N_PCC(sparams);
        ncomp = EHCI_HCS_N_CC(sparams);
        if (ncomp != sc->sc_ncomp) {
@@ -452,7 +457,7 @@
        }
        sc->sc_noport = EHCI_HCS_N_PORTS(sparams);
        cparams = EREAD4(sc, EHCI_HCCPARAMS);
-       USBHIST_LOG(ehcidebug, "cparams=%#x", cparams, 0, 0, 0);
+       DPRINTF("cparams=%#x", cparams, 0, 0, 0);
        sc->sc_hasppc = EHCI_HCS_PPC(sparams);
 
        if (EHCI_HCC_64BIT(cparams)) {
@@ -465,7 +470,7 @@
        sc->sc_bus.ub_dmaflags = USBMALLOC_MULTISEG;
 
        /* Reset the controller */
-       USBHIST_LOG(ehcidebug, "resetting", 0, 0, 0, 0);
+       DPRINTF("resetting", 0, 0, 0, 0);
        EOWRITE4(sc, EHCI_USBCMD, 0);   /* Halt controller */
        usb_delay_ms(&sc->sc_bus, 1);
        EOWRITE4(sc, EHCI_USBCMD, EHCI_CMD_HCRESET);
@@ -496,7 +501,7 @@
            EHCI_FLALIGN_ALIGN, &sc->sc_fldma);
        if (err)
                return err;
-       USBHIST_LOG(ehcidebug, "flsize=%d", sc->sc_flsize, 0, 0, 0);
+       DPRINTF("flsize=%d", sc->sc_flsize, 0, 0, 0);
        sc->sc_flist = KERNADDR(&sc->sc_fldma, 0);
 
        for (i = 0; i < sc->sc_flsize; i++) {
@@ -587,9 +592,9 @@
        usb_syncmem(&sqh->dma, sqh->offs, sizeof(sqh->qh),
            BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
 #ifdef EHCI_DEBUG
-       USBHIST_LOGN(ehcidebug, 5, "--- dump start ---", 0, 0, 0, 0);
+       DPRINTFN(5, "--- dump start ---", 0, 0, 0, 0);
        ehci_dump_sqh(sqh);
-       USBHIST_LOGN(ehcidebug, 5, "--- dump end ---", 0, 0, 0, 0);
+       DPRINTFN(5, "--- dump end ---", 0, 0, 0, 0);
 #endif
 
        /* Point to async list */
@@ -621,7 +626,7 @@
        }
 
        /* Enable interrupts */
-       USBHIST_LOG(ehcidebug, "enabling interupts", 0, 0, 0, 0);
+       DPRINTF("enabling interupts", 0, 0, 0, 0);
        EOWRITE4(sc, EHCI_USBINTR, sc->sc_eintrs);
 
        return 0;
@@ -641,7 +646,7 @@
        ehci_softc_t *sc = v;
        int ret = 0;
 
-       USBHIST_FUNC(); USBHIST_CALLED(ehcidebug);
+       EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
        if (sc == NULL)
                return 0;
@@ -657,8 +662,7 @@
 
                if (intrs)
                        EOWRITE4(sc, EHCI_USBSTS, intrs); /* Acknowledge */
-               USBHIST_LOGN(ehcidebug, 16,
-                   "ignored interrupt while polling", 0, 0, 0, 0);
+               DPRINTFN(16, "ignored interrupt while polling", 0, 0, 0, 0);
                goto done;
        }
 
@@ -674,7 +678,7 @@
 {
        uint32_t intrs, eintrs;
 
-       USBHIST_FUNC(); USBHIST_CALLED(ehcidebug);
+       EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
        /* In case the interrupt occurs before initialization has completed. */
        if (sc == NULL) {
@@ -691,14 +695,14 @@
                return 0;
 
        eintrs = intrs & sc->sc_eintrs;
-       USBHIST_LOG(ehcidebug, "sc=%p intrs=%#x(%#x) eintrs=%#x",
-           sc, intrs, EOREAD4(sc, EHCI_USBSTS), eintrs);
+       DPRINTF("sc=%p intrs=%#x(%#x) eintrs=%#x", sc, intrs,
+           EOREAD4(sc, EHCI_USBSTS), eintrs);
        if (!eintrs)
                return 0;
 
        EOWRITE4(sc, EHCI_USBSTS, intrs); /* Acknowledge */
        if (eintrs & EHCI_STS_IAA) {
-               USBHIST_LOG(ehcidebug, "door bell", 0, 0, 0, 0);
+               DPRINTF("door bell", 0, 0, 0, 0);
                kpreempt_disable();
                KASSERT(sc->sc_doorbell_si != NULL);
                softint_schedule(sc->sc_doorbell_si);
@@ -706,7 +710,7 @@
                eintrs &= ~EHCI_STS_IAA;
        }
        if (eintrs & (EHCI_STS_INT | EHCI_STS_ERRINT)) {
-               USBHIST_LOG(ehcidebug, "INT=%d  ERRINT=%d",
+               DPRINTF("INT=%d  ERRINT=%d",
                    eintrs & EHCI_STS_INT ? 1 : 0,
                    eintrs & EHCI_STS_ERRINT ? 1 : 0, 0, 0);
                usb_schedsoftintr(&sc->sc_bus);
@@ -754,7 +758,7 @@
        u_char *p;
        int i, m;
 
-       USBHIST_FUNC(); USBHIST_CALLED(ehcidebug);
+       EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
        mutex_enter(&sc->sc_lock);
        xfer = sc->sc_intrxfer;
@@ -772,8 +776,7 @@
                if (EOREAD4(sc, EHCI_PORTSC(i)) & EHCI_PS_CLEAR)
                        p[i/8] |= 1 << (i%8);
                if (i % 8 == 7)
-                       USBHIST_LOG(ehcidebug, "change(%d)=0x%02x", i / 8,
-                           p[i/8], 0, 0);
+                       DPRINTF("change(%d)=0x%02x", i / 8, p[i/8], 0, 0);
        }
        xfer->ux_actlen = xfer->ux_length;
        xfer->ux_status = USBD_NORMAL_COMPLETION;
@@ -793,7 +796,7 @@
 
        KASSERT(sc->sc_bus.ub_usepolling || mutex_owned(&sc->sc_lock));
 
-       USBHIST_FUNC(); USBHIST_CALLED(ehcidebug);
+       EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
        ex_completeq_t cq;
        TAILQ_INIT(&cq);
@@ -855,7 +858,7 @@
        ehci_soft_qtd_t *sqtd, *fsqtd, *lsqtd;
        uint32_t status;
 
-       USBHIST_FUNC(); USBHIST_CALLED(ehcidebug);
+       EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
        KASSERT(sc->sc_bus.ub_usepolling || mutex_owned(&sc->sc_lock));
 
@@ -883,7 +886,7 @@
            lsqtd->offs + offsetof(ehci_qtd_t, qtd_status),
            sizeof(lsqtd->qtd.qtd_status), BUS_DMASYNC_PREREAD);
        if (status & EHCI_QTD_ACTIVE) {
-               USBHIST_LOGN(ehcidebug, 10, "active ex=%p", ex, 0, 0, 0);
+               DPRINTFN(10, "active ex=%p", ex, 0, 0, 0);
 
                /* last qTD has already been checked */
                for (sqtd = fsqtd; sqtd != lsqtd; sqtd = sqtd->nextqtd) {
@@ -917,19 +920,17 @@
                                goto done;
                        }
                }
-               USBHIST_LOGN(ehcidebug, 10, "ex=%p std=%p still active",
-                   ex, ex->ex_sqtdstart, 0, 0);
+               DPRINTFN(10, "ex=%p std=%p still active", ex, ex->ex_sqtdstart,
+                   0, 0);
 #ifdef EHCI_DEBUG
-               USBHIST_LOGN(ehcidebug, 5, "--- still active start ---", 0, 0,
-                   0, 0);
+               DPRINTFN(5, "--- still active start ---", 0, 0, 0, 0);
                ehci_dump_sqtds(ex->ex_sqtdstart);
-               USBHIST_LOGN(ehcidebug, 5, "--- still active end ---", 0, 0, 0,
-                   0);
+               DPRINTFN(5, "--- still active end ---", 0, 0, 0, 0);
 #endif
                return;
        }
  done:
-       USBHIST_LOGN(ehcidebug, 10, "ex=%p done", ex, 0, 0, 0);
+       DPRINTFN(10, "ex=%p done", ex, 0, 0, 0);
        callout_stop(&ex->ex_xfer.ux_callout);
        ehci_idone(ex, cq);
 }
@@ -940,7 +941,7 @@
        ehci_soft_itd_t *itd;
        int i;
 
-       USBHIST_FUNC(); USBHIST_CALLED(ehcidebug);
+       EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
        KASSERT(mutex_owned(&sc->sc_lock));
 
@@ -972,11 +973,10 @@
        usb_syncmem(&itd->dma, itd->offs + offsetof(ehci_itd_t, itd_ctl),
            sizeof(itd->itd.itd_ctl), BUS_DMASYNC_PREREAD);
 
-       USBHIST_LOGN(ehcidebug, 10, "ex %p itd %p still active", ex,
-           ex->ex_itdstart, 0, 0);
+       DPRINTFN(10, "ex %p itd %p still active", ex, ex->ex_itdstart, 0, 0);
        return;
 done:
-       USBHIST_LOG(ehcidebug, "ex %p done", ex, 0, 0, 0);
+       DPRINTF("ex %p done", ex, 0, 0, 0);
        callout_stop(&ex->ex_xfer.ux_callout);
        ehci_idone(ex, cq);
 }
@@ -986,7 +986,7 @@
 {
        ehci_soft_sitd_t *sitd;
 
-       USBHIST_FUNC(); USBHIST_CALLED(ehcidebug);
+       EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
        KASSERT(mutex_owned(&sc->sc_lock));
 
@@ -1014,7 +1014,7 @@
        if (active)
                return;
 
-       USBHIST_LOGN(ehcidebug, 10, "ex=%p done", ex, 0, 0, 0);
+       DPRINTFN(10, "ex=%p done", ex, 0, 0, 0);
        callout_stop(&(ex->ex_xfer.ux_callout));
        ehci_idone(ex, cq);
 }
@@ -1030,24 +1030,24 @@
        uint32_t status = 0, nstatus = 0;
        int actlen = 0;
 
-       USBHIST_FUNC(); USBHIST_CALLED(ehcidebug);
+       EHCIHIST_FUNC(); EHCIHIST_CALLED();
 
        KASSERT(sc->sc_bus.ub_usepolling || mutex_owned(&sc->sc_lock));
 
-       USBHIST_LOG(ehcidebug, "ex=%p", ex, 0, 0, 0);
+       DPRINTF("ex=%p", ex, 0, 0, 0);
 
        if (xfer->ux_status == USBD_CANCELLED ||
            xfer->ux_status == USBD_TIMEOUT) {
-               USBHIST_LOG(ehcidebug, "aborted xfer=%p", xfer, 0, 0, 0);
+               DPRINTF("aborted xfer=%p", xfer, 0, 0, 0);
                return;
        }
 
 #ifdef DIAGNOSTIC
 #ifdef EHCI_DEBUG
        if (ex->ex_isdone) {
-               USBHIST_LOGN(ehcidebug, 5, "--- dump start ---", 0, 0, 0, 0);
+               DPRINTFN(5, "--- dump start ---", 0, 0, 0, 0);
                ehci_dump_exfer(ex);
-               USBHIST_LOGN(ehcidebug, 5, "--- dump end ---", 0, 0, 0, 0);
+               DPRINTFN(5, "--- dump end ---", 0, 0, 0, 0);
        }
 #endif
        KASSERTMSG(!ex->ex_isdone, "xfer %p type %d status %d", xfer,
@@ -1055,7 +1055,7 @@
        ex->ex_isdone = true;
 #endif
 
-       USBHIST_LOG(ehcidebug, "xfer=%p, pipe=%p ready", xfer, epipe, 0, 0);
+       DPRINTF("xfer=%p, pipe=%p ready", xfer, epipe, 0, 0);
 



Home | Main Index | Thread Index | Old Index