diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/usb/host/uhci-debug.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/usb/host/uhci-debug.c')
-rw-r--r-- | drivers/usb/host/uhci-debug.c | 89 |
1 files changed, 47 insertions, 42 deletions
diff --git a/drivers/usb/host/uhci-debug.c b/drivers/usb/host/uhci-debug.c index 6e7fb5f38db6..fc0b0daac93d 100644 --- a/drivers/usb/host/uhci-debug.c +++ b/drivers/usb/host/uhci-debug.c | |||
@@ -12,7 +12,6 @@ | |||
12 | #include <linux/slab.h> | 12 | #include <linux/slab.h> |
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/debugfs.h> | 14 | #include <linux/debugfs.h> |
15 | #include <linux/smp_lock.h> | ||
16 | #include <asm/io.h> | 15 | #include <asm/io.h> |
17 | 16 | ||
18 | #include "uhci-hcd.h" | 17 | #include "uhci-hcd.h" |
@@ -38,7 +37,8 @@ static void lprintk(char *buf) | |||
38 | } | 37 | } |
39 | } | 38 | } |
40 | 39 | ||
41 | static int uhci_show_td(struct uhci_td *td, char *buf, int len, int space) | 40 | static int uhci_show_td(struct uhci_hcd *uhci, struct uhci_td *td, char *buf, |
41 | int len, int space) | ||
42 | { | 42 | { |
43 | char *out = buf; | 43 | char *out = buf; |
44 | char *spid; | 44 | char *spid; |
@@ -48,8 +48,9 @@ static int uhci_show_td(struct uhci_td *td, char *buf, int len, int space) | |||
48 | if (len < 160) | 48 | if (len < 160) |
49 | return 0; | 49 | return 0; |
50 | 50 | ||
51 | status = td_status(td); | 51 | status = td_status(uhci, td); |
52 | out += sprintf(out, "%*s[%p] link (%08x) ", space, "", td, le32_to_cpu(td->link)); | 52 | out += sprintf(out, "%*s[%p] link (%08x) ", space, "", td, |
53 | hc32_to_cpu(uhci, td->link)); | ||
53 | out += sprintf(out, "e%d %s%s%s%s%s%s%s%s%s%sLength=%x ", | 54 | out += sprintf(out, "e%d %s%s%s%s%s%s%s%s%s%sLength=%x ", |
54 | ((status >> 27) & 3), | 55 | ((status >> 27) & 3), |
55 | (status & TD_CTRL_SPD) ? "SPD " : "", | 56 | (status & TD_CTRL_SPD) ? "SPD " : "", |
@@ -64,7 +65,7 @@ static int uhci_show_td(struct uhci_td *td, char *buf, int len, int space) | |||
64 | (status & TD_CTRL_BITSTUFF) ? "BitStuff " : "", | 65 | (status & TD_CTRL_BITSTUFF) ? "BitStuff " : "", |
65 | status & 0x7ff); | 66 | status & 0x7ff); |
66 | 67 | ||
67 | token = td_token(td); | 68 | token = td_token(uhci, td); |
68 | switch (uhci_packetid(token)) { | 69 | switch (uhci_packetid(token)) { |
69 | case USB_PID_SETUP: | 70 | case USB_PID_SETUP: |
70 | spid = "SETUP"; | 71 | spid = "SETUP"; |
@@ -87,12 +88,13 @@ static int uhci_show_td(struct uhci_td *td, char *buf, int len, int space) | |||
87 | (token >> 8) & 127, | 88 | (token >> 8) & 127, |
88 | (token & 0xff), | 89 | (token & 0xff), |
89 | spid); | 90 | spid); |
90 | out += sprintf(out, "(buf=%08x)\n", le32_to_cpu(td->buffer)); | 91 | out += sprintf(out, "(buf=%08x)\n", hc32_to_cpu(uhci, td->buffer)); |
91 | 92 | ||
92 | return out - buf; | 93 | return out - buf; |
93 | } | 94 | } |
94 | 95 | ||
95 | static int uhci_show_urbp(struct urb_priv *urbp, char *buf, int len, int space) | 96 | static int uhci_show_urbp(struct uhci_hcd *uhci, struct urb_priv *urbp, |
97 | char *buf, int len, int space) | ||
96 | { | 98 | { |
97 | char *out = buf; | 99 | char *out = buf; |
98 | struct uhci_td *td; | 100 | struct uhci_td *td; |
@@ -131,9 +133,10 @@ static int uhci_show_urbp(struct urb_priv *urbp, char *buf, int len, int space) | |||
131 | if (urbp->qh->type != USB_ENDPOINT_XFER_ISOC && | 133 | if (urbp->qh->type != USB_ENDPOINT_XFER_ISOC && |
132 | (++i <= 10 || debug > 2)) { | 134 | (++i <= 10 || debug > 2)) { |
133 | out += sprintf(out, "%*s%d: ", space + 2, "", i); | 135 | out += sprintf(out, "%*s%d: ", space + 2, "", i); |
134 | out += uhci_show_td(td, out, len - (out - buf), 0); | 136 | out += uhci_show_td(uhci, td, out, |
137 | len - (out - buf), 0); | ||
135 | } else { | 138 | } else { |
136 | if (td_status(td) & TD_CTRL_ACTIVE) | 139 | if (td_status(uhci, td) & TD_CTRL_ACTIVE) |
137 | ++nactive; | 140 | ++nactive; |
138 | else | 141 | else |
139 | ++ninactive; | 142 | ++ninactive; |
@@ -152,7 +155,7 @@ static int uhci_show_qh(struct uhci_hcd *uhci, | |||
152 | { | 155 | { |
153 | char *out = buf; | 156 | char *out = buf; |
154 | int i, nurbs; | 157 | int i, nurbs; |
155 | __le32 element = qh_element(qh); | 158 | __hc32 element = qh_element(qh); |
156 | char *qtype; | 159 | char *qtype; |
157 | 160 | ||
158 | /* Try to make sure there's enough memory */ | 161 | /* Try to make sure there's enough memory */ |
@@ -169,7 +172,8 @@ static int uhci_show_qh(struct uhci_hcd *uhci, | |||
169 | 172 | ||
170 | out += sprintf(out, "%*s[%p] %s QH link (%08x) element (%08x)\n", | 173 | out += sprintf(out, "%*s[%p] %s QH link (%08x) element (%08x)\n", |
171 | space, "", qh, qtype, | 174 | space, "", qh, qtype, |
172 | le32_to_cpu(qh->link), le32_to_cpu(element)); | 175 | hc32_to_cpu(uhci, qh->link), |
176 | hc32_to_cpu(uhci, element)); | ||
173 | if (qh->type == USB_ENDPOINT_XFER_ISOC) | 177 | if (qh->type == USB_ENDPOINT_XFER_ISOC) |
174 | out += sprintf(out, "%*s period %d phase %d load %d us, " | 178 | out += sprintf(out, "%*s period %d phase %d load %d us, " |
175 | "frame %x desc [%p]\n", | 179 | "frame %x desc [%p]\n", |
@@ -179,22 +183,22 @@ static int uhci_show_qh(struct uhci_hcd *uhci, | |||
179 | out += sprintf(out, "%*s period %d phase %d load %d us\n", | 183 | out += sprintf(out, "%*s period %d phase %d load %d us\n", |
180 | space, "", qh->period, qh->phase, qh->load); | 184 | space, "", qh->period, qh->phase, qh->load); |
181 | 185 | ||
182 | if (element & UHCI_PTR_QH) | 186 | if (element & UHCI_PTR_QH(uhci)) |
183 | out += sprintf(out, "%*s Element points to QH (bug?)\n", space, ""); | 187 | out += sprintf(out, "%*s Element points to QH (bug?)\n", space, ""); |
184 | 188 | ||
185 | if (element & UHCI_PTR_DEPTH) | 189 | if (element & UHCI_PTR_DEPTH(uhci)) |
186 | out += sprintf(out, "%*s Depth traverse\n", space, ""); | 190 | out += sprintf(out, "%*s Depth traverse\n", space, ""); |
187 | 191 | ||
188 | if (element & cpu_to_le32(8)) | 192 | if (element & cpu_to_hc32(uhci, 8)) |
189 | out += sprintf(out, "%*s Bit 3 set (bug?)\n", space, ""); | 193 | out += sprintf(out, "%*s Bit 3 set (bug?)\n", space, ""); |
190 | 194 | ||
191 | if (!(element & ~(UHCI_PTR_QH | UHCI_PTR_DEPTH))) | 195 | if (!(element & ~(UHCI_PTR_QH(uhci) | UHCI_PTR_DEPTH(uhci)))) |
192 | out += sprintf(out, "%*s Element is NULL (bug?)\n", space, ""); | 196 | out += sprintf(out, "%*s Element is NULL (bug?)\n", space, ""); |
193 | 197 | ||
194 | if (list_empty(&qh->queue)) { | 198 | if (list_empty(&qh->queue)) { |
195 | out += sprintf(out, "%*s queue is empty\n", space, ""); | 199 | out += sprintf(out, "%*s queue is empty\n", space, ""); |
196 | if (qh == uhci->skel_async_qh) | 200 | if (qh == uhci->skel_async_qh) |
197 | out += uhci_show_td(uhci->term_td, out, | 201 | out += uhci_show_td(uhci, uhci->term_td, out, |
198 | len - (out - buf), 0); | 202 | len - (out - buf), 0); |
199 | } else { | 203 | } else { |
200 | struct urb_priv *urbp = list_entry(qh->queue.next, | 204 | struct urb_priv *urbp = list_entry(qh->queue.next, |
@@ -202,13 +206,13 @@ static int uhci_show_qh(struct uhci_hcd *uhci, | |||
202 | struct uhci_td *td = list_entry(urbp->td_list.next, | 206 | struct uhci_td *td = list_entry(urbp->td_list.next, |
203 | struct uhci_td, list); | 207 | struct uhci_td, list); |
204 | 208 | ||
205 | if (element != LINK_TO_TD(td)) | 209 | if (element != LINK_TO_TD(uhci, td)) |
206 | out += sprintf(out, "%*s Element != First TD\n", | 210 | out += sprintf(out, "%*s Element != First TD\n", |
207 | space, ""); | 211 | space, ""); |
208 | i = nurbs = 0; | 212 | i = nurbs = 0; |
209 | list_for_each_entry(urbp, &qh->queue, node) { | 213 | list_for_each_entry(urbp, &qh->queue, node) { |
210 | if (++i <= 10) | 214 | if (++i <= 10) |
211 | out += uhci_show_urbp(urbp, out, | 215 | out += uhci_show_urbp(uhci, urbp, out, |
212 | len - (out - buf), space + 2); | 216 | len - (out - buf), space + 2); |
213 | else | 217 | else |
214 | ++nurbs; | 218 | ++nurbs; |
@@ -220,7 +224,8 @@ static int uhci_show_qh(struct uhci_hcd *uhci, | |||
220 | 224 | ||
221 | if (qh->dummy_td) { | 225 | if (qh->dummy_td) { |
222 | out += sprintf(out, "%*s Dummy TD\n", space, ""); | 226 | out += sprintf(out, "%*s Dummy TD\n", space, ""); |
223 | out += uhci_show_td(qh->dummy_td, out, len - (out - buf), 0); | 227 | out += uhci_show_td(uhci, qh->dummy_td, out, |
228 | len - (out - buf), 0); | ||
224 | } | 229 | } |
225 | 230 | ||
226 | return out - buf; | 231 | return out - buf; |
@@ -286,7 +291,6 @@ static int uhci_show_root_hub_state(struct uhci_hcd *uhci, char *buf, int len) | |||
286 | static int uhci_show_status(struct uhci_hcd *uhci, char *buf, int len) | 291 | static int uhci_show_status(struct uhci_hcd *uhci, char *buf, int len) |
287 | { | 292 | { |
288 | char *out = buf; | 293 | char *out = buf; |
289 | unsigned long io_addr = uhci->io_addr; | ||
290 | unsigned short usbcmd, usbstat, usbint, usbfrnum; | 294 | unsigned short usbcmd, usbstat, usbint, usbfrnum; |
291 | unsigned int flbaseadd; | 295 | unsigned int flbaseadd; |
292 | unsigned char sof; | 296 | unsigned char sof; |
@@ -296,14 +300,14 @@ static int uhci_show_status(struct uhci_hcd *uhci, char *buf, int len) | |||
296 | if (len < 80 * 9) | 300 | if (len < 80 * 9) |
297 | return 0; | 301 | return 0; |
298 | 302 | ||
299 | usbcmd = inw(io_addr + 0); | 303 | usbcmd = uhci_readw(uhci, 0); |
300 | usbstat = inw(io_addr + 2); | 304 | usbstat = uhci_readw(uhci, 2); |
301 | usbint = inw(io_addr + 4); | 305 | usbint = uhci_readw(uhci, 4); |
302 | usbfrnum = inw(io_addr + 6); | 306 | usbfrnum = uhci_readw(uhci, 6); |
303 | flbaseadd = inl(io_addr + 8); | 307 | flbaseadd = uhci_readl(uhci, 8); |
304 | sof = inb(io_addr + 12); | 308 | sof = uhci_readb(uhci, 12); |
305 | portsc1 = inw(io_addr + 16); | 309 | portsc1 = uhci_readw(uhci, 16); |
306 | portsc2 = inw(io_addr + 18); | 310 | portsc2 = uhci_readw(uhci, 18); |
307 | 311 | ||
308 | out += sprintf(out, " usbcmd = %04x %s%s%s%s%s%s%s%s\n", | 312 | out += sprintf(out, " usbcmd = %04x %s%s%s%s%s%s%s%s\n", |
309 | usbcmd, | 313 | usbcmd, |
@@ -348,8 +352,8 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len) | |||
348 | struct uhci_td *td; | 352 | struct uhci_td *td; |
349 | struct list_head *tmp, *head; | 353 | struct list_head *tmp, *head; |
350 | int nframes, nerrs; | 354 | int nframes, nerrs; |
351 | __le32 link; | 355 | __hc32 link; |
352 | __le32 fsbr_link; | 356 | __hc32 fsbr_link; |
353 | 357 | ||
354 | static const char * const qh_names[] = { | 358 | static const char * const qh_names[] = { |
355 | "unlink", "iso", "int128", "int64", "int32", "int16", | 359 | "unlink", "iso", "int128", "int64", "int32", "int16", |
@@ -377,7 +381,7 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len) | |||
377 | nframes = 10; | 381 | nframes = 10; |
378 | nerrs = 0; | 382 | nerrs = 0; |
379 | for (i = 0; i < UHCI_NUMFRAMES; ++i) { | 383 | for (i = 0; i < UHCI_NUMFRAMES; ++i) { |
380 | __le32 qh_dma; | 384 | __hc32 qh_dma; |
381 | 385 | ||
382 | j = 0; | 386 | j = 0; |
383 | td = uhci->frame_cpu[i]; | 387 | td = uhci->frame_cpu[i]; |
@@ -387,7 +391,7 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len) | |||
387 | 391 | ||
388 | if (nframes > 0) { | 392 | if (nframes > 0) { |
389 | out += sprintf(out, "- Frame %d -> (%08x)\n", | 393 | out += sprintf(out, "- Frame %d -> (%08x)\n", |
390 | i, le32_to_cpu(link)); | 394 | i, hc32_to_cpu(uhci, link)); |
391 | j = 1; | 395 | j = 1; |
392 | } | 396 | } |
393 | 397 | ||
@@ -396,7 +400,7 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len) | |||
396 | do { | 400 | do { |
397 | td = list_entry(tmp, struct uhci_td, fl_list); | 401 | td = list_entry(tmp, struct uhci_td, fl_list); |
398 | tmp = tmp->next; | 402 | tmp = tmp->next; |
399 | if (link != LINK_TO_TD(td)) { | 403 | if (link != LINK_TO_TD(uhci, td)) { |
400 | if (nframes > 0) | 404 | if (nframes > 0) |
401 | out += sprintf(out, " link does " | 405 | out += sprintf(out, " link does " |
402 | "not match list entry!\n"); | 406 | "not match list entry!\n"); |
@@ -404,7 +408,7 @@ static int uhci_sprint_schedule(struct uhci_hcd *uhci, char *buf, int len) | |||
404 | ++nerrs; | 408 | ++nerrs; |
405 | } | 409 | } |
406 | if (nframes > 0) | 410 | if (nframes > 0) |
407 | out += uhci_show_td(td, out, | 411 | out += uhci_show_td(uhci, td, out, |
408 | len - (out - buf), 4); | 412 | len - (out - buf), 4); |
409 | link = td->link; | 413 | link = td->link; |
410 | } while (tmp != head); | 414 | } while (tmp != head); |
@@ -416,11 +420,12 @@ check_link: | |||
416 | if (!j) { | 420 | if (!j) { |
417 | out += sprintf(out, | 421 | out += sprintf(out, |
418 | "- Frame %d -> (%08x)\n", | 422 | "- Frame %d -> (%08x)\n", |
419 | i, le32_to_cpu(link)); | 423 | i, hc32_to_cpu(uhci, link)); |
420 | j = 1; | 424 | j = 1; |
421 | } | 425 | } |
422 | out += sprintf(out, " link does not match " | 426 | out += sprintf(out, " link does not match " |
423 | "QH (%08x)!\n", le32_to_cpu(qh_dma)); | 427 | "QH (%08x)!\n", |
428 | hc32_to_cpu(uhci, qh_dma)); | ||
424 | } else | 429 | } else |
425 | ++nerrs; | 430 | ++nerrs; |
426 | } | 431 | } |
@@ -441,11 +446,11 @@ check_link: | |||
441 | 446 | ||
442 | /* Last QH is the Terminating QH, it's different */ | 447 | /* Last QH is the Terminating QH, it's different */ |
443 | if (i == SKEL_TERM) { | 448 | if (i == SKEL_TERM) { |
444 | if (qh_element(qh) != LINK_TO_TD(uhci->term_td)) | 449 | if (qh_element(qh) != LINK_TO_TD(uhci, uhci->term_td)) |
445 | out += sprintf(out, " skel_term_qh element is not set to term_td!\n"); | 450 | out += sprintf(out, " skel_term_qh element is not set to term_td!\n"); |
446 | link = fsbr_link; | 451 | link = fsbr_link; |
447 | if (!link) | 452 | if (!link) |
448 | link = LINK_TO_QH(uhci->skel_term_qh); | 453 | link = LINK_TO_QH(uhci, uhci->skel_term_qh); |
449 | goto check_qh_link; | 454 | goto check_qh_link; |
450 | } | 455 | } |
451 | 456 | ||
@@ -459,20 +464,20 @@ check_link: | |||
459 | out += uhci_show_qh(uhci, qh, out, | 464 | out += uhci_show_qh(uhci, qh, out, |
460 | len - (out - buf), 4); | 465 | len - (out - buf), 4); |
461 | if (!fsbr_link && qh->skel >= SKEL_FSBR) | 466 | if (!fsbr_link && qh->skel >= SKEL_FSBR) |
462 | fsbr_link = LINK_TO_QH(qh); | 467 | fsbr_link = LINK_TO_QH(uhci, qh); |
463 | } | 468 | } |
464 | if ((cnt -= 10) > 0) | 469 | if ((cnt -= 10) > 0) |
465 | out += sprintf(out, " Skipped %d QHs\n", cnt); | 470 | out += sprintf(out, " Skipped %d QHs\n", cnt); |
466 | 471 | ||
467 | link = UHCI_PTR_TERM; | 472 | link = UHCI_PTR_TERM(uhci); |
468 | if (i <= SKEL_ISO) | 473 | if (i <= SKEL_ISO) |
469 | ; | 474 | ; |
470 | else if (i < SKEL_ASYNC) | 475 | else if (i < SKEL_ASYNC) |
471 | link = LINK_TO_QH(uhci->skel_async_qh); | 476 | link = LINK_TO_QH(uhci, uhci->skel_async_qh); |
472 | else if (!uhci->fsbr_is_on) | 477 | else if (!uhci->fsbr_is_on) |
473 | ; | 478 | ; |
474 | else | 479 | else |
475 | link = LINK_TO_QH(uhci->skel_term_qh); | 480 | link = LINK_TO_QH(uhci, uhci->skel_term_qh); |
476 | check_qh_link: | 481 | check_qh_link: |
477 | if (qh->link != link) | 482 | if (qh->link != link) |
478 | out += sprintf(out, " last QH not linked to next skeleton!\n"); | 483 | out += sprintf(out, " last QH not linked to next skeleton!\n"); |