History log of /haiku/src/add-ons/kernel/bus_managers/usb/Device.cpp
Revision Date Author Comments
# e1e2a82d 30-May-2023 Augustin Cavalier <waddlesplash@gmail.com>

USB: Use BStackOrHeapArray in RegisterNode.

I saw in a KDL stack trace that this function was using over 4KB of stack.
As it is called as part of device_manager startup, where there can be
pretty deep recursion happening, that seems like a bad idea.

Additionally, it did not actually do bounds checking.
Now we dynamically allocate an array of sufficient length.


# 65f096fd 30-Nov-2022 Zelenoviy <zelenoviy@gmail.com>

USB: node unregistering returning B_BUSY is not a error in this case

Change-Id: Id9a1eccd47daef490d5ab2cba46ea97386ea0a89
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5870
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 215b685f 11-Dec-2022 X512 <danger_mail@list.ru>

kernel: Drop non-standard GNU inline assignment syntax

* We needed this previously due to our gcc2 compiled kernel.
* Now that our kernel is always latest gcc, we can move to the
c++20 syntax for inline assignment.
* Improves compatibility with clang, less GNU-specific stuff

Change-Id: Ib7272a0a52554a31e9a0e788fd3f031db9049795
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5898
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: Adrien Destugues <pulkomandy@pulkomandy.tk>


# 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>


# 8d046e26 20-Sep-2021 Augustin Cavalier <waddlesplash@gmail.com>

USB: Split WaitForUnbusy from Object::PutUSBID.

In a few instances, we need to not wait for objects to become unbusy
during ID puts because we expect they still will be, e.g. in the case
of Control pipes with submitted transfers that are still running. There,
we need to put the ID, cancel transfers, and only then wait for the
object to become unbusy.

Technically, this is a functional change, but at least in practice
it will have little real-world effect, for two reasons:

1. The DefaultPipe's Busy flag is basically never updated (the Device's
busy flag is generally used instead), so it will virtually never be
"busy".

2. Most devices have no Control endpoints besides that default one.

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


# faae5dd7 20-Sep-2021 Augustin Cavalier <waddlesplash@gmail.com>

USB: Put the default pipe's USB ID and cancel its transfers earlier during teardown.

This way, any endpoints or interfaces which are currently using the
default pipe for SetFeature/.../etc. will return immediately and
become unbusy.

Should fix the remaining KDLs in #16794 and #16969.

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


# 5ee91867 09-Sep-2021 Augustin Cavalier <waddlesplash@gmail.com>

USB: Track object busy-ness and wait for an unbusy state before teardown.

This reverts and replaces hrev53141, hrev53200~1, and hrev53888.

Two years ago (in hrev53141), I added checks to validate that Devices
were not in the process of being torn down before using them, to fix
a race condition KDL. Further logic was added in hrev53200~1 and in
hrev53888 for Pipes.

Well, upon closer inspection following the reports of #16794 et al.,
it appears upon closer inspection there were still two more race
conditions lurking in there: the first between Get and InitCheck, and
the second between InitCheck and use.

To resolve both of these, a new atomic "busy" flag is added to objects,
which is incremented before unlocking the objects array, and then
waited on before actually proceeding with teardown.

The older checks about initialization status are now superfluous
and are removed in favor of an earlier PutUSBID() invocation in Device.

While #16794 was fixed by hrev55429, some of those or related KDLs
might have been caused by these races. This also re-resolves #15115,
along with #14949 and #15710.

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


# 83825112 16-Sep-2021 Augustin Cavalier <waddlesplash@gmail.com>

USB: Rework Device deinitialization and destruction.

* Destroy interfaces and endpoints before deleting the default pipe,
as all of these may actually use the default pipe at any time
while they are alive.

* Remove the default pipe and then ourselves from the stack before
deleting the default pipe, as it also may be used at any time.

May help with some of the open tickets about USB stack KDLs.


# 22002cf4 01-Sep-2021 Augustin Cavalier <waddlesplash@gmail.com>

USB: Rename usb_endpoint_companion_descriptor...

...to usb_endpoint_superspeed_companion_descriptor, as it is
really SuperSpeed-specific (there are more companion descriptors
introduced in SuperSpeedPlus.)

