DragonFly BSD

CVS log for src/sys/bus/usb/ehci.c

[BACK] Up to [DragonFly] / src / sys / bus / usb

Request diff between arbitrary revisions


Keyword substitution: kv
Default branch: MAIN


Revision 1.36: download - view: text, markup, annotated - select for diffs
Thu Aug 14 20:55:53 2008 UTC (6 years, 2 months ago) by hasso
Branches: MAIN
CVS tags: HEAD
Diff to: previous 1.35: preferred, unified
Changes since revision 1.35: +0 -4 lines
Remove some useless variables and assignments from USB code.

Found-by: LLVM/Clang Static Analyzer

Revision 1.35: download - view: text, markup, annotated - select for diffs
Tue Jun 10 10:04:05 2008 UTC (6 years, 4 months ago) by hasso
Branches: MAIN
CVS tags: DragonFly_RELEASE_2_0_Slip, DragonFly_RELEASE_2_0, DragonFly_Preview
Diff to: previous 1.34: preferred, unified
Changes since revision 1.34: +0 -45 lines
Remove the code which disables port status change interrupts for 1 second
when one occured. It meant that event get lost or delayed until the next
change leaving the port dead under some circumstances.

Obtained-from: NetBSD

Revision 1.34: download - view: text, markup, annotated - select for diffs
Mon May 26 12:02:42 2008 UTC (6 years, 4 months ago) by mneumann
Branches: MAIN
Diff to: previous 1.33: preferred, unified
Changes since revision 1.33: +3 -5 lines
Expand delay macro into DELAY.

Revision 1.33: download - view: text, markup, annotated - select for diffs
Wed May 21 19:56:46 2008 UTC (6 years, 5 months ago) by mneumann
Branches: MAIN
Diff to: previous 1.32: preferred, unified
Changes since revision 1.32: +28 -33 lines
kprintf to device_printf conversion.

Revision 1.32: download - view: text, markup, annotated - select for diffs
Fri Jun 29 22:56:31 2007 UTC (7 years, 3 months ago) by hasso
Branches: MAIN
CVS tags: DragonFly_RELEASE_1_12_Slip, DragonFly_RELEASE_1_12, DragonFly_RELEASE_1_10_Slip, DragonFly_RELEASE_1_10
Diff to: previous 1.31: preferred, unified
Changes since revision 1.31: +13 -13 lines
Nuke usb_ callout macros.

Revision 1.31: download - view: text, markup, annotated - select for diffs
Thu Jun 28 13:55:12 2007 UTC (7 years, 3 months ago) by hasso
Branches: MAIN
Diff to: previous 1.30: preferred, unified
Changes since revision 1.30: +10 -10 lines
Nuke SIMPLEQ_* and logprintf.

Revision 1.30: download - view: text, markup, annotated - select for diffs
Thu Jun 28 06:32:31 2007 UTC (7 years, 3 months ago) by hasso
Branches: MAIN
Diff to: previous 1.29: preferred, unified
Changes since revision 1.29: +150 -150 lines
Nuke device_ptr_t, USBBASEDEVICE, USBDEVNAME(), USBDEVUNIT(), USBGETSOFTC(),
USBDEVPTRNAME() and Static with help from sed(1).

Revision 1.29: download - view: text, markup, annotated - select for diffs
Wed Jun 27 12:27:59 2007 UTC (7 years, 3 months ago) by hasso
Branches: MAIN
Diff to: previous 1.28: preferred, unified
Changes since revision 1.28: +0 -82 lines
Nuke the code specific to NetBSD/OpenBSD/FreeBSD at first. I doubt anyone
will update these pieces and I don't intend to review macros for all
platforms.

There is the chance though that I might kill something which should stay
in the code in form "TODO: port it to DF". So, please review and kick me.

Revision 1.28: download - view: text, markup, annotated - select for diffs
Fri Dec 22 23:12:17 2006 UTC (7 years, 10 months ago) by swildner
Branches: MAIN
CVS tags: DragonFly_RELEASE_1_8_Slip, DragonFly_RELEASE_1_8
Diff to: previous 1.27: preferred, unified
Changes since revision 1.27: +71 -71 lines
Rename printf -> kprintf in sys/ and add some defines where necessary
(files which are used in userland, too).

