[PATCH] xHCI 1.0: Endpoint Not Enabled Error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To handle the Endpoint Not Enabled Error described in section 4.7 of the xHCI
spec v1.0. Add the limit condition to avoid ringing the doorbell of the dis-
abled slot and do the WARN for the Endpoint Not Enabled Error.

Signed-off-by: Alex He <alex.he@xxxxxxx>
---
 drivers/usb/host/xhci-ring.c |   14 ++++++++++++++
 drivers/usb/host/xhci.h      |    4 ++++
 2 files changed, 18 insertions(+), 0 deletions(-)

diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index cc1485b..196f0ef 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -314,6 +314,16 @@ void xhci_ring_ep_doorbell(struct xhci_hcd *xhci,
 	__le32 __iomem *db_addr = &xhci->dba->doorbell[slot_id];
 	struct xhci_virt_ep *ep = &xhci->devs[slot_id]->eps[ep_index];
 	unsigned int ep_state = ep->ep_state;
+	struct xhci_virt_device *dev = xhci->devs[slot_id];
+	struct xhci_slot_ctx *slot_ctx;
+	unsigned int slot_state;
+
+	slot_ctx = xhci_get_slot_ctx(xhci, dev->out_ctx);
+	slot_state = GET_SLOT_STATE(slot_ctx->dev_state);
+
+	/* Don't ring the doorbell of the disabled slot */
+	if (slot_state == SLOT_DISABLED)
+		return;
 
 	/* Don't ring the doorbell for this endpoint if there are pending
 	 * cancellations because we don't want to interrupt processing.
@@ -1995,6 +2005,10 @@ static int handle_tx_event(struct xhci_hcd *xhci,
 	case COMP_BUFF_OVER:
 		xhci_warn(xhci, "WARN: buffer overrun event on endpoint\n");
 		break;
+	case COMP_EBADEP:
+		xhci_warn(xhci, "WARN: Doorbell rung for disabled slot "
+				"or endpoint\n");
+		goto cleanup;
 	case COMP_UNDERRUN:
 		/*
 		 * When the Isoch ring is empty, the xHC will generate
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index ac0196e..5292d07 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -558,6 +558,10 @@ struct xhci_slot_ctx {
 /* bits 8:26 reserved */
 /* Slot state */
 #define SLOT_STATE	(0x1f << 27)
+#define SLOT_DISABLED		0
+#define SLOT_DEFAULT		1
+#define SLOT_ADDRESSED		2
+#define SLOT_CONFIGURED		3
 #define GET_SLOT_STATE(p)	(((p) & (0x1f << 27)) >> 27)
 
 
-- 
1.7.0.4



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux