diff options
author | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2009-07-27 15:05:08 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-07-28 17:31:13 -0400 |
commit | 28c2d2efb48dec2f0b050affae6d5787d6449e47 (patch) | |
tree | aaa5d3617857f0a40b964f85e371207ce761c373 /drivers/usb/host/xhci-dbg.c | |
parent | 254c80a3a0eb811489f7410c3291f01a60e8e42f (diff) |
USB: xhci: Always align output device contexts to 64 bytes.
Make sure the xHCI output device context is 64-byte aligned. Previous
code was using the same structure for both the output device context and
the input control context. Since the structure had 32 bytes of flags
before the device context, the output device context wouldn't be 64-byte
aligned. Define a new structure to use for the output device context and
clean up the debugging for these two structures.
The copy of the device context in the input control context does *not*
need to be 64-byte aligned.
Signed-off-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 | 101 |
1 files changed, 63 insertions, 38 deletions
diff --git a/drivers/usb/host/xhci-dbg.c b/drivers/usb/host/xhci-dbg.c index 6d62e4abe3c6..d77f8de11256 100644 --- a/drivers/usb/host/xhci-dbg.c +++ b/drivers/usb/host/xhci-dbg.c | |||
@@ -393,78 +393,103 @@ void xhci_dbg_cmd_ptrs(struct xhci_hcd *xhci) | |||
393 | upper_32_bits(val)); | 393 | upper_32_bits(val)); |
394 | } | 394 | } |
395 | 395 | ||
396 | void xhci_dbg_ctx(struct xhci_hcd *xhci, struct xhci_device_control *ctx, dma_addr_t dma, unsigned int last_ep) | 396 | dma_addr_t xhci_dbg_slot_ctx(struct xhci_hcd *xhci, struct xhci_slot_ctx *slot, dma_addr_t dma) |
397 | { | 397 | { |
398 | int i, j; | ||
399 | int last_ep_ctx = 31; | ||
400 | /* Fields are 32 bits wide, DMA addresses are in bytes */ | 398 | /* Fields are 32 bits wide, DMA addresses are in bytes */ |
401 | int field_size = 32 / 8; | 399 | int field_size = 32 / 8; |
402 | 400 | int i; | |
403 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - drop flags\n", | ||
404 | &ctx->drop_flags, (unsigned long long)dma, | ||
405 | ctx->drop_flags); | ||
406 | dma += field_size; | ||
407 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - add flags\n", | ||
408 | &ctx->add_flags, (unsigned long long)dma, | ||
409 | ctx->add_flags); | ||
410 | dma += field_size; | ||
411 | for (i = 0; i < 6; ++i) { | ||
412 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd[%d]\n", | ||
413 | &ctx->rsvd[i], (unsigned long long)dma, | ||
414 | ctx->rsvd[i], i); | ||
415 | dma += field_size; | ||
416 | } | ||
417 | 401 | ||
418 | xhci_dbg(xhci, "Slot Context:\n"); | 402 | xhci_dbg(xhci, "Slot Context:\n"); |
419 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - dev_info\n", | 403 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - dev_info\n", |
420 | &ctx->slot.dev_info, | 404 | &slot->dev_info, |
421 | (unsigned long long)dma, ctx->slot.dev_info); | 405 | (unsigned long long)dma, slot->dev_info); |
422 | dma += field_size; | 406 | dma += field_size; |
423 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - dev_info2\n", | 407 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - dev_info2\n", |
424 | &ctx->slot.dev_info2, | 408 | &slot->dev_info2, |
425 | (unsigned long long)dma, ctx->slot.dev_info2); | 409 | (unsigned long long)dma, slot->dev_info2); |
426 | dma += field_size; | 410 | dma += field_size; |
427 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - tt_info\n", | 411 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - tt_info\n", |
428 | &ctx->slot.tt_info, | 412 | &slot->tt_info, |
429 | (unsigned long long)dma, ctx->slot.tt_info); | 413 | (unsigned long long)dma, slot->tt_info); |
430 | dma += field_size; | 414 | dma += field_size; |
431 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - dev_state\n", | 415 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - dev_state\n", |
432 | &ctx->slot.dev_state, | 416 | &slot->dev_state, |
433 | (unsigned long long)dma, ctx->slot.dev_state); | 417 | (unsigned long long)dma, slot->dev_state); |
434 | dma += field_size; | 418 | dma += field_size; |
435 | for (i = 0; i < 4; ++i) { | 419 | for (i = 0; i < 4; ++i) { |
436 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd[%d]\n", | 420 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd[%d]\n", |
437 | &ctx->slot.reserved[i], (unsigned long long)dma, | 421 | &slot->reserved[i], (unsigned long long)dma, |
438 | ctx->slot.reserved[i], i); | 422 | slot->reserved[i], i); |
439 | dma += field_size; | 423 | dma += field_size; |
440 | } | 424 | } |
441 | 425 | ||
426 | return dma; | ||
427 | } | ||
428 | |||
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) | ||
430 | { | ||
431 | int i, j; | ||
432 | int last_ep_ctx = 31; | ||
433 | /* Fields are 32 bits wide, DMA addresses are in bytes */ | ||
434 | int field_size = 32 / 8; | ||
435 | |||
442 | if (last_ep < 31) | 436 | if (last_ep < 31) |
443 | last_ep_ctx = last_ep + 1; | 437 | last_ep_ctx = last_ep + 1; |
444 | for (i = 0; i < last_ep_ctx; ++i) { | 438 | for (i = 0; i < last_ep_ctx; ++i) { |
445 | xhci_dbg(xhci, "Endpoint %02d Context:\n", i); | 439 | xhci_dbg(xhci, "Endpoint %02d Context:\n", i); |
446 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - ep_info\n", | 440 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - ep_info\n", |
447 | &ctx->ep[i].ep_info, | 441 | &ep[i].ep_info, |
448 | (unsigned long long)dma, ctx->ep[i].ep_info); | 442 | (unsigned long long)dma, ep[i].ep_info); |
449 | dma += field_size; | 443 | dma += field_size; |
450 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - ep_info2\n", | 444 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - ep_info2\n", |
451 | &ctx->ep[i].ep_info2, | 445 | &ep[i].ep_info2, |
452 | (unsigned long long)dma, ctx->ep[i].ep_info2); | 446 | (unsigned long long)dma, ep[i].ep_info2); |
453 | dma += field_size; | 447 | dma += field_size; |
454 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08llx - deq\n", | 448 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08llx - deq\n", |
455 | &ctx->ep[i].deq, | 449 | &ep[i].deq, |
456 | (unsigned long long)dma, ctx->ep[i].deq); | 450 | (unsigned long long)dma, ep[i].deq); |
457 | dma += 2*field_size; | 451 | dma += 2*field_size; |
458 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - tx_info\n", | 452 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - tx_info\n", |
459 | &ctx->ep[i].tx_info, | 453 | &ep[i].tx_info, |
460 | (unsigned long long)dma, ctx->ep[i].tx_info); | 454 | (unsigned long long)dma, ep[i].tx_info); |
461 | dma += field_size; | 455 | dma += field_size; |
462 | for (j = 0; j < 3; ++j) { | 456 | for (j = 0; j < 3; ++j) { |
463 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd[%d]\n", | 457 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd[%d]\n", |
464 | &ctx->ep[i].reserved[j], | 458 | &ep[i].reserved[j], |
465 | (unsigned long long)dma, | 459 | (unsigned long long)dma, |
466 | ctx->ep[i].reserved[j], j); | 460 | ep[i].reserved[j], j); |
467 | dma += field_size; | 461 | dma += field_size; |
468 | } | 462 | } |
469 | } | 463 | } |
464 | return dma; | ||
465 | } | ||
466 | |||
467 | void xhci_dbg_ctx(struct xhci_hcd *xhci, struct xhci_device_control *ctx, dma_addr_t dma, unsigned int last_ep) | ||
468 | { | ||
469 | int i; | ||
470 | /* Fields are 32 bits wide, DMA addresses are in bytes */ | ||
471 | int field_size = 32 / 8; | ||
472 | |||
473 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - drop flags\n", | ||
474 | &ctx->drop_flags, (unsigned long long)dma, | ||
475 | ctx->drop_flags); | ||
476 | dma += field_size; | ||
477 | xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - add flags\n", | ||
478 | &ctx->add_flags, (unsigned long long)dma, | ||
479 | ctx->add_flags); | ||
480 | dma += field_size; | ||
481 | for (i = 0; i < 6; ++i) { | ||
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; | ||
486 | } | ||
487 | dma = xhci_dbg_slot_ctx(xhci, &ctx->slot, dma); | ||
488 | dma = xhci_dbg_ep_ctx(xhci, ctx->ep, dma, last_ep); | ||
489 | } | ||
490 | |||
491 | void xhci_dbg_device_ctx(struct xhci_hcd *xhci, struct xhci_device_ctx *ctx, dma_addr_t dma, unsigned int last_ep) | ||
492 | { | ||
493 | dma = xhci_dbg_slot_ctx(xhci, &ctx->slot, dma); | ||
494 | dma = xhci_dbg_ep_ctx(xhci, ctx->ep, dma, last_ep); | ||
470 | } | 495 | } |