aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host
diff options
context:
space:
mode:
authorXenia Ragiadakou <burzalodowa@gmail.com>2013-09-09 06:30:00 -0400
committerSarah Sharp <sarah.a.sharp@linux.intel.com>2013-10-16 15:24:40 -0400
commitb8200c9479b8046a16a71648607fa796b548218b (patch)
tree2711277a8a92ff01a970ad49ad41e5d3f0fd24e2 /drivers/usb/host
parentbc752bde108400c80735ef72987acbca0eecefda (diff)
xhci: add argument 'slot_id' in stop_ep, set_deq and reset_ep cmd handlers
Since the Slot ID field in the command completion event matches the Slot ID field in the associated command TRB for the Stop Endpoint, Set Dequeue Pointer and Reset Endpoint commands, this patch adds in the handlers of their completion events a 'slot_id' argument and removes the slot id calculation in each of them. Also, a WARN_ON() was added in case the slot ids reported by command TRB and event TRB differ (although according to xhci spec rev1.0 that should not happen) Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r--drivers/usb/host/xhci-ring.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 61243f59f914..b98c9852172a 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -765,10 +765,9 @@ static void xhci_giveback_urb_in_irq(struct xhci_hcd *xhci,
765 * 2. Otherwise, we turn all the TRBs in the TD into No-op TRBs (with the chain 765 * 2. Otherwise, we turn all the TRBs in the TD into No-op TRBs (with the chain
766 * bit cleared) so that the HW will skip over them. 766 * bit cleared) so that the HW will skip over them.
767 */ 767 */
768static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, 768static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci, int slot_id,
769 union xhci_trb *trb, struct xhci_event_cmd *event) 769 union xhci_trb *trb, struct xhci_event_cmd *event)
770{ 770{
771 unsigned int slot_id;
772 unsigned int ep_index; 771 unsigned int ep_index;
773 struct xhci_virt_device *virt_dev; 772 struct xhci_virt_device *virt_dev;
774 struct xhci_ring *ep_ring; 773 struct xhci_ring *ep_ring;
@@ -780,7 +779,6 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci,
780 struct xhci_dequeue_state deq_state; 779 struct xhci_dequeue_state deq_state;
781 780
782 if (unlikely(TRB_TO_SUSPEND_PORT(le32_to_cpu(trb->generic.field[3])))) { 781 if (unlikely(TRB_TO_SUSPEND_PORT(le32_to_cpu(trb->generic.field[3])))) {
783 slot_id = TRB_TO_SLOT_ID(le32_to_cpu(trb->generic.field[3]));
784 virt_dev = xhci->devs[slot_id]; 782 virt_dev = xhci->devs[slot_id];
785 if (virt_dev) 783 if (virt_dev)
786 handle_cmd_in_cmd_wait_list(xhci, virt_dev, 784 handle_cmd_in_cmd_wait_list(xhci, virt_dev,
@@ -793,7 +791,6 @@ static void xhci_handle_cmd_stop_ep(struct xhci_hcd *xhci,
793 } 791 }
794 792
795 memset(&deq_state, 0, sizeof(deq_state)); 793 memset(&deq_state, 0, sizeof(deq_state));
796 slot_id = TRB_TO_SLOT_ID(le32_to_cpu(trb->generic.field[3]));
797 ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb->generic.field[3])); 794 ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb->generic.field[3]));
798 ep = &xhci->devs[slot_id]->eps[ep_index]; 795 ep = &xhci->devs[slot_id]->eps[ep_index];
799 796
@@ -1075,10 +1072,9 @@ static void update_ring_for_set_deq_completion(struct xhci_hcd *xhci,
1075 * endpoint doorbell to restart the ring, but only if there aren't more 1072 * endpoint doorbell to restart the ring, but only if there aren't more
1076 * cancellations pending. 1073 * cancellations pending.
1077 */ 1074 */
1078static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, 1075static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id,
1079 struct xhci_event_cmd *event, union xhci_trb *trb) 1076 struct xhci_event_cmd *event, union xhci_trb *trb)
1080{ 1077{
1081 unsigned int slot_id;
1082 unsigned int ep_index; 1078 unsigned int ep_index;
1083 unsigned int stream_id; 1079 unsigned int stream_id;
1084 struct xhci_ring *ep_ring; 1080 struct xhci_ring *ep_ring;
@@ -1086,7 +1082,6 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci,
1086 struct xhci_ep_ctx *ep_ctx; 1082 struct xhci_ep_ctx *ep_ctx;
1087 struct xhci_slot_ctx *slot_ctx; 1083 struct xhci_slot_ctx *slot_ctx;
1088 1084
1089 slot_id = TRB_TO_SLOT_ID(le32_to_cpu(trb->generic.field[3]));
1090 ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb->generic.field[3])); 1085 ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb->generic.field[3]));
1091 stream_id = TRB_TO_STREAM_ID(le32_to_cpu(trb->generic.field[2])); 1086 stream_id = TRB_TO_STREAM_ID(le32_to_cpu(trb->generic.field[2]));
1092 dev = xhci->devs[slot_id]; 1087 dev = xhci->devs[slot_id];
@@ -1168,13 +1163,11 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci,
1168 ring_doorbell_for_active_rings(xhci, slot_id, ep_index); 1163 ring_doorbell_for_active_rings(xhci, slot_id, ep_index);
1169} 1164}
1170 1165
1171static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, 1166static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id,
1172 struct xhci_event_cmd *event, union xhci_trb *trb) 1167 struct xhci_event_cmd *event, union xhci_trb *trb)
1173{ 1168{
1174 int slot_id;
1175 unsigned int ep_index; 1169 unsigned int ep_index;
1176 1170
1177 slot_id = TRB_TO_SLOT_ID(le32_to_cpu(trb->generic.field[3]));
1178 ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb->generic.field[3])); 1171 ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb->generic.field[3]));
1179 /* This command will only fail if the endpoint wasn't halted, 1172 /* This command will only fail if the endpoint wasn't halted,
1180 * but we don't care. 1173 * but we don't care.
@@ -1576,15 +1569,21 @@ static void handle_cmd_completion(struct xhci_hcd *xhci,
1576 xhci_handle_cmd_addr_dev(xhci, slot_id, cmd_comp_code); 1569 xhci_handle_cmd_addr_dev(xhci, slot_id, cmd_comp_code);
1577 break; 1570 break;
1578 case TRB_STOP_RING: 1571 case TRB_STOP_RING:
1579 xhci_handle_cmd_stop_ep(xhci, cmd_trb, event); 1572 WARN_ON(slot_id != TRB_TO_SLOT_ID(
1573 le32_to_cpu(cmd_trb->generic.field[3])));
1574 xhci_handle_cmd_stop_ep(xhci, slot_id, cmd_trb, event);
1580 break; 1575 break;
1581 case TRB_SET_DEQ: 1576 case TRB_SET_DEQ:
1582 xhci_handle_cmd_set_deq(xhci, event, cmd_trb); 1577 WARN_ON(slot_id != TRB_TO_SLOT_ID(
1578 le32_to_cpu(cmd_trb->generic.field[3])));
1579 xhci_handle_cmd_set_deq(xhci, slot_id, event, cmd_trb);
1583 break; 1580 break;
1584 case TRB_CMD_NOOP: 1581 case TRB_CMD_NOOP:
1585 break; 1582 break;
1586 case TRB_RESET_EP: 1583 case TRB_RESET_EP:
1587 xhci_handle_cmd_reset_ep(xhci, event, cmd_trb); 1584 WARN_ON(slot_id != TRB_TO_SLOT_ID(
1585 le32_to_cpu(cmd_trb->generic.field[3])));
1586 xhci_handle_cmd_reset_ep(xhci, slot_id, event, cmd_trb);
1588 break; 1587 break;
1589 case TRB_RESET_DEV: 1588 case TRB_RESET_DEV:
1590 WARN_ON(slot_id != TRB_TO_SLOT_ID( 1589 WARN_ON(slot_id != TRB_TO_SLOT_ID(