libpayload: improved UHCI TD debugging

Improved USB debugging for EHCI by enhacing dump_td
to dump all chain information

Change-Id: I8c667b43e09c39ff12aafbd779474efd652bd80f
Signed-off-by: Anton Kochkov <anton.kochkov@gmail.com>
Reviewed-on: http://review.coreboot.org/2054
Tested-by: build bot (Jenkins)
Reviewed-by: Nico Huber <nico.huber@secunet.com>
This commit is contained in:
Anton Kochkov 2012-12-19 13:49:20 +04:00 committed by Patrick Georgi
parent cf7b63ff65
commit c62b69cd02

View File

@ -61,41 +61,51 @@ uhci_dump (hci_t *controller)
} }
#endif #endif
static void static void td_dump(td_t *td)
td_dump (td_t *td)
{ {
char td_value[3]; usb_debug("+---------------------------------------------------+\n");
const char *td_type; if ((td->token & TD_PID_MASK) == UHCI_SETUP)
switch (td->token & TD_PID_MASK) { usb_debug("|..[SETUP]..........................................|\n");
case UHCI_SETUP: else if ((td->token & TD_PID_MASK) == UHCI_IN)
td_type="SETUP"; usb_debug("|..[IN].............................................|\n");
break; else if ((td->token & TD_PID_MASK) == UHCI_OUT)
case UHCI_IN: usb_debug("|..[OUT]............................................|\n");
td_type="IN"; else
break; usb_debug("|..[]...............................................|\n");
case UHCI_OUT: usb_debug("|:|============ UHCI TD at [0x%08lx] ==========|:|\n", virt_to_phys(td));
td_type="OUT"; usb_debug("|:+-----------------------------------------------+:|\n");
break; usb_debug("|:| Next TD/QH [0x%08lx] |:|\n", td->ptr & ~0xFUL);
default: usb_debug("|:+-----------------------------------------------+:|\n");
sprintf(td_value, "%x", td->token & TD_PID_MASK); usb_debug("|:| Depth/Breath [%lx] | QH/TD [%lx] | TERMINATE [%lx] |:|\n",
td_type=td_value; (td->ptr & (1UL << 2)) >> 2, (td->ptr & (1UL << 1)) >> 1, td->ptr & 1UL);
} usb_debug("|:+-----------------------------------------------+:|\n");
usb_debug ("%s packet (at %lx) to %x.%x failed\n", td_type, usb_debug("|:| T | Maximum Length | [%04lx] |:|\n", (td->token & (0x7FFUL << 21)) >> 21);
virt_to_phys (td), (td->token & TD_DEVADDR_MASK) >> TD_DEVADDR_SHIFT, usb_debug("|:| O | PID CODE | [%04lx] |:|\n", td->token & 0xFF);
(td->token & TD_EP_MASK) >> TD_EP_SHIFT); usb_debug("|:| K | Endpoint | [%04lx] |:|\n", (td->token & TD_EP_MASK) >> TD_EP_SHIFT);
usb_debug ("td (counter at %x) returns: ", td->ctrlsts >> TD_COUNTER_SHIFT); usb_debug("|:| E | Device Address | [%04lx] |:|\n", (td->token & (0x7FUL << 8)) >> 8);
usb_debug (" bitstuff err: %x, ", !!(td->ctrlsts & TD_STATUS_BITSTUFF_ERR)); usb_debug("|:| N | Data Toggle | [%lx] |:|\n", (td->token & (1UL << 19)) >> 19);
usb_debug (" CRC err: %x, ", !!(td->ctrlsts & TD_STATUS_CRC_ERR)); usb_debug("|:+-----------------------------------------------+:|\n");
usb_debug (" NAK rcvd: %x, ", !!(td->ctrlsts & TD_STATUS_NAK_RCVD)); usb_debug("|:| C | Short Packet Detector | [%lx] |:|\n", (td->ctrlsts & (1UL << 29)) >> 29);
usb_debug (" Babble: %x, ", !!(td->ctrlsts & TD_STATUS_BABBLE)); usb_debug("|:| O | Error Counter | [%lx] |:|\n",
usb_debug (" Data Buffer err: %x, ", !!(td->ctrlsts & TD_STATUS_DATABUF_ERR)); (td->ctrlsts & (3UL << TD_COUNTER_SHIFT)) >> TD_COUNTER_SHIFT);
usb_debug (" Stalled: %x, ", !!(td->ctrlsts & TD_STATUS_STALLED)); usb_debug("|:| N | Low Speed Device | [%lx] |:|\n", (td->ctrlsts & (1UL << 26)) >> 26);
usb_debug (" Active: %x\n", !!(td->ctrlsts & TD_STATUS_ACTIVE)); usb_debug("|:| T | Isochronous Select | [%lx] |:|\n", (td->ctrlsts & (1UL << 25)) >> 25);
if (td->ctrlsts & TD_STATUS_BABBLE) usb_debug("|:| R | Interrupt on Complete (IOC) | [%lx] |:|\n", (td->ctrlsts & (1UL << 24)) >> 24);
usb_debug (" Babble because of %s\n", usb_debug("|:+ O ----------------------------------------+:|\n");
(td->ctrlsts & TD_STATUS_BITSTUFF_ERR) ? "host" : "device"); usb_debug("|:| L | Active | [%lx] |:|\n", (td->ctrlsts & (1UL << 23)) >> 23);
if (td->ctrlsts & TD_STATUS_ACTIVE) usb_debug("|:| & | Stalled | [%lx] |:|\n", (td->ctrlsts & (1UL << 22)) >> 22);
usb_debug (" still active - timeout?\n"); usb_debug("|:| S | Data Buffer Error | [%lx] |:|\n", (td->ctrlsts & (1UL << 21)) >> 21);
usb_debug("|:| T | Bubble Detected | [%lx] |:|\n", (td->ctrlsts & (1UL << 20)) >> 20);
usb_debug("|:| A | NAK Received | [%lx] |:|\n", (td->ctrlsts & (1UL << 19)) >> 19);
usb_debug("|:| T | CRC/Timeout Error | [%lx] |:|\n", (td->ctrlsts & (1UL << 18)) >> 18);
usb_debug("|:| U | Bitstuff Error | [%lx] |:|\n", (td->ctrlsts & (1UL << 17)) >> 17);
usb_debug("|:| S ----------------------------------------|:|\n");
usb_debug("|:| | Actual Length | [%04lx] |:|\n", td->ctrlsts & 0x7FFUL);
usb_debug("|:+-----------------------------------------------+:|\n");
usb_debug("|:| Buffer pointer [0x%08lx] |:|\n", td->bufptr);
usb_debug("|:|-----------------------------------------------|:|\n");
usb_debug("|...................................................|\n");
usb_debug("+---------------------------------------------------+\n");
} }
static void static void