Revision 1.27: download - view: text, markup, annotated - select for diffs
Wed Dec 20 18:14:37 2006 UTC (7 years, 10 months ago) by dillon
Branches: MAIN
Diff to: previous 1.26: preferred, unified
Changes since revision 1.26: +1 -1 lines
Rename sprintf  -> ksprintf
Rename snprintf -> knsprintf

Make allowances for source files that are compiled for both userland and
the kernel.

Revision 1.26: download - view: text, markup, annotated - select for diffs
Sun Dec 10 02:03:56 2006 UTC (7 years, 10 months ago) by sephe
Branches: MAIN
Diff to: previous 1.25: preferred, unified
Changes since revision 1.25: +646 -244 lines
Sync USB support (host controller part) with FreeBSD6.

Following changes on FreeBSD-CURRENT(by iedowse@freebsd.org) are merged:
ehci.c	rev 1.52
ohci.c	rev 1.167
uhci.c	rev 1.172
usb.c	rev 1.111
usbdi.h	rev 1.61
"Use a different task queue for host controller and peripheral driver
 tasks. Since the host controllers rely on tasks to process transfer
 timeouts, if a synchronous transfer from a driver was invoked from
 a task and timed out, it would never complete because the single
 task thread was stuck performing the synchronous transfer so couldn't
 process the timeout."

As of this commit, only following kernel APIs are changed:
- usbd_get_string_desc() takes one more argument which returns the actual
  size of the string description.
- usb_add_task() takes one more argument.  The extra arguemnt is used
  to specify to which task queue the task should be added.  There is
  two task queues defined, one for peripheral driver (USB_TASKQ_DRIVER),
  one for host controller (USB_TASKQ_HC).

ugen(4) is adapted according to the above kernel API changes.

Thank all of the folks for their work on the USB support.

Tested-by:
swildner@, vbd@, joerg@(1.6 backport), Max Herrgard <herrgard@gmail.com>

# Though VT6202 is supported by ehci(4), I still have problems with this
# chip, even with the updated ehci(4).

Revision 1.25: download - view: text, markup, annotated - select for diffs
Wed Oct 25 20:55:51 2006 UTC (7 years, 11 months ago) by dillon
Branches: MAIN
Diff to: previous 1.24: preferred, unified
Changes since revision 1.24: +1 -11 lines
Do a major clean-up of the BUSDMA architecture.  A large number of
essentially machine-independant drivers use the structures and definitions
in machine-dependant directories that are really machine-independant in
nature.

Split <machine/bus_dma.h> into machine-depdendant and machine-independant parts
and make the primary access run through <sys/bus_dma.h>.

Remove <machine/bus.h>, <machine/bus_memio.h> and <machine/bus_pio.h>.  The
optimizations related to bus_memio.h and bus_pio.h made a huge mess,
introduced machine-specific knowledge into essentially machine-independant
drivers, and required specific #include file orderings to do their job.
They may be reintroduced in some other form later on.

Move <machine/resource.h> to <sys/bus_resource.h>.  The contents of the file
is machine-independant or can be made a superset across many platforms.

Make <sys/bus.h> include <sys/bus_dma.h> and <sys/bus_resource.h> and
include <sys/bus.h> where necessary. Remove all #include's of
<machine/resource.h> and <machine/bus.h>.  That is, make the BUSDMA
infrastructure integral to I/O-mapped and memory-mapped accesses to devices
and remove a large chunk of machine-specific dependancies from drivers.
bus_if.h and device_if.h are now required to be present when using <sys/bus.h>.

Revision 1.24: download - view: text, markup, annotated - select for diffs
Tue Sep 5 00:55:36 2006 UTC (8 years, 1 month ago) by dillon
Branches: MAIN
Diff to: previous 1.23: preferred, unified
Changes since revision 1.23: +1 -1 lines
Rename malloc->kmalloc, free->kfree, and realloc->krealloc.  Pass 1

