History log of /haiku/src/add-ons/kernel/busses/usb/ehci.h
Revision Date Author Comments
# 629f071b 27-Feb-2024 X512 <danger_mail@list.ru>

pci: extend MSI interrupt vector number to 32 bits

Also increase MSI message data size to 32 bits according to PCIe spec.

Remove 0xff check for MSI interrupts because it is potentially valid
interrupt vector number. Reject 0xff only for legacy pin interrupts.

- MSI-X supports up to 2048 interrupts per device that do not fit to
`uint8`.

- Non-x86 systems may use separate interrupt vector ranges for
hard-wired interrupts and MSI interrupts so `uint8` is not enough to
represent all of them.

Change-Id: Iaf9ffb197ec23db0f97ffe3ea756d28d7bfc8705
Reviewed-on: https://review.haiku-os.org/c/haiku/+/7433
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# 55a46882 30-May-2023 Augustin Cavalier <waddlesplash@gmail.com>

USB: Support physical-vector bulk requests.

Introduce a new utility method, "generic_memcpy", which takes
generic_addr_t plus indications of whether these specify virtual or
physical addresses (and potentially user addresess) and calls the
appropriate memcpy variant depending.

All bus drivers adjusted to support this at once. We don't actually
take advantage of the physical addresses in any way (yet), as USB
controllers have some pretty specific requirements that would have
to be carefully validated to use these directly.

All bus drivers tested and confirmed to still be working.

Change-Id: I66326667e148091147bb2b3d0843a26fb7e5bda6
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6479
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 99626c29 29-May-2023 Augustin Cavalier <waddlesplash@gmail.com>

USB: Use generic_io_vec in Transfer.

Prepares the way for actual physical-address request support,
which is not yet wired up.

Change-Id: I1b2d04a31e334a79b8361280fa0f3a5fbdb43d2b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6478
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# e6ce95c5 10-Oct-2022 Jérôme Duval <jerome.duval@gmail.com>

usb: register device nodes for hubs and devices

the device identifier is the USBID. no actual interface to be used by drivers.

Change-Id: I9fd1fdab0d02f1b82380c619b39bc3a12a9e2333
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5736
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Fredrik Holmqvist <fredrik.holmqvist@gmail.com>
Reviewed-by: X512 <danger_mail@list.ru>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 15ebede2 01-Oct-2022 Jérôme Duval <jerome.duval@gmail.com>

ehci: switch to the new driver API

Change-Id: I9102a27fe8e536003a0ab09c9cca5a87e88c8092
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5709
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 07ec2cf0 08-Feb-2020 Augustin Cavalier <waddlesplash@gmail.com>

EHCI: Call PrepareKernelAccess before writing descriptor chains.

Fixes #15653.


# 5c6d92d7 12-Apr-2019 Augustin Cavalier <waddlesplash@gmail.com>

busses/usb: Move ::AddTo to be above the class constructors.

It is called before them (and is responsible for calling them),
so having it in the middle of the file does not make a lot of sense.

Already done for XHCI. Only one functional change -- removing the
set_dprintf_enabled call. Drivers probably shouldn't spuriously
re-enable that if it was specifically disabled.


# 8844a67e 10-Dec-2018 Augustin Cavalier <waddlesplash@gmail.com>

More trivial syntax and logic cleanup.

Spotted by Clang. No functional change intended.


# 159aa93b 31-Aug-2014 Michael Lotz <mmlr@mlotz.ch>

USB: Generalize logic for debug transfers used within KDL.

Pull debug transfer methods into the base BusManager class and
implement them for UHCI and EHCI. This makes it possible to have a
single debugger command installed by the USB stack instead of HCI
specific ones.


# 4182d2ca 31-Aug-2014 Michael Lotz <mmlr@mlotz.ch>

EHCI: Cleanup member declaration order to match definition.


# 7cbae3c9 31-Aug-2014 Michael Lotz <mmlr@mlotz.ch>

EHCI: Implement debug transfers.


# 010b06a1 30-Jul-2013 Jerome Duval <jerome.duval@gmail.com>

EHCI USB: add MSI support

* similar to OHCI support by mmlr.
* interrupt handler is removed on destruction.


# d8b4cfc9 04-Aug-2012 Rene Gollent <anevilyak@gmail.com>

Get USB functional on x86-64.

