diff options
author | John Youn <johnyoun@synopsys.com> | 2009-07-27 15:05:15 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-07-28 17:31:13 -0400 |
commit | d115b04818e57bdbc7ccde4d0660b15e33013dc8 (patch) | |
tree | 48b699c9b81fb0570d03009f353225faad238c64 /drivers/usb/host/xhci-dbg.c | |
parent | 28c2d2efb48dec2f0b050affae6d5787d6449e47 (diff) |
USB: xhci: Support for 64-byte contexts
Adds support for controllers that use 64-byte contexts. The following context
data structures are affected by this: Device, Input, Input Control, Endpoint,
and Slot. To accommodate the use of either 32 or 64-byte contexts, a Device or
Input context can only be accessed through functions which look-up and return
pointers to their contained contexts.
Signed-off-by: John Youn <johnyoun@synopsys.com>
Acked-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/xhci-dbg.c')
-rw-r--r-- | drivers/usb/host/xhci-dbg.c | 125 |
1 files changed, 80 insertions, 45 deletions
diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index d77f8de11256..705e34324156 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c | |||
@@ -393,103 +393,138 @@ void xhci_dbg_cmd_ptrs(struct xhci_hcd *xhci) | |||
393 | upper_32_bits(val)); | 393 | upper_32_bits(val)); |
394 | } | 394 | } |
395 | 395 | ||
396 | dma_addr_t xhci_dbg_slot_ctx(struct xhci_hcd *xhci, struct xhci_slot_ctx *slot, dma_addr_t dma) | 396 | /* Print the last 32 bytes for 64-byte contexts */ |
397 | static void dbg_rsvd64(struct xhci_hcd *xhci, u64 *ctx, dma_addr_t dma) | ||
398 | { | ||
399 | int i; | ||
400 | for (i = 0; i < 4; ++i) { | ||
401 | xhci_dbg(xhci, "@%p (virt) @%08llx " | ||
402 | "(dma) %#08llx - rsvd64[%d]\n", | ||
403 | &ctx[4 + i], (unsigned long long)dma, | ||
404 | ctx[4 + i], i); | ||
405 | dma += 8; | ||
406 | } | ||
407 | } | ||
408 | |||
409 | void xhci_dbg_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx) | ||
397 | { | 410 | { |
398 | /* Fields are 32 bits wide, DMA addresses are in bytes */ | 411 | /* Fields are 32 bits wide, DMA addresses are in bytes */ |
399 | int field_size = 32 / 8; | 412 | int field_size = 32 / 8; |
400 | int i; | 413 | int i; |
401 | 414 | ||
415 | struct xhci_slot_ctx *slot_ctx = xhci_get_slot_ctx(xhci, ctx); | ||
416 | dma_addr_t dma = ctx->dma + ((unsigned long)slot_ctx - (unsigned long)ctx); | ||
417 | int csz = HCC_64BYTE_CONTEXT(xhci->hcc_params); | ||
418 | |||
402 | xhci_dbg(xhci, "Slot Context:\n"); | 419 | xhci_dbg(xhci, "Slot Context:\n"); |
403 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - dev_info\n", | 420 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - dev_info\n", |
404 | &slot->dev_info, | 421 | &slot_ctx->dev_info, |
405 | (unsigned long long)dma, slot->dev_info); | 422 | (unsigned long long)dma, slot_ctx->dev_info); |
406 | dma += field_size; | 423 | dma += field_size; |
407 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - dev_info2\n", | 424 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - dev_info2\n", |
408 | &slot->dev_info2, | 425 | &slot_ctx->dev_info2, |
409 | (unsigned long long)dma, slot->dev_info2); | 426 | (unsigned long long)dma, slot_ctx->dev_info2); |
410 | dma += field_size; | 427 | dma += field_size; |
411 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - tt_info\n", | 428 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - tt_info\n", |
412 | &slot->tt_info, | 429 | &slot_ctx->tt_info, |
413 | (unsigned long long)dma, slot->tt_info); | 430 | (unsigned long long)dma, slot_ctx->tt_info); |
414 | dma += field_size; | 431 | dma += field_size; |
415 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - dev_state\n", | 432 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - dev_state\n", |
416 | &slot->dev_state, | 433 | &slot_ctx->dev_state, |
417 | (unsigned long long)dma, slot->dev_state); | 434 | (unsigned long long)dma, slot_ctx->dev_state); |
418 | dma += field_size; | 435 | dma += field_size; |
419 | for (i = 0; i < 4; ++i) { | 436 | for (i = 0; i < 4; ++i) { |
420 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd[%d]\n", | 437 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd[%d]\n", |
421 | &slot->reserved[i], (unsigned long long)dma, | 438 | &slot_ctx->reserved[i], (unsigned long long)dma, |
422 | slot->reserved[i], i); | 439 | slot_ctx->reserved[i], i); |
423 | dma += field_size; | 440 | dma += field_size; |
424 | } | 441 | } |
425 | 442 | ||
426 | return dma; | 443 | if (csz) |
444 | dbg_rsvd64(xhci, (u64 *)slot_ctx, dma); | ||
427 | } | 445 | } |
428 | 446 | ||
429 | dma_addr_t xhci_dbg_ep_ctx(struct xhci_hcd *xhci, struct xhci_ep_ctx *ep, dma_addr_t dma, unsigned int last_ep) | 447 | void xhci_dbg_ep_ctx(struct xhci_hcd *xhci, |
448 | struct xhci_container_ctx *ctx, | ||
449 | unsigned int last_ep) | ||
430 | { | 450 | { |
431 | int i, j; | 451 | int i, j; |
432 | int last_ep_ctx = 31; | 452 | int last_ep_ctx = 31; |
433 | /* Fields are 32 bits wide, DMA addresses are in bytes */ | 453 | /* Fields are 32 bits wide, DMA addresses are in bytes */ |
434 | int field_size = 32 / 8; | 454 | int field_size = 32 / 8; |
455 | int csz = HCC_64BYTE_CONTEXT(xhci->hcc_params); | ||
435 | 456 | ||
436 | if (last_ep < 31) | 457 | if (last_ep < 31) |
437 | last_ep_ctx = last_ep + 1; | 458 | last_ep_ctx = last_ep + 1; |
438 | for (i = 0; i < last_ep_ctx; ++i) { | 459 | for (i = 0; i < last_ep_ctx; ++i) { |
460 | struct xhci_ep_ctx *ep_ctx = xhci_get_ep_ctx(xhci, ctx, i); | ||
461 | dma_addr_t dma = ctx->dma + | ||
462 | ((unsigned long)ep_ctx - (unsigned long)ctx); | ||
463 | |||
439 | xhci_dbg(xhci, "Endpoint %02d Context:\n", i); | 464 | xhci_dbg(xhci, "Endpoint %02d Context:\n", i); |
440 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - ep_info\n", | 465 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - ep_info\n", |
441 | &ep[i].ep_info, | 466 | &ep_ctx->ep_info, |
442 | (unsigned long long)dma, ep[i].ep_info); | 467 | (unsigned long long)dma, ep_ctx->ep_info); |
443 | dma += field_size; | 468 | dma += field_size; |
444 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - ep_info2\n", | 469 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - ep_info2\n", |
445 | &ep[i].ep_info2, | 470 | &ep_ctx->ep_info2, |
446 | (unsigned long long)dma, ep[i].ep_info2); | 471 | (unsigned long long)dma, ep_ctx->ep_info2); |
447 | dma += field_size; | 472 | dma += field_size; |
448 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08llx - deq\n", | 473 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08llx - deq\n", |
449 | &ep[i].deq, | 474 | &ep_ctx->deq, |
450 | (unsigned long long)dma, ep[i].deq); | 475 | (unsigned long long)dma, ep_ctx->deq); |
451 | dma += 2*field_size; | 476 | dma += 2*field_size; |
452 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - tx_info\n", | 477 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - tx_info\n", |
453 | &ep[i].tx_info, | 478 | &ep_ctx->tx_info, |
454 | (unsigned long long)dma, ep[i].tx_info); | 479 | (unsigned long long)dma, ep_ctx->tx_info); |
455 | dma += field_size; | 480 | dma += field_size; |
456 | for (j = 0; j < 3; ++j) { | 481 | for (j = 0; j < 3; ++j) { |
457 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd[%d]\n", | 482 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd[%d]\n", |
458 | &ep[i].reserved[j], | 483 | &ep_ctx->reserved[j], |
459 | (unsigned long long)dma, | 484 | (unsigned long long)dma, |
460 | ep[i].reserved[j], j); | 485 | ep_ctx->reserved[j], j); |
461 | dma += field_size; | 486 | dma += field_size; |
462 | } | 487 | } |
488 | |||
489 | if (csz) | ||
490 | dbg_rsvd64(xhci, (u64 *)ep_ctx, dma); | ||
463 | } | 491 | } |
464 | return dma; | ||
465 | } | 492 | } |
466 | 493 | ||
467 | void xhci_dbg_ctx(struct xhci_hcd *xhci, struct xhci_device_control *ctx, dma_addr_t dma, unsigned int last_ep) | 494 | void xhci_dbg_ctx(struct xhci_hcd *xhci, |
495 | struct xhci_container_ctx *ctx, | ||
496 | unsigned int last_ep) | ||
468 | { | 497 | { |
469 | int i; | 498 | int i; |
470 | /* Fields are 32 bits wide, DMA addresses are in bytes */ | 499 | /* Fields are 32 bits wide, DMA addresses are in bytes */ |
471 | int field_size = 32 / 8; | 500 | int field_size = 32 / 8; |
472 | 501 | struct xhci_slot_ctx *slot_ctx; | |
473 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - drop flags\n", | 502 | dma_addr_t dma = ctx->dma; |
474 | &ctx->drop_flags, (unsigned long long)dma, | 503 | int csz = HCC_64BYTE_CONTEXT(xhci->hcc_params); |
475 | ctx->drop_flags); | 504 | |
476 | dma += field_size; | 505 | if (ctx->type == XHCI_CTX_TYPE_INPUT) { |
477 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - add flags\n", | 506 | struct xhci_input_control_ctx *ctrl_ctx = |
478 | &ctx->add_flags, (unsigned long long)dma, | 507 | xhci_get_input_control_ctx(xhci, ctx); |
479 | ctx->add_flags); | 508 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - drop flags\n", |
480 | dma += field_size; | 509 | &ctrl_ctx->drop_flags, (unsigned long long)dma, |
481 | for (i = 0; i < 6; ++i) { | 510 | ctrl_ctx->drop_flags); |
482 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd[%d]\n", | ||
483 | &ctx->rsvd[i], (unsigned long long)dma, | ||
484 | ctx->rsvd[i], i); | ||
485 | dma += field_size; | 511 | dma += field_size; |
512 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - add flags\n", | ||
513 | &ctrl_ctx->add_flags, (unsigned long long)dma, | ||
514 | ctrl_ctx->add_flags); | ||
515 | dma += field_size; | ||
516 | for (i = 0; i < 6; ++i) { | ||
517 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd2[%d]\n", | ||
518 | &ctrl_ctx->rsvd2[i], (unsigned long long)dma, | ||
519 | ctrl_ctx->rsvd2[i], i); | ||
520 | dma += field_size; | ||
521 | } | ||
522 | |||
523 | if (csz) | ||
524 | dbg_rsvd64(xhci, (u64 *)ctrl_ctx, dma); | ||
486 | } | 525 | } |
487 | dma = xhci_dbg_slot_ctx(xhci, &ctx->slot, dma); | ||
488 | dma = xhci_dbg_ep_ctx(xhci, ctx->ep, dma, last_ep); | ||
489 | } | ||
490 | 526 | ||
491 | void xhci_dbg_device_ctx(struct xhci_hcd *xhci, struct xhci_device_ctx *ctx, dma_addr_t dma, unsigned int last_ep) | 527 | slot_ctx = xhci_get_slot_ctx(xhci, ctx); |
492 | { | 528 | xhci_dbg_slot_ctx(xhci, ctx); |
493 | dma = xhci_dbg_slot_ctx(xhci, &ctx->slot, dma); | 529 | xhci_dbg_ep_ctx(xhci, ctx, last_ep); |
494 | dma = xhci_dbg_ep_ctx(xhci, ctx->ep, dma, last_ep); | ||
495 | } | 530 | } |