3 * Copyright (C) 2013 secunet Security Networks AG
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 #include "xhci_private.h"
35 xhci_dump_slotctx(const slotctx_t
*const sc
)
37 xhci_debug("Slot Context (@%p):\n", sc
);
38 usb_debug(" FIELD1\t0x%08"PRIx32
"\n", sc
->f1
);
39 usb_debug(" FIELD2\t0x%08"PRIx32
"\n", sc
->f2
);
40 usb_debug(" FIELD3\t0x%08"PRIx32
"\n", sc
->f3
);
41 usb_debug(" FIELD4\t0x%08"PRIx32
"\n", sc
->f4
);
57 xhci_dump_epctx(const epctx_t
*const ec
)
59 xhci_debug("Endpoint Context (@%p):\n", ec
);
60 usb_debug(" FIELD1\t0x%08"PRIx32
"\n", ec
->f1
);
61 usb_debug(" FIELD2\t0x%08"PRIx32
"\n", ec
->f2
);
62 usb_debug(" TRDQ_L\t0x%08"PRIx32
"\n", ec
->tr_dq_low
);
63 usb_debug(" TRDQ_H\t0x%08"PRIx32
"\n", ec
->tr_dq_high
);
64 usb_debug(" FIELD5\t0x%08"PRIx32
"\n", ec
->f5
);
77 xhci_dump_devctx(const devctx_t
*const dc
, const u32 ctx_mask
)
81 xhci_dump_slotctx(dc
->slot
);
82 for (i
= 1; i
<= SC_GET(CTXENT
, dc
->slot
); ++i
) {
83 if (ctx_mask
& (1 << i
))
84 xhci_dump_epctx(dc
->ep
[i
]);
89 xhci_dump_inputctx(const inputctx_t
*const ic
)
91 xhci_debug("Input Control add: 0x%08"PRIx32
"\n", *ic
->add
);
92 xhci_debug("Input Control drop: 0x%08"PRIx32
"\n", *ic
->drop
);
93 xhci_dump_devctx(&ic
->dev
, *ic
->add
);
97 xhci_dump_transfer_trb(const trb_t
*const cur
)
99 xhci_debug("Transfer TRB (@%p):\n", cur
);
100 usb_debug(" PTR_L\t0x%08"PRIx32
"\n", cur
->ptr_low
);
101 usb_debug(" PTR_H\t0x%08"PRIx32
"\n", cur
->ptr_high
);
102 usb_debug(" STATUS\t0x%08"PRIx32
"\n", cur
->status
);
103 usb_debug(" CNTRL\t0x%08"PRIx32
"\n", cur
->control
);
116 xhci_next_trb(const trb_t
*const cur
)
118 if (TRB_GET(TT
, cur
) == TRB_LINK
)
119 return (!cur
->ptr_low
) ? NULL
: phys_to_virt(cur
->ptr_low
);
125 xhci_dump_transfer_trbs(const trb_t
*const first
, const trb_t
*const last
)
128 for (cur
= first
; cur
; cur
= xhci_next_trb(cur
)) {
129 xhci_dump_transfer_trb(cur
);