- Various changes to printf format specifiers to make them 32/64 safe.
- Adjustments to various descriptor structures since addr_t is not 32-bit
on x86-64, and consequently this breaks the physical structure that's
expected. Also adjusted padding to accomodate 32-byte boundaries when
64-bit pointers are in use.
- Adjustments to make use of phys_addr_t where needed.


# 77660b03 23-Aug-2011 Jérôme Duval <korli@users.berlios.de>

* threshold higher bit means a full frame. Also use the threshold for micro frames instead of frames.
* introduces fNextStartingFrame to keep track of the next frame to use on next submit.
* set the IOC bit for the last ITD
* computes multiply field of the ITD based on the packed size (1, 2 or 3).
* use locking around linking of ITD
* free descriptors on errors
* on finishing, whenever a non success status is found, set actual length to zero
* on finishing, when copying data to the Transfer object, copy starting on packet boundaries (skipping unused bytes).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42679 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ce44796e 23-May-2011 Michael Lotz <mmlr@mlotz.ch>

Introduce simplistic poll mode for EHCI. If enabled a thread will run the
interrupt handler every millisecond so it can check for interrupts to handle.
While this is certainly not ideal, it allows EHCI to run (surprisingly well
even) on chipsets that experience interrupt routing issues.
It can be enabled with the safemode setting "ehci_polling on" that can either
be entered using the new advanced debug option entry in the bootloader and/or
in the kernel settings file.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41688 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7df33d91 10-May-2011 Jérôme Duval <korli@users.berlios.de>

* Implement inbound isochronous transfer for EHCI, based on UHCI implementation.
* changes next_log to their actual type instead of void*
* the field this_phy now includes the item type, it simplifies things.
* isochronous transfer descriptors are linked in the periodic frame list first,
and points to existing interrupt transfer descriptors.

This is still work in progress. Yet it's worth committing as it doesn't seem to
have impacts, and is required for the UVC SoC project. Tested basically with
usb_webcam to receive UVC stream headers.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41424 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 38fc536e 14-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

Some more constness.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36250 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 853e6be8 14-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

* Rename usb_p.h to usb_private.h.
* Some automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36247 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1393394b 22-Sep-2009 Michael Lotz <mmlr@mlotz.ch>

We need to guarantee that when cancel returns that the callback won't be called
anymore. It could happen that the transfer was already in the process of being
finished, so wasn't in the list of pending transfers anymore. Cancel would then
return even though the callback wasn't called yet. This could lead to a callback
being called after a driver was already unloaded (even after it cleaned up the
pipes it used).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33239 a95241bf-73f2-0310-859d-f6bbb57e9c96


# aaf77384 11-May-2009 Michael Lotz <mmlr@mlotz.ch>

Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30713 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f14fe767 23-Jan-2009 Michael Lotz <mmlr@mlotz.ch>

* Rework the USB tracing mechanism. Cleaned it up and make it more convenient to
use. It will now print out the usb_ids of the objects that generate the trace
messages. These IDs are unique compared to the device address used previously,
because device addresses are per bus while usb_ids are global. This makes
trace output from devices across multiple controllers distinguishable.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29002 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 856c49e6 06-Jun-2008 Michael Lotz <mmlr@mlotz.ch>

Only check the explicitly enabled interrupts in EHCI. Otherwise we might steal
a shared interrupt from someone else.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25822 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 20c43b02 10-Jan-2008 Michael Lotz <mmlr@mlotz.ch>

* Add support for low/full speed interrupt transfers over USB 2.0 hubs
* Actually enable the periodic schedule so that any interrupts work over EHCI

For those who wait for OHCI: You can now attach your USB 1.1 mouse or keyboard
to a USB 2.0 hub and it should work.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23382 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7f074829 17-Nov-2007 Michael Lotz <mmlr@mlotz.ch>

* Removed the two extra submit functions and combined them directly into SubmitTransfer()
* The sparation based on async and periodic schedule made no sense as it is a question of queued/non-queued
* Therefore removed the near complete code duplication for adding interrupt transfers (that are also queued)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22943 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ed1eff2f 17-Nov-2007 Michael Lotz <mmlr@mlotz.ch>

* Implement interrupt transfers in EHCI
* Uses a "collapsed binary tree" (for lack of a better name) to support the different intervals
* Remove a leftover variable declaration that was hiding error conditions away...
* Some cleanup

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22942 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 13508e8b 14-Nov-2007 Michael Lotz <mmlr@mlotz.ch>

