diff options
author | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2009-07-27 15:03:46 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-07-28 17:31:12 -0400 |
commit | 66e49d8774fa03539713e8f91169c37c05df1e94 (patch) | |
tree | e513ccdc346d7ff2d3e4c838c3023e6d73a49d53 /drivers/usb/host/xhci-ring.c | |
parent | 2d83109be62edd9647c45d7ed2b916b03974a7ec (diff) |
USB: xhci: Make debugging more verbose.
Add more debugging to the irq handler, slot context initialization, ring
operations, URB cancellation, and MMIO writes.
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-ring.c')
-rw-r--r-- | drivers/usb/host/xhci-ring.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index fe9541a89a3d..1fc0decfa0ac 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -135,6 +135,7 @@ static void next_trb(struct xhci_hcd *xhci, | |||
135 | static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer) | 135 | static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer) |
136 | { | 136 | { |
137 | union xhci_trb *next = ++(ring->dequeue); | 137 | union xhci_trb *next = ++(ring->dequeue); |
138 | unsigned long long addr; | ||
138 | 139 | ||
139 | ring->deq_updates++; | 140 | ring->deq_updates++; |
140 | /* Update the dequeue pointer further if that was a link TRB or we're at | 141 | /* Update the dequeue pointer further if that was a link TRB or we're at |
@@ -152,6 +153,13 @@ static void inc_deq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer | |||
152 | ring->dequeue = ring->deq_seg->trbs; | 153 | ring->dequeue = ring->deq_seg->trbs; |
153 | next = ring->dequeue; | 154 | next = ring->dequeue; |
154 | } | 155 | } |
156 | addr = (unsigned long long) xhci_trb_virt_to_dma(ring->deq_seg, ring->dequeue); | ||
157 | if (ring == xhci->event_ring) | ||
158 | xhci_dbg(xhci, "Event ring deq = 0x%llx (DMA)\n", addr); | ||
159 | else if (ring == xhci->cmd_ring) | ||
160 | xhci_dbg(xhci, "Command ring deq = 0x%llx (DMA)\n", addr); | ||
161 | else | ||
162 | xhci_dbg(xhci, "Ring deq = 0x%llx (DMA)\n", addr); | ||
155 | } | 163 | } |
156 | 164 | ||
157 | /* | 165 | /* |
@@ -171,6 +179,7 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer | |||
171 | { | 179 | { |
172 | u32 chain; | 180 | u32 chain; |
173 | union xhci_trb *next; | 181 | union xhci_trb *next; |
182 | unsigned long long addr; | ||
174 | 183 | ||
175 | chain = ring->enqueue->generic.field[3] & TRB_CHAIN; | 184 | chain = ring->enqueue->generic.field[3] & TRB_CHAIN; |
176 | next = ++(ring->enqueue); | 185 | next = ++(ring->enqueue); |
@@ -204,6 +213,13 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring, bool consumer | |||
204 | ring->enqueue = ring->enq_seg->trbs; | 213 | ring->enqueue = ring->enq_seg->trbs; |
205 | next = ring->enqueue; | 214 | next = ring->enqueue; |
206 | } | 215 | } |
216 | addr = (unsigned long long) xhci_trb_virt_to_dma(ring->enq_seg, ring->enqueue); | ||
217 | if (ring == xhci->event_ring) | ||
218 | xhci_dbg(xhci, "Event ring enq = 0x%llx (DMA)\n", addr); | ||
219 | else if (ring == xhci->cmd_ring) | ||
220 | xhci_dbg(xhci, "Command ring enq = 0x%llx (DMA)\n", addr); | ||
221 | else | ||
222 | xhci_dbg(xhci, "Ring enq = 0x%llx (DMA)\n", addr); | ||
207 | } | 223 | } |
208 | 224 | ||
209 | /* | 225 | /* |
@@ -252,8 +268,7 @@ void xhci_set_hc_event_deq(struct xhci_hcd *xhci) | |||
252 | * there might be more events to service. | 268 | * there might be more events to service. |
253 | */ | 269 | */ |
254 | temp &= ~ERST_EHB; | 270 | temp &= ~ERST_EHB; |
255 | if (!in_interrupt()) | 271 | xhci_dbg(xhci, "// Write event ring dequeue pointer, preserving EHB bit\n"); |
256 | xhci_dbg(xhci, "// Write event ring dequeue pointer, preserving EHB bit\n"); | ||
257 | xhci_write_64(xhci, ((u64) deq & (u64) ~ERST_PTR_MASK) | temp, | 272 | xhci_write_64(xhci, ((u64) deq & (u64) ~ERST_PTR_MASK) | temp, |
258 | &xhci->ir_set->erst_dequeue); | 273 | &xhci->ir_set->erst_dequeue); |
259 | } | 274 | } |
@@ -781,6 +796,7 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
781 | struct urb *urb = 0; | 796 | struct urb *urb = 0; |
782 | int status = -EINPROGRESS; | 797 | int status = -EINPROGRESS; |
783 | 798 | ||
799 | xhci_dbg(xhci, "In %s\n", __func__); | ||
784 | xdev = xhci->devs[TRB_TO_SLOT_ID(event->flags)]; | 800 | xdev = xhci->devs[TRB_TO_SLOT_ID(event->flags)]; |
785 | if (!xdev) { | 801 | if (!xdev) { |
786 | xhci_err(xhci, "ERROR Transfer event pointed to bad slot\n"); | 802 | xhci_err(xhci, "ERROR Transfer event pointed to bad slot\n"); |
@@ -789,6 +805,7 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
789 | 805 | ||
790 | /* Endpoint ID is 1 based, our index is zero based */ | 806 | /* Endpoint ID is 1 based, our index is zero based */ |
791 | ep_index = TRB_TO_EP_ID(event->flags) - 1; | 807 | ep_index = TRB_TO_EP_ID(event->flags) - 1; |
808 | xhci_dbg(xhci, "%s - ep index = %d\n", __func__, ep_index); | ||
792 | ep_ring = xdev->ep_rings[ep_index]; | 809 | ep_ring = xdev->ep_rings[ep_index]; |
793 | if (!ep_ring || (xdev->out_ctx->ep[ep_index].ep_info & EP_STATE_MASK) == EP_STATE_DISABLED) { | 810 | if (!ep_ring || (xdev->out_ctx->ep[ep_index].ep_info & EP_STATE_MASK) == EP_STATE_DISABLED) { |
794 | xhci_err(xhci, "ERROR Transfer event pointed to disabled endpoint\n"); | 811 | xhci_err(xhci, "ERROR Transfer event pointed to disabled endpoint\n"); |
@@ -797,6 +814,7 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
797 | 814 | ||
798 | event_dma = event->buffer; | 815 | event_dma = event->buffer; |
799 | /* This TRB should be in the TD at the head of this ring's TD list */ | 816 | /* This TRB should be in the TD at the head of this ring's TD list */ |
817 | xhci_dbg(xhci, "%s - checking for list empty\n", __func__); | ||
800 | if (list_empty(&ep_ring->td_list)) { | 818 | if (list_empty(&ep_ring->td_list)) { |
801 | xhci_warn(xhci, "WARN Event TRB for slot %d ep %d with no TDs queued?\n", | 819 | xhci_warn(xhci, "WARN Event TRB for slot %d ep %d with no TDs queued?\n", |
802 | TRB_TO_SLOT_ID(event->flags), ep_index); | 820 | TRB_TO_SLOT_ID(event->flags), ep_index); |
@@ -806,11 +824,14 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
806 | urb = NULL; | 824 | urb = NULL; |
807 | goto cleanup; | 825 | goto cleanup; |
808 | } | 826 | } |
827 | xhci_dbg(xhci, "%s - getting list entry\n", __func__); | ||
809 | td = list_entry(ep_ring->td_list.next, struct xhci_td, td_list); | 828 | td = list_entry(ep_ring->td_list.next, struct xhci_td, td_list); |
810 | 829 | ||
811 | /* Is this a TRB in the currently executing TD? */ | 830 | /* Is this a TRB in the currently executing TD? */ |
831 | xhci_dbg(xhci, "%s - looking for TD\n", __func__); | ||
812 | event_seg = trb_in_td(ep_ring->deq_seg, ep_ring->dequeue, | 832 | event_seg = trb_in_td(ep_ring->deq_seg, ep_ring->dequeue, |
813 | td->last_trb, event_dma); | 833 | td->last_trb, event_dma); |
834 | xhci_dbg(xhci, "%s - found event_seg = %p\n", __func__, event_seg); | ||
814 | if (!event_seg) { | 835 | if (!event_seg) { |
815 | /* HC is busted, give up! */ | 836 | /* HC is busted, give up! */ |
816 | xhci_err(xhci, "ERROR Transfer event TRB DMA ptr not part of current TD\n"); | 837 | xhci_err(xhci, "ERROR Transfer event TRB DMA ptr not part of current TD\n"); |
@@ -1027,6 +1048,8 @@ cleanup: | |||
1027 | /* FIXME for multi-TD URBs (who have buffers bigger than 64MB) */ | 1048 | /* FIXME for multi-TD URBs (who have buffers bigger than 64MB) */ |
1028 | if (urb) { | 1049 | if (urb) { |
1029 | usb_hcd_unlink_urb_from_ep(xhci_to_hcd(xhci), urb); | 1050 | usb_hcd_unlink_urb_from_ep(xhci_to_hcd(xhci), urb); |
1051 | xhci_dbg(xhci, "Giveback URB %p, len = %d, status = %d\n", | ||
1052 | urb, td->urb->actual_length, status); | ||
1030 | spin_unlock(&xhci->lock); | 1053 | spin_unlock(&xhci->lock); |
1031 | usb_hcd_giveback_urb(xhci_to_hcd(xhci), urb, status); | 1054 | usb_hcd_giveback_urb(xhci_to_hcd(xhci), urb, status); |
1032 | spin_lock(&xhci->lock); | 1055 | spin_lock(&xhci->lock); |
@@ -1044,6 +1067,7 @@ void xhci_handle_event(struct xhci_hcd *xhci) | |||
1044 | int update_ptrs = 1; | 1067 | int update_ptrs = 1; |
1045 | int ret; | 1068 | int ret; |
1046 | 1069 | ||
1070 | xhci_dbg(xhci, "In %s\n", __func__); | ||
1047 | if (!xhci->event_ring || !xhci->event_ring->dequeue) { | 1071 | if (!xhci->event_ring || !xhci->event_ring->dequeue) { |
1048 | xhci->error_bitmask |= 1 << 1; | 1072 | xhci->error_bitmask |= 1 << 1; |
1049 | return; | 1073 | return; |
@@ -1056,18 +1080,25 @@ void xhci_handle_event(struct xhci_hcd *xhci) | |||
1056 | xhci->error_bitmask |= 1 << 2; | 1080 | xhci->error_bitmask |= 1 << 2; |
1057 | return; | 1081 | return; |
1058 | } | 1082 | } |
1083 | xhci_dbg(xhci, "%s - OS owns TRB\n", __func__); | ||
1059 | 1084 | ||
1060 | /* FIXME: Handle more event types. */ | 1085 | /* FIXME: Handle more event types. */ |
1061 | switch ((event->event_cmd.flags & TRB_TYPE_BITMASK)) { | 1086 | switch ((event->event_cmd.flags & TRB_TYPE_BITMASK)) { |
1062 | case TRB_TYPE(TRB_COMPLETION): | 1087 | case TRB_TYPE(TRB_COMPLETION): |
1088 | xhci_dbg(xhci, "%s - calling handle_cmd_completion\n", __func__); | ||
1063 | handle_cmd_completion(xhci, &event->event_cmd); | 1089 | handle_cmd_completion(xhci, &event->event_cmd); |
1090 | xhci_dbg(xhci, "%s - returned from handle_cmd_completion\n", __func__); | ||
1064 | break; | 1091 | break; |
1065 | case TRB_TYPE(TRB_PORT_STATUS): | 1092 | case TRB_TYPE(TRB_PORT_STATUS): |
1093 | xhci_dbg(xhci, "%s - calling handle_port_status\n", __func__); | ||
1066 | handle_port_status(xhci, event); | 1094 | handle_port_status(xhci, event); |
1095 | xhci_dbg(xhci, "%s - returned from handle_port_status\n", __func__); | ||
1067 | update_ptrs = 0; | 1096 | update_ptrs = 0; |
1068 | break; | 1097 | break; |
1069 | case TRB_TYPE(TRB_TRANSFER): | 1098 | case TRB_TYPE(TRB_TRANSFER): |
1099 | xhci_dbg(xhci, "%s - calling handle_tx_event\n", __func__); | ||
1070 | ret = handle_tx_event(xhci, &event->trans_event); | 1100 | ret = handle_tx_event(xhci, &event->trans_event); |
1101 | xhci_dbg(xhci, "%s - returned from handle_tx_event\n", __func__); | ||
1071 | if (ret < 0) | 1102 | if (ret < 0) |
1072 | xhci->error_bitmask |= 1 << 9; | 1103 | xhci->error_bitmask |= 1 << 9; |
1073 | else | 1104 | else |