History log of /freebsd-10-stable/sys/dev/usb/controller/xhci.c
Revision Date Author Comments
# 360335 26-Apr-2020 hselasky

MFC r360075:
Set the maximum exit latency to 0 for XHCI USB 3.0 devices, because we
don't implement link power management, LPM.

This fixes error code XHCI_TRB_ERROR_BANDWIDTH for isochronous USB 3.0
transactions.

Submitted by: Horse Ma <Shichun.Ma@dell.com>
Sponsored by: Mellanox Technologies


# 358875 11-Mar-2020 hselasky

MFC r358738:
Remove the power bit from the super speed root hub port status register
because it clobbers the super speed link status when a device is in super
speed mode. Currently the power bit is not needed for anything in the USB
hub driver.

This fixes USB warm reset for super speed devices.

Tested by: Shichun.Ma@dell.com
Sponsored by: Mellanox Technologies


# 356783 16-Jan-2020 hselasky

MFC r356545:
Fix a XHCI driver issue with Intel's Gemini Lake SOC.

Do not configure any endpoint twice, but instead keep track of which
endpoints are configured on a per device basis, and use an evaluate
endpoint context command instead. When changing the configuration make
sure all endpoints get deconfigured and the configured endpoint mask
is reset.

This fixes an issue where an endpoint might stop working if there is
an error and the endpoint needs to be reconfigured as a part of the
error recovery mechanism in the FreeBSD USB stack.

Tested by: Shichun.Ma@dell.com
Sponsored by: Mellanox Technologies


# 353179 07-Oct-2019 hselasky

MFC r352556:
Add quirk for XHCI(4) controllers to support USB control transfers
above 1Kbyte. It might look like some XHCI(4) controllers do not
support when the USB control transfer is split using a link TRB. The
next NORMAL TRB after the link TRB is simply failing with XHCI error
code 4. The quirk ensures we allocate a 64Kbyte buffer so that the
data stage TRB is not broken with a link TRB.

Found at: EuroBSDcon 2019
Sponsored by: Mellanox Technologies


# 353171 07-Oct-2019 hselasky

MFC r352554:
The maximum TD size is 31 and not 15.

Found at: EuroBSDcon 2019
Sponsored by: Mellanox Technologies


# 348853 10-Jun-2019 hselasky

MFC r348604:
In xhci(4) there is no stream ID in the completion TRB.
Instead iterate all the stream IDs in stream mode to find
the matching USB transfer.

Sponsored by: Mellanox Technologies


# 333203 03-May-2018 hselasky

MFC r333100:
Improve fix in r304629 by allowing configuration of the behaviour
through a SYSCTL instead of a compile time define.

Add quirk by default for all LynxPoint XHCI controllers.

PR: 227602
Sponsored by: Mellanox Technologies


# 315252 14-Mar-2017 hselasky

MFC r312424:

Fix problem with suspend and resume when using Skylake chipsets. Make
sure the XHCI controller is reset after halting it. The problem is
clearly a BIOS bug as the suspend and resume is failing without
loading the XHCI driver. The same happens when using Linux and the
XHCI driver is not loaded.

Submitted by: Yanko Yankulov <yanko.yankulov@gmail.com>
PR: 216261


# 304998 29-Aug-2016 hselasky

MFC r304629:
Don't separate the status stage of the XHCI USB control transfers into
its own job because this breaks the simplified QEMU XHCI TRB parser,
which expects the complete USB control transfer as a series of back to
back TRBs. The old behaviour is kept under #ifdef in case this change
breaks enumeration of any USB devices.

PR: 212021


# 304993 29-Aug-2016 hselasky

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


# 302266 29-Jun-2016 hselasky

MFC r302076:
Update the definition for number of scratch pages to match the latest
version of the XHCI specification. Make sure the code can handle the
maximum number of allowed scratch pages.

Submitted by: Shichun_Ma@Dell.com


# 296446 07-Mar-2016 hselasky

MFC r295928:
Configure the correct bMaxPacketSize for control endpoints before
requesting the initial complete device descriptor and not as part of
the subsequent babble error recovery. Babble means that the received
USB packet was bigger than than configured maximum packet size. This
only affects enumeration of FULL speed USB devices which use a
bMaxPacketSize different from 8 bytes. This patch might help fix
enumeration of USB devices which exhibit USB I/O errors in dmesg
during boot.


# 290331 03-Nov-2015 hselasky