Completely redesign the USB explore process. Replaces the scary race conditions of the previous locking mechanism and simplifies handling of device changes by a more centralized approach.
Changes are now collected during explore and notifications as well as rescans are done at once. Through this a driver is also not rescanned multiple times anymore.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22929 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c954d334 11-Aug-2007 Michael Lotz <mmlr@mlotz.ch>

* Apply more sane canceling logic to EHCI too
* Remove the leftover user_area - this is handeled inside the Transfer class by now

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21906 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b0341b28 25-May-2007 François Revol <revol@free.fr>

Revert r21231 as it's supposedly not possible. Someone implement OHCI then pleazzze!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21241 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3d5bdb86 24-May-2007 François Revol <revol@free.fr>

Added a keep_port_ownership driver setting for EHCI, to allow keeping devices on EHCI instead of giving them up to the 1.0 controller.
Hopefully this will get things working here until OHCI is implemented.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21231 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4b3d0fcf 06-May-2007 Michael Lotz <mmlr@mlotz.ch>

Implemented transfer cancelling for EHCI by reworking the previously unused CancelPendingTransfer() into CancelQueuedTransfers() with the pipe based semantic.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21044 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 00f6fab9 26-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Implemented a notification method for BusManagers so that they can be notified of pipe changes (creation, destruction, changed settings).
This is necessary in OHCI and will probably be used in EHCI also to keep one endpoint construct for each pipe open instead on creating and deleting it for each transfer.
* Pseudo implemented set_pipe_policy for isochronous pipes that makes use of the new notification system.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18945 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4330ef22 25-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Added retries to the PhysicalMemoryAllocator. Memory is allocated and freed at a very high frequency, so low memory conditions shouldn't last very long.
* Added a separate thread for cleaning up EHCI transfers. This makes it possible to actually always wait for the async advance interrupt without hindering execution of transfers.
This pushes performance again and fixes the bug I introduced in the last change, that we could free yet cached descriptors when a previous async advance timed out.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18929 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 17f83b21 24-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Switched from the old v2 callback status codes to the new v3 codes
This means that the usb_callback_func now takes a status_t instead of a uint32 status.
Also the error codes are now different. I don't see this as a real problem in binary compatibility, as the status codes were never really documented and most drivers just assumed that a nonzero status meant an error.
Source compatibility breaks for callback functions and error defines. I fixed (hopefully) all places in the tree that are currenty included in the image and affected by the change.
* Corrected error reporting in UHCI and EHCI using the new status codes.
* Fixed a memory leak in EHCI where the async advance interrupt was not triggered in time.
* Fixed another race condition in usb_raw that could cause a crash when a device is removed while a transfer is pending.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18916 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8a278a1b 24-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Fixing my previous attempt at fixing cookie handling. Device addresses cannot be used, since there may be devices with the same address across different busses. A linked list of usb_driver_cookies is maintained now that relates devices and cookies.
* Fixed endpoint halt clearing. The data toggle has to be reset when we clear a stall.
* Now using up to B_PAGE_SIZE * 4 sized buffers in EHCI. They are split automatically by the host controller. This further pushes throughput.
* Optimize memory allocator settings for the above case. Enlarging it's managed space to 1MB
* Ignore the transaction error bit in EHCI. It is only of informational character as it also idicates errors that were recovered automatically. If an unrecoverable error occures, other bits will indicate this.
* Fixed some more print formats in debug output.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18915 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7145ff17 20-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Implemented compatibility workaround for BeOS to be able to write user memory from the kernel finisher thread

This fixes crashing of the USB Mass Storage driver under R5. It is fully working there now.
I hope to be able to do this more cleanly under Haiku though.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18894 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bcc2d1b6 15-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Implemented usable thread synchronisation for UHCI and EHCI.
* Cleaned interrupt handlers for both busses, too.
* Fixed memory leak of the queue head stray descriptors in EHCI.
* Fixed warnings about assigning NULL to the module flags field.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18857 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dff0c634 15-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Implemented transfer finishing in EHCI
* Implemented actual length calculation in EHCI
* Implemented bulk transfers in EHCI
* Implemented queue freeing in EHCI
* Added extended buffer pointers to the EHCI structs, necessary when the controller supports 64bit
* Fixed debug output and removed warnings due to wrong print format

