svn commit: r368210 - stable/11/sys/dev/usb/controller

Hans Petter Selasky hselasky at FreeBSD.org
Tue Dec 1 12:33:39 UTC 2020


Author: hselasky
Date: Tue Dec  1 12:33:39 2020
New Revision: 368210
URL: https://svnweb.freebsd.org/changeset/base/368210

Log:
  MFC r367614:
  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
  Sponsored by:		Mellanox Technologies // NVIDIA Networking

Modified:
  stable/11/sys/dev/usb/controller/xhci.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/usb/controller/xhci.c
==============================================================================
--- stable/11/sys/dev/usb/controller/xhci.c	Tue Dec  1 12:32:35 2020	(r368209)
+++ stable/11/sys/dev/usb/controller/xhci.c	Tue Dec  1 12:33:39 2020	(r368210)
@@ -4049,6 +4049,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);
@@ -4065,6 +4068,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