MFC r285914, r289029 and r289560:
- Move the remainder of host controller capability registers reading from
xhci_start_controller() to xhci_init(). These values don't change at run-
time so there's no point of acquiring them on every USB_HW_POWER_RESUME
instead of only once during initialization. In r276717, reading the first
couple of registers in question already had been moved as a prerequisite
for the changes in that revision.
- Identify ASMedia ASM1042A controllers.
- Use NULL instead of 0 for pointers.
- Add quirks for USB 3.0 PCI devices.

PR: 203650


# 279648 05-Mar-2015 hselasky

MFC r279544:
Add quirk to disable 64-bit XHCI DMA after r276717.

Requested by: Gary Jennejohn <gljennjohn@gmail.com>


# 279353 27-Feb-2015 hselasky

MFC r279233:
Ensure that the XHCI driver will refresh the control endpoint settings
when re-enumerating a FULL speed device. Else the wrong max packet
setting might be used when trying to re-enumerate a FULL speed device.


# 278662 13-Feb-2015 hselasky

MFC r278477:
Fix DMA address casts.


# 278507 10-Feb-2015 hselasky

MFC r278071:
Section 3.2.9 in the XHCI specification about control transfers says
that we should use a normal-TRB if there are more TRBs extending the
data-stage TRB. Add a dedicated state bit to the internal USB transfer
flags to handle this case.


# 278278 05-Feb-2015 hselasky

MFC r266969 and r276717:
Add 64-bit DMA support in the XHCI controller driver.
- Fix some comments and whitespaces while at it.
- Add support for PAE.


# 276965 11-Jan-2015 hselasky

MFC r276321, r276404, r276407 and r276799:
Various XHCI fixes and improvements:
- Improve and fix MSI interrupt allocation, setup and release.
- Add missed flushing of data which can happen when "xhci_configure_mask()"
is called from "xhci_configure_reset_endpoint()". Ensure the 3-strikes
error feature is always enabled except for ISOCHRONOUS transfers.
- Allow systems having a page size greater than 4K to use fewer
scatter-gather XHCI TRB entries for its payload data. The XHCI
controller can handle at least 65536 bytes per scatter-gather list
entry.


# 272589 06-Oct-2014 hselasky

MFC r272349, r272422 and r272479:
- Fix XHCI driver for devices which have more than 15 physical root HUB
ports. The current bitmap array was too small to hold more than 16
bits and would at some point toggle the context size, which then would
trigger an enumeration fault and cause a fallback to the EHCI
companion controller, if any.
- Make sure we always set the maximum number of valid contexts.
- Set default cycle state in case of early interrupts.


# 272097 25-Sep-2014 hselasky

MFC r271953:
Some XHCI hardware requires dropping the endpoint context before
adding it again.

Approved by: re, glebius


# 269447 02-Aug-2014 hselasky

MFC r269139:
Split the XHCI TRB allocations into smaller parts, so that we don't
end up allocating contiguous busdma buffers above PAGE_SIZE bytes.


# 266669 25-May-2014 hselasky

MFC r266541:

- Fix a bug where the TLBPC value was forced to being odd for IN
direction isochronous transfers.
- Remove setting of fields which does not belong to the respective
TRBs. These fields are currently set as zero and this is more a
cosmetic change.


# 265078 29-Apr-2014 hselasky

MFC r265015:
Setting the IMOD value below 0x3F8 can cause IRQ lockups in the Intel
LynxPoint USB 3.0 controllers found in MacBookPro 2013's.


# 264336 11-Apr-2014 hselasky

MFC r264294:
Fix for infinite XHCI reset loops when the set address USB request fails.


# 262370 23-Feb-2014 hselasky

MFC r261872:
Fix minor logical error in the XHCI driver. Set correct SETUP packet
direction value.


# 261111 24-Jan-2014 hselasky

MFC r258545:
Comply to the XHCI specification. Certain input context fields should
always be zero.


# 261096 24-Jan-2014 hselasky

MFC r260388, r260535 and r260536:
Fix XHCI interrupt logic for "Intel Lynx Point" found in MBP2013.


# 260537 11-Jan-2014 hselasky

MFC r260184:
Minor correction for the XHCI reset logic.


# 259607 19-Dec-2013 hselasky

MFC r259248 and r259462:
Set chain bit correctly. This will fix some problems sending and
receiving Zero Length Packets, ZLPs. See comment in code for more
information.


# 259603 19-Dec-2013 hselasky

MFC r259023 and r259095:
Improve the XHCI command timeout recovery handling code.
Fix some typos while at it.


# 257110 25-Oct-2013 hselasky