Revision 1.23: download - view: text, markup, annotated - select for diffs
Thu Aug 3 16:40:46 2006 UTC (8 years, 2 months ago) by swildner
Branches: MAIN
Diff to: previous 1.22: preferred, unified
Changes since revision 1.22: +1 -1 lines
Remove all occurences of double semicolons at the end of a line by
single ones.

Submitted-by: Bill Marquette <bill.marquette@gmail.com>

Revision 1.22: download - view: text, markup, annotated - select for diffs
Mon Jun 5 20:56:52 2006 UTC (8 years, 4 months ago) by dillon
Branches: MAIN
CVS tags: DragonFly_RELEASE_1_6_Slip, DragonFly_RELEASE_1_6
Diff to: previous 1.21: preferred, unified
Changes since revision 1.21: +0 -2 lines
Remove an inappropriate crit_exit() in ehci.c and add a missing crit_exit()
in kern/vfs_subr.c.  Specify string IDs in vfsync_bp() so we don't get
complaints on the console when the kernel is compiled with
DEBUG_CRIT_SECTIONS.

The missing crit_exit() in kern/vfs_subr.c was causing the kernel to leave
threads in a critical section, causing interrupts to stop operating and
cpu-bound userland programs to lock up the rest of the system.

Reported-by: Sascha Wildner <saw@online.de>, others.

Revision 1.21: download - view: text, markup, annotated - select for diffs
Fri May 5 20:14:58 2006 UTC (8 years, 5 months ago) by dillon
Branches: MAIN
Diff to: previous 1.20: preferred, unified
Changes since revision 1.20: +2 -2 lines
Remove the thread pointer argument to lockmgr().  All lockmgr() ops use the
current thread.

Move the lockmgr code in BUF_KERNPROC to lockmgr_kernproc().  This code
allows the lock owner to be set to a special value so any thread can unlock
the lock and is required for B_ASYNC I/O so biodone() can release the lock.

Revision 1.20: download - view: text, markup, annotated - select for diffs
Tue May 2 16:12:01 2006 UTC (8 years, 5 months ago) by dillon
Branches: MAIN
Diff to: previous 1.19: preferred, unified
Changes since revision 1.19: +31 -0 lines
- Add workarounds for dropped interrupts on VIA and ATI controllers.
- Include more vendor IDs.

Submitted-by: Gary <gary@velocity-servers.net>
Taken-from: FreeBSD/NetBSD

Revision 1.19: download - view: text, markup, annotated - select for diffs
Sat Apr 29 22:05:21 2006 UTC (8 years, 5 months ago) by dillon
Branches: MAIN
Diff to: previous 1.18: preferred, unified
Changes since revision 1.18: +4 -2 lines
Bring in some fixes from NetBSD:

- Avoid NULL pointer dereference (ehci.c)
- Abort quickly if we don't have a buffer in all the cases. (uhci.c)
- Only do the software reset if we are dying, like we do in ohci and
  ehci (uhci.c)

Submitted-by: Gary <gary@velocity-servers.net>
Taken-from: NetBSD

Revision 1.18: download - view: text, markup, annotated - select for diffs
Sun Apr 23 03:07:58 2006 UTC (8 years, 6 months ago) by dillon
Branches: MAIN
Diff to: previous 1.17: preferred, unified
Changes since revision 1.17: +2 -2 lines
Remove the now unused interlock argument to the lockmgr() procedure.
This argument has been abused over the years by kernel programmers
attempting to optimize certain locking and data modification sequences,
resulting in a virtually unreadable code in some cases.  The interlock
also made porting between BSDs difficult as each BSD implemented their
interlock differently.  DragonFly has slowly removed use of the interlock
argument and we can now finally be rid of it entirely.

Revision 1.17: download - view: text, markup, annotated - select for diffs
Thu Mar 2 19:07:54 2006 UTC (8 years, 7 months ago) by dillon
Branches: MAIN
Diff to: previous 1.16: preferred, unified
Changes since revision 1.16: +1 -1 lines
Pass LK_PCATCH instead of trying to store tsleep flags in the lock
structure, so multiple entities competing for the same lock do not
use unexpected flags when sleeping.

