ChangeSet 1.1595.7.33, 2003/07/31 22:51:23-07:00, david-b@pacbell.net

[PATCH] USB: ehci-hcd, show microframe schedules

This updates the ehci periodic schedule dumping code to be
more useful when displaying the interrupt transfer tree:

  - includes start/complete split frame mask in QH
  - gets rid of some needless output (more terse)
  - shows whether IN or OUT tds are queued, and how many

The microframe info isn't yet very interesting, but it's
helpful when a microframe scheduler is in use.  (Which will
be a patch some other time!)


 drivers/usb/host/ehci-dbg.c |   41 +++++++++++++++++++++++++++++++++--------
 1 files changed, 33 insertions(+), 8 deletions(-)


diff -Nru a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c
--- a/drivers/usb/host/ehci-dbg.c	Fri Aug  1 10:53:51 2003
+++ b/drivers/usb/host/ehci-dbg.c	Fri Aug  1 10:53:51 2003
@@ -476,28 +476,53 @@
 		do {
 			switch (tag) {
 			case Q_TYPE_QH:
-				temp = snprintf (next, size, " qh%d/%p",
-						p.qh->period, p.qh);
+				temp = snprintf (next, size, " qh%d-%04x/%p",
+						p.qh->period,
+						le32_to_cpup (&p.qh->hw_info2)
+							/* uframe masks */
+							& 0xffff,
+						p.qh);
 				size -= temp;
 				next += temp;
+				/* don't repeat what follows this qh */
 				for (temp = 0; temp < seen_count; temp++) {
-					if (seen [temp].ptr == p.ptr)
-						break;
+					if (seen [temp].ptr != p.ptr)
+						continue;
+					if (p.qh->qh_next.ptr)
+						temp = snprintf (next, size,
+							" ...");
+					p.ptr = 0;
+					break;
 				}
 				/* show more info the first time around */
 				if (temp == seen_count) {
 					u32	scratch = cpu_to_le32p (
 							&p.qh->hw_info1);
+					struct ehci_qtd	*qtd;
+					char		*type = "";
+
+					/* count tds, get ep direction */
+					temp = 0;
+					list_for_each_entry (qtd,
+							&p.qh->qtd_list,
+							qtd_list) {
+						temp++;
+						switch (0x03 & (le32_to_cpu (
+							qtd->hw_token) >> 8)) {
+						case 0: type = "out"; continue;
+						case 1: type = "in"; continue;
+						}
+					}
 
 					temp = snprintf (next, size,
-						" (%cs dev%d ep%d [%d/%d] %d)",
+						" (%c%d ep%d%s "
+						"[%d/%d] q%d p%d)",
 						speed_char (scratch),
 						scratch & 0x007f,
-						(scratch >> 8) & 0x000f,
+						(scratch >> 8) & 0x000f, type,
 						p.qh->usecs, p.qh->c_usecs,
+						temp,
 						0x7ff & (scratch >> 16));
-
-					/* FIXME TD info too */
 
 					if (seen_count < DBG_SCHED_LIMIT)
 						seen [seen_count++].qh = p.qh;