No functional change, and this is a private struct at present.


# fcf7cbe7 16-Jul-2019 Adrien Destugues <pulkomandy@pulkomandy.tk>

PVS V522: null pointer dereferences

Change-Id: Iaa753ef3a93c36031789a85f87e569fc410d3304
Reviewed-on: https://review.haiku-os.org/c/1604
Reviewed-by: Stephan Aßmus <superstippi@gmx.de>


# 6e2bbbb1 12-Jul-2019 Augustin Cavalier <waddlesplash@gmail.com>

USB: Rename USB_SPEED_SUPER to USB_SPEED_SUPERSPEED.

For consistency's sake with the others.


# dd249016 17-May-2019 Augustin Cavalier <waddlesplash@gmail.com>

USB: Check and set the Device object state appropriately.

The Device object gets an ID before it begins initializing, and
loses its ID after it fully finishes tearing down, so simply
verifying the Device object is non-NULL is not enough to verify
that we can use it. We need to call InitCheck() every time.

In Device itself, we should also unset fInitOK when beginning
teardown, so that anyone who still has a handle can no longer
use this Device object while teardown occurs (which, depending
on the number of pipes, pending transfers, etc. may take some
time.)

Fixes #14949 and almost certainly any other USB-related KDLs
in these codepaths.


# 086528f6 16-May-2019 Augustin Cavalier <waddlesplash@gmail.com>

USB & XHCI: Refactor endpoint initialization to support SuperSpeed better.

SuperSpeed (USB3) devices have a "companion descriptor" along with the
endpoint descriptors that describes certain other attributes they have,
which are important for the controller to schedule transfers properly.
Previously we were just using USB2 values; now we are properly using USB3
ones.

Tested on an Intel Lynx Point controller. As far as I can tell, no
regressions, but #15000 is not fixed anyway.


# 59750213 22-May-2014 Axel Dörfler <axeld@pinc-software.de>

usb: fixed potential crash.

* The active interface may be null. This actually happens with a Lasmex
USB speaker in case it is turned on.


# 1152f83d 22-May-2014 Axel Dörfler <axeld@pinc-software.de>

usb: coding style cleanup.

* Removed a few superfluous comments, too.


# 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.


# 2b31b4a8 01-May-2012 Jérôme Duval <jerome.duval@gmail.com>

Work in progress on xHCI bus driver.

* added more traces, coding style
* added xhci_td, xhci_endpoint structs.
* SubmitRequest: this links a 3-stage TD control request into
the endpoint ring.
* _InsertEndpointForPipe: when a pipe is created, configure the
endpoint and set up the controller cookie.
* CreateDescriptor and FreeDescriptor: allocates memory for a TD.
* _LinkDescriptorForPipe: link a TD in an endpoint ring.
* _UnlinkDescriptorForPipe: unlink a TD
* AllocateDevice:
slot number zero isn't valid.
stick the slot number to the device struct.
configure the default endpoint before calling SetAddress.
address is found in the device context instead of the input context.
device address passed to the USB stack has to begin with 1.
* Ring:
check for invalid slot/endpoint combination.
ring the slot doorbell instead of the doorbell 0.
* Root hub: fixed USB version.
* HandleTransferComplete: finds out the TD which submitted a
transfer.


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

Tiny cleanup.


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


# c4c6cedd 05-Jul-2010 Ithamar R. Adema <ithamar.adema@team-embedded.nl>

* Work around a problem with a USB device (in my case, Qualcomm Gobi 3G modem) that reports interface_number values that are out of range with the interface_count. This would make the usb stack in Haiku crash.

Will need a different fix to get device to work, but at least Haiku won't crash on bootup with this change.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37409 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


# 9b0a2ab2 13-Sep-2009 Michael Lotz <mmlr@mlotz.ch>

No need to crash if we are deleted after not getting far enough to allocate the
configuration buffers.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33122 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


# 5565f43e 12-Sep-2008 Michael Lotz <mmlr@mlotz.ch>

Check the allocation of the endpoint pipe object.


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


# a5243128 21-Jul-2008 Michael Lotz <mmlr@mlotz.ch>