Only NFS really uses PCATCH with lockmgr locks.

Revision 1.16: download - view: text, markup, annotated - select for diffs
Sun Jan 22 14:03:51 2006 UTC (8 years, 9 months ago) by swildner
Branches: MAIN
Diff to: previous 1.15: preferred, unified
Changes since revision 1.15: +53 -11 lines
* Move function types to a separate line.

* Ansify function definitions.

* Remove (void) casts for discarded return values.

In collaboration with: Alexey Slynko <slynko@tronet.ru>

Revision 1.15: download - view: text, markup, annotated - select for diffs
Sun Sep 4 05:16:59 2005 UTC (9 years, 1 month ago) by dillon
Branches: MAIN
CVS tags: DragonFly_RELEASE_1_4_Slip, DragonFly_RELEASE_1_4
Diff to: previous 1.14: preferred, unified
Changes since revision 1.14: +11 -13 lines
1.101   Update code comments.

1.100   Update code comments.

1.99    DEFERRED
1.98    DEFERRED

1.97    Timeout while polling is in ms not ticks.  [This should be
        computationally equivalent to the code that was there before, but
        is far simpler].

1.96    DEFERRED - Abort race.  It is unclear whether an xfer can be
                   aborted multiple times.

1.95    DEFERRED (interrupt fixes that may still be buggy)
1.94    DEFERRED (interrupt fixes that may still be buggy)
1.93    DEFERRED (interrupt fixes that may still be buggy)
1.92    DEFERRED (interrupt fixes that may still be buggy)

1.91    NOT APPLICABLE (whitespace cleanup)

1.90    WILL NOT BE APPLIED - This rev tries to setup some sort of
        memory reserve but doesn't really solve any problems.  A
        reserve is useless if it is not operated as a circular
        resource-limited pipeline.

1.89    Don't error out if the number of companion controllers is wrong, just
        complain and go ahead.

Revision 1.14: download - view: text, markup, annotated - select for diffs
Sun Sep 4 04:46:12 2005 UTC (9 years, 1 month ago) by dillon
Branches: MAIN
Diff to: previous 1.13: preferred, unified
Changes since revision 1.13: +19 -13 lines
Merge the following revs from NetBSD (in an attempt to bring new material
in in a more piecemeal fashion):

1.105   NOT APPLICABLE TO DRAGONFLY.  This rev moved interrupt enablement
	to near the end of the init.  DragonFly already goes even further
	and moves interrupt enablement into the PCI module.

1.104   Constification and variable naming cleanup.

1.103   Make sure all physical addresses are filled in the qTD even when we have
        a page offset.

1.102   Make sure to honor the USBD_FORCE_SHORT_XFER flag and generate an empty
        transfer when necessary.

Revision 1.13: download - view: text, markup, annotated - select for diffs
Sun Sep 4 04:27:57 2005 UTC (9 years, 1 month ago) by dillon
Branches: MAIN
Diff to: previous 1.12: preferred, unified
Changes since revision 1.12: +58 -350 lines
Revert the very last commit to ehci.c (1.12).  It was locking the system
up on boot.  The other portions of the Jeroen's patch set remain intact.

Revision 1.12: download - view: text, markup, annotated - select for diffs
Sat Aug 27 19:00:49 2005 UTC (9 years, 1 month ago) by asmodai
Branches: MAIN
Diff to: previous 1.11: preferred, unified
Changes since revision 1.11: +351 -59 lines
Synchronise with NetBSD:

ehci.c:

v1.74: Add suspend/resume support.
v1.75: Fix typo: compolicated.
v1.76: A little portability stuff (lockmgr -> usb_lockmgr)
v1.78: add interrupt transfers
v1.79: use DPRINTF instead of a printf

ehcireg.h:

1.18: Fix EHCI_HCS_P_INDICATOR

usb_port.h:

