Module Name: src
Committed By: skrll
Date: Sat Jun 18 19:30:24 UTC 2016
Modified Files:
src/sys/dev/ic: sl811hs.c
Log Message:
Debug updates to work with vmstat(1) -u
To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/ic/sl811hs.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/ic/sl811hs.c
diff -u src/sys/dev/ic/sl811hs.c:1.78 src/sys/dev/ic/sl811hs.c:1.79
--- src/sys/dev/ic/sl811hs.c:1.78 Fri Jun 17 16:07:40 2016
+++ src/sys/dev/ic/sl811hs.c Sat Jun 18 19:30:24 2016
@@ -1,4 +1,4 @@
-/* $NetBSD: sl811hs.c,v 1.78 2016/06/17 16:07:40 skrll Exp $ */
+/* $NetBSD: sl811hs.c,v 1.79 2016/06/18 19:30:24 skrll Exp $ */
/*
* Not (c) 2007 Matthew Orgass
@@ -68,7 +68,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.78 2016/06/17 16:07:40 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sl811hs.c,v 1.79 2016/06/18 19:30:24 skrll Exp $");
#ifdef _KERNEL_OPT
#include "opt_slhci.h"
@@ -160,18 +160,59 @@ static const uint8_t slhci_tregs[2][4] =
#ifdef SLHCI_DEBUG
#define SLHCI_MEM_ACCOUNTING
-static const char *
-pnames(int ptype)
-{
- static const char * const names[] = { "ROOT Ctrl", "ROOT Intr",
- "Control (setup)", "Control (data)", "Control (status)",
- "Interrupt", "Bulk", "BAD PTYPE" };
-
- KASSERT(sizeof(names) / sizeof(names[0]) == PT_MAX + 2);
- if (ptype > PT_MAX)
- ptype = PT_MAX + 1;
- return names[ptype];
-}
+
+#define DDOLOGCTRL(x) do { \
+ DDOLOG("CTRL suspend=%d", !!((x) & SL11_CTRL_SUSPEND), 0, 0, 0); \
+ DDOLOG("CTRL ls =%d jk =%d reset =%d sof =%d", \
+ !!((x) & SL11_CTRL_LOWSPEED), !!((x) & SL11_CTRL_JKSTATE), \
+ !!((x) & SL11_CTRL_RESETENGINE), !!((x) & SL11_CTRL_ENABLESOF));\
+} while (0)
+
+#define DDOLOGISR(r) do { \
+ DDOLOG("ISR data =%d det/res=%d insert =%d sof =%d", \
+ !!((r) & SL11_ISR_DATA), !!((r) & SL11_ISR_RESUME), \
+ !!((r) & SL11_ISR_INSERT), !!!!((r) & SL11_ISR_SOF)); \
+ DDOLOG("ISR babble =%d usbb =%d usba =%d", \
+ !!((r) & SL11_ISR_BABBLE), !!((r) & SL11_ISR_USBB), \
+ !!((r) & SL11_ISR_USBA), 0); \
+} while (0)
+
+#define DDOLOGIER(r) do { \
+ DDOLOG("IER det/res=%d insert =%d sof =%d", \
+ !!((r) & SL11_IER_RESUME), \
+ !!((r) & SL11_IER_INSERT), !!!!((r) & SL11_IER_SOF), 0); \
+ DDOLOG("IER babble =%d usbb =%d usba =%d", \
+ !!((r) & SL11_IER_BABBLE), !!((r) & SL11_IER_USBB), \
+ !!((r) & SL11_IER_USBA), 0); \
+} while (0)
+
+#define DDLOGSTATUS(s) do { \
+ DDOLOG("STAT stall =%d nak =%d overflow =%d setup =%d", \
+ !!((s) & SL11_EPSTAT_STALL), !!((s) & SL11_EPSTAT_NAK), \
+ !!((s) & SL11_EPSTAT_OVERFLOW), !!((s) & SL11_EPSTAT_SETUP)); \
+ DDOLOG("STAT sequence=%d timeout =%d error =%d ack =%d", \
+ !!((s) & SL11_EPSTAT_SEQUENCE), !!((s) & SL11_EPSTAT_TIMEOUT), \
+ !!((s) & SL11_EPSTAT_ERROR), !!((s) & SL11_EPSTAT_ACK)); \
+} while (0)
+
+#define DDLOGEPCTRL(r) do { \
+ DDOLOG("CTRL preamble=%d toggle =%d sof =%d iso =%d", \
+ !!((r) & SL11_EPCTRL_PREAMBLE), !!((r) & SL11_EPCTRL_DATATOGGLE),\
+ !!((r) & SL11_EPCTRL_SOF), !!((r) & SL11_EPCTRL_ISO)); \
+ DDOLOG("CTRL out =%d enable =%d arm =%d", \
+ !!((r) & SL11_EPCTRL_DIRECTION), \
+ !!((r) & SL11_EPCTRL_ENABLE), !!((r) & SL11_EPCTRL_ARM), 0); \
+} while (0)
+
+#define DDLOGEPSTAT(r) do { \
+ DDOLOG("STAT stall =%d nak =%d overflow =%d setup =%d", \
+ !!((r) & SL11_EPSTAT_STALL), !!((r) & SL11_EPSTAT_NAK), \
+ !!((r) & SL11_EPSTAT_OVERFLOW), !!((r) & SL11_EPSTAT_SETUP)); \
+ DDOLOG("STAT sequence=%d timeout =%d error =%d ack =%d", \
+ !!((r) & SL11_EPSTAT_SEQUENCE), !!((r) & SL11_EPSTAT_TIMEOUT), \
+ !!((r) & SL11_EPSTAT_ERROR), !!((r) & SL11_EPSTAT_ACK)); \
+} while (0)
+
#endif
/*
@@ -530,7 +571,6 @@ static void slhci_get_status(struct slhc
#ifdef SLHCI_DEBUG
void slhci_log_buffer(struct usbd_xfer *);
void slhci_log_req(usb_device_request_t *);
-void slhci_log_req_hub(usb_device_request_t *);
void slhci_log_dumpreg(void);
void slhci_log_xfer(struct usbd_xfer *);
void slhci_log_spipe(struct slhci_pipe *);
@@ -590,21 +630,7 @@ struct slhci_softc *ssc;
#define DDOLOG(f, a, b, c, d) do { KERNHIST_LOG(usbhist, f, a, b, c, d); \
} while (/*CONSTCOND*/0)
#define DLOG(x, f, a, b, c, d) SLHCI_DEXEC(x, DDOLOG(f, a, b, c, d))
-/*
- * DLOGFLAG8 is a macro not a function so that flag name expressions are not
- * evaluated unless the flag bit is set (which could save a register read).
- * x is debug mask, y is flag identifier, z is flag variable,
- * a-h are flag names (must evaluate to string constants, msb first).
- */
-#define DDOLOGFLAG8(y, z, a, b, c, d, e, f, g, h) do { uint8_t _DLF8 = (z); \
- if (_DLF8 & 0xf0) KERNHIST_LOG(usbhist, y " %s %s %s %s", _DLF8 & 0x80 ? \
- (a) : "", _DLF8 & 0x40 ? (b) : "", _DLF8 & 0x20 ? (c) : "", _DLF8 & 0x10 ? \
- (d) : ""); if (_DLF8 & 0x0f) KERNHIST_LOG(usbhist, y " %s %s %s %s", \
- _DLF8 & 0x08 ? (e) : "", _DLF8 & 0x04 ? (f) : "", _DLF8 & 0x02 ? (g) : "", \
- _DLF8 & 0x01 ? (h) : ""); \
-} while (/*CONSTCOND*/ 0)
-#define DLOGFLAG8(x, y, z, a, b, c, d, e, f, g, h) \
- SLHCI_DEXEC(x, DDOLOGFLAG8(y, z, a, b, c, d, e, f, g, h))
+
/*
* DDOLOGBUF logs a buffer up to 8 bytes at a time. No identifier so that we
* can make it a real function.
@@ -647,8 +673,6 @@ DDOLOGBUF(uint8_t *buf, unsigned int len
#define SLHCI_DEXEC(x, y) ((void)0)
#define DDOLOG(f, a, b, c, d) ((void)0)
#define DLOG(x, f, a, b, c, d) ((void)0)
-#define DDOLOGFLAG8(y, z, a, b, c, d, e, f, g, h) ((void)0)
-#define DLOGFLAG8(x, y, z, a, b, c, d, e, f, g, h) ((void)0)
#define DDOLOGBUF(b, l) ((void)0)
#define DLOGBUF(x, b, l) ((void)0)
#endif /* SLHCI_DEBUG */
@@ -658,8 +682,6 @@ DDOLOGBUF(uint8_t *buf, unsigned int len
if (!(exp)) { \
printf("%s: assertion %s failed line %u function %s!" \
" halted\n", SC_NAME(sc), #exp, __LINE__, __func__);\
- DDOLOG("%s: assertion %s failed line %u function %s!" \
- " halted\n", SC_NAME(sc), #exp, __LINE__, __func__);\
slhci_halt(sc, spipe, xfer); \
ext; \
} \
@@ -668,8 +690,6 @@ DDOLOGBUF(uint8_t *buf, unsigned int len
if (!(exp)) { \
printf("%s: assertion %s failed line %u function %s!" \
" halted\n", SC_NAME(sc), #exp, __LINE__, __func__); \
- DDOLOG("%s: assertion %s failed line %u function %s!" \
- " halted\n", SC_NAME(sc), #exp, __LINE__, __func__); \
slhci_lock_call(sc, &slhci_halt, spipe, xfer); \
ext; \
} \
@@ -793,8 +813,8 @@ slhci_freex(struct usbd_bus *bus, struct
struct slhci_softc *sc = SLHCI_BUS2SC(bus);
printf("%s: slhci_freex: xfer=%p not busy, %#08x halted\n",
SC_NAME(sc), xfer, xfer->ux_state);
- DDOLOG("%s: slhci_freex: xfer=%p not busy, %#08x halted\n",
- SC_NAME(sc), xfer, xfer->ux_state, 0);
+ DDOLOG("xfer=%p not busy, %#08x halted\n", xfer,
+ xfer->ux_state, 0, 0);
slhci_lock_call(sc, &slhci_halt, NULL, NULL);
return;
}
@@ -819,8 +839,8 @@ slhci_transfer(struct usbd_xfer *xfer)
struct slhci_softc *sc = SLHCI_XFER2SC(xfer);
usbd_status error;
- DLOG(D_TRACE, "%s transfer xfer %p spipe %p ",
- pnames(SLHCI_XFER_TYPE(xfer)), xfer, xfer->ux_pipe,0);
+ DLOG(D_TRACE, "transfer type %d xfer %p spipe %p ",
+ SLHCI_XFER_TYPE(xfer), xfer, xfer->ux_pipe, 0);
/* Insert last in queue */
mutex_enter(&sc->sc_lock);
@@ -862,8 +882,8 @@ slhci_start(struct usbd_xfer *xfer)
max_packet = UGETW(ed->wMaxPacketSize);
- DLOG(D_TRACE, "%s start xfer %p spipe %p length %d",
- pnames(spipe->ptype), xfer, spipe, xfer->ux_length);
+ DLOG(D_TRACE, "transfer type %d start xfer %p spipe %p length %d",
+ spipe->ptype, xfer, spipe, xfer->ux_length);
/* root transfers use slhci_root_start */
@@ -898,8 +918,7 @@ slhci_start(struct usbd_xfer *xfer)
xfer->ux_length > spipe->tregs[LEN])) {
printf("%s: Long INTR transfer not supported!\n",
SC_NAME(sc));
- DDOLOG("%s: Long INTR transfer not supported!\n",
- SC_NAME(sc), 0,0,0);
+ DDOLOG("Long INTR transfer not supported!", 0, 0, 0, 0);
xfer->ux_status = USBD_INVAL;
}
#endif
@@ -995,7 +1014,7 @@ slhci_root_start(struct usbd_xfer *xfer)
LK_SLASSERT(spipe != NULL && xfer != NULL, sc, spipe, xfer, return
USBD_CANCELLED);
- DLOG(D_TRACE, "%s start", pnames(SLHCI_XFER_TYPE(xfer)), 0,0,0);
+ DLOG(D_TRACE, "transfer type %d start", SLHCI_XFER_TYPE(xfer), 0, 0, 0);
KASSERT(spipe->ptype == PT_ROOT_INTR);
@@ -1076,8 +1095,7 @@ slhci_open(struct usbd_pipe *pipe)
break;
default:
printf("%s: Invalid root endpoint!\n", SC_NAME(sc));
- DDOLOG("%s: Invalid root endpoint!\n", SC_NAME(sc),
- 0,0,0);
+ DDOLOG("Invalid root endpoint", 0, 0, 0, 0);
return USBD_INVAL;
}
return USBD_NORMAL_COMPLETION;
@@ -1101,7 +1119,7 @@ slhci_open(struct usbd_pipe *pipe)
break;
}
- DLOG(D_MSG, "open pipe %s interval %d", pnames(spipe->ptype),
+ DLOG(D_MSG, "open pipe type %d interval %d", spipe->ptype,
pipe->up_interval, 0,0);
pipe->up_methods = __UNCONST(&slhci_pipe_methods);
@@ -1276,8 +1294,8 @@ slhci_detach(struct slhci_softc *sc, int
if (sc->sc_mem_use) {
printf("%s: Memory still in use after detach! mem_use (count)"
" = %d\n", SC_NAME(sc), sc->sc_mem_use);
- DDOLOG("%s: Memory still in use after detach! mem_use (count)"
- " = %d\n", SC_NAME(sc), sc->sc_mem_use, 0,0);
+ DDOLOG("Memory still in use after detach! mem_use (count)"
+ " = %d", sc->sc_mem_use, 0, 0, 0);
}
#endif
@@ -1313,8 +1331,8 @@ slhci_abort(struct usbd_xfer *xfer)
sc = SLHCI_XFER2SC(xfer);
KASSERT(mutex_owned(&sc->sc_lock));
- DLOG(D_TRACE, "%s abort xfer %p spipe %p spipe->xfer %p",
- pnames(spipe->ptype), xfer, spipe, spipe->xfer);
+ DLOG(D_TRACE, "transfer type %d abort xfer %p spipe %p spipe->xfer %p",
+ spipe->ptype, xfer, spipe, spipe->xfer);
slhci_lock_call(sc, &slhci_do_abort, spipe, xfer);
@@ -1333,8 +1351,8 @@ slhci_close(struct usbd_pipe *pipe)
sc = SLHCI_PIPE2SC(pipe);
spipe = SLHCI_PIPE2SPIPE(pipe);
- DLOG(D_TRACE, "%s close spipe %p spipe->xfer %p",
- pnames(spipe->ptype), spipe, spipe->xfer, 0);
+ DLOG(D_TRACE, "transfer type %d close spipe %p spipe->xfer %p",
+ spipe->ptype, spipe, spipe->xfer, 0);
slhci_lock_call(sc, &slhci_close_pipe, spipe, NULL);
}
@@ -1347,7 +1365,7 @@ slhci_clear_toggle(struct usbd_pipe *pip
spipe = SLHCI_PIPE2SPIPE(pipe);
- DLOG(D_TRACE, "%s toggle spipe %p", pnames(spipe->ptype),
+ DLOG(D_TRACE, "transfer type %d toggle spipe %p", spipe->ptype,
spipe,0,0);
spipe->pflags &= ~PF_TOGGLE;
@@ -1359,8 +1377,8 @@ slhci_clear_toggle(struct usbd_pipe *pip
printf("%s: Clear toggle on transfer in progress! halted\n",
SC_NAME(sc));
- DDOLOG("%s: Clear toggle on transfer in progress! halted\n",
- SC_NAME(sc), 0,0,0);
+ DDOLOG("Clear toggle on transfer in progress! halted",
+ 0, 0, 0, 0);
slhci_halt(sc, NULL, NULL);
}
#endif
@@ -1549,6 +1567,7 @@ waitcheck:
slhci_dotransfer(sc);
goto waitcheck;
}
+ DLOG(D_INTR, "... done", 0, 0, 0, 0);
}
/* End lock entry functions. Start in lock function. */
@@ -1750,10 +1769,9 @@ slhci_dointr(struct slhci_softc *sc)
e = slhci_read(sc, SL11_IER);
f = slhci_read(sc, SL11_CTRL);
- DDOLOG("Flags=%#x IER=%#x ISR=%#x", t->flags, e, r, 0);
- DDOLOGFLAG8("Status=", r, "D+", (f & SL11_CTRL_SUSPEND) ?
- "RESUME" : "NODEV", "INSERT", "SOF", "res", "BABBLE",
- "USBB", "USBA");
+ DDOLOG("Flags=%#x IER=%#x ISR=%#x CTRL=%#x", t->flags, e, r, f);
+ DDOLOGCTRL(f);
+ DDOLOGISR(r);
}
#endif
@@ -1766,8 +1784,7 @@ slhci_dointr(struct slhci_softc *sc)
if (sc->sc_ier != slhci_read(sc, SL11_IER)) {
printf("%s: IER value corrupted! halted\n",
SC_NAME(sc));
- DDOLOG("%s: IER value corrupted! halted\n",
- SC_NAME(sc), 0,0,0);
+ DDOLOG("IER value corrupted! halted", 0, 0, 0, 0);
slhci_halt(sc, NULL, NULL);
return 1;
}
@@ -1810,8 +1827,8 @@ slhci_dointr(struct slhci_softc *sc)
(F_AINPROG|F_BINPROG))) {
printf("%s: Missed transfer completion. halted\n",
SC_NAME(sc));
- DDOLOG("%s: Missed transfer completion. halted\n",
- SC_NAME(sc), 0,0,0);
+ DDOLOG("Missed transfer completion. halted", 0, 0, 0,
+ 0);
slhci_halt(sc, NULL, NULL);
return 1;
} else if (t->flags & F_SOFCHECK1) {
@@ -1882,8 +1899,8 @@ slhci_dointr(struct slhci_softc *sc)
if (!(t->flags & (ab ? F_BINPROG : F_AINPROG))) {
printf("%s: %s done but not in progress! halted\n",
SC_NAME(sc), ab ? "B" : "A");
- DDOLOG("%s: %s done but not in progress! halted\n",
- SC_NAME(sc), ab ? "B" : "A", 0,0);
+ DDOLOG("AB=%d done but not in progress! halted", ab,
+ 0, 0, 0);
slhci_halt(sc, NULL, NULL);
return 1;
}
@@ -1921,9 +1938,8 @@ slhci_abdone(struct slhci_softc *sc, int
DLOG(D_TRACE, "ABDONE flags %#x", t->flags, 0,0,0);
- DLOG(D_MSG, "DONE %s spipe %p len %d xfer %p", ab ? "B" : "A",
- t->spipe[ab], t->len[ab], t->spipe[ab] ?
- t->spipe[ab]->xfer : NULL);
+ DLOG(D_MSG, "DONE AB=%d spipe %p len %d xfer %p", ab, t->spipe[ab],
+ t->len[ab], t->spipe[ab] ? t->spipe[ab]->xfer : NULL);
spipe = t->spipe[ab];
@@ -1999,11 +2015,11 @@ slhci_abdone(struct slhci_softc *sc, int
}
#ifdef SLHCI_DEBUG
- if (slhcidebug & SLHCI_D_NAK || (status & SL11_EPSTAT_ERRBITS) !=
- SL11_EPSTAT_NAK)
- DLOGFLAG8(D_XFER, "STATUS=", status, "STALL", "NAK",
- "Overflow", "Setup", "Data Toggle", "Timeout", "Error",
- "ACK");
+ if ((slhcidebug & SLHCI_D_NAK) ||
+ (status & SL11_EPSTAT_ERRBITS) != SL11_EPSTAT_NAK) {
+ DDOLOG("USB Status = %#.2x", status, 0, 0, 0);
+ DDLOGSTATUS(status);
+ }
#endif
if (!(status & SL11_EPSTAT_ERRBITS)) {
@@ -2041,8 +2057,8 @@ slhci_abdone(struct slhci_softc *sc, int
if (status & SL11_EPSTAT_SETUP) {
printf("%s: Invalid controller state detected! "
"halted\n", SC_NAME(sc));
- DDOLOG("%s: Invalid controller state detected! "
- "halted\n", SC_NAME(sc), 0,0,0);
+ DDOLOG("Invalid controller state detected! "
+ "halted", 0, 0, 0, 0);
slhci_halt(sc, spipe, xfer);
return;
} else if (__predict_false(sc->sc_bus.ub_usepolling)) {
@@ -2073,10 +2089,9 @@ slhci_abdone(struct slhci_softc *sc, int
xfer->ux_status = USBD_IOERROR;
DLOG(D_ERR, "Max retries reached! status %#x "
- "xfer->ux_status %#x", status, xfer->ux_status, 0,0);
- DLOGFLAG8(D_ERR, "STATUS=", status, "STALL",
- "NAK", "Overflow", "Setup", "Data Toggle",
- "Timeout", "Error", "ACK");
+ "xfer->ux_status %#x", status, xfer->ux_status, 0,
+ 0);
+ DDLOGSTATUS(status);
if (status == SL11_EPSTAT_OVERFLOW &&
ratecheck(&sc->sc_overflow_warn_rate,
@@ -2084,9 +2099,9 @@ slhci_abdone(struct slhci_softc *sc, int
printf("%s: Overflow condition: "
"data corruption possible\n",
SC_NAME(sc));
- DDOLOG("%s: Overflow condition: "
- "data corruption possible\n",
- SC_NAME(sc), 0,0,0);
+ DDOLOG("Overflow condition: "
+ "data corruption possible",
+ 0, 0, 0, 0);
}
head = Q_CALLBACKS;
} else {
@@ -2319,8 +2334,8 @@ slhci_dotransfer(struct slhci_softc *sc)
SLHCI_FS_DATA_TIME(spipe->tregs[LEN]);
}
- DLOG(D_MSG, "NEW TRANSFER %s flags %#x alen %d blen %d",
- ab ? "B" : "A", t->flags, t->len[0], t->len[1]);
+ DLOG(D_MSG, "NEW TRANSFER AB=%d flags %#x alen %d blen %d",
+ ab, t->flags, t->len[0], t->len[1]);
if (spipe->tregs[LEN])
i = 0;
@@ -2334,9 +2349,9 @@ slhci_dotransfer(struct slhci_softc *sc)
spipe->tregs[i]);
}
- DLOG(D_SXFER, "Transfer len %d pid %#x dev %d type %s",
+ DLOG(D_SXFER, "Transfer len %d pid %#x dev %d type %d",
spipe->tregs[LEN], spipe->tregs[PID], spipe->tregs[DEV],
- pnames(spipe->ptype));
+ spipe->ptype);
t->spipe[ab] = spipe;
t->flags |= ab ? F_BREADY : F_AREADY;
@@ -2383,9 +2398,9 @@ slhci_callback(struct slhci_softc *sc)
xfer = spipe->xfer;
LK_SLASSERT(xfer != NULL, sc, spipe, NULL, return);
spipe->xfer = NULL;
- DLOG(D_XFER, "xfer callback length %d actlen %d spipe %x "
- "type %s", xfer->ux_length, xfer->ux_actlen, spipe,
- pnames(spipe->ptype));
+ DLOG(D_XFER, "xfer callback length %d actlen %d spipe %d "
+ "type %d", xfer->ux_length, xfer->ux_actlen, spipe,
+ spipe->ptype);
do_callback:
slhci_do_callback(sc, xfer);
}
@@ -2527,8 +2542,8 @@ slhci_lsvh_warn(struct slhci_softc *sc,
if (!(t->flags & F_LSVH_WARNED)) {
printf("%s: Low speed device via hub disabled, "
"see slhci(4)\n", SC_NAME(sc));
- DDOLOG("%s: Low speed device via hub disabled, "
- "see slhci(4)\n", SC_NAME(sc), 0,0,0);
+ DDOLOG("Low speed device via hub disabled, "
+ "see slhci(4)", SC_NAME(sc), 0,0,0);
t->flags |= F_LSVH_WARNED;
}
return USBD_INVAL;
@@ -2546,8 +2561,8 @@ slhci_isoc_warn(struct slhci_softc *sc,
if (!(t->flags & F_ISOC_WARNED)) {
printf("%s: ISOC transfer not supported "
"(see slhci(4))\n", SC_NAME(sc));
- DDOLOG("%s: ISOC transfer not supported "
- "(see slhci(4))\n", SC_NAME(sc), 0,0,0);
+ DDOLOG("ISOC transfer not supported "
+ "(see slhci(4))", 0, 0, 0, 0);
t->flags |= F_ISOC_WARNED;
}
return USBD_INVAL;
@@ -2887,8 +2902,8 @@ slhci_reserve_bustime(struct slhci_softc
if (t->reserved_bustime < 0) {
printf("%s: reserved_bustime %d < 0!\n",
SC_NAME(sc), t->reserved_bustime);
- DDOLOG("%s: reserved_bustime %d < 0!\n",
- SC_NAME(sc), t->reserved_bustime, 0,0);
+ DDOLOG("reserved_bustime %d < 0!",
+ t->reserved_bustime, 0, 0, 0);
t->reserved_bustime = 0;
}
#endif
@@ -2903,15 +2918,15 @@ slhci_reserve_bustime(struct slhci_softc
printf("%s: Max reserved bus time exceeded! "
"Erroring request.\n", SC_NAME(sc));
DDOLOG("%s: Max reserved bus time exceeded! "
- "Erroring request.\n", SC_NAME(sc), 0,0,0);
+ "Erroring request.", 0, 0, 0, 0);
}
return 0;
#else
{
printf("%s: Reserved bus time exceeds %d!\n",
SC_NAME(sc), SLHCI_RESERVED_BUSTIME);
- DDOLOG("%s: Reserved bus time exceeds %d!\n",
- SC_NAME(sc), SLHCI_RESERVED_BUSTIME, 0,0);
+ DDOLOG("Reserved bus time exceeds %d!",
+ SLHCI_RESERVED_BUSTIME, 0, 0, 0);
}
#endif
}
@@ -3023,8 +3038,7 @@ slhci_set_feature(struct slhci_softc *sc
}
} else if (what == UHF_PORT_SUSPEND) {
printf("%s: USB Suspend not implemented!\n", SC_NAME(sc));
- DDOLOG("%s: USB Suspend not implemented!\n", SC_NAME(sc),
- 0,0,0);
+ DDOLOG("USB Suspend not implemented!", 0, 0, 0, 0);
} else if (what == UHF_PORT_POWER) {
DLOG(D_MSG, "PORT_POWER", 0,0,0,0);
/* for x68k Nereid USB controller */
@@ -3112,7 +3126,7 @@ slhci_roothub_ctrl(struct usbd_bus *bus,
type = req->bmRequestType;
- SLHCI_DEXEC(D_TRACE, slhci_log_req_hub(req));
+ SLHCI_DEXEC(D_TRACE, slhci_log_req(req));
/*
* USB requests for hubs have two basic types, standard and class.
@@ -3286,76 +3300,19 @@ void
slhci_log_req(usb_device_request_t *r)
{
SLHCIHIST_FUNC(); SLHCIHIST_CALLED();
- static const char *xmes[]={
- "GETSTAT",
- "CLRFEAT",
- "res",
- "SETFEAT",
- "res",
- "SETADDR",
- "GETDESC",
- "SETDESC",
- "GETCONF",
- "SETCONF",
- "GETIN/F",
- "SETIN/F",
- "SYNC_FR",
- "UNKNOWN"
- };
- int req, mreq, type, value, index, len;
+ int req, type, value, index, len;
req = r->bRequest;
- mreq = (req > 13) ? 13 : req;
type = r->bmRequestType;
value = UGETW(r->wValue);
index = UGETW(r->wIndex);
len = UGETW(r->wLength);
- DDOLOG("request: %s %#x", xmes[mreq], type, 0,0);
+ DDOLOG("request: type %#x", type, 0, 0, 0);
DDOLOG("request: r=%d,v=%d,i=%d,l=%d ", req, value, index, len);
}
void
-slhci_log_req_hub(usb_device_request_t *r)
-{
- SLHCIHIST_FUNC(); SLHCIHIST_CALLED();
- static const struct {
- int req;
- int type;
- const char *str;
- } conf[] = {
- { 1, 0x20, "ClrHubFeat" },
- { 1, 0x23, "ClrPortFeat" },
- { 2, 0xa3, "GetBusState" },
- { 6, 0xa0, "GetHubDesc" },
- { 0, 0xa0, "GetHubStat" },
- { 0, 0xa3, "GetPortStat" },
- { 7, 0x20, "SetHubDesc" },
- { 3, 0x20, "SetHubFeat" },
- { 3, 0x23, "SetPortFeat" },
- {-1, 0, NULL},
- };
- int i;
- int value, index, len;
- const char *str;
-
- value = UGETW(r->wValue);
- index = UGETW(r->wIndex);
- len = UGETW(r->wLength);
- for (i = 0; ; i++) {
- if (conf[i].req == -1 ) {
- slhci_log_req(r);
- return;
- }
- if (r->bmRequestType == conf[i].type && r->bRequest == conf[i].req) {
- str = conf[i].str;
- break;
- }
- }
- DDOLOG("hub request: %s v=%d,i=%d,l=%d ", str, value, index, len);
-}
-
-void
slhci_log_dumpreg(void)
{
SLHCIHIST_FUNC(); SLHCIHIST_CALLED();
@@ -3364,46 +3321,46 @@ slhci_log_dumpreg(void)
static u_char buf[240];
r = slhci_read(ssc, SL11_E0CTRL);
- DDOLOG("USB A Host Control = %#.2x", r, 0,0,0);
- DDOLOGFLAG8("E0CTRL=", r, "Preamble", "Data Toggle", "SOF Sync",
- "ISOC", "res", "Out", "Enable", "Arm");
+ DDOLOG("USB A Host Control = %#.2x", r, 0, 0, 0);
+ DDLOGEPCTRL(r);
+
aaddr = slhci_read(ssc, SL11_E0ADDR);
DDOLOG("USB A Base Address = %u", aaddr, 0,0,0);
alen = slhci_read(ssc, SL11_E0LEN);
DDOLOG("USB A Length = %u", alen, 0,0,0);
r = slhci_read(ssc, SL11_E0STAT);
DDOLOG("USB A Status = %#.2x", r, 0,0,0);
- DDOLOGFLAG8("E0STAT=", r, "STALL", "NAK", "Overflow", "Setup",
- "Data Toggle", "Timeout", "Error", "ACK");
+ DDLOGEPSTAT(r);
+
r = slhci_read(ssc, SL11_E0CONT);
DDOLOG("USB A Remaining or Overflow Length = %u", r, 0,0,0);
r = slhci_read(ssc, SL11_E1CTRL);
DDOLOG("USB B Host Control = %#.2x", r, 0,0,0);
- DDOLOGFLAG8("E1CTRL=", r, "Preamble", "Data Toggle", "SOF Sync",
- "ISOC", "res", "Out", "Enable", "Arm");
+ DDLOGEPCTRL(r);
+
baddr = slhci_read(ssc, SL11_E1ADDR);
DDOLOG("USB B Base Address = %u", baddr, 0,0,0);
blen = slhci_read(ssc, SL11_E1LEN);
DDOLOG("USB B Length = %u", blen, 0,0,0);
r = slhci_read(ssc, SL11_E1STAT);
DDOLOG("USB B Status = %#.2x", r, 0,0,0);
- DDOLOGFLAG8("E1STAT=", r, "STALL", "NAK", "Overflow", "Setup",
- "Data Toggle", "Timeout", "Error", "ACK");
+ DDLOGEPSTAT(r);
+
r = slhci_read(ssc, SL11_E1CONT);
DDOLOG("USB B Remaining or Overflow Length = %u", r, 0,0,0);
r = slhci_read(ssc, SL11_CTRL);
DDOLOG("Control = %#.2x", r, 0,0,0);
- DDOLOGFLAG8("CTRL=", r, "res", "Suspend", "LOW Speed",
- "J-K State Force", "Reset", "res", "res", "SOF");
+ DDOLOGCTRL(r);
+
r = slhci_read(ssc, SL11_IER);
DDOLOG("Interrupt Enable = %#.2x", r, 0,0,0);
- DDOLOGFLAG8("IER=", r, "D+ **IER!**", "Device Detect/Resume",
- "Insert/Remove", "SOF", "res", "res", "USBB", "USBA");
+ DDOLOGIER(r);
+
r = slhci_read(ssc, SL11_ISR);
DDOLOG("Interrupt Status = %#.2x", r, 0,0,0);
- DDOLOGFLAG8("ISR=", r, "D+", "Device Detect/Resume",
- "Insert/Remove", "SOF", "res", "res", "USBB", "USBA");
+ DDOLOGISR(r);
+
r = slhci_read(ssc, SL11_REV);
DDOLOG("Revision = %#.2x", r, 0,0,0);
r = slhci_read(ssc, SL811_CSOF);
@@ -3433,18 +3390,19 @@ slhci_log_xfer(struct usbd_xfer *xfer)
DDOLOG("xfer: length=%u, actlen=%u, flags=%#x, timeout=%u,",
xfer->ux_length, xfer->ux_actlen, xfer->ux_flags, xfer->ux_timeout);
DDOLOG("buffer=%p", xfer->ux_buf, 0,0,0);
- slhci_log_req_hub(&xfer->ux_request);
+ slhci_log_req(&xfer->ux_request);
}
void
slhci_log_spipe(struct slhci_pipe *spipe)
{
SLHCIHIST_FUNC(); SLHCIHIST_CALLED();
- DDOLOG("spipe %p onlists: %s %s %s", spipe, gcq_onlist(&spipe->ap) ?
- "AP" : "", gcq_onlist(&spipe->to) ? "TO" : "",
- gcq_onlist(&spipe->xq) ? "XQ" : "");
- DDOLOG("spipe: xfer %p buffer %p pflags %#x ptype %s",
- spipe->xfer, spipe->buffer, spipe->pflags, pnames(spipe->ptype));
+ DDOLOG("spipe %p onlists: AP=%d TO=%d XQ=%d", spipe,
+ gcq_onlist(&spipe->ap) ? 1 : 0,
+ gcq_onlist(&spipe->to) ? 1 : 0,
+ gcq_onlist(&spipe->xq) ? 1 : 0);
+ DDOLOG("spipe: xfer %p buffer %p pflags %#x ptype %d",
+ spipe->xfer, spipe->buffer, spipe->pflags, spipe->ptype);
}
void