* Fix off-by-one error in port number which caused full- or lowspeed devices
behind highspeed hubs with multiple transaction translators not to work.
* The parent hub isn't necessarily the one providing the transaction translator
for a full- or lowspeed device. Therefore we need to inherit the hub/port
addresses to lower devices unless we are a highspeed hub that might be the
actual provider of the transaction translator. This logic error caused full-
and lowspeed devices not to work if they were behind a fullspeed hub that
itself was behind a highspeed hub.

This fixes bugs #1889 and #2501.

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


# c2f077d0 25-May-2008 Michael Lotz <mmlr@mlotz.ch>

* Clear the configurations list so it can safely be handled in case the device
fails to init completely.
* Fix wrong usage of realloc and check the allocations.
* Check a few more allocations, should be all now.
* Fix a small memory leaks in error case.
* Do a few more checks when unconfiguring and deleting a device so an incompletely
initilized device is deleted correctly and does not crash or leak.

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


# 519fbf77 18-May-2008 Michael Lotz <mmlr@mlotz.ch>

* Make the maximum port count a define and set it to 16. OHCI officially
supports up to 15 ports and QEMUs OHCI emulation uses a port count of 10
for example.
* Update the hub code to remove the hardcoded 8 port limits.
* Some other code to enumerate the USB structure I had laying around
(available internally only, might be added as a public API some time).

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


# bb90c2a6 10-May-2008 Michael Lotz <mmlr@mlotz.ch>

* Clear the endpoints of an alternate interface that is going away before
updating the active pointer as otherwise the endpoints of the new alternate
would have been cleared instead of the old one (leaking endpoints).
* Only clear and re-initialize the endpoints of the interface we are setting
an alterntate. Otherwise we tear down all the device endpoints which would
result in a bad situation for composite devices where multiple drivers may
use different functions (through different interfaces) of a device side by
side.
* Minor cleanup.

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


# b04afa24 04-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

* Another tiny cut in stack load time: do not delay after setting the current
configuration of a root hub
* Cut down on number of retries to set the initial device address

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


# 30cb1cfb 22-Nov-2007 Salvatore Benedetto <salvatore.benedetto@gmail.com>

* Added SetAltInterface method which allows to set an alternate interface for the device
* Added InitEndpoint and ClearEndpoint to avoid code duplication
* Usual clean up


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


# 072c28de 21-Nov-2007 Michael Lotz <mmlr@mlotz.ch>

* Redesign the Pipe constructor to only take the parent object
* All other init is done in InitCommon() which only needs to be present in the base class
* Adding the hub port a device is attached to to the Device class
* Add hub port and hub address to the Pipe class (will be used for split transactions in EHCI)
* Update the root hubs to reflect the changes to hub creation

Sadly we need pipes that do not belong to devices (default pipe for addressing and to get initial device descriptor). Therefore we cannot resolve hub address and port from the parent device.

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


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

Store the polling interval in the InterruptPipe class to make it accessible to the controller.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22936 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


# 80403882 29-Jul-2007 Michael Lotz <mmlr@mlotz.ch>

Initialize the endpoints of all interfaces of the configuration to be set. Fixes stuff that needs more than one interface at the same time (ACM modems for example).

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


# 3f2288a4 05-May-2007 Michael Lotz <mmlr@mlotz.ch>

Fixed wrong deallocation of device resources which caused KDL when unplugging devices with more than one interface.

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


# e40b5c0d 26-Jan-2007 Michael Lotz <mmlr@mlotz.ch>

Fixed a wrong index that could cause crashes with devices containing generic descriptors

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


# c4cce727 18-Jan-2007 Michael Lotz <mmlr@mlotz.ch>

* Revised locking of the USB stack classes
* Implemented the Hub destructor to properly free all of its child devices
* Added FreeDevice() and FreeAddress() to the BusManager class
* Added timeout to ControlPipe::SendRequest()
* Changed how the recursive device reporting works so that it respects the support descriptors of a driver
* Enabled driver rescanning for drivers that are not currently loaded but still registered (R5 only as the devfs function is yet missing from Haiku)
* Changed the way usb_ids are handed out so that free ones are reused instead of just running out of ids
* Fixed driver registration so that each driver is only added once (and devices are reported once per driver)
* Unified debug output and fixed some warnings with debug output turned on
* Fixed some style issues and removed stray whitespaces

