From 89a586ed5b8d53651e600582b05593d86a0d8701 Mon Sep 17 00:00:00 2001 From: hselasky Date: Mon, 29 Aug 2016 08:46:15 +0000 Subject: [PATCH] MFC r304597: Fix for invalid use of bits in input context. Basically split configuring of EP0 and non-EP0 into xhci_cmd_evaluate_ctx() and xhci_cmd_configure_ep() respectivly. This resolves some errors when using XHCI under QEMU and gets is more in line with the XHCI specification. PR: 212021 git-svn-id: svn://svn.freebsd.org/base/stable/8@304995 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/dev/usb/controller/xhci.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c index 267fdfdf5..08a38f7b9 100644 --- a/sys/dev/usb/controller/xhci.c +++ b/sys/dev/usb/controller/xhci.c @@ -3794,12 +3794,10 @@ xhci_configure_reset_endpoint(struct usb_xfer *xfer) xhci_configure_mask(udev, (1U << epno) | 1U, 0); - err = xhci_cmd_evaluate_ctx(sc, buf_inp.physaddr, index); - - if (err != 0) - DPRINTF("Could not configure endpoint %u\n", epno); - - err = xhci_cmd_configure_ep(sc, buf_inp.physaddr, 0, index); + if (epno > 1) + err = xhci_cmd_configure_ep(sc, buf_inp.physaddr, 0, index); + else + err = xhci_cmd_evaluate_ctx(sc, buf_inp.physaddr, index); if (err != 0) DPRINTF("Could not configure endpoint %u\n", epno); @@ -4183,6 +4181,10 @@ xhci_device_state_change(struct usb_device *udev) sc->sc_hw.devs[index].state = XHCI_ST_ADDRESSED; + /* set configure mask to slot only */ + xhci_configure_mask(udev, 1, 0); + + /* deconfigure all endpoints, except EP0 */ err = xhci_cmd_configure_ep(sc, 0, 1, index); if (err) { -- 2.45.0