NetBSD/OpenBSD specific things, lockmgr->usb_lockmgr..

Revision 1.11: download - view: text, markup, annotated - select for diffs
Sat Aug 27 15:34:17 2005 UTC (9 years, 1 month ago) by asmodai
Branches: MAIN
Diff to: previous 1.10: preferred, unified
Changes since revision 1.10: +28 -35 lines
Synchronise with NetBSD (some come from OpenBSD):

v1.68: Adjust some silliness that was causing us to do extra work for "frame
       list rollover" interrupts, which we pretty much ignore.
v1.69: hcpriv is not actually used here.  Remove references to it.
v1.71: ANSIfy.
v1.72: Update printfs with accurate function names.
       Convert EHCI_LINK_TERMINATE using htole32().
v1.73: Fix spelling of intterupt.
       Use do .. while wrappers for debug print.

Revision 1.10: download - view: text, markup, annotated - select for diffs
Sat Aug 27 15:09:38 2005 UTC (9 years, 1 month ago) by asmodai
Branches: MAIN
Diff to: previous 1.9: preferred, unified
Changes since revision 1.9: +2 -2 lines
Place && at the right place.

Revision 1.9: download - view: text, markup, annotated - select for diffs
Sat Aug 27 14:56:52 2005 UTC (9 years, 1 month ago) by asmodai
Branches: MAIN
Diff to: previous 1.8: preferred, unified
Changes since revision 1.8: +7 -0 lines
Sync with NetBSD:

PR/23128:

Although the dma descriptors are limited to any 4G address range,
the data is not, using extra area in the dma descriptors to
define a 64 bit address. This is described in appendix B
of the EHCI 1.0 spec from the URL in the file dev/usb/ehci.c.
With a 64 bit address capable controller these upper address
values must be set, the current driver does not do this.

Revision 1.8: download - view: text, markup, annotated - select for diffs
Fri Jun 10 18:21:11 2005 UTC (9 years, 4 months ago) by dillon
Branches: MAIN
Diff to: previous 1.7: preferred, unified
Changes since revision 1.7: +8 -3 lines
Attempt to avoid a livelocked USB interrupt during boot by not enabling
the EHCI interrupt until after all the companion controllers have been
attached.

Revision 1.7: download - view: text, markup, annotated - select for diffs
Thu Jun 2 20:40:40 2005 UTC (9 years, 4 months ago) by dillon
Branches: MAIN
Diff to: previous 1.6: preferred, unified
Changes since revision 1.6: +45 -59 lines
Remove spl*() calls from the bus/ infrastructure, replacing them with
critical sections.  Remove splusb() from everywhere, replacing it with
critical sections.

