xhci: add helper to get the endpoint state of a endpoint context
define GET_EP_CTX_STATE() macro to get the endpoint state from a pointer to a le32 enpoint context structure No functional changes Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
3f1dae6b19
commit
5071e6b279
@ -1000,8 +1000,7 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id,
|
|||||||
break;
|
break;
|
||||||
case COMP_CTX_STATE:
|
case COMP_CTX_STATE:
|
||||||
xhci_warn(xhci, "WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.\n");
|
xhci_warn(xhci, "WARN Set TR Deq Ptr cmd failed due to incorrect slot or ep state.\n");
|
||||||
ep_state = le32_to_cpu(ep_ctx->ep_info);
|
ep_state = GET_EP_CTX_STATE(ep_ctx);
|
||||||
ep_state &= EP_STATE_MASK;
|
|
||||||
slot_state = le32_to_cpu(slot_ctx->dev_state);
|
slot_state = le32_to_cpu(slot_ctx->dev_state);
|
||||||
slot_state = GET_SLOT_STATE(slot_state);
|
slot_state = GET_SLOT_STATE(slot_state);
|
||||||
xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
|
xhci_dbg_trace(xhci, trace_xhci_dbg_cancel_urb,
|
||||||
@ -1794,8 +1793,7 @@ static int xhci_requires_manual_halt_cleanup(struct xhci_hcd *xhci,
|
|||||||
* endpoint anyway. Check if a babble halted the
|
* endpoint anyway. Check if a babble halted the
|
||||||
* endpoint.
|
* endpoint.
|
||||||
*/
|
*/
|
||||||
if ((ep_ctx->ep_info & cpu_to_le32(EP_STATE_MASK)) ==
|
if (GET_EP_CTX_STATE(ep_ctx) == EP_STATE_HALTED)
|
||||||
cpu_to_le32(EP_STATE_HALTED))
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -2244,9 +2242,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,
|
|||||||
ep = &xdev->eps[ep_index];
|
ep = &xdev->eps[ep_index];
|
||||||
ep_ring = xhci_dma_to_transfer_ring(ep, le64_to_cpu(event->buffer));
|
ep_ring = xhci_dma_to_transfer_ring(ep, le64_to_cpu(event->buffer));
|
||||||
ep_ctx = xhci_get_ep_ctx(xhci, xdev->out_ctx, ep_index);
|
ep_ctx = xhci_get_ep_ctx(xhci, xdev->out_ctx, ep_index);
|
||||||
if (!ep_ring ||
|
if (!ep_ring || GET_EP_CTX_STATE(ep_ctx) == EP_STATE_DISABLED) {
|
||||||
(le32_to_cpu(ep_ctx->ep_info) & EP_STATE_MASK) ==
|
|
||||||
EP_STATE_DISABLED) {
|
|
||||||
xhci_err(xhci, "ERROR Transfer event for disabled endpoint "
|
xhci_err(xhci, "ERROR Transfer event for disabled endpoint "
|
||||||
"or incorrect stream ring\n");
|
"or incorrect stream ring\n");
|
||||||
xhci_err(xhci, "@%016llx %08x %08x %08x %08x\n",
|
xhci_err(xhci, "@%016llx %08x %08x %08x %08x\n",
|
||||||
@ -2807,8 +2803,7 @@ static int prepare_transfer(struct xhci_hcd *xhci,
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = prepare_ring(xhci, ep_ring,
|
ret = prepare_ring(xhci, ep_ring, GET_EP_CTX_STATE(ep_ctx),
|
||||||
le32_to_cpu(ep_ctx->ep_info) & EP_STATE_MASK,
|
|
||||||
num_trbs, mem_flags);
|
num_trbs, mem_flags);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
@ -3704,7 +3699,7 @@ int xhci_queue_isoc_tx_prepare(struct xhci_hcd *xhci, gfp_t mem_flags,
|
|||||||
/* Check the ring to guarantee there is enough room for the whole urb.
|
/* Check the ring to guarantee there is enough room for the whole urb.
|
||||||
* Do not insert any td of the urb to the ring if the check failed.
|
* Do not insert any td of the urb to the ring if the check failed.
|
||||||
*/
|
*/
|
||||||
ret = prepare_ring(xhci, ep_ring, le32_to_cpu(ep_ctx->ep_info) & EP_STATE_MASK,
|
ret = prepare_ring(xhci, ep_ring, GET_EP_CTX_STATE(ep_ctx),
|
||||||
num_trbs, mem_flags);
|
num_trbs, mem_flags);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
@ -3717,8 +3712,7 @@ int xhci_queue_isoc_tx_prepare(struct xhci_hcd *xhci, gfp_t mem_flags,
|
|||||||
|
|
||||||
/* Calculate the start frame and put it in urb->start_frame. */
|
/* Calculate the start frame and put it in urb->start_frame. */
|
||||||
if (HCC_CFC(xhci->hcc_params) && !list_empty(&ep_ring->td_list)) {
|
if (HCC_CFC(xhci->hcc_params) && !list_empty(&ep_ring->td_list)) {
|
||||||
if ((le32_to_cpu(ep_ctx->ep_info) & EP_STATE_MASK) ==
|
if (GET_EP_CTX_STATE(ep_ctx) == EP_STATE_RUNNING) {
|
||||||
EP_STATE_RUNNING) {
|
|
||||||
urb->start_frame = xep->next_frame_id;
|
urb->start_frame = xep->next_frame_id;
|
||||||
goto skip_start_over;
|
goto skip_start_over;
|
||||||
}
|
}
|
||||||
|
@ -1650,8 +1650,7 @@ int xhci_drop_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
|
|||||||
/* If the HC already knows the endpoint is disabled,
|
/* If the HC already knows the endpoint is disabled,
|
||||||
* or the HCD has noted it is disabled, ignore this request
|
* or the HCD has noted it is disabled, ignore this request
|
||||||
*/
|
*/
|
||||||
if (((ep_ctx->ep_info & cpu_to_le32(EP_STATE_MASK)) ==
|
if ((GET_EP_CTX_STATE(ep_ctx) == EP_STATE_DISABLED) ||
|
||||||
cpu_to_le32(EP_STATE_DISABLED)) ||
|
|
||||||
le32_to_cpu(ctrl_ctx->drop_flags) &
|
le32_to_cpu(ctrl_ctx->drop_flags) &
|
||||||
xhci_get_endpoint_flag(&ep->desc)) {
|
xhci_get_endpoint_flag(&ep->desc)) {
|
||||||
/* Do not warn when called after a usb_device_reset */
|
/* Do not warn when called after a usb_device_reset */
|
||||||
|
@ -709,6 +709,8 @@ struct xhci_ep_ctx {
|
|||||||
#define EP_STATE_HALTED 2
|
#define EP_STATE_HALTED 2
|
||||||
#define EP_STATE_STOPPED 3
|
#define EP_STATE_STOPPED 3
|
||||||
#define EP_STATE_ERROR 4
|
#define EP_STATE_ERROR 4
|
||||||
|
#define GET_EP_CTX_STATE(ctx) (le32_to_cpu((ctx)->ep_info) & EP_STATE_MASK)
|
||||||
|
|
||||||
/* Mult - Max number of burtst within an interval, in EP companion desc. */
|
/* Mult - Max number of burtst within an interval, in EP companion desc. */
|
||||||
#define EP_MULT(p) (((p) & 0x3) << 8)
|
#define EP_MULT(p) (((p) & 0x3) << 8)
|
||||||
#define CTX_TO_EP_MULT(p) (((p) >> 8) & 0x3)
|
#define CTX_TO_EP_MULT(p) (((p) >> 8) & 0x3)
|
||||||
|
Loading…
Reference in New Issue
Block a user