Overall the USB stack should now be much more reliable. It should not crash on disconnects anymore and repluging of a device should be noticed by all drivers.

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


# 099dab07 27-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Fixed device creation. No pipes for device endpoints are created and the initial handle of all endpoints is 0.
* The endpoint pipes of a configuration are now created when the configuration is actually set.
* Implemented an Unconfigure() function that tears down any pipe that was created for that configuration.
* Implemented the device destructor that unconfigures and frees the resources allocated for the various usb_*_info structures.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18952 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


# 90b9fb4f 23-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Fixed notify cookie handling. There is not one cookie per device, but one per device/driver combination
* Fixed SetFeature/ClearFeature/GetStatus for interfaces by adding the respective interface number
* Added driver rescanning mechanism (taken from bin/rescan)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18912 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


# 02ce23a1 24-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

* Unified and disabled TRACEing for the usb stack and uhci hcd
* Fixed warnings
* Some cleanup
* Added myself as an author to some files

No functional changes.

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


# 5b0ec61f 19-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

* Added USB API Version 3. It's put into USB3.h while the v2 API resides in USB2.h. USB.h just includes USB2.h for now.
* Rewrote both headers on the way.
* The usb module now exports both, the v2 and v3 module_info.
* Changed the internals of the USB Stack to give out usb_ids instead of opaque handles to internal classes.
* Cleaned up some more of the Stack by moving members into other classes and removing unused stuff.
* Updated the usb_raw driver from v2 to v3 API.

Since both usb_hid (which still uses the v2 API) and usb_raw (which now uses the v3 API) work, I'd call it a success ;-)

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


# 64f3c065 16-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

Implemented a usb_ioctl to retrive the logical device name (like 0/0, 0/1/0 or 1/hub) that will be used by usb_raw to publish the according devfs entries.

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


# d83f3c1a 13-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

* Fixed setting configurations (need to use the configuration_value instead of the index of course)
* Fixed reported power status of the UHCI Root Hub
* Added preservation of the SOF_MODIFY register when doing a global reset of the UHC
* Read out the actual length for outgoing transfers too
* Made actual length handling for transfers a bit safer and correct in respect to NULL packets
* Use short packet detect to handle short packets
* First step at implementing the hub interrupt

Since the devices are now configured correctly, some bulk transfers actually work. Also my hub now reports its status correctly.

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


# f1020a6c 12-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

* Changed the Stack lock to a benaphore
* Removed some debug output from UHCI
* Added some debug output to the usb module instead ;)
* Rewrote the way new devices are attached and ports are handled (now more similar to FreeBSD)
* Corrected handling of port resets so that they should work on hubs too
* Cleaned up some headers

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


# b8c6a851 11-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

* Implemented most of the USB module public API (using opaque handles like in R5 will change that to using IDs later)
* Fixed the UHCI root hub and the hub implementation. Interface and endpoint descriptors are part of the configuration descriptor, they cannot be requested individually.
* Added simple support for interrupt and bulk transfers to UHCI. It's enough to get my USB mouse working to a stable and usable degree.
* Cleaned up and reworked some other parts, added allocation checks and such.

Yes, my internet connection is back up :)

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


# b7a062b5 29-May-2006 Michael Lotz <mmlr@mlotz.ch>

* Calmed down debug output a bit
* Removed all friends in the USB stack classes (as they are not needed)
* Added max packet size to the pipe and respect it on transfers
* Use pipes with the same speed as the device

Device descriptors can now also be retrieved from full speed devices and devices with a packet size of more than 8 bytes. The devices are also correctly initialized to their default configuration.

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


# 96da8285 28-May-2006 Michael Lotz <mmlr@mlotz.ch>

Applying style to remaining classes. No functional change.

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


# 1a2e81b5 19-Jul-2004 Niels Sascha Reedijk <niels.reedijk@gmail.com>

Summary: Merge in changes in busses / bus-manager loading
Keywords:

Patches applied:

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-24
Rename AllocArea to AllocateArea for consistency

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-25
Make the memory allocation routines more global and share it with the hc

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-26
Change from uint32 to addr_t to be safe on 64 bit in the future

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-27
AllocateChunk returns an area_id

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-28
Really fixing AllocateChunk now

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-29
Fix a bug where data was uninitialised when used and load debug symbols

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-30
Integrate host_controller.h

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-31
Many changes to accomodate for new bus_manager handling


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


