summaryrefslogtreecommitdiff
path: root/payloads/libpayload
diff options
context:
space:
mode:
authorAnton Kochkov <anton.kochkov@gmail.com>2012-12-19 13:49:20 +0400
committerPatrick Georgi <patrick@georgi-clan.de>2012-12-19 15:19:34 +0100
commitc62b69cd02f863fd1319401735bd2cb50fe856ae (patch)
tree3106e0174b77e2483b5ca055c16ea5b24467a78a /payloads/libpayload
parentcf7b63ff65270d83540828cfbd2314b5d82dcb9d (diff)
downloadcoreboot-c62b69cd02f863fd1319401735bd2cb50fe856ae.tar.xz
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>
Diffstat (limited to 'payloads/libpayload')
-rw-r--r--payloads/libpayload/drivers/usb/uhci.c78
1 files changed, 44 insertions, 34 deletions
diff --git a/payloads/libpayload/drivers/usb/uhci.c b/payloads/libpayload/drivers/usb/uhci.c
index b4ccb980a0..bfa1b57d43 100644
--- a/payloads/libpayload/drivers/usb/uhci.c
+++ b/payloads/libpayload/drivers/usb/uhci.c
@@ -61,41 +61,51 @@ uhci_dump (hci_t *controller)
}
#endif
-static void
-td_dump (td_t *td)
+static void td_dump(td_t *td)
{
- char td_value[3];
- const char *td_type;
- switch (td->token & TD_PID_MASK) {
- case UHCI_SETUP:
- td_type="SETUP";
- break;
- case UHCI_IN:
- td_type="IN";
- break;
- case UHCI_OUT:
- td_type="OUT";
- break;
- default:
- sprintf(td_value, "%x", td->token & TD_PID_MASK);
- td_type=td_value;
- }
- usb_debug ("%s packet (at %lx) to %x.%x failed\n", td_type,
- virt_to_phys (td), (td->token & TD_DEVADDR_MASK) >> TD_DEVADDR_SHIFT,
- (td->token & TD_EP_MASK) >> TD_EP_SHIFT);
- usb_debug ("td (counter at %x) returns: ", td->ctrlsts >> TD_COUNTER_SHIFT);
- usb_debug (" bitstuff err: %x, ", !!(td->ctrlsts & TD_STATUS_BITSTUFF_ERR));
- usb_debug (" CRC err: %x, ", !!(td->ctrlsts & TD_STATUS_CRC_ERR));
- usb_debug (" NAK rcvd: %x, ", !!(td->ctrlsts & TD_STATUS_NAK_RCVD));
- usb_debug (" Babble: %x, ", !!(td->ctrlsts & TD_STATUS_BABBLE));
- usb_debug (" Data Buffer err: %x, ", !!(td->ctrlsts & TD_STATUS_DATABUF_ERR));
- usb_debug (" Stalled: %x, ", !!(td->ctrlsts & TD_STATUS_STALLED));
- usb_debug (" Active: %x\n", !!(td->ctrlsts & TD_STATUS_ACTIVE));
- if (td->ctrlsts & TD_STATUS_BABBLE)
- usb_debug (" Babble because of %s\n",
- (td->ctrlsts & TD_STATUS_BITSTUFF_ERR) ? "host" : "device");
- if (td->ctrlsts & TD_STATUS_ACTIVE)
- usb_debug (" still active - timeout?\n");
+ usb_debug("+---------------------------------------------------+\n");
+ if ((td->token & TD_PID_MASK) == UHCI_SETUP)
+ usb_debug("|..[SETUP]..........................................|\n");
+ else if ((td->token & TD_PID_MASK) == UHCI_IN)
+ usb_debug("|..[IN].............................................|\n");
+ else if ((td->token & TD_PID_MASK) == UHCI_OUT)
+ usb_debug("|..[OUT]............................................|\n");
+ else
+ usb_debug("|..[]...............................................|\n");
+ usb_debug("|:|============ UHCI TD at [0x%08lx] ==========|:|\n", virt_to_phys(td));
+ usb_debug("|:+-----------------------------------------------+:|\n");
+ usb_debug("|:| Next TD/QH [0x%08lx] |:|\n", td->ptr & ~0xFUL);
+ usb_debug("|:+-----------------------------------------------+:|\n");
+ usb_debug("|:| Depth/Breath [%lx] | QH/TD [%lx] | TERMINATE [%lx] |:|\n",
+ (td->ptr & (1UL << 2)) >> 2, (td->ptr & (1UL << 1)) >> 1, td->ptr & 1UL);
+ usb_debug("|:+-----------------------------------------------+:|\n");
+ usb_debug("|:| T | Maximum Length | [%04lx] |:|\n", (td->token & (0x7FFUL << 21)) >> 21);
+ usb_debug("|:| O | PID CODE | [%04lx] |:|\n", td->token & 0xFF);
+ usb_debug("|:| K | Endpoint | [%04lx] |:|\n", (td->token & TD_EP_MASK) >> TD_EP_SHIFT);
+ usb_debug("|:| E | Device Address | [%04lx] |:|\n", (td->token & (0x7FUL << 8)) >> 8);
+ usb_debug("|:| N | Data Toggle | [%lx] |:|\n", (td->token & (1UL << 19)) >> 19);
+ usb_debug("|:+-----------------------------------------------+:|\n");
+ usb_debug("|:| C | Short Packet Detector | [%lx] |:|\n", (td->ctrlsts & (1UL << 29)) >> 29);
+ usb_debug("|:| O | Error Counter | [%lx] |:|\n",
+ (td->ctrlsts & (3UL << TD_COUNTER_SHIFT)) >> TD_COUNTER_SHIFT);
+ usb_debug("|:| N | Low Speed Device | [%lx] |:|\n", (td->ctrlsts & (1UL << 26)) >> 26);
+ usb_debug("|:| T | Isochronous Select | [%lx] |:|\n", (td->ctrlsts & (1UL << 25)) >> 25);
+ usb_debug("|:| R | Interrupt on Complete (IOC) | [%lx] |:|\n", (td->ctrlsts & (1UL << 24)) >> 24);
+ usb_debug("|:+ O ----------------------------------------+:|\n");
+ usb_debug("|:| L | Active | [%lx] |:|\n", (td->ctrlsts & (1UL << 23)) >> 23);
+ usb_debug("|:| & | Stalled | [%lx] |:|\n", (td->ctrlsts & (1UL << 22)) >> 22);
+ 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