Commit Graph

46 Commits

Author SHA1 Message Date
Josef Karthauser
094fb32de7 Update to reflect the NetBSD patches that are already included. 2003-07-14 20:31:03 +00:00
John-Mark Gurney
c97325b0c8 WARNING: white space diff
This code reduces the number of trailing white space to be more in line
w/ NetBSD.  I don't regenerate usbdevs, saving that for when it really
changes.
2003-07-04 01:50:39 +00:00
Josef Karthauser
567f4af63d MFNetBSD: ugen.c (1.57), ulpt.c (1.48), usb.c (1.67), usbdi.c (1.96),
usbdi.h (1.60)
	  (and local changes compatibility changes to ufm.c and urio.c)

    date: 2002/02/11 15:11:49;  author: augustss;
    Give usbd_do_request_flags() an extra argument for the timeout.
2002-05-06 18:23:36 +00:00
Josef Karthauser
3aebbbbc02 Update $NetBSD$ idents. 2002-04-07 17:02:25 +00:00
Josef Karthauser
7c21b0290d MFNetBSD: ukbd.c (1.52), usbdi.c (1.54), usbdi.h (1.35)
date: 2000/01/16 09:37:18;  author: augustss;
    Let usbd_set_polling() work on a usbd_device_handle instead of
    a usbd_interface_handle.
2002-04-07 13:16:18 +00:00
Josef Karthauser
58af1b84da MFNetBSD: usbdi.c (1.93), usbdi.h (1.59)
date: 2001/12/24 21:36:15;  author: augustss;
    Add some more DIAGNOSTIC tests.
    Make usb_match_device() match on USB_PRODUCT_ANY.
2002-04-07 12:42:18 +00:00
Josef Karthauser
f7f4bdbbcb Update $NetBSD$ ident. 2002-04-07 12:29:55 +00:00
Josef Karthauser
f046c9272a MFNetBSD: usbdi.c (1.80), usbdi.h (1.51)
date: 2001/04/13 11:19:58;  author: augustss;
    Finally get rid of the UGLY and EVIL hack for avoiding tsleep().
2002-04-07 12:18:52 +00:00
Josef Karthauser
dfdec0c69e MFNetBSD: usbdi.c (1.63), usbdi.h (1.41)
date: 2000/03/02 12:37:51;  author: augustss;
    Use ratecheck() to limit error messages on disconnect.
    Break out some common functionality.

We don't have ratecheck() in our kernel yet, so I've hardcoded
usb_ratecheck() to return true always.
2002-04-07 11:56:19 +00:00
Josef Karthauser
05172ec004 MFNetBSD: usbdi.c (1.85), usbdi.h (1.54), usbdi_util.c (1.37)
date: 2001/11/15 15:15:59;  author: augustss;
    usbd_interface2device_handle() cannot fail.
2002-04-07 10:50:41 +00:00
Josef Karthauser
86cf1335d5 Back the last commit out. The network drivers need reworking first. :( 2002-04-02 14:54:52 +00:00
Josef Karthauser
920153807b MFNetBSD: usbdi.c (1.80), usbdi.h (1.51)
date: 2001/04/13 11:19:58;  author: augustss;
    Finally get rid of the UGLY and EVIL hack for avoiding tsleep().
2002-04-02 14:28:18 +00:00
Josef Karthauser
e92dc1d513 MFNetBSD: usb_subr.c (1.87), usbdi.h (1.53)
date: 2001/08/15 00:04:59;  author: augustss;
    Add a little infrastructure so that individual drivers can easily check
    if thee was a vendor+product locator match.
2002-04-02 14:08:43 +00:00
Josef Karthauser
548db09f32 MFNetBSD:
revision 1.50
    date: 2001/04/12 01:18:24;  author: thorpej;  state: Exp;  lines: +6 -2
    Only if __HAVE_GENERIC_SOFT_INTERRUPTS is then splusb == splsoftnet
    (because we register the interrupt with IPL_SOFTNET).  However, if
    we're using a callout, then splusb == splsoftclock (because the
    callouts happen from the softclock interrupt).

    Note that splsoftnet blocks softclock interrupts, but this is
    meant to better describe what's going on.
2002-04-02 10:53:42 +00:00
Josef Karthauser
09f681d7b7 MFNetBSD: usb.c (1.53), usbdi.h (1.49)
date: 2001/01/23 17:04:30;  author: augustss;
    Ad function to remove a usb task.
2002-04-02 09:58:16 +00:00
Josef Karthauser
e469fe6e0a MFNetBSD: uhub.c (1.49), usb.c (1.51), usbdi.h (1.48), usbdivar.h (1.63)
date: 2001/01/21 19:00:06;  author: augustss;
    Change the operation of the USB event thread.  Before it only
    performed USB device discovery, now it can also perform (short)
    tasks for device drivers that need a process context, but don't
    have one.  This is not pretty, but better than using busy-wait
    in an interrupt context.
2002-04-02 09:49:36 +00:00
Josef Karthauser
8be36692c3 MFNetBSD: ohci.c (1.99), uhci.c (1.133), usb.c (1.49), usb_port.h
(1.39), usbdi.c (1.79), usbdi.h (1.47), usbdivar.h (1.62)

    date: 2001/01/21 02:39:52;  author: augustss;
    Add code to use soft interrupt to handle USB interrupt processing.
    Don't enable the code since it doesn't work with the kludgy Ethernet
    drivers.
2002-04-01 21:34:01 +00:00
Josef Karthauser
a4c63369dd constify 2002-04-01 19:22:04 +00:00
Josef Karthauser
8271e9b194 Update $NetBSD$ idents to better reflect reality. 2002-04-01 18:31:16 +00:00
Josef Karthauser
44b382cbc0 Synchronise with the NetBSD version of this header file for formatting. 2002-04-01 17:43:28 +00:00
Josef Karthauser
d262a59fb2 Merge from NetBSD: usbdi.c rev 1.77, usbdi.h rev 1.44
date: 2000/09/23 21:02:04;  author: augustss;
    Add a way to do control transfers on other pipes than the default pipe.
2002-04-01 17:30:24 +00:00
Josef Karthauser
ce3eae9093 Merge from NetBSD: revs 1.55 and 1.56
Original NetBSD logs:

	----------------------------
	revision 1.56
	date: 2001/12/03 01:47:12;  author: augustss;  lines: +5 -3
	Handle vendor/product lookup with a common routine.
	----------------------------
	revision 1.55
	date: 2001/12/02 23:25:25;  author: augustss;  lines: +8 -1
	Add a subroutine to search for a vendor/product pair.
	----------------------------
2002-02-11 03:15:08 +00:00
Josef Karthauser
a07e9d4af3 Merge from NetBSD.
uhub.c:     revision 1.37
    usb.4:      revision 1.30
    usb.c:      revision 1.38
    usb.h:      revision 1.40
    usb_port.h: revision 1.21
    usb_subr.c: revision 1.65
    usbdi.h:    revision 1.40

Split the attach/detach events up into device, driver and controller
attach and detach events.

The commit message from NetBSD was:
        date: 2000/02/02 07:34:00;  author: augustss;  state: Exp;
        Change the USB event mechanism to include more information
        about devices and drivers.  Partly from FreeBSD.

Also rework usbd to take these new event types into account.
2002-01-28 01:03:19 +00:00
Josef Karthauser
b7e4eb198d Merge from NetBSD:
ohci.c:	revision 1.72 and 1.73
    ohcivar.h:	revision 1.19 and 1.20
    uhci.c:	revision 1.85
    usbdi.h:	a small part of revision 1.40
    usbdivar.h:	revision 1.47

Relevant commit messages from NetBSD are:

	date: 2000/02/22 11:30:54;  author: augustss;  state: Exp;
	Prepare a little for having USB interrupt processing done
	outside the hard interrupt level (in a thread or a softintr).
	No real soft processing done yet.
	----------------------------
	date: 2000/02/01 05:42:53;  author: augustss;  state: Exp;
	Put some #ifdefs around power and shutdown hooks.
2002-01-26 12:04:22 +00:00
Nick Hibma
e1f5734cbe Pull in the most recent version of usb_quirks.h and propagate the necessary
changes to the various files.

Also, pull in most of the current usb_subr.c file.
2001-07-05 10:12:59 +00:00
Nick Hibma
4f04f78215 Remove __P prototypes to reduce diffs between the NetBSD and FreeBSD
versions.
2000-07-17 18:41:20 +00:00
Nick Hibma
128aa3af3c Change Lennart's e-mail address. 2000-05-14 16:43:10 +00:00
Nick Hibma
f68d3a9c5c Add usbd_clear_endpoint_toggle(pipe) function.
This is needed to implement a asynchronous callback for clear endpoint
stall, needed for the umass driver.
2000-01-25 18:40:39 +00:00
Bill Paul
a6d9a40e81 More USB ethernet tweaks:
- Sync ohci, uhci and usbdi modules with NetBSD in order to obtain the
  following improvements:
        o New USBD_NO_TSLEEP flag can be used in place of UQ_NO_TSLEEP
          quirk. This allows drivers to specify busy waiting only for
          certain transfers (namely control transfers for reading/writing
          registers and stuff).
        o New USBD_FORCE_SHORT_XFER flag can be used to deal with
          devices like the ADMtek Pegasus that sense the end of bulk OUT
          transfers in a special way (if a transfer is exactly a multiple
          of 64 bytes in size, you need to send an extra empty packet
          to terminate the transfer).
        o usbd_open_pipe_intr() now accepts an interval argument which
          can be used to change the rate at which the interrupt callback
          routine is invoked. Specifying USBD_DEFAULT_INTERVAL uses the
          value specified in the device's config data, but drivers can
          override it if needed.
- Change if_aue to use USBD_FORCE_SHORT_XFER for packet transmissions.
- Change if_aue, if_kue and if_cue to use USBD_NO_TSLEEP for all
  control transfers. We no longer force the non-tsleep hack for
  bulk transfers since these are done asynchronously anyway.
- Removed quirk entry fiddling from if_aue and if_kue since we don't
  need it anymore now that we have the USBD_NO_TSLEEP flag.
- Tweak ulpt, uhid, ums and ukbd drivers to use the new arg to
  usbd_open_pipe_intr().
- Add a flag to the softc struct in the ethernet drivers to indicate
  when a device has been detached, and use this flag to perform
  tests to prevent the drivers from trying to do control transfers
  if this is the case. This is necessary because calling if_detach()
  with INET6 enabled will eventually result in a call to the driver's
  ioctl() routine to delete the multicast groups on the interface,
  which will result in attempts to perform control transfers. (It's
  possible this also happens even without INET6 support enabled.) This
  is pointless since we know that if the detach method has been called,
  the hardware has been unplugged.
- Changed watchdog timeout routines to just call the driver init routines
  to initialize the device states without trying to close and re-open the
  pipes. This is partly because we don't want to frob things at interrupt
  context, but also because this doesn't seem to work right and I don't
  want to panic the system just because a USB device may have stopped
  responding.
- Fix aue_rxeof() to be a little smarter about detecting when a double
  transfer is needed. Unfortunately, the design of the chip makes it hard
  to get this exactly right. Hopefully, this will go away once either
  Nick or Lennart finds the bug in the uhci driver that makes this ugly
  hack necessary.
- Also sync usbdevs with NetBSD.
2000-01-20 07:38:33 +00:00
Nick Hibma
a9909bdaab Synchronisation with NetBSD 1999/11/27
- more req[uest]->xfer changes.
- get the corresponding NetBSD Id's right

ohci.c
   - move untimeout above print statement
   - remove usb_delay that panics the system (tsleep in intr context) when
   ohcidebug > 5.

ugen.c
   - create the devices for endpoints with make_dev.

uhub.c
   - change from using usbdebug to uhubdebug
   - add more debugging statements
1999-11-28 21:01:06 +00:00
Nick Hibma
3241be7550 Synchronisation with NetBSD as of 1999/11/16:
Cleaning up the code:
- Declare many functions static
- Change variable names to make them more self explanatory
- Change usbd_request_handle -> usbd_xfer_handle
- Syntactical changes
- Remove some unused code
- Other KNF changes

Interrupt context handling
- Change delay to usbd_delay_ms were possible (takes polling mode into
  account)
- Change detection mechanism for interrupt context

Add support for pre-allocation DMA-able memory by device driver

Add preliminary support for isochronous to the UHCI driver (not for OHCI
yet).

usb.c, uhci.c, ohci.c
- Initial attempt at detachable USB host controllers
- Handle the use_polling flag with a lttle more care and only set it if
we are cold booting.

usb.c, uhci.c ohci.c, usbdi.c usbdi_util.c usb_subr.c
- Make sure an aborted pipe is marked as not running.
- Start queued request in the right order.
- Insert some more DIAGNOSTIC sanity checks.
- Remove (almost) unused definitions USBD_XFER_OUT and USBD_XFER_IN.

usb.c, usb_subr.c
- Add an event mechanism so that a userland process can watch devices
  come and go.

ohci.c
- Handle the case when a USB transfer is so long that it crosses two
  page (4K) boundaries.  OHCI cannot do that with a single TD so we make
  a chain.

ulpt.c
- Use a bigger buffer when transferring data.
- Pre-allocate the DMA buffer.  This makes the driver slightly more
  efficient.
- Comment out the GET_DEVICE_ID code, because for some unknown reason it
  causes printing to fail sometimes.

usb.h
- Add a macro to extract the isoc type.
- Add a macro to check whether the routine has been entered after splusb
  and if not, complain.

usbdi.c
- Fix a glitch in dequeueing and aborting requests on interrupt pipes.
- Add a flag in the request to determine if the data copying is done by
  the driver or the usbdi layer.
1999-11-17 22:33:51 +00:00
Nick Hibma
354b93e124 priorities weren't correct (old version). 1999-10-07 20:58:43 +00:00
Nick Hibma
8c895d718b Major synchronisation with the NetBSD USB stack:
- Some cleanup and improvements in the uhci and ohci drivers
- Support for plugging and unplugging devices improved
- Now available is bulk transport over OHCI controllers
- Resume and suspend have been temporarily been disabled again.  Proper
  support for it is available in the uhci.c and ohci.c files but I have
  not yet spent the brain cycles to use it.
- OpenBSD now uses the USB stack as well
- Add FreeBSD tags
1999-10-07 19:26:38 +00:00
Nick Hibma
6d38342e16 Add comments, change variable names to make them consistent (r -> err,
timo_handle -> timeout_handle, p -> pipe, *pipe -> *rpipe, etc.)
1999-07-25 18:54:22 +00:00
Nick Hibma
178e4460ef Replace usbd_device_set_desc by device_set_desc_copy 1999-06-27 09:42:40 +00:00
Nick Hibma
509a03961f USB stopped working as of the recent cdevsw cleanup. This fixes that. 1999-06-01 07:22:01 +00:00
Nick Hibma
f26c33d249 usbdi.h:
Implement priorities.
GENERIC, LINT, files:
        Remove remarks about ordering of device names.
GENERIC, LINT:
        Sort the devices alphabetically in LINT and GENERIC.
1999-05-20 20:02:37 +00:00
Peter Wemm
6182fdbda8 Bring the 'new-bus' to the i386. This extensively changes the way the
i386 platform boots, it is no longer ISA-centric, and is fully dynamic.
Most old drivers compile and run without modification via 'compatability
shims' to enable a smoother transition.  eisa, isapnp and pccard* are
not yet using the new resource manager.  Once fully converted, all drivers
will be loadable, including PCI and ISA.

(Some other changes appear to have snuck in, including a port of Soren's
 ATA driver to the Alpha.  Soren, back this out if you need to.)

This is a checkpoint of work-in-progress, but is quite functional.

The bulk of the work was done over the last few years by Doug Rabson and
Garrett Wollman.

Approved by:	core
1999-04-16 21:22:55 +00:00
Nick Hibma
67aa00a71b 1) Make debugging more selective.
2) create function usbd_errstr which turns a usbd_status into a sensible
   error message
3) Change the printf in DPRINTF to logprintf which is a define for
   log(KERN_DEBUG, x)
1999-04-11 20:50:33 +00:00
Nick Hibma
ff0ccda34e change wrong names in prototypes (pipe to dev) 1999-04-05 17:19:48 +00:00
Nick Hibma
83fac6ab3f Cosmetical changes. 1999-03-22 19:58:59 +00:00
Nick Hibma
235dddd4ea Textual changes 1999-01-22 00:51:12 +00:00
Nick Hibma
53809e8652 Sync with NetBSD sources. Almost there. Mostly style fixes. 1999-01-10 18:42:54 +00:00
Nick Hibma
a73f7cf01f Major synchronisation with NetBSD USB code 1999-01-07 23:07:57 +00:00
Nick Hibma
6fef2c2c27 Added Id to all files 1998-12-14 09:32:25 +00:00
Nick Hibma
0cec007c5f Initial commit of ported NetBSD USB stack 1998-11-26 23:13:13 +00:00