Control and bulk transfers are now working nicely for EHCI. This means that I can now get pictures from my camera with USB 2.0 speed. Note though that many things still are unimplemented (isochronous transfers, split transactions, interrupt transfers, queue chaches per pipe, ...). But it's certainly a nice step forward :-).

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18855 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f452f9dc 14-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Implemented most qTD and qH functions for EHCI async transfers.
* Implementing control and bulk (async) transfers. They don't work yet though.
* Corrected the legacy support handling in EHCI
* Fixed the bit mask for total bytes in qTDs and added the data toggle bit
* Changed the boolean low speed flags to usb_speed enum that allows for low, full and highspeed

Also wrote a memory allocator that takes over memory management from the stack. It is similar to a buddy allocator. This does on the one hand remove some ugly code from the stack and is on the other hand far more scalable than the previous free list approach. This scalability is needed for proper EHCI support where buffers can go up to a size of 5 pages. The allocator is not perfect and it's memory overhead is quite high compared to the managed memory (depends on the managed block sizes), but it's quik and works well so far.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18849 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8fedfdfc 30-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

* Rewrote some stack internals (again). Everything is now created using a parent object that shares the BusManager and Stack information to reduce individual constructors.
* Don't inherit Device and Interface from pipes anymore. The device has a default pipe member now.
* Since the parent of each Object is now known, we can send control messages using the default pipe of the device from all attached elements (pipes and interfaces).
* Fixed the generic {Set|Clear}Feature() and GetStatus() calls to include the endpoint address for pipe specific requests.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18710 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ffe3f107 27-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

* Redisigned some of the USB Stack. Unified constructors, removed redundant functions and moved some other functions around
* Implemented the EHCIRootHub
* Reworked UHCIRootHub to be more of a utility class and moved the actual work into the UHCI BusManager
* Implemented port reset in EHCI. Ports with low and fullspeed devices are now correctly handed over to the companion host controller.

Attachs and detachs as well as port resetting / enabling works now in EHCI. Only the actual data transfers are missing thereafter ;-)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18656 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 01595708 26-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

* Changed EHCI register access from port to memory mapped io (which is required)
* Added individual register operations for operational and capability registers
* Added resetting the host controller which appearantly actually works

Note that you shouldn't install the ehci module if you want uhci to work.
It disables the companion host controller drivers (uhci and ohci) because it takes port ownership and does not yet give it back for low and fullspeed devices.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18648 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9e857d24 25-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

* Adding skeleton EHCI driver. Some parts filled from the specs and the UHCI driver.
* Corrected some errors I found while reading UHCI.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18626 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 159aa93b31cb5d926ef4939a16419e7d02979b1c 31-Aug-2014 Michael Lotz <mmlr@mlotz.ch>

USB: Generalize logic for debug transfers used within KDL.

Pull debug transfer methods into the base BusManager class and
implement them for UHCI and EHCI. This makes it possible to have a
single debugger command installed by the USB stack instead of HCI
specific ones.


# 4182d2cadf6856883be916b9ca67491bc6f5e2fc 31-Aug-2014 Michael Lotz <mmlr@mlotz.ch>

EHCI: Cleanup member declaration order to match definition.


# 7cbae3c96949ea78ad796ce86ef1c6a46ad213f2 31-Aug-2014 Michael Lotz <mmlr@mlotz.ch>

EHCI: Implement debug transfers.


# 010b06a16e6bb1c84a92ed34dd410b5769a0b430 30-Jul-2013 Jerome Duval <jerome.duval@gmail.com>

EHCI USB: add MSI support

* similar to OHCI support by mmlr.
* interrupt handler is removed on destruction.


# d8b4cfc9829119291e68cfe0152c239fd8850b3d 04-Aug-2012 Rene Gollent <anevilyak@gmail.com>

Get USB functional on x86-64.

- Various changes to printf format specifiers to make them 32/64 safe.
- Adjustments to various descriptor structures since addr_t is not 32-bit
on x86-64, and consequently this breaks the physical structure that's
expected. Also adjusted padding to accomodate 32-byte boundaries when
64-bit pointers are in use.
- Adjustments to make use of phys_addr_t where needed.


