History log of /freebsd-10.3-release/sys/dev/usb/controller/xhci.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 296373 04-Mar-2016 marius

- Copy stable/10@296371 to releng/10.3 in preparation for 10.3-RC1
builds.
- Update newvers.sh to reflect RC1.
- Update __FreeBSD_version to reflect 10.3.
- Update default pkg(8) configuration to use the quarterly branch.

Approved by: re (implicit)

# 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)


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 255768 21-Sep-2013 hselasky

Stability fixes for Intel LynxPoint XHCI controllers. Disable XHCI port
routing if we get certain errors. Poll for command completion upon
command timeouts. The XHCI error events might not generate interrupts.

MFC after: 1 week
Reported by: Daniel Gerzo <danger@rulez.sk>, Antonis Anastasiadis <anastasiadis@datalive.gr>
PR: usb/181159
Approved by: re (gjb)


# 255356 07-Sep-2013 hselasky

Revert parts of r245132 and r245175. We don't need to write to the
IMAN register to clear the pending interrupt status bits. This patch
tries to solve problems seen on the MacBook Air, as reported by
Johannes Lundberg <johannes@brilliantservice.co.jp>

MFC after: 1 week


# 255347 07-Sep-2013 hselasky

Disable USB 3.0 streams mode by default, hence not all XHCI chipsets
implement it to avoid undefined behaviour.


# 253532 21-Jul-2013 hselasky

Fix an XHCI regression:

The Block Event Interrupts, BEI, feature does not
work like expected with the Renesas XHCI chipsets.
Revert feature.

While at it correct the TD SIZE computation in
case of Zero Length Packet, ZLP, in the end of a
multi frame USB transfer.

MFC after: 1 week
PR: usb/180726


# 251515 07-Jun-2013 hselasky

Fix some recent regression issues:

1) Only multi-TD isochronous transfers should use NORMAL
type after specific type as per XHCI specification.

2) BEI bit is only available in NORMAL and ISOCHRONOUS
TRB types. Don't use this bit for other types to avoid
hardware asserts. Reserved bits should be don't care
though ...

MFC after: 1 week
PR: usb/179342


# 251499 07-Jun-2013 hselasky

Add support for polling the XHCI interrupt handler when
the regular interrupt handler is not working properly or
in case of MSI interrupts which are not yet supported.
Remove interrupt setup code for FreeBSD versions older
than 700031.

MFC after: 1 week
PR: usb/179342


# 251254 02-Jun-2013 hselasky

Correct the TD size computation. npkt should reflect the number of packets
remaining after the current TRB has been executed. Refer to section 4.11.2.4
of the XHCI specification for USB.

MFC after: 1 week


# 251253 02-Jun-2013 hselasky

Correct TRB type for multi TRB transfers of non-NORMAL type, like isochronous.
Only the first TRB should be markes as special. Subsequent ones should be
marked as NORMAL. Optimise away TD first variable.

MFC after: 1 week


# 251251 02-Jun-2013 hselasky

Block event interrupts when we don't need it as soon as possible.
Typically this feature is used for isochronous transfers.
This reduces the amount of XHCI interrupting.

MFC after: 1 week


# 251249 02-Jun-2013 hselasky

Don't set the start ISOC ASAP bit for non-isochronous TRBs.

MFC after: 1 week


# 251247 02-Jun-2013 hselasky

Correct some XHCI streams mode transfer handling found by code inspection.
The existing streams mode support is not working and has not been tested
due to lack of hardware which supports the given feature.

MFC after: 1 week


# 249786 23-Apr-2013 hselasky

Add descriptive comment.


# 248554 20-Mar-2013 hselasky

Fix spelling.


# 246363 05-Feb-2013 hselasky

Add defines to more easily allow a single threaded version of the FreeBSD
USB stack. This is useful for non-kernel purposes, like the loader.


# 246126 30-Jan-2013 hselasky

Do not unnecessarily split a string literal, because
splitting it makes it hard to grep.

Submitted by: Christoph Mallon


# 246122 30-Jan-2013 hselasky

Modify the FreeBSD USB kernel code so that it can be compiled directly
into the FreeBSD boot loader, typically for non-USB aware BIOSes, EFI systems
or embedded platforms. This is also useful for out of the system compilation
of the FreeBSD USB stack for various purposes. The USB kernel files can
now optionally include a global header file which should include all needed
definitions required to compile the FreeBSD USB stack. When the global USB
header file is included, no other USB header files will be included by
default.

Add new file containing the USB stack configuration for the
FreeBSD loader build.

Replace some __FBSDID()'s by /* $FreeBSD$ */ comments. Now all
USB files follow the same style.

Use cases:
- console in loader via USB
- loading kernel via USB

Discussed with: Hiroki Sato, hrs @ EuroBSDCon


# 246113 30-Jan-2013 hselasky

Add missing NULL pointer check.

Reported by: Lars Engels
MFC after: 1 week


# 245175 08-Jan-2013 hselasky

Shave off another register write to save some more
microseconds of PCI access time.

Tested by: sos @
Submitted by: sos @
MFC after: 1 week


# 245132 07-Jan-2013 hselasky

Optimise the XHCI interrupt handling.
This patch will save CPU time when the XHCI interrupt is
shared with other devices.
Only check event rings when interrupt bits are set.
Otherwise would indicate hiding possible hardware fault(s).