MFC r256750:
Improve XHCI stability. When a command timeout happens, the command
should be aborted else the command queue can stop. Refer to section
"4.6.1.2" of the XHCI specification.

Approved by: re (glebius)


# 279648 05-Mar-2015 hselasky

MFC r279544:
Add quirk to disable 64-bit XHCI DMA after r276717.

Requested by: Gary Jennejohn <gljennjohn@gmail.com>


# 279353 27-Feb-2015 hselasky

MFC r279233:
Ensure that the XHCI driver will refresh the control endpoint settings
when re-enumerating a FULL speed device. Else the wrong max packet
setting might be used when trying to re-enumerate a FULL speed device.


# 278662 13-Feb-2015 hselasky

MFC r278477:
Fix DMA address casts.


# 278507 10-Feb-2015 hselasky

MFC r278071:
Section 3.2.9 in the XHCI specification about control transfers says
that we should use a normal-TRB if there are more TRBs extending the
data-stage TRB. Add a dedicated state bit to the internal USB transfer
flags to handle this case.


# 278278 05-Feb-2015 hselasky

MFC r266969 and r276717:
Add 64-bit DMA support in the XHCI controller driver.
- Fix some comments and whitespaces while at it.
- Add support for PAE.


# 276965 11-Jan-2015 hselasky

MFC r276321, r276404, r276407 and r276799:
Various XHCI fixes and improvements:
- Improve and fix MSI interrupt allocation, setup and release.
- Add missed flushing of data which can happen when "xhci_configure_mask()"
is called from "xhci_configure_reset_endpoint()". Ensure the 3-strikes
error feature is always enabled except for ISOCHRONOUS transfers.
- Allow systems having a page size greater than 4K to use fewer
scatter-gather XHCI TRB entries for its payload data. The XHCI
controller can handle at least 65536 bytes per scatter-gather list
entry.


# 272589 06-Oct-2014 hselasky

MFC r272349, r272422 and r272479:
- Fix XHCI driver for devices which have more than 15 physical root HUB
ports. The current bitmap array was too small to hold more than 16
bits and would at some point toggle the context size, which then would
trigger an enumeration fault and cause a fallback to the EHCI
companion controller, if any.
- Make sure we always set the maximum number of valid contexts.
- Set default cycle state in case of early interrupts.


# 272097 25-Sep-2014 hselasky

MFC r271953:
Some XHCI hardware requires dropping the endpoint context before
adding it again.

Approved by: re, glebius


# 269447 02-Aug-2014 hselasky

MFC r269139:
Split the XHCI TRB allocations into smaller parts, so that we don't
end up allocating contiguous busdma buffers above PAGE_SIZE bytes.


# 266669 25-May-2014 hselasky

MFC r266541:

- Fix a bug where the TLBPC value was forced to being odd for IN
direction isochronous transfers.
- Remove setting of fields which does not belong to the respective
TRBs. These fields are currently set as zero and this is more a
cosmetic change.


# 265078 29-Apr-2014 hselasky

MFC r265015:
Setting the IMOD value below 0x3F8 can cause IRQ lockups in the Intel
LynxPoint USB 3.0 controllers found in MacBookPro 2013's.


# 264336 11-Apr-2014 hselasky

MFC r264294:
Fix for infinite XHCI reset loops when the set address USB request fails.


# 262370 23-Feb-2014 hselasky

MFC r261872:
Fix minor logical error in the XHCI driver. Set correct SETUP packet
direction value.


# 261111 24-Jan-2014 hselasky

MFC r258545:
Comply to the XHCI specification. Certain input context fields should
always be zero.


# 261096 24-Jan-2014 hselasky

MFC r260388, r260535 and r260536:
Fix XHCI interrupt logic for "Intel Lynx Point" found in MBP2013.


# 260537 11-Jan-2014 hselasky

MFC r260184:
Minor correction for the XHCI reset logic.


# 259607 19-Dec-2013 hselasky

MFC r259248 and r259462:
Set chain bit correctly. This will fix some problems sending and
receiving Zero Length Packets, ZLPs. See comment in code for more
information.


# 259603 19-Dec-2013 hselasky

MFC r259023 and r259095:
Improve the XHCI command timeout recovery handling code.
Fix some typos while at it.


# 257110 25-Oct-2013 hselasky

MFC r256750:
Improve XHCI stability. When a command timeout happens, the command
should be aborted else the command queue can stop. Refer to section
"4.6.1.2" of the XHCI specification.

Approved by: re (glebius)