# 77660b03e844ff20dc766a3033f4ee0d776983fb 23-Aug-2011 Jérôme Duval <korli@users.berlios.de>

* threshold higher bit means a full frame. Also use the threshold for micro frames instead of frames.
* introduces fNextStartingFrame to keep track of the next frame to use on next submit.
* set the IOC bit for the last ITD
* computes multiply field of the ITD based on the packed size (1, 2 or 3).
* use locking around linking of ITD
* free descriptors on errors
* on finishing, whenever a non success status is found, set actual length to zero
* on finishing, when copying data to the Transfer object, copy starting on packet boundaries (skipping unused bytes).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42679 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ce44796e34f049cc20fb8a522c81f05c325b69a5 23-May-2011 Michael Lotz <mmlr@mlotz.ch>

Introduce simplistic poll mode for EHCI. If enabled a thread will run the
interrupt handler every millisecond so it can check for interrupts to handle.
While this is certainly not ideal, it allows EHCI to run (surprisingly well
even) on chipsets that experience interrupt routing issues.
It can be enabled with the safemode setting "ehci_polling on" that can either
be entered using the new advanced debug option entry in the bootloader and/or
in the kernel settings file.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41688 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7df33d912b05c8d986287bec208df68c595c24a8 10-May-2011 Jérôme Duval <korli@users.berlios.de>

* Implement inbound isochronous transfer for EHCI, based on UHCI implementation.
* changes next_log to their actual type instead of void*
* the field this_phy now includes the item type, it simplifies things.
* isochronous transfer descriptors are linked in the periodic frame list first,
and points to existing interrupt transfer descriptors.

This is still work in progress. Yet it's worth committing as it doesn't seem to
have impacts, and is required for the UVC SoC project. Tested basically with
usb_webcam to receive UVC stream headers.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41424 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 38fc536e0525ec97d60d4bdd29dbe68e4b17ec13 14-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

Some more constness.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36250 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 853e6be8ca7117d62f497d539aa044adc2fdf573 14-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

* Rename usb_p.h to usb_private.h.
* Some automatic whitespace cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36247 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 1393394ba6adde434020a48e5d9b7b22822150b0 22-Sep-2009 Michael Lotz <mmlr@mlotz.ch>

We need to guarantee that when cancel returns that the callback won't be called
anymore. It could happen that the transfer was already in the process of being
finished, so wasn't in the list of pending transfers anymore. Cancel would then
return even though the callback wasn't called yet. This could lead to a callback
being called after a driver was already unloaded (even after it cleaned up the
pipes it used).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33239 a95241bf-73f2-0310-859d-f6bbb57e9c96


# aaf773849933563f0a6dbdf7816bbbfc9c65b6e3 11-May-2009 Michael Lotz <mmlr@mlotz.ch>

Cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30713 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f14fe767bf568186bbd0678e35b03c99d8a264c6 23-Jan-2009 Michael Lotz <mmlr@mlotz.ch>

* Rework the USB tracing mechanism. Cleaned it up and make it more convenient to
use. It will now print out the usb_ids of the objects that generate the trace
messages. These IDs are unique compared to the device address used previously,
because device addresses are per bus while usb_ids are global. This makes
trace output from devices across multiple controllers distinguishable.
* Some cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29002 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 856c49e614420148f8fe9471e33baf1e97cf6a9e 06-Jun-2008 Michael Lotz <mmlr@mlotz.ch>

Only check the explicitly enabled interrupts in EHCI. Otherwise we might steal
a shared interrupt from someone else.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25822 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 20c43b026dda2fc83698ccd5d073ab7037abd1fb 10-Jan-2008 Michael Lotz <mmlr@mlotz.ch>

* Add support for low/full speed interrupt transfers over USB 2.0 hubs
* Actually enable the periodic schedule so that any interrupts work over EHCI

For those who wait for OHCI: You can now attach your USB 1.1 mouse or keyboard
to a USB 2.0 hub and it should work.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@23382 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7f074829886403b0e04406ed47f0fbe5ae2f5655 17-Nov-2007 Michael Lotz <mmlr@mlotz.ch>

* Removed the two extra submit functions and combined them directly into SubmitTransfer()
* The sparation based on async and periodic schedule made no sense as it is a question of queued/non-queued
* Therefore removed the near complete code duplication for adding interrupt transfers (that are also queued)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22943 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ed1eff2fec7b126e8032ef19357cb7aceda2c388 17-Nov-2007 Michael Lotz <mmlr@mlotz.ch>

