mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-05 18:39:59 +00:00
xhci: Remove some unnecessary casts and tidy some endian swap code
Some of the recently-added cpu_to_leXX and leXX_to_cpu made things somewhat messy; this patch neatens some of these areas, removing unnecessary casts in those parts also. In some places (where Y & Z are constants) a comparison of (leXX_to_cpu(X) & Y) == Z has been replaced with (X & cpu_to_leXX(Y)) == cpu_to_leXX(Z). The endian reversal of the constants should wash out at compile time. Signed-off-by: Matt Evans <matt@ozlabs.org> Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
This commit is contained in:
parent
55922c9d1b
commit
f5960b698e
5 changed files with 52 additions and 55 deletions
|
@ -266,11 +266,11 @@ void xhci_debug_trb(struct xhci_hcd *xhci, union xhci_trb *trb)
|
||||||
xhci_dbg(xhci, "Interrupter target = 0x%x\n",
|
xhci_dbg(xhci, "Interrupter target = 0x%x\n",
|
||||||
GET_INTR_TARGET(le32_to_cpu(trb->link.intr_target)));
|
GET_INTR_TARGET(le32_to_cpu(trb->link.intr_target)));
|
||||||
xhci_dbg(xhci, "Cycle bit = %u\n",
|
xhci_dbg(xhci, "Cycle bit = %u\n",
|
||||||
(unsigned int) (le32_to_cpu(trb->link.control) & TRB_CYCLE));
|
le32_to_cpu(trb->link.control) & TRB_CYCLE);
|
||||||
xhci_dbg(xhci, "Toggle cycle bit = %u\n",
|
xhci_dbg(xhci, "Toggle cycle bit = %u\n",
|
||||||
(unsigned int) (le32_to_cpu(trb->link.control) & LINK_TOGGLE));
|
le32_to_cpu(trb->link.control) & LINK_TOGGLE);
|
||||||
xhci_dbg(xhci, "No Snoop bit = %u\n",
|
xhci_dbg(xhci, "No Snoop bit = %u\n",
|
||||||
(unsigned int) (le32_to_cpu(trb->link.control) & TRB_NO_SNOOP));
|
le32_to_cpu(trb->link.control) & TRB_NO_SNOOP);
|
||||||
break;
|
break;
|
||||||
case TRB_TYPE(TRB_TRANSFER):
|
case TRB_TYPE(TRB_TRANSFER):
|
||||||
address = le64_to_cpu(trb->trans_event.buffer);
|
address = le64_to_cpu(trb->trans_event.buffer);
|
||||||
|
@ -284,9 +284,9 @@ void xhci_debug_trb(struct xhci_hcd *xhci, union xhci_trb *trb)
|
||||||
address = le64_to_cpu(trb->event_cmd.cmd_trb);
|
address = le64_to_cpu(trb->event_cmd.cmd_trb);
|
||||||
xhci_dbg(xhci, "Command TRB pointer = %llu\n", address);
|
xhci_dbg(xhci, "Command TRB pointer = %llu\n", address);
|
||||||
xhci_dbg(xhci, "Completion status = %u\n",
|
xhci_dbg(xhci, "Completion status = %u\n",
|
||||||
(unsigned int) GET_COMP_CODE(le32_to_cpu(trb->event_cmd.status)));
|
GET_COMP_CODE(le32_to_cpu(trb->event_cmd.status)));
|
||||||
xhci_dbg(xhci, "Flags = 0x%x\n",
|
xhci_dbg(xhci, "Flags = 0x%x\n",
|
||||||
(unsigned int) le32_to_cpu(trb->event_cmd.flags));
|
le32_to_cpu(trb->event_cmd.flags));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
xhci_dbg(xhci, "Unknown TRB with TRB type ID %u\n",
|
xhci_dbg(xhci, "Unknown TRB with TRB type ID %u\n",
|
||||||
|
@ -318,10 +318,10 @@ void xhci_debug_segment(struct xhci_hcd *xhci, struct xhci_segment *seg)
|
||||||
for (i = 0; i < TRBS_PER_SEGMENT; ++i) {
|
for (i = 0; i < TRBS_PER_SEGMENT; ++i) {
|
||||||
trb = &seg->trbs[i];
|
trb = &seg->trbs[i];
|
||||||
xhci_dbg(xhci, "@%016llx %08x %08x %08x %08x\n", addr,
|
xhci_dbg(xhci, "@%016llx %08x %08x %08x %08x\n", addr,
|
||||||
(u32)lower_32_bits(le64_to_cpu(trb->link.segment_ptr)),
|
lower_32_bits(le64_to_cpu(trb->link.segment_ptr)),
|
||||||
(u32)upper_32_bits(le64_to_cpu(trb->link.segment_ptr)),
|
upper_32_bits(le64_to_cpu(trb->link.segment_ptr)),
|
||||||
(unsigned int) le32_to_cpu(trb->link.intr_target),
|
le32_to_cpu(trb->link.intr_target),
|
||||||
(unsigned int) le32_to_cpu(trb->link.control));
|
le32_to_cpu(trb->link.control));
|
||||||
addr += sizeof(*trb);
|
addr += sizeof(*trb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -402,8 +402,8 @@ void xhci_dbg_erst(struct xhci_hcd *xhci, struct xhci_erst *erst)
|
||||||
addr,
|
addr,
|
||||||
lower_32_bits(le64_to_cpu(entry->seg_addr)),
|
lower_32_bits(le64_to_cpu(entry->seg_addr)),
|
||||||
upper_32_bits(le64_to_cpu(entry->seg_addr)),
|
upper_32_bits(le64_to_cpu(entry->seg_addr)),
|
||||||
(unsigned int) le32_to_cpu(entry->seg_size),
|
le32_to_cpu(entry->seg_size),
|
||||||
(unsigned int) le32_to_cpu(entry->rsvd));
|
le32_to_cpu(entry->rsvd));
|
||||||
addr += sizeof(*entry);
|
addr += sizeof(*entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,8 +89,8 @@ static void xhci_link_segments(struct xhci_hcd *xhci, struct xhci_segment *prev,
|
||||||
return;
|
return;
|
||||||
prev->next = next;
|
prev->next = next;
|
||||||
if (link_trbs) {
|
if (link_trbs) {
|
||||||
prev->trbs[TRBS_PER_SEGMENT-1].link.
|
prev->trbs[TRBS_PER_SEGMENT-1].link.segment_ptr =
|
||||||
segment_ptr = cpu_to_le64(next->dma);
|
cpu_to_le64(next->dma);
|
||||||
|
|
||||||
/* Set the last TRB in the segment to have a TRB type ID of Link TRB */
|
/* Set the last TRB in the segment to have a TRB type ID of Link TRB */
|
||||||
val = le32_to_cpu(prev->trbs[TRBS_PER_SEGMENT-1].link.control);
|
val = le32_to_cpu(prev->trbs[TRBS_PER_SEGMENT-1].link.control);
|
||||||
|
@ -187,8 +187,8 @@ static struct xhci_ring *xhci_ring_alloc(struct xhci_hcd *xhci,
|
||||||
|
|
||||||
if (link_trbs) {
|
if (link_trbs) {
|
||||||
/* See section 4.9.2.1 and 6.4.4.1 */
|
/* See section 4.9.2.1 and 6.4.4.1 */
|
||||||
prev->trbs[TRBS_PER_SEGMENT-1].link.
|
prev->trbs[TRBS_PER_SEGMENT-1].link.control |=
|
||||||
control |= cpu_to_le32(LINK_TOGGLE);
|
cpu_to_le32(LINK_TOGGLE);
|
||||||
xhci_dbg(xhci, "Wrote link toggle flag to"
|
xhci_dbg(xhci, "Wrote link toggle flag to"
|
||||||
" segment %p (virtual), 0x%llx (DMA)\n",
|
" segment %p (virtual), 0x%llx (DMA)\n",
|
||||||
prev, (unsigned long long)prev->dma);
|
prev, (unsigned long long)prev->dma);
|
||||||
|
@ -549,8 +549,8 @@ struct xhci_stream_info *xhci_alloc_stream_info(struct xhci_hcd *xhci,
|
||||||
addr = cur_ring->first_seg->dma |
|
addr = cur_ring->first_seg->dma |
|
||||||
SCT_FOR_CTX(SCT_PRI_TR) |
|
SCT_FOR_CTX(SCT_PRI_TR) |
|
||||||
cur_ring->cycle_state;
|
cur_ring->cycle_state;
|
||||||
stream_info->stream_ctx_array[cur_stream].
|
stream_info->stream_ctx_array[cur_stream].stream_ring =
|
||||||
stream_ring = cpu_to_le64(addr);
|
cpu_to_le64(addr);
|
||||||
xhci_dbg(xhci, "Setting stream %d ring ptr to 0x%08llx\n",
|
xhci_dbg(xhci, "Setting stream %d ring ptr to 0x%08llx\n",
|
||||||
cur_stream, (unsigned long long) addr);
|
cur_stream, (unsigned long long) addr);
|
||||||
|
|
||||||
|
@ -786,7 +786,7 @@ int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id,
|
||||||
xhci_dbg(xhci, "Set slot id %d dcbaa entry %p to 0x%llx\n",
|
xhci_dbg(xhci, "Set slot id %d dcbaa entry %p to 0x%llx\n",
|
||||||
slot_id,
|
slot_id,
|
||||||
&xhci->dcbaa->dev_context_ptrs[slot_id],
|
&xhci->dcbaa->dev_context_ptrs[slot_id],
|
||||||
(unsigned long long) le64_to_cpu(xhci->dcbaa->dev_context_ptrs[slot_id]));
|
le64_to_cpu(xhci->dcbaa->dev_context_ptrs[slot_id]));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
fail:
|
fail:
|
||||||
|
@ -890,19 +890,19 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
|
||||||
ctrl_ctx->add_flags = cpu_to_le32(SLOT_FLAG | EP0_FLAG);
|
ctrl_ctx->add_flags = cpu_to_le32(SLOT_FLAG | EP0_FLAG);
|
||||||
|
|
||||||
/* 3) Only the control endpoint is valid - one endpoint context */
|
/* 3) Only the control endpoint is valid - one endpoint context */
|
||||||
slot_ctx->dev_info |= cpu_to_le32(LAST_CTX(1) | (u32) udev->route);
|
slot_ctx->dev_info |= cpu_to_le32(LAST_CTX(1) | udev->route);
|
||||||
switch (udev->speed) {
|
switch (udev->speed) {
|
||||||
case USB_SPEED_SUPER:
|
case USB_SPEED_SUPER:
|
||||||
slot_ctx->dev_info |= cpu_to_le32((u32) SLOT_SPEED_SS);
|
slot_ctx->dev_info |= cpu_to_le32(SLOT_SPEED_SS);
|
||||||
break;
|
break;
|
||||||
case USB_SPEED_HIGH:
|
case USB_SPEED_HIGH:
|
||||||
slot_ctx->dev_info |= cpu_to_le32((u32) SLOT_SPEED_HS);
|
slot_ctx->dev_info |= cpu_to_le32(SLOT_SPEED_HS);
|
||||||
break;
|
break;
|
||||||
case USB_SPEED_FULL:
|
case USB_SPEED_FULL:
|
||||||
slot_ctx->dev_info |= cpu_to_le32((u32) SLOT_SPEED_FS);
|
slot_ctx->dev_info |= cpu_to_le32(SLOT_SPEED_FS);
|
||||||
break;
|
break;
|
||||||
case USB_SPEED_LOW:
|
case USB_SPEED_LOW:
|
||||||
slot_ctx->dev_info |= cpu_to_le32((u32) SLOT_SPEED_LS);
|
slot_ctx->dev_info |= cpu_to_le32(SLOT_SPEED_LS);
|
||||||
break;
|
break;
|
||||||
case USB_SPEED_WIRELESS:
|
case USB_SPEED_WIRELESS:
|
||||||
xhci_dbg(xhci, "FIXME xHCI doesn't support wireless speeds\n");
|
xhci_dbg(xhci, "FIXME xHCI doesn't support wireless speeds\n");
|
||||||
|
@ -916,7 +916,7 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
|
||||||
port_num = xhci_find_real_port_number(xhci, udev);
|
port_num = xhci_find_real_port_number(xhci, udev);
|
||||||
if (!port_num)
|
if (!port_num)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
slot_ctx->dev_info2 |= cpu_to_le32((u32) ROOT_HUB_PORT(port_num));
|
slot_ctx->dev_info2 |= cpu_to_le32(ROOT_HUB_PORT(port_num));
|
||||||
/* Set the port number in the virtual_device to the faked port number */
|
/* Set the port number in the virtual_device to the faked port number */
|
||||||
for (top_dev = udev; top_dev->parent && top_dev->parent->parent;
|
for (top_dev = udev; top_dev->parent && top_dev->parent->parent;
|
||||||
top_dev = top_dev->parent)
|
top_dev = top_dev->parent)
|
||||||
|
|
|
@ -113,15 +113,13 @@ static int last_trb(struct xhci_hcd *xhci, struct xhci_ring *ring,
|
||||||
if (ring == xhci->event_ring)
|
if (ring == xhci->event_ring)
|
||||||
return trb == &seg->trbs[TRBS_PER_SEGMENT];
|
return trb == &seg->trbs[TRBS_PER_SEGMENT];
|
||||||
else
|
else
|
||||||
return (le32_to_cpu(trb->link.control) & TRB_TYPE_BITMASK)
|
return TRB_TYPE_LINK_LE32(trb->link.control);
|
||||||
== TRB_TYPE(TRB_LINK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int enqueue_is_link_trb(struct xhci_ring *ring)
|
static int enqueue_is_link_trb(struct xhci_ring *ring)
|
||||||
{
|
{
|
||||||
struct xhci_link_trb *link = &ring->enqueue->link;
|
struct xhci_link_trb *link = &ring->enqueue->link;
|
||||||
return ((le32_to_cpu(link->control) & TRB_TYPE_BITMASK) ==
|
return TRB_TYPE_LINK_LE32(link->control);
|
||||||
TRB_TYPE(TRB_LINK));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Updates trb to point to the next TRB in the ring, and updates seg if the next
|
/* Updates trb to point to the next TRB in the ring, and updates seg if the next
|
||||||
|
@ -372,7 +370,7 @@ static struct xhci_segment *find_trb_seg(
|
||||||
while (cur_seg->trbs > trb ||
|
while (cur_seg->trbs > trb ||
|
||||||
&cur_seg->trbs[TRBS_PER_SEGMENT - 1] < trb) {
|
&cur_seg->trbs[TRBS_PER_SEGMENT - 1] < trb) {
|
||||||
generic_trb = &cur_seg->trbs[TRBS_PER_SEGMENT - 1].generic;
|
generic_trb = &cur_seg->trbs[TRBS_PER_SEGMENT - 1].generic;
|
||||||
if (le32_to_cpu(generic_trb->field[3]) & LINK_TOGGLE)
|
if (generic_trb->field[3] & cpu_to_le32(LINK_TOGGLE))
|
||||||
*cycle_state ^= 0x1;
|
*cycle_state ^= 0x1;
|
||||||
cur_seg = cur_seg->next;
|
cur_seg = cur_seg->next;
|
||||||
if (cur_seg == start_seg)
|
if (cur_seg == start_seg)
|
||||||
|
@ -489,8 +487,8 @@ void xhci_find_new_dequeue_state(struct xhci_hcd *xhci,
|
||||||
}
|
}
|
||||||
|
|
||||||
trb = &state->new_deq_ptr->generic;
|
trb = &state->new_deq_ptr->generic;
|
||||||
if ((le32_to_cpu(trb->field[3]) & TRB_TYPE_BITMASK) ==
|
if (TRB_TYPE_LINK_LE32(trb->field[3]) &&
|
||||||
TRB_TYPE(TRB_LINK) && (le32_to_cpu(trb->field[3]) & LINK_TOGGLE))
|
(trb->field[3] & cpu_to_le32(LINK_TOGGLE)))
|
||||||
state->new_cycle_state ^= 0x1;
|
state->new_cycle_state ^= 0x1;
|
||||||
next_trb(xhci, ep_ring, &state->new_deq_seg, &state->new_deq_ptr);
|
next_trb(xhci, ep_ring, &state->new_deq_seg, &state->new_deq_ptr);
|
||||||
|
|
||||||
|
@ -525,8 +523,7 @@ static void td_to_noop(struct xhci_hcd *xhci, struct xhci_ring *ep_ring,
|
||||||
for (cur_seg = cur_td->start_seg, cur_trb = cur_td->first_trb;
|
for (cur_seg = cur_td->start_seg, cur_trb = cur_td->first_trb;
|
||||||
true;
|
true;
|
||||||
next_trb(xhci, ep_ring, &cur_seg, &cur_trb)) {
|
next_trb(xhci, ep_ring, &cur_seg, &cur_trb)) {
|
||||||
if ((le32_to_cpu(cur_trb->generic.field[3]) & TRB_TYPE_BITMASK)
|
if (TRB_TYPE_LINK_LE32(cur_trb->generic.field[3])) {
|
||||||
== TRB_TYPE(TRB_LINK)) {
|
|
||||||
/* Unchain any chained Link TRBs, but
|
/* Unchain any chained Link TRBs, but
|
||||||
* leave the pointers intact.
|
* leave the pointers intact.
|
||||||
*/
|
*/
|
||||||
|
@ -1000,7 +997,7 @@ static void handle_reset_ep_completion(struct xhci_hcd *xhci,
|
||||||
* but we don't care.
|
* but we don't care.
|
||||||
*/
|
*/
|
||||||
xhci_dbg(xhci, "Ignoring reset ep completion code of %u\n",
|
xhci_dbg(xhci, "Ignoring reset ep completion code of %u\n",
|
||||||
(unsigned int) GET_COMP_CODE(le32_to_cpu(event->status)));
|
GET_COMP_CODE(le32_to_cpu(event->status)));
|
||||||
|
|
||||||
/* HW with the reset endpoint quirk needs to have a configure endpoint
|
/* HW with the reset endpoint quirk needs to have a configure endpoint
|
||||||
* command complete before the endpoint can be used. Queue that here
|
* command complete before the endpoint can be used. Queue that here
|
||||||
|
@ -1458,7 +1455,8 @@ 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 ((le32_to_cpu(ep_ctx->ep_info) & EP_STATE_MASK) == EP_STATE_HALTED)
|
if ((ep_ctx->ep_info & cpu_to_le32(EP_STATE_MASK)) ==
|
||||||
|
cpu_to_le32(EP_STATE_HALTED))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1752,10 +1750,8 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td,
|
||||||
for (cur_trb = ep_ring->dequeue,
|
for (cur_trb = ep_ring->dequeue,
|
||||||
cur_seg = ep_ring->deq_seg; cur_trb != event_trb;
|
cur_seg = ep_ring->deq_seg; cur_trb != event_trb;
|
||||||
next_trb(xhci, ep_ring, &cur_seg, &cur_trb)) {
|
next_trb(xhci, ep_ring, &cur_seg, &cur_trb)) {
|
||||||
if ((le32_to_cpu(cur_trb->generic.field[3]) &
|
if (!TRB_TYPE_NOOP_LE32(cur_trb->generic.field[3]) &&
|
||||||
TRB_TYPE_BITMASK) != TRB_TYPE(TRB_TR_NOOP) &&
|
!TRB_TYPE_LINK_LE32(cur_trb->generic.field[3]))
|
||||||
(le32_to_cpu(cur_trb->generic.field[3]) &
|
|
||||||
TRB_TYPE_BITMASK) != TRB_TYPE(TRB_LINK))
|
|
||||||
len += TRB_LEN(le32_to_cpu(cur_trb->generic.field[2]));
|
len += TRB_LEN(le32_to_cpu(cur_trb->generic.field[2]));
|
||||||
}
|
}
|
||||||
len += TRB_LEN(le32_to_cpu(cur_trb->generic.field[2])) -
|
len += TRB_LEN(le32_to_cpu(cur_trb->generic.field[2])) -
|
||||||
|
@ -1888,10 +1884,8 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td,
|
||||||
for (cur_trb = ep_ring->dequeue, cur_seg = ep_ring->deq_seg;
|
for (cur_trb = ep_ring->dequeue, cur_seg = ep_ring->deq_seg;
|
||||||
cur_trb != event_trb;
|
cur_trb != event_trb;
|
||||||
next_trb(xhci, ep_ring, &cur_seg, &cur_trb)) {
|
next_trb(xhci, ep_ring, &cur_seg, &cur_trb)) {
|
||||||
if ((le32_to_cpu(cur_trb->generic.field[3]) &
|
if (!TRB_TYPE_NOOP_LE32(cur_trb->generic.field[3]) &&
|
||||||
TRB_TYPE_BITMASK) != TRB_TYPE(TRB_TR_NOOP) &&
|
!TRB_TYPE_LINK_LE32(cur_trb->generic.field[3]))
|
||||||
(le32_to_cpu(cur_trb->generic.field[3]) &
|
|
||||||
TRB_TYPE_BITMASK) != TRB_TYPE(TRB_LINK))
|
|
||||||
td->urb->actual_length +=
|
td->urb->actual_length +=
|
||||||
TRB_LEN(le32_to_cpu(cur_trb->generic.field[2]));
|
TRB_LEN(le32_to_cpu(cur_trb->generic.field[2]));
|
||||||
}
|
}
|
||||||
|
@ -2046,8 +2040,8 @@ static int handle_tx_event(struct xhci_hcd *xhci,
|
||||||
TRB_TO_SLOT_ID(le32_to_cpu(event->flags)),
|
TRB_TO_SLOT_ID(le32_to_cpu(event->flags)),
|
||||||
ep_index);
|
ep_index);
|
||||||
xhci_dbg(xhci, "Event TRB with TRB type ID %u\n",
|
xhci_dbg(xhci, "Event TRB with TRB type ID %u\n",
|
||||||
(unsigned int) (le32_to_cpu(event->flags)
|
(le32_to_cpu(event->flags) &
|
||||||
& TRB_TYPE_BITMASK)>>10);
|
TRB_TYPE_BITMASK)>>10);
|
||||||
xhci_print_trb_offsets(xhci, (union xhci_trb *) event);
|
xhci_print_trb_offsets(xhci, (union xhci_trb *) event);
|
||||||
if (ep->skip) {
|
if (ep->skip) {
|
||||||
ep->skip = false;
|
ep->skip = false;
|
||||||
|
@ -2104,9 +2098,7 @@ static int handle_tx_event(struct xhci_hcd *xhci,
|
||||||
* corresponding TD has been cancelled. Just ignore
|
* corresponding TD has been cancelled. Just ignore
|
||||||
* the TD.
|
* the TD.
|
||||||
*/
|
*/
|
||||||
if ((le32_to_cpu(event_trb->generic.field[3])
|
if (TRB_TYPE_NOOP_LE32(event_trb->generic.field[3])) {
|
||||||
& TRB_TYPE_BITMASK)
|
|
||||||
== TRB_TYPE(TRB_TR_NOOP)) {
|
|
||||||
xhci_dbg(xhci,
|
xhci_dbg(xhci,
|
||||||
"event_trb is a no-op TRB. Skip it\n");
|
"event_trb is a no-op TRB. Skip it\n");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
@ -2432,7 +2424,7 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring,
|
||||||
next->link.control |= cpu_to_le32(TRB_CHAIN);
|
next->link.control |= cpu_to_le32(TRB_CHAIN);
|
||||||
|
|
||||||
wmb();
|
wmb();
|
||||||
next->link.control ^= cpu_to_le32((u32) TRB_CYCLE);
|
next->link.control ^= cpu_to_le32(TRB_CYCLE);
|
||||||
|
|
||||||
/* Toggle the cycle bit after the last ring segment. */
|
/* Toggle the cycle bit after the last ring segment. */
|
||||||
if (last_trb_on_last_seg(xhci, ring, ring->enq_seg, next)) {
|
if (last_trb_on_last_seg(xhci, ring, ring->enq_seg, next)) {
|
||||||
|
|
|
@ -1333,8 +1333,8 @@ 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 ((le32_to_cpu(ep_ctx->ep_info) & EP_STATE_MASK) ==
|
if (((ep_ctx->ep_info & cpu_to_le32(EP_STATE_MASK)) ==
|
||||||
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)) {
|
||||||
xhci_warn(xhci, "xHCI %s called with disabled ep %p\n",
|
xhci_warn(xhci, "xHCI %s called with disabled ep %p\n",
|
||||||
|
@ -1725,8 +1725,7 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci,
|
||||||
/* Enqueue pointer can be left pointing to the link TRB,
|
/* Enqueue pointer can be left pointing to the link TRB,
|
||||||
* we must handle that
|
* we must handle that
|
||||||
*/
|
*/
|
||||||
if ((le32_to_cpu(command->command_trb->link.control)
|
if (TRB_TYPE_LINK_LE32(command->command_trb->link.control))
|
||||||
& TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK))
|
|
||||||
command->command_trb =
|
command->command_trb =
|
||||||
xhci->cmd_ring->enq_seg->next->trbs;
|
xhci->cmd_ring->enq_seg->next->trbs;
|
||||||
|
|
||||||
|
@ -2519,8 +2518,7 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
|
||||||
/* Enqueue pointer can be left pointing to the link TRB,
|
/* Enqueue pointer can be left pointing to the link TRB,
|
||||||
* we must handle that
|
* we must handle that
|
||||||
*/
|
*/
|
||||||
if ((le32_to_cpu(reset_device_cmd->command_trb->link.control)
|
if (TRB_TYPE_LINK_LE32(reset_device_cmd->command_trb->link.control))
|
||||||
& TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK))
|
|
||||||
reset_device_cmd->command_trb =
|
reset_device_cmd->command_trb =
|
||||||
xhci->cmd_ring->enq_seg->next->trbs;
|
xhci->cmd_ring->enq_seg->next->trbs;
|
||||||
|
|
||||||
|
|
|
@ -1065,6 +1065,13 @@ union xhci_trb {
|
||||||
/* Get NEC firmware revision. */
|
/* Get NEC firmware revision. */
|
||||||
#define TRB_NEC_GET_FW 49
|
#define TRB_NEC_GET_FW 49
|
||||||
|
|
||||||
|
#define TRB_TYPE_LINK(x) (((x) & TRB_TYPE_BITMASK) == TRB_TYPE(TRB_LINK))
|
||||||
|
/* Above, but for __le32 types -- can avoid work by swapping constants: */
|
||||||
|
#define TRB_TYPE_LINK_LE32(x) (((x) & cpu_to_le32(TRB_TYPE_BITMASK)) == \
|
||||||
|
cpu_to_le32(TRB_TYPE(TRB_LINK)))
|
||||||
|
#define TRB_TYPE_NOOP_LE32(x) (((x) & cpu_to_le32(TRB_TYPE_BITMASK)) == \
|
||||||
|
cpu_to_le32(TRB_TYPE(TRB_TR_NOOP)))
|
||||||
|
|
||||||
#define NEC_FW_MINOR(p) (((p) >> 0) & 0xff)
|
#define NEC_FW_MINOR(p) (((p) >> 0) & 0xff)
|
||||||
#define NEC_FW_MAJOR(p) (((p) >> 8) & 0xff)
|
#define NEC_FW_MAJOR(p) (((p) >> 8) & 0xff)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue