summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/uhci.c
Commit message (Collapse)AuthorAgeFilesLines
* Mechanical change to use <sys/queue.h> macro API instead ofphk2001-02-041-1/+1
| | | | | | | fondling implementation details. Created with: sed(1) Reviewed by: md5(1)
* Make intr_nesting_level per-process, rather than per-cpu. Setupjake2001-01-211-1/+1
| | | | | | | | interrupt threads to run with it always >= 1, so that malloc can detect M_WAITOK from "interrupt" context. This is also necessary in order to context switch from sched_ithd() directly. Reviewed By: peter
* Use PCPU_GET, PCPU_PTR and PCPU_SET to access all per-cpu variablesjake2001-01-101-1/+1
| | | | other then curproc.
* Weaken a bogus dependency on <sys/proc.h> in <sys/buf.h> by #ifdef'ingphk2000-10-291-1/+0
| | | | | | | | | | the offending inline function (BUF_KERNPROC) on it being #included already. I'm not sure BUF_KERNPROC() is even the right thing to do or in the right place or implemented the right way (inline vs normal function). Remove consequently unneeded #includes of <sys/proc.h>
* Undo previous commit. <machine/clock.h> is needed for the prototypen_hibma2000-10-161-0/+1
| | | | for DELAY().
* Remove unneeded #include <machine/clock.h>phk2000-10-151-1/+0
|
* Fake the Power On command on the virtual hub.n_hibma2000-08-131-1/+4
| | | | | | | This removes the two IOERROR's on startup a many has been seeing on UHCI controllers. Taken from NetBSD.
* Save and restore the registers SOF and FRAMENUMBER on suspend. In somen_hibma2000-08-071-5/+12
| | | | | | | | | cases the registers are not correctly set on resume. This solves the problem of USB failing after resuming a machine. Submitted by: mike+fbsd@medianstrip.net PR: 18261
* Sync with NetBSD:n_hibma2000-08-011-206/+91
| | | | K&R style function headers -> ANSI.
* Remove __P prototypes to reduce diffs between the NetBSD and FreeBSDn_hibma2000-07-171-97/+97
| | | | versions.
* Inverted error messages.n_hibma2000-06-151-3/+3
| | | | Submitted by: John R. LoVerso <john@loverso.southborough.ma.us>
* Back out the previous change to the queue(3) interface.jake2000-05-261-1/+1
| | | | | | It was not discussed and should probably not happen. Requested by: msmith and others
* Change the way that the queue(3) structures are declared; don't assume thatjake2000-05-231-1/+1
| | | | | | | | the type argument to *_HEAD and *_ENTRY is a struct. Suggested by: phk Reviewed by: phk Approved by: mdodd
* Change Lennart's e-mail address.n_hibma2000-05-141-1/+1
|
* OpenBSD has a broken debugger that does not grok static. Use an_hibma2000-04-031-87/+87
| | | | | | #define Static static that the OpenBSD folks can define it to be empty if they like.
* Get rid of the last remnants of powerhook abuse.n_hibma2000-03-181-2/+2
|
* Do not use the powerhooks at all, instead of abusing and empty #define.n_hibma2000-03-151-2/+4
|
* Correctly handle the conversion from virtual to physical addresses. Then_hibma2000-02-101-12/+12
| | | | | | | | | | | | problem was basically (for offset > 4096): vtophys(addr) + offset != vtophys(addr + offset) Also, use TD's with a maximum size of 4k instead of 8kb for OHCI controllers. This problem occurs in drivers that use large transfer sizes: umass, host2host and ethernet with jumbo frames.
* Fix a bug in the uhci driver that breaks large bulk IN transfers. Thewpaul2000-01-281-5/+16
| | | | | | | | | | | | | | uhci_check_intr() routine needs to be more careful about deciding when the end of a transfer has been detected. This allows me to remove the nasty workaround code from if_aue and if_cue. Receive performance is now much better for these adapters (500KB/sec vs. 350KB/sec). Also removed unused KUE_CUTOFF define from if_kuereg.h. Submitted by: Lennart Augustsson Reviewed by: n_hibma
* Add support for DEVICE_SUSPEND, DEVICE_RESUME and DEVICE_SHUTDOWNn_hibma2000-01-201-6/+0
| | | | | | | | | | methods for USB devices. However: with none of the devices I have here suspend seems to work properly. This is probably a bug in uhci_power which I still have to look at. Prodded and pushed by: Christopher Masto <chris@netmonger.net>
* More USB ethernet tweaks:wpaul2000-01-201-51/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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.
* Fix one bug and make one minor enhancement:wpaul1999-12-231-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | - In uhci_intr() check to see if sc->sc_bus.bdev is NULL, and if it is, ack any pending interrupts and disable them, then return. It is possible for interrupts to be delivered the moment a handler is set up at attach time in uhci_pci.c, particularly when attempting to kldload the usb.ko module after the system is already up. However the driver isn't ready to field interrupts at that time and certain pointers in the softc struct aren't initialized yet, and we invariably end up falling off the end of one of them. The effect is that kldloading the usb module will panic the system in uhci_intr(). This added sanity check stops this from happening: I can now kldload the usb.ko module without any problems and load/attach other USB drivers after it. Of course the uhci driver has no detach method, but that's another problem. - In uhci_run(), set the UHCI_CMD_MAXP bit in the command register to allow 64-byte packets to be used for full speed bandwidth reclamation. Certain high speed devices (in this case the ADMtek USB ethernet adapter) require this bit to be set, otherwise babble errors occur at the end of large (between 1100 and 1500 byte) transfers. This should not affect other devices, although supposedly it is less efficient than the 32-byte setting. Unfortunately, this is a per-bus setting, not a per-device setting, so we can't just enable it for certain devices on the USB bus.
* In one queue all the TDs (transfer descriptor, packets) for one transfern_hibma1999-12-021-3/+6
| | | | | | | | | | | | | | | | | | | | | | are queued. Traverse the queues vertically and then horizontally. This means that TDs for one xfer are transmitted back to back until the first NAK or error condition. Up to now we transmitted a TD per frame and transmitted the next TD in the next frame. The old approach is more fair if you have the end of the queue point at the beginning of the control transfer queue, but also a lot more overhead due to the fact that the QHs have to be read more often. The new approach squirts the packets down the line as fast as possible for one transfer and then does the next one. In the current situation, with fairly empty USB buses, this is a more sensible approach. We might have to revisit the scheduler later however. It speeds up large transfers (Zip drive, Host-To-Host adapters) on UHCI by a factor of 5 and makes it as fast as OHCI on the bus. The next problem to solve is the question why the limit is 300kb/s and not 1000/kb/s (kb == kilobyte).
* Synchronisation with NetBSD 1999/11/27n_hibma1999-11-281-20/+25
| | | | | | | | | | | | | | | | | - 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
* Synchronisation with NetBSD as of 1999/11/16:n_hibma1999-11-171-496/+642
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Fix the computation of the status of the transfers. It never saw a STALLEDn_hibma1999-11-111-8/+17
| | | | | | | | | | condition for Short transfers. Change the scheduling to Depth first. We now transfer as many TD's as possible from QH before moving to the next queue (Breadth first). It should still be verified that this does not lead to starvation in a busy system (in the case were transfers are added to the beginning of the control or bulk queues).
* Remove superfluous header file includes.n_hibma1999-11-081-1/+1
| | | | Pushed-By: phk
* Major synchronisation with the NetBSD USB stack:n_hibma1999-10-071-1725/+1756
| | | | | | | | | | | - 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
* Reset the UHCI controller when the device comes back from suspend.n_hibma1999-08-231-12/+11
| | | | | | | This should be replaced by proper support for suspend one day (global suspend). Submitted-by: Christopher Masto <chris@netmonger.net>
* - Added documentationn_hibma1999-08-171-1321/+1508
| | | | - fix bug in data toggle handling
* Add comments, change variable names to make them consistent (r -> err,n_hibma1999-07-251-9/+9
| | | | timo_handle -> timeout_handle, p -> pipe, *pipe -> *rpipe, etc.)
* - When aborting an interrupt pipe, just wait for 1ms for the completionn_hibma1999-05-301-9/+5
| | | | | | | | of the current interrupt trasaction. - Do not schedule the next interrupt transaction if the pipe is being aborted or the last round of the interrupt transaction ended with error. Submitted by: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
* Oops. Introduced a typo in one of previous commits.n_hibma1999-05-011-1/+1
|
* Clean up uhci_intr. Avoid acknowledging mutliple interrupts withn_hibma1999-05-011-26/+27
| | | | multiple writes.
* Correct maximum error count in TD initialisation for transfer from 2 to 3.n_hibma1999-05-011-2/+2
|
* Clean up debugging output, rename printf to DPRINTF and set somen_hibma1999-05-011-38/+29
| | | | debugging levels to more sensible values.
* Move the disabling of interrupts right before the allocation of then_hibma1999-05-011-0/+2
| | | | | | resource. Avoids useless interrupts occurring between the allocation of the interrupt resource and the final initialisation of the kernel. Cause of these interrupts is unknown (a resuming device?).
* 1) Change printf's into DPRINTF.n_hibma1999-04-201-84/+95
| | | | | | | 2) rename variables to be more conclusive. 3) fix a problem in uhci_ii_done. Avoid collecting all the status's of the TD's, we only need to one from the last inactive one. 4) Change the errorcount from 2 to 3 (see UHCI spec.).
* Bring the 'new-bus' to the i386. This extensively changes the way thepeter1999-04-161-5/+8
| | | | | | | | | | | | | | | | | | 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
* 1) Make debugging more selective.n_hibma1999-04-111-15/+24
| | | | | | | 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)
* USBD_STALLED bit checking was inconsistent. Mixed use of == and &n_hibma1999-04-111-5/+6
| | | | Patch provided by: Kazutaka YOKOTA
* 1) clean up debugging outputn_hibma1999-03-231-10/+3
| | | | | | 2) remove erroneous querying of PCI LegSup register while it should be fetched from PCI config space 3) change name of define for this register
* Moved timeout initialisation a bit earlier in the process. Then_hibma1999-03-221-8/+9
| | | | untimeout function triggered panics once in a while.
* Move untimeout up before call to uhci_ii_done, avoids panic inn_hibma1999-03-081-4/+1
| | | | | | | untimeout. Submitted by Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> and gehenna@jp.FreeBSD.org.
* 1) In polling mode (during boot) the callout_handle wasn'tn_hibma1999-02-191-24/+11
| | | | | | | initialised (PR1). Thanks to "Louis A. Mamakos" <louie@TransSys.COM> for his patient testing of my mods. 2) Removed some debugging output (PR1)
* Moved busreset in uhci_init up to avoid clearing of FLBASE in Via 83572n_hibma1999-02-181-11/+8
| | | | (PR1)
* Added more verbose debugging output to uhci_runn_hibma1999-02-151-2/+26
|
* add LEGSUP to uhci_dumpregsn_hibma1999-01-221-4/+7
|
* Textual changesn_hibma1999-01-221-3/+0
|
* Fixed bug that made UHCI controllers fail to start.n_hibma1999-01-211-4/+9
|
OpenPOWER on IntegriCloud