Revision 1.6: download - view: text, markup, annotated - select for diffs
Thu Jul 8 03:47:09 2004 UTC (10 years, 3 months ago) by dillon
Branches: MAIN
CVS tags: DragonFly_Stable, DragonFly_Snap29Sep2004, DragonFly_Snap13Sep2004, DragonFly_RELEASE_1_2_Slip, DragonFly_RELEASE_1_2, DragonFly_1_0_REL, DragonFly_1_0A_REL
Diff to: previous 1.5: preferred, unified
Changes since revision 1.5: +75 -58 lines
Bring EHCI up-to-date with NetBSD.  The most serious fixes are 1.53, 1.55,
1.56, and 1.64.

    revision 1.67
    Fix a byte order error.	(note: was already previously ported to
				 DFly)

    revision 1.66
    Fix an endianness problem (EHCI_NULL was being double-swapped).

    revision 1.65
    Make one message dependent on ohcidebug, so it doesn't interfere with polled
    operation; e.g. when entering a root device or in DDB.

    revision 1.64
    Further cleanup of toggle handling.  Now that we use EHCI_QH_DTC, we don't
    need to fiddle with the TOGGLE bit in the overlay descriptor, so minimize
    how much we fuss with it.

    revision 1.63
    Fix an error in a debug printf().

    revision 1.62
    Adjust a couple of comments to make it clear WTF is going on.

    revision 1.61

    revision 1.60
    Remove comment about the data toggle being borked.

    revision 1.59
    As the ehci_idone() now uses the variable `epipe' unconditionally, always
    declare it (in other words, make this file compile w/o EHCI_DEBUG).

    revision 1.58
    Fix a stupid bug in ehci_check_intr() that caused use to try to complete a
    transaction that was still running.  Now ehci can handle multiple devices
    being active at once.

    revision 1.57
    Oops.  Remove a couple of printf()s.

    revision 1.56
    Failure to properly mask off UE_DIR_IN from the endpoint address was causing
    OHCI_ED_FORMAT_ISO and EHCI_QH_HRECL to get set spuriously, causing rather
    interesting lossage.

    Suddenly I get MUCH better performance with ehci...

    revision 1.55
    Set the data toggle correctly, and use EHCI_QTD_DTC.  This fixes problems with
    my ALi-based drive enclosure (it works now, rather than failing to attach).
    Also seems to work with a GL811-based enclosure and an ASUS enclosure with a
    CD-RW, on both Intel and NEC controllers.

    Note: The ALi enclosure is currently very SLOW, due to some issue with taking
    too long to notice that the QTD is complete.  This requires more investigation.

    revision 1.54
    branches:  1.54.2;
    Michael van Elst reports his USB2 disk works stable after latest Chuck's
    ehci.c changes, so remove the item from TODO.

    revision 1.53
    in ehci_softintr() when looping over the active xfers, save the next pointer
    before calling ehci_check_intr(), since that will free the xfer structure
    if the xfer is complete.

    revision 1.52
    add list of known issues, from Lennart Augustsson and Michael van Elst

    revision 1.51
    Use the correct wValue to get hub desriptors.
    Also, make wValue checks of root hub codes less strict.

Revision 1.5: download - view: text, markup, annotated - select for diffs
Fri Mar 12 03:43:06 2004 UTC (10 years, 7 months ago) by dillon
Branches: MAIN
CVS tags: DragonFly_1_0_RC1
Diff to: previous 1.4: preferred, unified
Changes since revision 1.4: +1 -1 lines
Use M_INTWAIT and M_WAITOK instead of M_NOWAIT within the USB bus
infrastructure.  For the system to operate as expected, allocations
done in this layer have to be reliable.

Revision 1.4: download - view: text, markup, annotated - select for diffs
Wed Feb 11 15:17:26 2004 UTC (10 years, 8 months ago) by joerg
Branches: MAIN
Diff to: previous 1.3: preferred, unified
Changes since revision 1.3: +5 -5 lines
Add defined(__FreeBSD__) and defined(__DragonFly__) where appropriate

Revision 1.3: download - view: text, markup, annotated - select for diffs
Thu Jan 8 18:12:59 2004 UTC (10 years, 9 months ago) by asmodai
Branches: MAIN
Diff to: previous 1.2: preferred, unified
Changes since revision 1.2: +1 -1 lines
Get rid of PZERO.  This was removed about the first of August.
It probably compiled due to the preprocessor defining code out.

Revision 1.2: download - view: text, markup, annotated - select for diffs
Thu Jan 1 00:29:25 2004 UTC (10 years, 9 months ago) by dillon
Branches: MAIN
Diff to: previous 1.1: preferred, unified
Changes since revision 1.1: +10 -10 lines
Get EHCI to compile.  This will make USB2.0 work when 'device ehci' is
specified.  Note that USB2.0 support is not as good as USB1.x support,
but it does appear to work with my USB2.0 external hard drive.

Revision 1.1: download - view: text, markup, annotated - select for diffs
Tue Dec 30 01:01:44 2003 UTC (10 years, 9 months ago) by dillon
Branches: MAIN
Bring in the entire FreeBSD-5 USB infrastructure.  As of this commit my
USB camera, Hard Drive, Mouse, and Sony memory key all work and I can even
unplug and replug them in without crashing the port.

Not all drivers and subsystems compile as of this commit, but the ones that
do not are very close.

Diff request

This form allows you to request diffs between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.

Log view options