tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Patch: xhci controller driver improvements
On 08/12/14 23:07, Nick Hudson wrote:
On 08/12/14 10:42, Takahiro HAYASHI wrote:
On 08/12/14 07:45, Takahiro HAYASHI wrote:
Please send diff :)
Wait for a while plz.
lessprf.diff
replaces most of device_printf.
I define new macros DPRINTD and DPRINTDF. former prints
args with device_xname(sc->sc_dev), latter prints args
with device name and function name.
Can you check that this compiles with all the combinations of USB_DEBUG,
XHCI_DEBUG and DIAGNOSTIC please?
Sorry, some declrations was reported unused.
New patch is attached.
I'll dump my local misc patches too.
usb3.diff
tries to make usb stack recognize super speed and
make usbdevs(8) print super speed.
This patch also adds XHCI_DEBUG flag to opt_usb.h.
I committed most of this apart from the memset as I don't think it's required.
lockmore.diff
adds lock with sc_intr_lock to xhci_intr and xhci_poll.
committed
lsmps.diff
makes use 8 as wMaxPacketSize for LS when addressing device.
http://mail-index.netbsd.org/source-changes/2013/03/20/msg042367.html
Committed.
Thank you for commit!
--
t-hash
--- xhci.c.orig 2014-08-12 23:29:37.000000000 +0900
+++ xhci.c 2014-08-13 00:40:38.000000000 +0900
@@ -59,9 +59,24 @@ __KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.2
int xhcidebug = 0;
#define DPRINTF(x) do { if (xhcidebug) printf x; } while(0)
#define DPRINTFN(n,x) do { if (xhcidebug>(n)) printf x; } while (0)
+#define DPRINTD(n,fmt,...) do { \
+ if (xhcidebug > (n)) { \
+ printf("%s: " fmt, \
+ device_xname(sc->sc_dev),## __VA_ARGS__); \
+ } \
+ } while (0/*CONSTCOND*/)
+#define DPRINTDF(n,fmt,...) do { \
+ if (xhcidebug > (n)) { \
+ printf("%s: %s: " fmt, \
+ device_xname(sc->sc_dev), \
+ __FUNCTION__,## __VA_ARGS__); \
+ } \
+ } while (0/*CONSTCOND*/)
#else
#define DPRINTF(x)
#define DPRINTFN(n,x)
+#define DPRINTD(...) ((void)0)
+#define DPRINTDF(...) ((void)0)
#endif
#define XHCI_DCI_SLOT 0
@@ -863,7 +878,7 @@ xhci_intr(void *v)
if (sc->sc_dying || !device_has_power(sc->sc_dev))
goto done;
- DPRINTF(("%s: %s\n", __func__, device_xname(sc->sc_dev)));
+ DPRINTDF(16, "\n");
/* If we get an interrupt while polling, then just ignore it. */
if (sc->sc_bus.use_polling) {
@@ -926,13 +941,18 @@ xhci_configure_endpoint(usbd_pipe_handle
usbd_status err;
uint32_t *cp;
- device_printf(sc->sc_dev, "%s dci %u (0x%x)\n", __func__, dci,
- pipe->endpoint->edesc->bEndpointAddress);
+ DPRINTDF(0, "dci %u (0x%x (addr %u dir %s) xtype %u)\n",
+ dci, pipe->endpoint->edesc->bEndpointAddress,
+ UE_GET_ADDR(ed->bEndpointAddress),
+ UE_GET_DIR(ed->bEndpointAddress) == UE_DIR_IN ? "in" : "out",
+ UE_GET_XFERTYPE(ed->bmAttributes)
+ );
/* XXX ensure input context is available? */
memset(xhci_slot_get_icv(sc, xs, 0), 0, sc->sc_pgsz);
+ /* set up initial input control context */
cp = xhci_slot_get_icv(sc, xs, XHCI_ICI_INPUT_CONTROL);
cp[0] = htole32(0);
cp[1] = htole32(XHCI_INCTX_1_ADD_MASK(dci));
@@ -1007,8 +1027,9 @@ xhci_reset_endpoint(usbd_pipe_handle pip
struct xhci_trb trb;
usbd_status err;
- device_printf(sc->sc_dev, "%s\n", __func__);
+ DPRINTDF(0, "\n");
+ /* XXX byte order */
trb.trb_0 = 0;
trb.trb_2 = 0;
trb.trb_3 = XHCI_TRB_3_SLOT_SET(xs->xs_idx) |
@@ -1030,8 +1051,9 @@ xhci_stop_endpoint(usbd_pipe_handle pipe
usbd_status err;
const u_int dci = xhci_ep_get_dci(pipe->endpoint->edesc);
- device_printf(sc->sc_dev, "%s\n", __func__);
+ DPRINTDF(0, "\n");
+ /* XXX byte order */
trb.trb_0 = 0;
trb.trb_2 = 0;
trb.trb_3 = XHCI_TRB_3_SLOT_SET(xs->xs_idx) |
@@ -1054,7 +1076,7 @@ xhci_set_dequeue(usbd_pipe_handle pipe)
struct xhci_trb trb;
usbd_status err;
- device_printf(sc->sc_dev, "%s\n", __func__);
+ DPRINTDF(0, "\n");
memset(xr->xr_trb, 0, xr->xr_ntrb * XHCI_TRB_SIZE);
usb_syncmem(&xr->xr_dma, 0, xr->xr_ntrb * XHCI_TRB_SIZE,
@@ -1080,13 +1102,13 @@ xhci_open(usbd_pipe_handle pipe)
usbd_device_handle const dev = pipe->device;
struct xhci_softc * const sc = dev->bus->hci_private;
usb_endpoint_descriptor_t * const ed = pipe->endpoint->edesc;
+#ifdef XHCI_DEBUG
const int8_t addr = dev->address;
+#endif
const uint8_t xfertype = UE_GET_XFERTYPE(ed->bmAttributes);
- DPRINTF(("%s\n", __func__));
- DPRINTF(("addr %d\n", addr));
- device_printf(sc->sc_dev, "%s addr %d depth %d port %d speed %d\n",
- __func__, addr, dev->depth, dev->powersrc->portno, dev->speed);
+ DPRINTDF(0, "addr %d depth %d port %d speed %d\n",
+ addr, dev->depth, dev->powersrc->portno, dev->speed);
if (sc->sc_dying)
return USBD_IOERROR;
@@ -1141,7 +1163,7 @@ xhci_rhpsc(struct xhci_softc * const sc,
usbd_xfer_handle const xfer = sc->sc_intrxfer;
uint8_t *p;
- device_printf(sc->sc_dev, "port %u status change\n", port);
+ DPRINTD(0, "port %u status change\n", port);
if (xfer == NULL)
return;
@@ -1152,7 +1174,7 @@ xhci_rhpsc(struct xhci_softc * const sc,
port -= sc->sc_hs_port_start;
port += 1;
- device_printf(sc->sc_dev, "hs port %u status change\n", port);
+ DPRINTD(0, "hs port %u status change\n", port);
p = KERNADDR(&xfer->dmabuf, 0);
memset(p, 0, xfer->length);
@@ -1168,16 +1190,15 @@ xhci_handle_event(struct xhci_softc * co
uint64_t trb_0;
uint32_t trb_2, trb_3;
- DPRINTF(("%s: %s\n", __func__, device_xname(sc->sc_dev)));
+ DPRINTDF(16, "\n");
trb_0 = le64toh(trb->trb_0);
trb_2 = le32toh(trb->trb_2);
trb_3 = le32toh(trb->trb_3);
#if 0
- device_printf(sc->sc_dev,
- "event: %p 0x%016"PRIx64" 0x%08"PRIx32" 0x%08"PRIx32"\n", trb,
- trb_0, trb_2, trb_3);
+ DPRINTD("event: %p 0x%016"PRIx64" 0x%08"PRIx32" 0x%08"PRIx32"\n",
+ trb, trb_0, trb_2, trb_3);
#endif
switch (XHCI_TRB_3_TYPE_GET(trb_3)){
@@ -1203,12 +1224,12 @@ xhci_handle_event(struct xhci_softc * co
}
xfer = &xx->xx_xfer;
#if 0
- device_printf(sc->sc_dev, "%s xfer %p\n", __func__, xfer);
+ DPRINTDF(0, "xfer %p\n", xfer);
#endif
if ((trb_3 & XHCI_TRB_3_ED_BIT) != 0) {
#if 0
- device_printf(sc->sc_dev, "transfer event data: "
+ DPRINTD(0, "transfer event data: "
"0x%016"PRIx64" 0x%08"PRIx32" %02x\n",
trb_0, XHCI_TRB_2_REM_GET(trb_2),
XHCI_TRB_2_ERROR_GET(trb_2));
@@ -1254,13 +1275,13 @@ xhci_handle_event(struct xhci_softc * co
sc->sc_result_trb.trb_3 = trb_3;
if (XHCI_TRB_2_ERROR_GET(trb_2) !=
XHCI_TRB_ERROR_SUCCESS) {
- device_printf(sc->sc_dev, "command completion "
+ DPRINTD(0, "command completion "
"failure: 0x%016"PRIx64" 0x%08"PRIx32" "
"0x%08"PRIx32"\n", trb_0, trb_2, trb_3);
}
cv_signal(&sc->sc_command_cv);
} else {
- device_printf(sc->sc_dev, "event: %p 0x%016"PRIx64" "
+ DPRINTD(0, "event: %p 0x%016"PRIx64" "
"0x%08"PRIx32" 0x%08"PRIx32"\n", trb, trb_0,
trb_2, trb_3);
}
@@ -1282,11 +1303,11 @@ xhci_softintr(void *v)
struct xhci_trb *trb;
int i, j, k;
- DPRINTF(("%s: %s\n", __func__, device_xname(sc->sc_dev)));
-
i = er->xr_ep;
j = er->xr_cs;
+ DPRINTDF(16, "i=%d j=%d\n", i, j);
+
while (1) {
usb_syncmem(&er->xr_dma, XHCI_TRB_SIZE * i, XHCI_TRB_SIZE,
BUS_DMASYNC_POSTREAD);
@@ -1311,7 +1332,7 @@ xhci_softintr(void *v)
xhci_rt_write_8(sc, XHCI_ERDP(0), xhci_ring_trbp(er, er->xr_ep) |
XHCI_ERDP_LO_BUSY);
- DPRINTF(("%s: %s ends\n", __func__, device_xname(sc->sc_dev)));
+ DPRINTDF(16, "ends\n");
return;
}
@@ -1321,7 +1342,7 @@ xhci_poll(struct usbd_bus *bus)
{
struct xhci_softc * const sc = bus->hci_private;
- DPRINTF(("%s: %s\n", __func__, device_xname(sc->sc_dev)));
+ DPRINTDF(0, "\n");
mutex_spin_enter(&sc->sc_intr_lock);
xhci_intr1(sc);
@@ -1336,7 +1357,7 @@ xhci_allocm(struct usbd_bus *bus, usb_dm
struct xhci_softc * const sc = bus->hci_private;
usbd_status err;
- DPRINTF(("%s\n", __func__));
+ DPRINTDF(16, "\n");
err = usb_allocmem_flags(&sc->sc_bus, size, 0, dma, 0);
#if 0
@@ -1345,8 +1366,7 @@ xhci_allocm(struct usbd_bus *bus, usb_dm
#endif
#ifdef XHCI_DEBUG
if (err)
- device_printf(sc->sc_dev, "xhci_allocm: usb_allocmem()=%d\n",
- err);
+ DPRINTDF(0, "usb_allocmem()=%d\n", err);
#endif
return err;
@@ -1357,7 +1377,7 @@ xhci_freem(struct usbd_bus *bus, usb_dma
{
struct xhci_softc * const sc = bus->hci_private;
-// DPRINTF(("%s\n", __func__));
+// DPRINTDF(16, "\n");
#if 0
if (dma->block->flags & USB_DMA_RESERVE) {
@@ -1374,7 +1394,7 @@ xhci_allocx(struct usbd_bus *bus)
struct xhci_softc * const sc = bus->hci_private;
usbd_xfer_handle xfer;
-// DPRINTF(("%s\n", __func__));
+// DPRINTDF(16, "\n");
xfer = pool_cache_get(sc->sc_xferpool, PR_NOWAIT);
if (xfer != NULL) {
@@ -1392,12 +1412,12 @@ xhci_freex(struct usbd_bus *bus, usbd_xf
{
struct xhci_softc * const sc = bus->hci_private;
-// DPRINTF(("%s\n", __func__));
+// DPRINTDF(16, "\n");
#ifdef DIAGNOSTIC
if (xfer->busy_free != XFER_BUSY) {
- device_printf(sc->sc_dev, "xhci_freex: xfer=%p "
- "not busy, 0x%08x\n", xfer, xfer->busy_free);
+ DPRINTDF(-1, "xfer=%p not busy, 0x%08x\n",
+ xfer, xfer->busy_free);
}
xfer->busy_free = XFER_FREE;
#endif
@@ -1430,6 +1450,8 @@ xhci_new_device(device_t parent, usbd_bu
uint8_t slot;
uint8_t addr;
+ DPRINTDF(1, "bus=%p port=%d depth=%d speed=%d up %p upport %d\n",
+ bus, port, depth, speed, up, up->portno);
dev = malloc(sizeof *dev, M_USB, M_NOWAIT|M_ZERO);
if (dev == NULL)
return USBD_NOMEM;
@@ -1454,8 +1476,6 @@ xhci_new_device(device_t parent, usbd_bu
/* doesn't matter, just don't let it uninitialized */
dev->def_ep.datatoggle = 0;
- device_printf(sc->sc_dev, "%s up %p portno %d\n", __func__, up,
- up->portno);
dev->quirks = &usbd_no_quirk;
dev->address = 0;
@@ -1470,9 +1490,9 @@ xhci_new_device(device_t parent, usbd_bu
for (adev = dev, hub = dev;
hub != NULL;
adev = hub, hub = hub->myhub) {
- device_printf(sc->sc_dev, "%s hub %p\n", __func__, hub);
+ DPRINTDF(0, "hub %p\n", hub);
}
- device_printf(sc->sc_dev, "%s hub %p\n", __func__, hub);
+ DPRINTDF(0, "hub %p\n", hub);
if (hub != NULL) {
for (int p = 0; p < hub->hub->hubdesc.bNbrPorts; p++) {
@@ -1488,7 +1508,7 @@ xhci_new_device(device_t parent, usbd_bu
} else {
rhport += sc->sc_hs_port_start - 1;
}
- device_printf(sc->sc_dev, "%s rhport %d\n", __func__, rhport);
+ DPRINTDF(0, "rhport %d\n", rhport);
dev->speed = speed;
dev->langid = USBD_NOLANG;
@@ -1525,8 +1545,7 @@ xhci_new_device(device_t parent, usbd_bu
cp = xhci_slot_get_dcv(sc, xs, XHCI_DCI_SLOT);
//hexdump("slot context", cp, sc->sc_ctxsz);
addr = XHCI_SCTX_3_DEV_ADDR_GET(cp[3]);
- device_printf(sc->sc_dev, "%s device address %u\n",
- __func__, addr);
+ DPRINTDF(0, "device address %u\n", addr);
/* XXX ensure we know when the hardware does something
we can't yet cope with */
KASSERT(addr >= 1 && addr <= 127);
@@ -1545,8 +1564,7 @@ xhci_new_device(device_t parent, usbd_bu
else
USETW(dev->def_ep_desc.wMaxPacketSize,
dd->bMaxPacketSize);
- device_printf(sc->sc_dev, "%s bMaxPacketSize %u\n", __func__,
- dd->bMaxPacketSize);
+ DPRINTDF(0, "bMaxPacketSize %u\n", dd->bMaxPacketSize);
xhci_update_ep0_mps(sc, xs,
UGETW(dev->def_ep_desc.wMaxPacketSize));
err = usbd_reload_device_desc(dev);
@@ -1569,7 +1587,7 @@ xhci_new_device(device_t parent, usbd_bu
if ((depth == 0) && (port == 0)) {
usbd_attach_roothub(parent, dev);
- device_printf(sc->sc_dev, "root_hub %p\n", bus->root_hub);
+ DPRINTD(-1, "root_hub %p\n", bus->root_hub);
return USBD_NORMAL_COMPLETION;
}
@@ -1627,17 +1645,18 @@ xhci_ring_put(struct xhci_softc * const
for (i = 0; i < ntrbs; i++) {
#if 0
- device_printf(sc->sc_dev, "%s %p %p %zu "
- "%016"PRIx64" %08"PRIx32" %08"PRIx32"\n", __func__, xr,
+ /* XXX byte order */
+ DPRINTDF(0, "%p %p %zu "
+ "%016"PRIx64" %08"PRIx32" %08"PRIx32"\n", xr,
trbs, i, trbs[i].trb_0, trbs[i].trb_2, trbs[i].trb_3);
#endif
+ /* XXX byte order */
KASSERT(XHCI_TRB_3_TYPE_GET(trbs[i].trb_3) !=
XHCI_TRB_TYPE_LINK);
}
#if 0
- device_printf(sc->sc_dev, "%s %p xr_ep 0x%x xr_cs %u\n", __func__,
- xr, xr->xr_ep, xr->xr_cs);
+ DPRINTDF(0, "%p xr_ep 0x%x xr_cs %u\n", xr, xr->xr_ep, xr->xr_cs);
#endif
ri = xr->xr_ep;
@@ -1719,8 +1738,7 @@ xhci_ring_put(struct xhci_softc * const
xr->xr_cs = cs;
#if 0
- device_printf(sc->sc_dev, "%s %p xr_ep 0x%x xr_cs %u\n", __func__,
- xr, xr->xr_ep, xr->xr_cs);
+ DPRINTDF(0, "%p xr_ep 0x%x xr_cs %u\n", xr, xr->xr_ep, xr->xr_cs);
#endif
}
@@ -1731,8 +1749,7 @@ xhci_do_command(struct xhci_softc * cons
struct xhci_ring * const cr = &sc->sc_cr;
usbd_status err;
- device_printf(sc->sc_dev, "%s input: "
- "0x%016"PRIx64" 0x%08"PRIx32" 0x%08"PRIx32"\n", __func__,
+ DPRINTDF(1, "input: 0x%016"PRIx64" 0x%08"PRIx32" 0x%08"PRIx32"\n",
trb->trb_0, trb->trb_2, trb->trb_3);
mutex_enter(&sc->sc_lock);
@@ -1756,8 +1773,7 @@ xhci_do_command(struct xhci_softc * cons
trb->trb_2 = sc->sc_result_trb.trb_2;
trb->trb_3 = sc->sc_result_trb.trb_3;
- device_printf(sc->sc_dev, "%s output: "
- "0x%016"PRIx64" 0x%08"PRIx32" 0x%08"PRIx32"\n", __func__,
+ DPRINTDF(1, "output: 0x%016"PRIx64" 0x%08"PRIx32" 0x%08"PRIx32"\n",
trb->trb_0, trb->trb_2, trb->trb_3);
switch (XHCI_TRB_2_ERROR_GET(trb->trb_2)) {
@@ -1824,7 +1840,7 @@ xhci_update_ep0_mps(struct xhci_softc *
usbd_status err;
uint32_t * cp;
- device_printf(sc->sc_dev, "%s\n", __func__);
+ DPRINTDF(0, "\n");
cp = xhci_slot_get_icv(sc, xs, XHCI_ICI_INPUT_CONTROL);
cp[0] = htole32(0);
@@ -1853,7 +1869,7 @@ xhci_set_dcba(struct xhci_softc * const
{
uint64_t * const dcbaa = KERNADDR(&sc->sc_dcbaa_dma, 0);
- device_printf(sc->sc_dev, "dcbaa %p dc %016"PRIx64" slot %d\n",
+ DPRINTD(0, "dcbaa: va %p pa %016"PRIx64" slot %d\n",
&dcbaa[si], dcba, si);
dcbaa[si] = htole64(dcba);
@@ -1872,6 +1888,8 @@ xhci_init_slot(struct xhci_softc * const
uint32_t mps;
uint32_t xspeed;
+ DPRINTDF(1, "slot %u depth %d speed %d port %d rhport %d\n",
+ slot, depth, speed, port, rhport);
switch (speed) {
case USB_SPEED_LOW:
xspeed = 2;
@@ -1890,8 +1908,7 @@ xhci_init_slot(struct xhci_softc * const
mps = USB_3_MAX_CTRL_PACKET;
break;
default:
- device_printf(sc->sc_dev, "%s: impossible speed: %x",
- __func__, speed);
+ DPRINTDF(-1, "impossible speed 0x%x\n", speed);
return USBD_INVAL;
}
@@ -1919,7 +1936,7 @@ xhci_init_slot(struct xhci_softc * const
err = xhci_ring_init(sc, &xs->xs_ep[dci].xe_tr,
XHCI_TRANSFER_RING_TRBS, XHCI_TRB_ALIGN);
if (err) {
- device_printf(sc->sc_dev, "ring init failure\n");
+ DPRINTD(-1, "ring init failure\n");
return err;
}
}
@@ -2065,7 +2082,7 @@ xhci_root_ctrl_transfer(usbd_xfer_handle
struct xhci_softc * const sc = xfer->pipe->device->bus->hci_private;
usbd_status err;
- DPRINTF(("%s\n", __func__));
+ DPRINTDF(16, "\n");
/* Insert last in queue. */
mutex_enter(&sc->sc_lock);
@@ -2092,7 +2109,7 @@ xhci_root_ctrl_start(usbd_xfer_handle xf
int port, i;
uint32_t v;
- DPRINTF(("%s\n", __func__));
+ DPRINTDF(16, "\n");
if (sc->sc_dying)
return USBD_IOERROR;
@@ -2106,8 +2123,8 @@ xhci_root_ctrl_start(usbd_xfer_handle xf
if (len != 0)
buf = KERNADDR(&xfer->dmabuf, 0);
- DPRINTF(("root req: %02x %02x %04x %04x %04x\n", req->bmRequestType,
- req->bRequest, value, index, len));
+ DPRINTD(1, "root req: %02x %02x %04x %04x %04x\n", req->bmRequestType,
+ req->bRequest, value, index, len);
#define C(x,y) ((x) | ((y) << 8))
switch(C(req->bRequest, req->bmRequestType)) {
@@ -2314,8 +2331,8 @@ xhci_root_ctrl_start(usbd_xfer_handle xf
}
v = xhci_op_read_4(sc, XHCI_PORTSC(sc->sc_hs_port_start - 1 +
index));
- DPRINTF(("%s READ_CLASS_OTHER GET_STATUS PORTSC %d (%d) %08x\n",
- __func__, index, sc->sc_hs_port_start - 1 + index, v));
+ DPRINTDF(0, "READ_CLASS_OTHER GET_STATUS PORTSC %d (%d) %08x\n",
+ index, sc->sc_hs_port_start - 1 + index, v);
switch (XHCI_PS_SPEED_GET(v)) {
case 1:
i = UPS_FULL_SPEED;
@@ -2426,7 +2443,7 @@ xhci_root_ctrl_abort(usbd_xfer_handle xf
static void
xhci_root_ctrl_close(usbd_pipe_handle pipe)
{
- DPRINTF(("%s\n", __func__));
+ DPRINTFN(1, ("%s\n", __func__));
/* Nothing to do. */
}
@@ -2541,10 +2558,10 @@ xhci_device_ctrl_start(usbd_xfer_handle
uint32_t control;
u_int i;
- DPRINTF(("%s\n", __func__));
- DPRINTF(("req: %02x %02x %04x %04x %04x\n", req->bmRequestType,
+ DPRINTDF(16, "\n");
+ DPRINTD(1, "req: %02x %02x %04x %04x %04x\n", req->bmRequestType,
req->bRequest, UGETW(req->wValue), UGETW(req->wIndex),
- UGETW(req->wLength)));
+ UGETW(req->wLength));
/* XXX */
if (tr->is_halted) {
@@ -2617,7 +2634,7 @@ no_data:
}
if (sc->sc_bus.use_polling) {
- device_printf(sc->sc_dev, "%s polling\n", __func__);
+ DPRINTDF(0, "polling\n");
//xhci_waitintr(sc, xfer);
}
@@ -2627,7 +2644,7 @@ no_data:
static void
xhci_device_ctrl_done(usbd_xfer_handle xfer)
{
- DPRINTF(("%s\n", __func__));
+ DPRINTFN(16, ("%s\n", __func__));
callout_stop(&xfer->timeout_handle); /* XXX wrong place */
@@ -2636,13 +2653,16 @@ xhci_device_ctrl_done(usbd_xfer_handle x
static void
xhci_device_ctrl_abort(usbd_xfer_handle xfer)
{
- DPRINTF(("%s\n", __func__));
+#ifdef XHCI_DEBUG
+ struct xhci_softc * const sc = xfer->pipe->device->bus->hci_private;
+#endif
+ DPRINTDF(16, "\n");
}
static void
xhci_device_ctrl_close(usbd_pipe_handle pipe)
{
- DPRINTF(("%s\n", __func__));
+ DPRINTFN(16, ("%s\n", __func__));
}
/* ----------------- */
@@ -2657,6 +2677,8 @@ xhci_device_bulk_transfer(usbd_xfer_hand
struct xhci_softc * const sc = xfer->pipe->device->bus->hci_private;
usbd_status err;
+ DPRINTDF(16, "\n");
+
/* Insert last in queue. */
mutex_enter(&sc->sc_lock);
err = usb_insert_transfer(xfer);
@@ -2686,10 +2708,7 @@ xhci_device_bulk_start(usbd_xfer_handle
uint32_t control;
u_int i = 0;
-#if 0
- device_printf(sc->sc_dev, "%s %p slot %u dci %u\n", __func__, xfer,
- xs->xs_idx, dci);
-#endif
+ DPRINTDF(16, "%p slot %u dci %u\n", xfer, xs->xs_idx, dci);
if (sc->sc_dying)
return USBD_IOERROR;
@@ -2723,7 +2742,7 @@ xhci_device_bulk_start(usbd_xfer_handle
xhci_db_write_4(sc, XHCI_DOORBELL(xs->xs_idx), dci);
if (sc->sc_bus.use_polling) {
- device_printf(sc->sc_dev, "%s polling\n", __func__);
+ DPRINTDF(0, "polling\n");
//xhci_waitintr(sc, xfer);
}
@@ -2733,18 +2752,15 @@ xhci_device_bulk_start(usbd_xfer_handle
static void
xhci_device_bulk_done(usbd_xfer_handle xfer)
{
- //struct xhci_softc * const sc = xfer->pipe->device->bus->hci_private;
- //struct xhci_slot * const xs = xfer->pipe->device->hci_private;
- //const u_int dci = xhci_ep_get_dci(xfer->pipe->endpoint->edesc);
+#ifdef XHCI_DEBUG
+ struct xhci_softc * const sc = xfer->pipe->device->bus->hci_private;
+ struct xhci_slot * const xs = xfer->pipe->device->hci_private;
+ const u_int dci = xhci_ep_get_dci(xfer->pipe->endpoint->edesc);
+#endif
const u_int endpt = xfer->pipe->endpoint->edesc->bEndpointAddress;
const bool isread = UE_GET_DIR(endpt) == UE_DIR_IN;
- DPRINTF(("%s\n", __func__));
-
-#if 0
- device_printf(sc->sc_dev, "%s %p slot %u dci %u\n", __func__, xfer,
- xs->xs_idx, dci);
-#endif
+ DPRINTDF(16, "%p slot %u dci %u\n", xfer, xs->xs_idx, dci);
callout_stop(&xfer->timeout_handle); /* XXX wrong place */
@@ -2757,13 +2773,21 @@ xhci_device_bulk_done(usbd_xfer_handle x
static void
xhci_device_bulk_abort(usbd_xfer_handle xfer)
{
- DPRINTF(("%s\n", __func__));
+#if defined(DIAGNOSTIC) || defined(XHCI_DEBUG)
+ struct xhci_softc * const sc = xfer->pipe->device->bus->hci_private;
+#endif
+ DPRINTDF(16, "\n");
+
+ KASSERT(mutex_owned(&sc->sc_lock));
}
static void
xhci_device_bulk_close(usbd_pipe_handle pipe)
{
- DPRINTF(("%s\n", __func__));
+#ifdef XHCI_DEBUG
+ struct xhci_softc * const sc = pipe->device->bus->hci_private;
+#endif
+ DPRINTDF(16, "\n");
}
/* --------------- */
@@ -2804,10 +2828,7 @@ xhci_device_intr_start(usbd_xfer_handle
uint32_t control;
u_int i = 0;
-#if 0
- device_printf(sc->sc_dev, "%s %p slot %u dci %u\n", __func__, xfer,
- xs->xs_idx, dci);
-#endif
+ DPRINTDF(16, "%p slot %u dci %u\n", xfer, xs->xs_idx, dci);
if (sc->sc_dying)
return USBD_IOERROR;
@@ -2830,9 +2851,7 @@ xhci_device_intr_start(usbd_xfer_handle
xhci_db_write_4(sc, XHCI_DOORBELL(xs->xs_idx), dci);
if (sc->sc_bus.use_polling) {
-#ifdef XHCI_DEBUG
- device_printf(sc->sc_dev, "%s polling\n", __func__);
-#endif
+ DPRINTDF(0, "polling\n");
//xhci_waitintr(sc, xfer);
}
@@ -2850,12 +2869,8 @@ xhci_device_intr_done(usbd_xfer_handle x
#endif
const u_int endpt = xfer->pipe->endpoint->edesc->bEndpointAddress;
const bool isread = UE_GET_DIR(endpt) == UE_DIR_IN;
- DPRINTF(("%s\n", __func__));
-#ifdef XHCI_DEBUG
- device_printf(sc->sc_dev, "%s %p slot %u dci %u\n", __func__, xfer,
- xs->xs_idx, dci);
-#endif
+ DPRINTDF(16, "%p slot %u dci %u\n", xfer, xs->xs_idx, dci);
KASSERT(sc->sc_bus.use_polling || mutex_owned(&sc->sc_lock));
@@ -2881,11 +2896,12 @@ xhci_device_intr_done(usbd_xfer_handle x
static void
xhci_device_intr_abort(usbd_xfer_handle xfer)
{
+#if defined(XHCI_DEBUG) || defined(DIAGNOSTIC)
struct xhci_softc * const sc = xfer->pipe->device->bus->hci_private;
- DPRINTF(("%s\n", __func__));
+#endif
+ DPRINTDF(16, "%p\n", xfer);
KASSERT(mutex_owned(&sc->sc_lock));
- device_printf(sc->sc_dev, "%s %p\n", __func__, xfer);
KASSERT(xfer->pipe->intrxfer == xfer);
xfer->status = USBD_CANCELLED;
usb_transfer_complete(xfer);
@@ -2894,9 +2910,10 @@ xhci_device_intr_abort(usbd_xfer_handle
static void
xhci_device_intr_close(usbd_pipe_handle pipe)
{
+#ifdef XHCI_DEBUG
struct xhci_softc * const sc = pipe->device->bus->hci_private;
- DPRINTF(("%s\n", __func__));
- device_printf(sc->sc_dev, "%s %p\n", __func__, pipe);
+#endif
+ DPRINTDF(1, "pipe %p\n", pipe);
xhci_unconfigure_endpoint(pipe);
}
Home |
Main Index |
Thread Index |
Old Index