# 7ce4cf08 30-May-2004 Niels Sascha Reedijk <niels.reedijk@gmail.com>

Summary: Merged with development branch (nielx)

Patches applied:

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-22
Update/add licence header


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


# 0f6609e8 28-May-2004 Niels Sascha Reedijk <niels.reedijk@gmail.com>

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-5
Commit (in between) because of a switch of development-machines

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-6
Implement basic hub init

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-7
Implement a bit more of hub operation

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-8
Device Adress 0 is reserved for the default pipe!

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-9
Implement basic Pipe stuff

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-10
Create basic chunk allocation

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-11
Add Required util.c/util.h

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-12
Provide locking for the stack and make AllocateChunk thread-safe

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-13
Integrated util.c in stack class (cleans up a little)

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-14
Improve Pipe and give the Busmanager its default pipe

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-15
Make the Device class speed aware

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-16
Make Chunk allocation code more dynamic

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-17
Small test-commit to test if webdav is working -- ignore

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-18
Changed Packets into Transfers

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-19
Fix mistakes in host_controller.c

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-20
Advanced a little more in the Pipe stuff

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-21
Merge with mainline and add newlines at the end of files


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


# 8b485af8 13-Apr-2004 Niels Sascha Reedijk <niels.reedijk@gmail.com>

Summary: Continued work on hub initialisation
Keywords:

Patches applied:

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-5
Commit (in between) because of a switch of development-machines

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-6
Implement basic hub init

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-7
Implement a bit more of hub operation


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


# a8e39155 30-Dec-2003 Niels Sascha Reedijk <niels.reedijk@gmail.com>

*
n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-1
Implement basic Busmanager loader modules
*
n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-2
Continue shaping up some things
*
n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-3
Continued device initialisation
*
n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-4
Finalised the device initialisation


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


# 59750213e765ffa8c711b2ccad5a81ae56baee5a 22-May-2014 Axel Dörfler <axeld@pinc-software.de>

usb: fixed potential crash.

* The active interface may be null. This actually happens with a Lasmex
USB speaker in case it is turned on.


# 1152f83ddcb77adb58e501133decfe653326ef57 22-May-2014 Axel Dörfler <axeld@pinc-software.de>

usb: coding style cleanup.

* Removed a few superfluous comments, too.


# 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.


# 2b31b4a88cdcc94b3db80cd453b9fd366420873c 01-May-2012 Jérôme Duval <jerome.duval@gmail.com>

Work in progress on xHCI bus driver.

* added more traces, coding style
* added xhci_td, xhci_endpoint structs.
* SubmitRequest: this links a 3-stage TD control request into
the endpoint ring.
* _InsertEndpointForPipe: when a pipe is created, configure the
endpoint and set up the controller cookie.
* CreateDescriptor and FreeDescriptor: allocates memory for a TD.
* _LinkDescriptorForPipe: link a TD in an endpoint ring.
* _UnlinkDescriptorForPipe: unlink a TD
* AllocateDevice:
slot number zero isn't valid.
stick the slot number to the device struct.
configure the default endpoint before calling SetAddress.
address is found in the device context instead of the input context.
device address passed to the USB stack has to begin with 1.
* Ring:
check for invalid slot/endpoint combination.
ring the slot doorbell instead of the doorbell 0.
* Root hub: fixed USB version.
* HandleTransferComplete: finds out the TD which submitted a
transfer.


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

Tiny cleanup.


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


# c4c6cedde60ae43bd0ad275cef6d113c50f510d9 05-Jul-2010 Ithamar R. Adema <ithamar.adema@team-embedded.nl>

* Work around a problem with a USB device (in my case, Qualcomm Gobi 3G modem) that reports interface_number values that are out of range with the interface_count. This would make the usb stack in Haiku crash.

Will need a different fix to get device to work, but at least Haiku won't crash on bootup with this change.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37409 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


# 9b0a2ab24c6edc25117ce1fd699818a6739ce30a 13-Sep-2009 Michael Lotz <mmlr@mlotz.ch>

