Commit Graph

14 Commits

Author SHA1 Message Date
Ian Dowse
093daa268f Attempt to follow the procedure described in section 4.10 of the
EHCI spec for linking in new qTDs into an asynchronous QH. This
requires that there is a qTD marked as not active and not halted
at the start of the QH's list, and the hardware will know to re-fetch
the qTD on each pass rather than just looking at the overlay qTD:

  "The host controller must be able to advance the queue from the
  Fetch QH state in order to avoid all hardware/software race
  conditions. This simple mechanism allows software to simply link
  qTDs to the queue head and activate them, then the host controller
  will always find them if/when they are reachable."

This is achieved by keeping an "inactivesqtd" entry on the QH list,
and re-using it each time as the start of the next transfer, and
allocating a new qTD to become the next inactivesqtd. Then a new
transfer can be activated by just setting its "active" flag, which
avoids all the previous messing with overlay qTD state in
ehci_set_qh_qtd().
2006-05-24 03:04:11 +00:00
Ariff Abdullah
ed3b31fc67 ehci_pci.c:
ATI EHCI controllers exhibit simmilar stall issues and require
	this dropped interrupts workaround. Be verbose about it.
ehci.c:
ehcivar.h:
	Slight change in comments to note about issues surrounding both
	VIA and ATI EHCI controllers.

Approved by:	iedowse
2006-01-16 19:23:59 +00:00
Ian Dowse
afcb6f8261 Work around a problem seen on VIA EHCI controllers where occasionally
an interrupt appears to occur before the transfer has been marked
as completed. This caused umass transfers to get stuck, especially
when writing large files. The workaround sets up a timer that
rechecks for missed completed transfers if some operations are still
pending. Other suggested workarounds, such as performing a PCI read
immediately after acknowledging the interrupts, do not appear to
help.

Obtained from:	OpenBSD
2006-01-15 21:03:19 +00:00
Alexander Leidinger
16f309f0e2 This part of the struct isn't needed on FreeBSD:
---snip---
FYI this bit isn't needed for FreeBSD - I think it came from either
OpenBSD or NetBSD where arc4random() wasn't available during cold
boot.
---snip---

Explained by:	iedowse
2005-09-24 14:49:36 +00:00
Alexander Leidinger
d4c4f2c099 ehcivar.h:
Synchronise with NetBSD upto rev 1.19:
		- Allow 32 chars in the saved vendor string.
		- Some NetBSD-only changes.
		- Some missing parts (define, variable).

ehci_pci.c:
	Add vendor ids for ATI and Philips.

	Add identification strings for the following:
		o ALi's M5239
		o AMD 8111
		o ATI SB200, SB400
		o Intel 6300ESB, ICH4, ICH5, ICH7
		o NVIDIA nForce 2, nForce 3, nForce 4
		o Philips ISP156x

ehcireg.h:
	We're at the same level as rev 1.18 from NetBSD.

usb_port.h:
	NetBSD/OpenBSD specific things

Obtained from:		NetBSD via DragonFly
No comment from:	usb@
2005-09-18 11:45:39 +00:00
Ian Dowse
a3d327674a It was possible to have two threads concurrently aborting the same
transfer, which lead to panics or page faults. For example if a
transfer timed out, another thread could come along and attempt to
abort the same transfer while the timeout task was sleeping in
the *_abort_xfer() function.

Add an "aborting" flag to the private transfer state in each host
controller driver and use this to ensure that the abort is only
executed once. Also prioritise normal abort requests over timeouts
so that the callback is always given a status of USB_CANCELLED even
if the timeout-initiated abort began first.

The crashes caused by this bug were mainly reported in connection
with lpd printing to a USB printer.

PR:	usb/78208, usb/78986
2005-03-19 19:08:46 +00:00
Warner Losh
ad3142eda4 MFp4:
sc_child isn't used on FreeBSD, so ifdef it out in a way that is
NetBSD mergeable.
2005-01-11 07:34:13 +00:00
Warner Losh
098ca2bda9 Start each of the license/copyright comments with /*-, minor shuffle of lines 2005-01-06 01:43:34 +00:00
Julian Elischer
2f37e02978 Rewrite ehci_abort_xfer() to use the method hinted at in the EHCI spec.
to remove a transaction from the async schedule. The previous method didn't
work well and led to the hardware writing to free'd buffers etc, as
it didn't always know that the transaction had been aborted.

Written after consultation with David Brownell who wrote the Linux
EHCI driver.

As part of this give the sqh structure a "previous" pointer.

MFC after:	1 week
2004-12-29 01:21:18 +00:00
Ian Dowse
cf181f3b71 Save and restore state across suspend/resume events.
Submitted by:	David Gwynne <dlg@openbsd.org>
Obtained from:	OpenBSD (+ extra patches supplied by David)
2004-10-30 15:13:09 +00:00
Ian Dowse
f50033ff2e Make the USB subsystem unloadable and detachable, though currently
a significant amount of memory may be leaked each time a host
controller is detached.
2004-08-02 15:37:35 +00:00
Ian Dowse
da37d6ad41 Attempt to follow the correct procedure for synchronising with the
system BIOS to disable legacy device emulation as per the "EHCI
Extended Capability: Pre-OS to OS Handoff Synchronisation" section
of the EHCI spec. BIOSes that implement legacy emulation using SMIs
are supposed to disable the emulation when this procedure is performed.
2004-08-02 12:56:01 +00:00
Ian Dowse
2dacb7cc04 Implement basic support for EHCI interrupt pipes. This is unlikely
to be particularly correct or optimal, but it seems to be enough
to allow the attachment of USB2 hubs and USB2 devices connected via
USB2 hubs. None of the split transaction support is implemented in
our USB stack, so USB1 peripherals will definitely not work when
connected via USB2 hubs.
2004-08-01 18:47:42 +00:00
Bernd Walter
ca3acad1d7 add EHCI (USB 2.0) controller support.
Approved by:	joe
		gallatin (mentor)
Obtained from:  NetBSD
2003-04-14 14:04:08 +00:00