~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/drivers/usb/usb-uhci-debug.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifdef DEBUG
  2 static void __attribute__((__unused__)) uhci_show_qh (puhci_desc_t qh)
  3 {
  4         if (qh->type != QH_TYPE) {
  5                 dbg("qh has not QH_TYPE");
  6                 return;
  7         }
  8         dbg("QH @ %p/%08lX:", qh, virt_to_bus (qh));
  9 
 10         if (qh->hw.qh.head & UHCI_PTR_TERM)
 11                 dbg("    Head Terminate");
 12         else 
 13                 dbg("    Head: %s @ %08X",
 14                     (qh->hw.qh.head & UHCI_PTR_QH?"QH":"TD"),
 15                     qh->hw.qh.head & ~UHCI_PTR_BITS);
 16 
 17         if (qh->hw.qh.element & UHCI_PTR_TERM)
 18                 dbg("    Element Terminate");
 19         else 
 20                 dbg("    Element: %s @ %08X",
 21                     (qh->hw.qh.element & UHCI_PTR_QH?"QH":"TD"),
 22                     qh->hw.qh.element & ~UHCI_PTR_BITS);
 23 }
 24 #endif
 25 
 26 static void uhci_show_td (puhci_desc_t td)
 27 {
 28         char *spid;
 29         
 30         switch (td->hw.td.info & 0xff) {
 31         case USB_PID_SETUP:
 32                 spid = "SETUP";
 33                 break;
 34         case USB_PID_OUT:
 35                 spid = " OUT ";
 36                 break;
 37         case USB_PID_IN:
 38                 spid = " IN  ";
 39                 break;
 40         default:
 41                 spid = "  ?  ";
 42                 break;
 43         }
 44 
 45         warn("  TD @ %p/%08lX, MaxLen=%02x DT%d EP=%x Dev=%x PID=(%s) buf=%08x",
 46              td, virt_to_bus (td),
 47              td->hw.td.info >> 21,
 48              ((td->hw.td.info >> 19) & 1),
 49              (td->hw.td.info >> 15) & 15,
 50              (td->hw.td.info >> 8) & 127,
 51              spid,
 52              td->hw.td.buffer);
 53 
 54         warn("    Len=%02x e%d %s%s%s%s%s%s%s%s%s%s",
 55              td->hw.td.status & 0x7ff,
 56              ((td->hw.td.status >> 27) & 3),
 57              (td->hw.td.status & TD_CTRL_SPD) ? "SPD " : "",
 58              (td->hw.td.status & TD_CTRL_LS) ? "LS " : "",
 59              (td->hw.td.status & TD_CTRL_IOC) ? "IOC " : "",
 60              (td->hw.td.status & TD_CTRL_ACTIVE) ? "Active " : "",
 61              (td->hw.td.status & TD_CTRL_STALLED) ? "Stalled " : "",
 62              (td->hw.td.status & TD_CTRL_DBUFERR) ? "DataBufErr " : "",
 63              (td->hw.td.status & TD_CTRL_BABBLE) ? "Babble " : "",
 64              (td->hw.td.status & TD_CTRL_NAK) ? "NAK " : "",
 65              (td->hw.td.status & TD_CTRL_CRCTIMEO) ? "CRC/Timeo " : "",
 66              (td->hw.td.status & TD_CTRL_BITSTUFF) ? "BitStuff " : ""
 67                 );
 68 
 69         if (td->hw.td.link & UHCI_PTR_TERM)
 70                 warn("   TD Link Terminate");
 71         else 
 72                 warn("    Link points to %s @ %08x, %s",
 73                      (td->hw.td.link & UHCI_PTR_QH?"QH":"TD"),
 74                      td->hw.td.link & ~UHCI_PTR_BITS,
 75                      (td->hw.td.link & UHCI_PTR_DEPTH ? "Depth first" : "Breadth first"));
 76 }
 77 #ifdef DEBUG
 78 static void __attribute__((__unused__)) uhci_show_td_queue (puhci_desc_t td)
 79 {
 80         //dbg("uhci_show_td_queue %p (%08lX):", td, virt_to_bus (td));
 81         while (1) {
 82                 uhci_show_td (td);
 83                 if (td->hw.td.link & UHCI_PTR_TERM)
 84                         break;
 85                 if (td != bus_to_virt (td->hw.td.link & ~UHCI_PTR_BITS))
 86                         td = bus_to_virt (td->hw.td.link & ~UHCI_PTR_BITS);
 87                 else {
 88                         dbg("td points to itself!");
 89                         break;
 90                 }
 91         }
 92 }
 93 
 94 static void __attribute__((__unused__)) uhci_show_queue (puhci_desc_t qh)
 95 {
 96         uhci_desc_t *start_qh=qh;
 97 
 98         dbg("uhci_show_queue %p:", qh);
 99         while (1) {
100                 uhci_show_qh (qh);
101 
102                 if (!(qh->hw.qh.element & UHCI_PTR_TERM))
103                         uhci_show_td_queue (bus_to_virt (qh->hw.qh.element & ~UHCI_PTR_BITS));
104 
105                 if (qh->hw.qh.head & UHCI_PTR_TERM)
106                         break;
107 
108                 if (qh != bus_to_virt (qh->hw.qh.head & ~UHCI_PTR_BITS))
109                         qh = bus_to_virt (qh->hw.qh.head & ~UHCI_PTR_BITS);
110                 else {
111                         dbg("qh points to itself!");
112                         break;
113                 }
114                 
115                 if (qh==start_qh) { // avoid loop
116                         dbg("Loop detect");
117                         break;
118                 }
119         }               
120 }
121 
122 static void __attribute__((__unused__)) uhci_show_sc (int port, unsigned short status)
123 {
124         dbg("  stat%d     =     %04x   %s%s%s%s%s%s%s%s",
125              port,
126              status,
127              (status & USBPORTSC_SUSP) ? "PortSuspend " : "",
128              (status & USBPORTSC_PR) ? "PortReset " : "",
129              (status & USBPORTSC_LSDA) ? "LowSpeed " : "",
130              (status & USBPORTSC_RD) ? "ResumeDetect " : "",
131              (status & USBPORTSC_PEC) ? "EnableChange " : "",
132              (status & USBPORTSC_PE) ? "PortEnabled " : "",
133              (status & USBPORTSC_CSC) ? "ConnectChange " : "",
134              (status & USBPORTSC_CCS) ? "PortConnected " : "");
135 }
136 
137 void uhci_show_status (puhci_t s)
138 {
139         unsigned int io_addr = s->io_addr;
140         unsigned short usbcmd, usbstat, usbint, usbfrnum;
141         unsigned int flbaseadd;
142         unsigned char sof;
143         unsigned short portsc1, portsc2;
144 
145         usbcmd = inw (io_addr + 0);
146         usbstat = inw (io_addr + 2);
147         usbint = inw (io_addr + 4);
148         usbfrnum = inw (io_addr + 6);
149         flbaseadd = inl (io_addr + 8);
150         sof = inb (io_addr + 12);
151         portsc1 = inw (io_addr + 16);
152         portsc2 = inw (io_addr + 18);
153 
154         dbg("  usbcmd    =     %04x   %s%s%s%s%s%s%s%s",
155              usbcmd,
156              (usbcmd & USBCMD_MAXP) ? "Maxp64 " : "Maxp32 ",
157              (usbcmd & USBCMD_CF) ? "CF " : "",
158              (usbcmd & USBCMD_SWDBG) ? "SWDBG " : "",
159              (usbcmd & USBCMD_FGR) ? "FGR " : "",
160              (usbcmd & USBCMD_EGSM) ? "EGSM " : "",
161              (usbcmd & USBCMD_GRESET) ? "GRESET " : "",
162              (usbcmd & USBCMD_HCRESET) ? "HCRESET " : "",
163              (usbcmd & USBCMD_RS) ? "RS " : "");
164 
165         dbg("  usbstat   =     %04x   %s%s%s%s%s%s",
166              usbstat,
167              (usbstat & USBSTS_HCH) ? "HCHalted " : "",
168              (usbstat & USBSTS_HCPE) ? "HostControllerProcessError " : "",
169              (usbstat & USBSTS_HSE) ? "HostSystemError " : "",
170              (usbstat & USBSTS_RD) ? "ResumeDetect " : "",
171              (usbstat & USBSTS_ERROR) ? "USBError " : "",
172              (usbstat & USBSTS_USBINT) ? "USBINT " : "");
173 
174         dbg("  usbint    =     %04x", usbint);
175         dbg("  usbfrnum  =   (%d)%03x", (usbfrnum >> 10) & 1,
176              0xfff & (4 * (unsigned int) usbfrnum));
177         dbg("  flbaseadd = %08x", flbaseadd);
178         dbg("  sof       =       %02x", sof);
179         uhci_show_sc (1, portsc1);
180         uhci_show_sc (2, portsc2);
181 }
182 #endif
183 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.