No need to crash if we are deleted after not getting far enough to allocate the
configuration buffers.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33122 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


# 5565f43e07b1e7e1e7e2c438b256721efdacf704 12-Sep-2008 Michael Lotz <mmlr@mlotz.ch>

Check the allocation of the endpoint pipe object.


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


# a5243128424aab5d6f5cfebe965de0b1334fcee5 21-Jul-2008 Michael Lotz <mmlr@mlotz.ch>

* Fix off-by-one error in port number which caused full- or lowspeed devices
behind highspeed hubs with multiple transaction translators not to work.
* The parent hub isn't necessarily the one providing the transaction translator
for a full- or lowspeed device. Therefore we need to inherit the hub/port
addresses to lower devices unless we are a highspeed hub that might be the
actual provider of the transaction translator. This logic error caused full-
and lowspeed devices not to work if they were behind a fullspeed hub that
itself was behind a highspeed hub.

This fixes bugs #1889 and #2501.

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


# c2f077d03e5372bbe10862c74c9c981d4cb87eca 25-May-2008 Michael Lotz <mmlr@mlotz.ch>

* Clear the configurations list so it can safely be handled in case the device
fails to init completely.
* Fix wrong usage of realloc and check the allocations.
* Check a few more allocations, should be all now.
* Fix a small memory leaks in error case.
* Do a few more checks when unconfiguring and deleting a device so an incompletely
initilized device is deleted correctly and does not crash or leak.

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


# 519fbf77d397b5b604e7423f5c7fc8f9fdf37d35 18-May-2008 Michael Lotz <mmlr@mlotz.ch>

* Make the maximum port count a define and set it to 16. OHCI officially
supports up to 15 ports and QEMUs OHCI emulation uses a port count of 10
for example.
* Update the hub code to remove the hardcoded 8 port limits.
* Some other code to enumerate the USB structure I had laying around
(available internally only, might be added as a public API some time).

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


# bb90c2a6033d59f96da233ff8b68fcddd4c7cbf6 10-May-2008 Michael Lotz <mmlr@mlotz.ch>

* Clear the endpoints of an alternate interface that is going away before
updating the active pointer as otherwise the endpoints of the new alternate
would have been cleared instead of the old one (leaking endpoints).
* Only clear and re-initialize the endpoints of the interface we are setting
an alterntate. Otherwise we tear down all the device endpoints which would
result in a bad situation for composite devices where multiple drivers may
use different functions (through different interfaces) of a device side by
side.
* Minor cleanup.

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


# b04afa2413da6a05a6f2c424abe6cf6444180cd2 04-Apr-2008 Michael Lotz <mmlr@mlotz.ch>

* Another tiny cut in stack load time: do not delay after setting the current
configuration of a root hub
* Cut down on number of retries to set the initial device address

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


# 30cb1cfbb6d3215eb03897b13c360a0026261bb6 22-Nov-2007 Salvatore Benedetto <salvatore.benedetto@gmail.com>

* Added SetAltInterface method which allows to set an alternate interface for the device
* Added InitEndpoint and ClearEndpoint to avoid code duplication
* Usual clean up


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


# 072c28ded529ca52c32863b4eb1b8f21f1debb71 21-Nov-2007 Michael Lotz <mmlr@mlotz.ch>

* Redesign the Pipe constructor to only take the parent object
* All other init is done in InitCommon() which only needs to be present in the base class
* Adding the hub port a device is attached to to the Device class
* Add hub port and hub address to the Pipe class (will be used for split transactions in EHCI)
* Update the root hubs to reflect the changes to hub creation

Sadly we need pipes that do not belong to devices (default pipe for addressing and to get initial device descriptor). Therefore we cannot resolve hub address and port from the parent device.

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


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

Store the polling interval in the InterruptPipe class to make it accessible to the controller.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22936 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


# 8040388202af600aed88df449b57578b8649396a 29-Jul-2007 Michael Lotz <mmlr@mlotz.ch>

Initialize the endpoints of all interfaces of the configuration to be set. Fixes stuff that needs more than one interface at the same time (ACM modems for example).

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


# 3f2288a41bb6e0a0f3cd033a86ee27c35a4797d2 05-May-2007 Michael Lotz <mmlr@mlotz.ch>