* Implement interrupt transfers in EHCI
* Uses a "collapsed binary tree" (for lack of a better name) to support the different intervals
* Remove a leftover variable declaration that was hiding error conditions away...
* Some cleanup

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22942 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 13508e8bd034aac27c2e3271aefa04e255520d99 14-Nov-2007 Michael Lotz <mmlr@mlotz.ch>

Completely redesign the USB explore process. Replaces the scary race conditions of the previous locking mechanism and simplifies handling of device changes by a more centralized approach.
Changes are now collected during explore and notifications as well as rescans are done at once. Through this a driver is also not rescanned multiple times anymore.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22929 a95241bf-73f2-0310-859d-f6bbb57e9c96


# c954d334059dce539eea9c07d6fe46b307c7edab 11-Aug-2007 Michael Lotz <mmlr@mlotz.ch>

* Apply more sane canceling logic to EHCI too
* Remove the leftover user_area - this is handeled inside the Transfer class by now

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21906 a95241bf-73f2-0310-859d-f6bbb57e9c96


# b0341b286b2c30281e6bcb83aad6aa963b102cbe 25-May-2007 François Revol <revol@free.fr>

Revert r21231 as it's supposedly not possible. Someone implement OHCI then pleazzze!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21241 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3d5bdb86881b8cf275576b1c11fcc92c0cfeae8a 24-May-2007 François Revol <revol@free.fr>

Added a keep_port_ownership driver setting for EHCI, to allow keeping devices on EHCI instead of giving them up to the 1.0 controller.
Hopefully this will get things working here until OHCI is implemented.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21231 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4b3d0fcfda9e442ef8c4c8b6c44f8dc581d3ccbb 06-May-2007 Michael Lotz <mmlr@mlotz.ch>

Implemented transfer cancelling for EHCI by reworking the previously unused CancelPendingTransfer() into CancelQueuedTransfers() with the pipe based semantic.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21044 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 00f6fab9315c42c68c336f31f6061ba6faa17c27 26-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Implemented a notification method for BusManagers so that they can be notified of pipe changes (creation, destruction, changed settings).
This is necessary in OHCI and will probably be used in EHCI also to keep one endpoint construct for each pipe open instead on creating and deleting it for each transfer.
* Pseudo implemented set_pipe_policy for isochronous pipes that makes use of the new notification system.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18945 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 4330ef22d5cffd443a7af847124557a803d15327 25-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Added retries to the PhysicalMemoryAllocator. Memory is allocated and freed at a very high frequency, so low memory conditions shouldn't last very long.
* Added a separate thread for cleaning up EHCI transfers. This makes it possible to actually always wait for the async advance interrupt without hindering execution of transfers.
This pushes performance again and fixes the bug I introduced in the last change, that we could free yet cached descriptors when a previous async advance timed out.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18929 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 17f83b219d63eae4de462d6868e7d26ad6c3949e 24-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Switched from the old v2 callback status codes to the new v3 codes
This means that the usb_callback_func now takes a status_t instead of a uint32 status.
Also the error codes are now different. I don't see this as a real problem in binary compatibility, as the status codes were never really documented and most drivers just assumed that a nonzero status meant an error.
Source compatibility breaks for callback functions and error defines. I fixed (hopefully) all places in the tree that are currenty included in the image and affected by the change.
* Corrected error reporting in UHCI and EHCI using the new status codes.
* Fixed a memory leak in EHCI where the async advance interrupt was not triggered in time.
* Fixed another race condition in usb_raw that could cause a crash when a device is removed while a transfer is pending.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18916 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8a278a1bb7c57c701210c7ded6b5b8dca82e293f 24-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Fixing my previous attempt at fixing cookie handling. Device addresses cannot be used, since there may be devices with the same address across different busses. A linked list of usb_driver_cookies is maintained now that relates devices and cookies.
* Fixed endpoint halt clearing. The data toggle has to be reset when we clear a stall.
* Now using up to B_PAGE_SIZE * 4 sized buffers in EHCI. They are split automatically by the host controller. This further pushes throughput.
* Optimize memory allocator settings for the above case. Enlarging it's managed space to 1MB
* Ignore the transaction error bit in EHCI. It is only of informational character as it also idicates errors that were recovered automatically. If an unrecoverable error occures, other bits will indicate this.
* Fixed some more print formats in debug output.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18915 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 7145ff1705037d7310ea0d608484279c1dabfa64 20-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Implemented compatibility workaround for BeOS to be able to write user memory from the kernel finisher thread

