svn commit: r367614 - head/sys/dev/usb/controller

Hans Petter Selasky hselasky at FreeBSD.org
Thu Nov 12 09:15:08 UTC 2020


Author: hselasky
Date: Thu Nov 12 09:15:07 2020
New Revision: 367614
URL: https://svnweb.freebsd.org/changeset/base/367614

Log:
  When doing a USB alternate setting on an USB interface we need to
  re-configure the XHCI endpoint context.
  
  Differential Revision:	https://reviews.freebsd.org/D27174
  MFC after:	1 week
  Sponsored by:	Mellanox Technologies // NVIDIA Networking

Modified:
  head/sys/dev/usb/controller/xhci.c

Modified: head/sys/dev/usb/controller/xhci.c
==============================================================================
--- head/sys/dev/usb/controller/xhci.c	Thu Nov 12 02:52:01 2020	(r367613)
+++ head/sys/dev/usb/controller/xhci.c	Thu Nov 12 09:15:07 2020	(r367614)
@@ -4020,6 +4020,9 @@ xhci_ep_init(struct usb_device *udev, struct usb_endpo
     struct usb_endpoint *ep)
 {
 	struct xhci_endpoint_ext *pepext;
+	struct xhci_softc *sc;
+	uint8_t index;
+	uint8_t epno;
 
 	DPRINTFN(2, "endpoint=%p, addr=%d, endpt=%d, mode=%d\n",
 	    ep, udev->address, edesc->bEndpointAddress, udev->flags.usb_mode);
@@ -4036,6 +4039,18 @@ xhci_ep_init(struct usb_device *udev, struct usb_endpo
 	USB_BUS_LOCK(udev->bus);
 	pepext->trb_halted = 1;
 	pepext->trb_running = 0;
+
+	/*
+	 * When doing an alternate setting, except for control
+	 * endpoints, we need to re-configure the XHCI endpoint
+	 * context:
+	 */
+	if ((edesc->bEndpointAddress & UE_ADDR) != 0) {
+		sc = XHCI_BUS2SC(udev->bus);
+		index = udev->controller_slot_id;
+		epno = XHCI_EPNO2EPID(edesc->bEndpointAddress);
+		sc->sc_hw.devs[index].ep_configured &= ~(1U << epno);
+	}
 	USB_BUS_UNLOCK(udev->bus);
 }
 


More information about the svn-src-all mailing list