Fixed wrong deallocation of device resources which caused KDL when unplugging devices with more than one interface.

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


# e40b5c0d590247bc698a658f369ffe793b1c080e 26-Jan-2007 Michael Lotz <mmlr@mlotz.ch>

Fixed a wrong index that could cause crashes with devices containing generic descriptors

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


# c4cce7277c297a0a5a78c69a20375182522296e1 18-Jan-2007 Michael Lotz <mmlr@mlotz.ch>

* Revised locking of the USB stack classes
* Implemented the Hub destructor to properly free all of its child devices
* Added FreeDevice() and FreeAddress() to the BusManager class
* Added timeout to ControlPipe::SendRequest()
* Changed how the recursive device reporting works so that it respects the support descriptors of a driver
* Enabled driver rescanning for drivers that are not currently loaded but still registered (R5 only as the devfs function is yet missing from Haiku)
* Changed the way usb_ids are handed out so that free ones are reused instead of just running out of ids
* Fixed driver registration so that each driver is only added once (and devices are reported once per driver)
* Unified debug output and fixed some warnings with debug output turned on
* Fixed some style issues and removed stray whitespaces

Overall the USB stack should now be much more reliable. It should not crash on disconnects anymore and repluging of a device should be noticed by all drivers.

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


# 099dab075320a7098ed48e385ceb810534befb2c 27-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Fixed device creation. No pipes for device endpoints are created and the initial handle of all endpoints is 0.
* The endpoint pipes of a configuration are now created when the configuration is actually set.
* Implemented an Unconfigure() function that tears down any pipe that was created for that configuration.
* Implemented the device destructor that unconfigures and frees the resources allocated for the various usb_*_info structures.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18952 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


# 90b9fb4fbc1a11c47080ee8e9194d32de6ed735c 23-Sep-2006 Michael Lotz <mmlr@mlotz.ch>

* Fixed notify cookie handling. There is not one cookie per device, but one per device/driver combination
* Fixed SetFeature/ClearFeature/GetStatus for interfaces by adding the respective interface number
* Added driver rescanning mechanism (taken from bin/rescan)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18912 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


# 02ce23a1adaf30f7d8a63fd953bb5314ea560d55 24-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

* Unified and disabled TRACEing for the usb stack and uhci hcd
* Fixed warnings
* Some cleanup
* Added myself as an author to some files

No functional changes.

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


# 5b0ec61f972bca106675a66c37354e38efb8016d 19-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

* Added USB API Version 3. It's put into USB3.h while the v2 API resides in USB2.h. USB.h just includes USB2.h for now.
* Rewrote both headers on the way.
* The usb module now exports both, the v2 and v3 module_info.
* Changed the internals of the USB Stack to give out usb_ids instead of opaque handles to internal classes.
* Cleaned up some more of the Stack by moving members into other classes and removing unused stuff.
* Updated the usb_raw driver from v2 to v3 API.

Since both usb_hid (which still uses the v2 API) and usb_raw (which now uses the v3 API) work, I'd call it a success ;-)

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


# 64f3c0650321a0951e337baccaf6db98baa5489c 16-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

Implemented a usb_ioctl to retrive the logical device name (like 0/0, 0/1/0 or 1/hub) that will be used by usb_raw to publish the according devfs entries.

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


# d83f3c1a45d231f5ec4e3c1127d5f44a9b54fb00 13-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

* Fixed setting configurations (need to use the configuration_value instead of the index of course)
* Fixed reported power status of the UHCI Root Hub
* Added preservation of the SOF_MODIFY register when doing a global reset of the UHC
* Read out the actual length for outgoing transfers too
* Made actual length handling for transfers a bit safer and correct in respect to NULL packets
* Use short packet detect to handle short packets
* First step at implementing the hub interrupt

Since the devices are now configured correctly, some bulk transfers actually work. Also my hub now reports its status correctly.

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


# f1020a6c4914d769f910ae85158a8fb9c9c060f7 12-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

* Changed the Stack lock to a benaphore
* Removed some debug output from UHCI
* Added some debug output to the usb module instead ;)
* Rewrote the way new devices are attached and ports are handled (now more similar to FreeBSD)
* Corrected handling of port resets so that they should work on hubs too
* Cleaned up some headers

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