This fixes crashing of the USB Mass Storage driver under R5. It is fully working there now.
I hope to be able to do this more cleanly under Haiku though.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18894 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bcc2d1b69a3c9b2a7951b894ad3e5579dcbaffa1 15-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Implemented usable thread synchronisation for UHCI and EHCI.
* Cleaned interrupt handlers for both busses, too.
* Fixed memory leak of the queue head stray descriptors in EHCI.
* Fixed warnings about assigning NULL to the module flags field.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18857 a95241bf-73f2-0310-859d-f6bbb57e9c96


# dff0c634db8e3d8210c08419fa2795a355352714 15-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Implemented transfer finishing in EHCI
* Implemented actual length calculation in EHCI
* Implemented bulk transfers in EHCI
* Implemented queue freeing in EHCI
* Added extended buffer pointers to the EHCI structs, necessary when the controller supports 64bit
* Fixed debug output and removed warnings due to wrong print format

Control and bulk transfers are now working nicely for EHCI. This means that I can now get pictures from my camera with USB 2.0 speed. Note though that many things still are unimplemented (isochronous transfers, split transactions, interrupt transfers, queue chaches per pipe, ...). But it's certainly a nice step forward :-).

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18855 a95241bf-73f2-0310-859d-f6bbb57e9c96


# f452f9dc783e647ece105a379564d9ce6a05de2b 14-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Implemented most qTD and qH functions for EHCI async transfers.
* Implementing control and bulk (async) transfers. They don't work yet though.
* Corrected the legacy support handling in EHCI
* Fixed the bit mask for total bytes in qTDs and added the data toggle bit
* Changed the boolean low speed flags to usb_speed enum that allows for low, full and highspeed

Also wrote a memory allocator that takes over memory management from the stack. It is similar to a buddy allocator. This does on the one hand remove some ugly code from the stack and is on the other hand far more scalable than the previous free list approach. This scalability is needed for proper EHCI support where buffers can go up to a size of 5 pages. The allocator is not perfect and it's memory overhead is quite high compared to the managed memory (depends on the managed block sizes), but it's quik and works well so far.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18849 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8fedfdfcf8f931cd52a6e934a5b4e0aca565cf99 30-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

* Rewrote some stack internals (again). Everything is now created using a parent object that shares the BusManager and Stack information to reduce individual constructors.
* Don't inherit Device and Interface from pipes anymore. The device has a default pipe member now.
* Since the parent of each Object is now known, we can send control messages using the default pipe of the device from all attached elements (pipes and interfaces).
* Fixed the generic {Set|Clear}Feature() and GetStatus() calls to include the endpoint address for pipe specific requests.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18710 a95241bf-73f2-0310-859d-f6bbb57e9c96


# ffe3f107c4ae65ec52128bb36115779fe07a01c0 27-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

* Redisigned some of the USB Stack. Unified constructors, removed redundant functions and moved some other functions around
* Implemented the EHCIRootHub
* Reworked UHCIRootHub to be more of a utility class and moved the actual work into the UHCI BusManager
* Implemented port reset in EHCI. Ports with low and fullspeed devices are now correctly handed over to the companion host controller.

Attachs and detachs as well as port resetting / enabling works now in EHCI. Only the actual data transfers are missing thereafter ;-)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18656 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 01595708f3ff37e1c86f32548fc48a7a6a5d4be7 26-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

* Changed EHCI register access from port to memory mapped io (which is required)
* Added individual register operations for operational and capability registers
* Added resetting the host controller which appearantly actually works

Note that you shouldn't install the ehci module if you want uhci to work.
It disables the companion host controller drivers (uhci and ohci) because it takes port ownership and does not yet give it back for low and fullspeed devices.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18648 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9e857d24ca41743874f6b3c08bb0c35f53df5763 25-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

* Adding skeleton EHCI driver. Some parts filled from the specs and the UHCI driver.
* Corrected some errors I found while reading UHCI.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18626 a95241bf-73f2-0310-859d-f6bbb57e9c96