Tested by: sos @
Submitted by: sos @
MFC after: 1 week


# 243780 01-Dec-2012 hselasky

- Add support for Etron EJ168 USB 3.0 Host Controllers.
This brand of controllers expects that the number of
contexts specified in the input slot context points
to an active endpoint context, else it refuses to
operate.

- Ring the correct doorbell when streams mode is used.
- Wrap one or two long lines.

Tested by: Markus Pfeiffer (DragonFlyBSD)
MFC after: 1 week


# 242126 26-Oct-2012 hselasky

Add missing CTLFLAG_TUN flag to tunable sysctls in USB stack.
Rearrange the tunables and belonging sysctl declarations, so
that they are next to eachother.

Submitted by: n_hibma @
MFC after: 1 week


# 241082 01-Oct-2012 hselasky

Inherit USB mode from RootHUB port where the USB device is connected.
Only RootHUB ports can be dual mode. Disallow OTG ports on external HUBs.
This simplifies some checks in the USB controller drivers.

MFC after: 1 week


# 239617 23-Aug-2012 hselasky

Add tunable for XHCI port routing.

MFC after: 1 week


# 239214 12-Aug-2012 hselasky

Add support for the so-called streams feature of BULK endpoints
in SUPER-speed mode, USB 3.0.

This feature has not been tested yet, due to lack of hardware.

This feature is useful when implementing protocols like UASP,
USB attached SCSI which promises higher USB mass storage throughput.

This patch also implements support for hardware processing of endpoints
for increased performance. The switching to hardware processing
of an endpoint is done via a callback to the USB controller driver. The
stream feature is implemented like a variant of a hardware USB protocol.

USB controller drivers implementing device mode needs to be updated to
implement the new "xfer_stall" USB controller method and remove the
"xfer" argument from the "set_stall" method.

The API's toward existing USB drivers are preserved. To setup a USB transfer
in stream mode, set the "stream_id" field of the USB config structure to
the desired value.

The maximum number of BULK streams is currently hardcoded and limited to 8
via a define in usb_freebsd.h.

All USB drivers should be re-compiled after this change.

LibUSB will be updated next week to support streams mode. A new IOCTL to
setup BULK streams as already been implemented. The ugen device nodes
currently only supports stream ID zero.

The FreeBSD version has been bumped.

MFC after: 2 weeks


# 234803 29-Apr-2012 hselasky

Add support for Multi-TT mode of modern USB HUBs.
This will give you more bandwidth for isochronous
FULL speed applications connected through a
High Speed HUB.

This patch has been tested with XHCI and EHCI.

MFC after: 1 week


# 233774 02-Apr-2012 hselasky

Fix compiler warnings, mostly signed issues,
when USB modules are compiled with WARNS=9.

MFC after: 1 weeks


# 230090 13-Jan-2012 hselasky

Bugfix: Make sure the XHCI driver doesn't clear
the route string field. Else USB 3.0 HUBs
won't work.

MFC after: 5 days


# 230050 13-Jan-2012 hselasky

Correct use of USB 3.0 POWER bit in the port status register,
hence it was overlapping the USB 3.0 root HUB's speed bits.

Reported by: Kohji Okuno
MFC after: 1 week


# 230032 12-Jan-2012 hselasky

- Try to fix support for USB 3.0 HUBs.
- Try to fix support for USB 3.0 suspend and resume.

MFC after: 1 week


# 229086 31-Dec-2011 hselasky

Add missing change to XHCI driver similar to changes in r228483.

MFC after: 0 days


# 227654 18-Nov-2011 hselasky

Make some XHCI command timeouts less strict.

Reported by: Jan Henrik Sylvester
MFC after: 1 week


# 227541 15-Nov-2011 hselasky

Some brands of XHCI controllers needs more time to reset.

Reported by: Jan Henrik Sylvester
MFC after: 1 week


# 227401 09-Nov-2011 hselasky

Fix size of USB 3.0 descriptor field.

MFC after: 3 days


# 227396 09-Nov-2011 hselasky

Fix size of USB 3.0 descriptor field.

MFC after: 3 days


# 227309 07-Nov-2011 ed

Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.

The SYSCTL_NODE macro defines a list that stores all child-elements of
that node. If there's no SYSCTL_DECL macro anywhere else, there's no
reason why it shouldn't be static.


# 226803 26-Oct-2011 hselasky

Fix suspend and resume of FULL and HIGH speed USB devices
in the generic XHCI driver. There appears to be some minor
logic missing for this feature to work.

MFC after: 3 days


# 217374 13-Jan-2011 hselasky

- Add support for 64-byte contexts to XHCI driver.
- Remove some dead code.
- Fixed one instance of missing endian conversion.

Approved by: thompsa (mentor)


# 217265 11-Jan-2011 jhb

Remove unneeded includes of <sys/linker_set.h>. Other headers that use
it internally contain nested includes.

Reviewed by: bde


# 213379 03-Oct-2010 hselasky

Commit initial version of new XHCI driver which was written from
scratch. This driver adds support for USB3.0 devices. The XHCI
interface is also backwards compatible to USB2.0 and USB1.0 and will
evntually replace the OHCI/UHCI and EHCI drivers.

There will be follow-up commits during the coming week to link the
driver into the default kernel build and add missing USB3.0
functionality in the USB core. Currently only the driver files are
committed.

Approved by: thompsa (mentor)