# b8c6a85136cd56e8cf3282ca69b0d2d2832a3eee 11-Aug-2006 Michael Lotz <mmlr@mlotz.ch>

* Implemented most of the USB module public API (using opaque handles like in R5 will change that to using IDs later)
* Fixed the UHCI root hub and the hub implementation. Interface and endpoint descriptors are part of the configuration descriptor, they cannot be requested individually.
* Added simple support for interrupt and bulk transfers to UHCI. It's enough to get my USB mouse working to a stable and usable degree.
* Cleaned up and reworked some other parts, added allocation checks and such.

Yes, my internet connection is back up :)

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


# b7a062b5add9426990a2656b9b0846618ee4ae90 29-May-2006 Michael Lotz <mmlr@mlotz.ch>

* Calmed down debug output a bit
* Removed all friends in the USB stack classes (as they are not needed)
* Added max packet size to the pipe and respect it on transfers
* Use pipes with the same speed as the device

Device descriptors can now also be retrieved from full speed devices and devices with a packet size of more than 8 bytes. The devices are also correctly initialized to their default configuration.

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


# 96da8285b0b36b7499e334e9ecc3da22e8e9b599 28-May-2006 Michael Lotz <mmlr@mlotz.ch>

Applying style to remaining classes. No functional change.

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


# 1a2e81b52cfafb4a0ec65f935ce32b69923638dd 19-Jul-2004 Niels Sascha Reedijk <niels.reedijk@gmail.com>

Summary: Merge in changes in busses / bus-manager loading
Keywords:

Patches applied:

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-24
Rename AllocArea to AllocateArea for consistency

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-25
Make the memory allocation routines more global and share it with the hc

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-26
Change from uint32 to addr_t to be safe on 64 bit in the future

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-27
AllocateChunk returns an area_id

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-28
Really fixing AllocateChunk now

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-29
Fix a bug where data was uninitialised when used and load debug symbols

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-30
Integrate host_controller.h

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-31
Many changes to accomodate for new bus_manager handling


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


# 7ce4cf086694f494b20d3e2f1c7eda103aa5af63 30-May-2004 Niels Sascha Reedijk <niels.reedijk@gmail.com>

Summary: Merged with development branch (nielx)

Patches applied:

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-22
Update/add licence header


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


# 0f6609e85c6573eadcfc4b6fa0acaa847e313680 28-May-2004 Niels Sascha Reedijk <niels.reedijk@gmail.com>

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-5
Commit (in between) because of a switch of development-machines

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-6
Implement basic hub init

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-7
Implement a bit more of hub operation

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-8
Device Adress 0 is reserved for the default pipe!

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-9
Implement basic Pipe stuff

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-10
Create basic chunk allocation

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-11
Add Required util.c/util.h

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-12
Provide locking for the stack and make AllocateChunk thread-safe

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-13
Integrated util.c in stack class (cleans up a little)

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-14
Improve Pipe and give the Busmanager its default pipe

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-15
Make the Device class speed aware

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-16
Make Chunk allocation code more dynamic

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-17
Small test-commit to test if webdav is working -- ignore

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-18
Changed Packets into Transfers

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-19
Fix mistakes in host_controller.c

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-20
Advanced a little more in the Pipe stuff

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-21
Merge with mainline and add newlines at the end of files


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


# 8b485af8749e8e3385cf0607eca2baa530ed5eef 13-Apr-2004 Niels Sascha Reedijk <niels.reedijk@gmail.com>

Summary: Continued work on hub initialisation
Keywords:

Patches applied:

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-5
Commit (in between) because of a switch of development-machines

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-6
Implement basic hub init

* n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-7
Implement a bit more of hub operation


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


# a8e39155919845b80f7a27ffbc279dc6e019a0a0 30-Dec-2003 Niels Sascha Reedijk <niels.reedijk@gmail.com>

*
n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-1
Implement basic Busmanager loader modules
*
n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-2
Continue shaping up some things
*
n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-3
Continued device initialisation
*
n.reedijk@planet.nl--nielx-2003/usb-busmanager--development--0.1--patch-4
Finalised the device initialisation


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