Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2251198b authored by Mathias Nyman's avatar Mathias Nyman Committed by Greg Kroah-Hartman
Browse files

xhci: clean up event ring checks from inc_enq()



Remove the event ring related checks in inc_enq()

Host hardware is the producer of events on the event ring,
driver will not queue anything, or call inc_enq() for the
event ring.

Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent f9c589e1
Loading
Loading
Loading
Loading
+28 −36
Original line number Original line Diff line number Diff line
@@ -199,50 +199,42 @@ static void inc_enq(struct xhci_hcd *xhci, struct xhci_ring *ring,


	chain = le32_to_cpu(ring->enqueue->generic.field[3]) & TRB_CHAIN;
	chain = le32_to_cpu(ring->enqueue->generic.field[3]) & TRB_CHAIN;
	/* If this is not event ring, there is one less usable TRB */
	/* If this is not event ring, there is one less usable TRB */
	if (ring->type != TYPE_EVENT &&
	if (!last_trb(xhci, ring, ring->enq_seg, ring->enqueue))
			!last_trb(xhci, ring, ring->enq_seg, ring->enqueue))
		ring->num_trbs_free--;
		ring->num_trbs_free--;
	next = ++(ring->enqueue);
	next = ++(ring->enqueue);


	ring->enq_updates++;
	ring->enq_updates++;
	/* Update the dequeue pointer further if that was a link TRB or we're at
	/* Update the dequeue pointer further if that was a link TRB */
	 * the end of an event ring segment (which doesn't have link TRBS)
	 */
	while (last_trb(xhci, ring, ring->enq_seg, next)) {
	while (last_trb(xhci, ring, ring->enq_seg, next)) {
		if (ring->type != TYPE_EVENT) {

		/*
		/*
			 * If the caller doesn't plan on enqueueing more
		 * If the caller doesn't plan on enqueueing more TDs before
			 * TDs before ringing the doorbell, then we
		 * ringing the doorbell, then we don't want to give the link TRB
			 * don't want to give the link TRB to the
		 * to the hardware just yet. We'll give the link TRB back in
			 * hardware just yet.  We'll give the link TRB
		 * prepare_ring() just before we enqueue the TD at the top of
			 * back in prepare_ring() just before we enqueue
		 * the ring.
			 * the TD at the top of the ring.
		 */
		 */
		if (!chain && !more_trbs_coming)
		if (!chain && !more_trbs_coming)
			break;
			break;


			/* If we're not dealing with 0.95 hardware or
		/* If we're not dealing with 0.95 hardware or isoc rings on
			 * isoc rings on AMD 0.96 host,
		 * AMD 0.96 host, carry over the chain bit of the previous TRB
			 * carry over the chain bit of the previous TRB
		 * (which may mean the chain bit is cleared).
		 * (which may mean the chain bit is cleared).
		 */
		 */
		if (!(ring->type == TYPE_ISOC &&
		if (!(ring->type == TYPE_ISOC &&
					(xhci->quirks & XHCI_AMD_0x96_HOST))
		      (xhci->quirks & XHCI_AMD_0x96_HOST)) &&
						&& !xhci_link_trb_quirk(xhci)) {
		    !xhci_link_trb_quirk(xhci)) {
				next->link.control &=
			next->link.control &= cpu_to_le32(~TRB_CHAIN);
					cpu_to_le32(~TRB_CHAIN);
			next->link.control |= cpu_to_le32(chain);
				next->link.control |=
					cpu_to_le32(chain);
		}
		}
		/* Give this link TRB to the hardware */
		/* Give this link TRB to the hardware */
		wmb();
		wmb();
		next->link.control ^= cpu_to_le32(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))
			ring->cycle_state ^= 1;
			ring->cycle_state ^= 1;
			}

		}
		ring->enq_seg = ring->enq_seg->next;
		ring->enq_seg = ring->enq_seg->next;
		ring->enqueue = ring->enq_seg->trbs;
		ring->enqueue = ring->enq_seg->trbs;
		next = ring->enqueue;
		next = ring->enqueue;