History log of /freebsd-10.1-release/sys/dev/usb/usb_device.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 269917 13-Aug-2014 hselasky

MFC r269566:
Fix for deadlock in USB device side mode.


# 267775 23-Jun-2014 marius

MFC: r267321

Avoid the USB device disconnected and controller shutdown clutter on system
shutdown by putting the former under !rebooting and turning the latter into
debug messages.

Reviewed by: hps
Sponsored by: Bally Wulff Games & Entertainment GmbH


# 263799 27-Mar-2014 hselasky

MFC r263423:
Try to resolve a possible deadlock when detaching USB devices which
create character devices. The deadlock can happen if an application is
issuing IOCTLs which require USB refcounting, at the same time the USB
device is detaching.

There is already a counter in place in the USB device structure to
detect this situation, but it was not always checked ahead of invoking
functions that might destroy character devices, like detach, set
configuration, set alternate interface or detach active kernel driver.


# 261110 24-Jan-2014 hselasky

MFC r260808 and r260814:
- Close a minor deadlock.
- Fix a possible memory use after free and leak situation associated
with USB device detach when using character device handles. This also
includes LibUSB. It turns out that "usb_close()" cannot always get a
reference to clean up its USB transfers and such, if called during the
kernel USB device detach.


# 261105 24-Jan-2014 hselasky

MFC r260588 and r260589:
- Separate I/O errors from reception of STALL PID.
- Implement better error recovery for Transaction Translators, TTs,
found in High Speed USB HUBs which translate from High Speed USB into
FULL or LOW speed USB. In some rare cases SPLIT transactions might get
lost, which might leave the TT in an unknown state. Whenever we detect
such an error try to issue either a clear TT buffer request, or if
that is not possible reset the whole TT.


# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 250986 25-May-2013 hselasky

Fix some statical clang analyzer warnings.


# 250212 03-May-2013 hselasky

Fix compile warning.


# 250207 03-May-2013 hselasky

- Add more defines to limit USB memory usage and number of allocations
in reduced memory systems.

- Split allocation and freeing of the configuration descriptor into a separate
function, so that the configuration descriptor can be made fixed size
to save memory allocations. This applies for both device and host mode.


# 250204 03-May-2013 hselasky

Add some defines to limit USB memory usage in reduced memory systems.


# 250202 03-May-2013 hselasky

Allow the default USB template to be specified at compile time.


# 249043 03-Apr-2013 hselasky

Add missing ifdef's for reduced feature compilations.


# 248246 13-Mar-2013 hselasky

- Make quirk for reading device descriptor from broken USB devices.
Else they won't enumerate at all:
hw.usb.full_ddesc=1
- Reduce the USB descriptor read timeout from 1000ms to
500ms. Typical value for LOW speed devices is 50-100ms.
- Enumerate USB device a maximum of 3 times when a port
connection change event is detected, before giving up.

MFC after: 1 month


# 246759 13-Feb-2013 hselasky

Resolve a LOR after r246616. Protect control requests using the USB device
enumeration lock. Make sure all callers of usbd_enum_lock() check the return
value. Remove the control transfer specific lock. Bump the FreeBSD version
number, hence external USB modules may need to be recompiled due to a USB
device structure change.

MFC after: 1 week


# 246616 10-Feb-2013 hselasky

- Move scratch data from the USB bus structure to the USB device structure
so that simultaneous access cannot happen. Protect scratch area using
the enumeration lock. Also reduce stack usage in usbd_transfer_setup()
by moving some big stack members to the scratch area. This saves around
200 bytes of stack.
- Fix a whitespace.

MFC after: 1 week


# 246363 05-Feb-2013 hselasky

Add defines to more easily allow a single threaded version of the FreeBSD
USB stack. This is useful for non-kernel purposes, like the loader.


# 246122 30-Jan-2013 hselasky

Modify the FreeBSD USB kernel code so that it can be compiled directly
into the FreeBSD boot loader, typically for non-USB aware BIOSes, EFI systems
or embedded platforms. This is also useful for out of the system compilation
of the FreeBSD USB stack for various purposes. The USB kernel files can
now optionally include a global header file which should include all needed
definitions required to compile the FreeBSD USB stack. When the global USB
header file is included, no other USB header files will be included by
default.

Add new file containing the USB stack configuration for the
FreeBSD loader build.

Replace some __FBSDID()'s by /* $FreeBSD$ */ comments. Now all
USB files follow the same style.

Use cases:
- console in loader via USB
- loading kernel via USB

Discussed with: Hiroki Sato, hrs @ EuroBSDCon


# 242126 26-Oct-2012 hselasky

Add missing CTLFLAG_TUN flag to tunable sysctls in USB stack.
Rearrange the tunables and belonging sysctl declarations, so
that they are next to eachother.

Submitted by: n_hibma @
MFC after: 1 week


# 239240 13-Aug-2012 hselasky

Fix for missing locks due to recent change.

PR: usb/170606
MFC after: 2 weeks


# 239214 12-Aug-2012 hselasky

Add support for the so-called streams feature of BULK endpoints
in SUPER-speed mode, USB 3.0.

This feature has not been tested yet, due to lack of hardware.

This feature is useful when implementing protocols like UASP,
USB attached SCSI which promises higher USB mass storage throughput.

This patch also implements support for hardware processing of endpoints
for increased performance. The switching to hardware processing
of an endpoint is done via a callback to the USB controller driver. The
stream feature is implemented like a variant of a hardware USB protocol.

USB controller drivers implementing device mode needs to be updated to
implement the new "xfer_stall" USB controller method and remove the
"xfer" argument from the "set_stall" method.

The API's toward existing USB drivers are preserved. To setup a USB transfer
in stream mode, set the "stream_id" field of the USB config structure to
the desired value.

The maximum number of BULK streams is currently hardcoded and limited to 8
via a define in usb_freebsd.h.

All USB drivers should be re-compiled after this change.

LibUSB will be updated next week to support streams mode. A new IOCTL to
setup BULK streams as already been implemented. The ugen device nodes
currently only supports stream ID zero.

The FreeBSD version has been bumped.

MFC after: 2 weeks


# 239177 10-Aug-2012 hselasky

Style.

MFC after: 2 weeks


# 236407 01-Jun-2012 hselasky

Improve support for detaching kernel drivers on a per interface basis.

MFC after: 1 week


# 233774 02-Apr-2012 hselasky

Fix compiler warnings, mostly signed issues,
when USB modules are compiled with WARNS=9.

MFC after: 1 weeks


# 226903 29-Oct-2011 hselasky

Improve USB mass storage quirk auto detection.

MFC after: 3 days


# 225469 10-Sep-2011 hselasky

Refactor auto-quirk solution so that we break as few external
drivers as possible.

PR: usb/160299
Approved by: re (kib)
Suggested by: rwatson
MFC after: 0 days


# 225350 02-Sep-2011 hselasky

This patch adds automatic detection of USB mass storage devices
which does not support the no synchronize cache SCSI command.

The __FreeBSD_version version macro has been bumped and
external kernel modules needs to be recompiled after
this patch.

Approved by: re (kib)
MFC after: 1 week
PR: usb/160299


# 224777 11-Aug-2011 hselasky

Use synchronous device destruction instead of asynchronous, so that a new
device having the same name like a previous one is not created before the old
one is gone. This fixes some panics due to asserts in the devfs code which
were added recently.

Approved by: re (kib)
MFC after: 1 week


# 223513 24-Jun-2011 hselasky

- Ensure that we get all the required nomatch devd events.

MFC after: 3 days


# 223512 24-Jun-2011 hselasky

- Move execution of event handlers into the probe and attach function so that
dynamically loaded device drivers get a chance to run their event hooks.

- Decouple the USB suspend and resume lock from witness. It produces some
false warnings due to reusing the lock name among multiple devices.

MFC after: 3 days


# 222051 18-May-2011 avg

usb: change to one-pass probing of device drivers

This brings USB bus more in line with how newbus is supposed to be used.
Also, because of the two-pass probing the following message was produced
by devd in default configuration when almost any USB device was
connected:
Unknown USB device: vendor <> product <> bus <>
This should be fixed now.

Note that many USB device drivers pass some information from probe
method to attach method via ivars. For this to continue working we rely
on the fact that the subr_bus code calls probe method of a winning driver
again before calling its attach method in the case where multiple
drivers claim to support a device. This is done because device
description is set in successful probe methods and we want to get a correct
device description from a winning driver. So now this logic is re-used
for setting ivars too.

Reviewed by: hselasky
MFC after: 1 month


# 221623 08-May-2011 hselasky

Cleanup usb_notify_addq_compat(). It should not
be needed any more.

MFC after: 7 days


# 217265 11-Jan-2011 jhb

Remove unneeded includes of <sys/linker_set.h>. Other headers that use
it internally contain nested includes.

Reviewed by: bde


# 216072 30-Nov-2010 hselasky

We need to define a cdev variable associated with each USB device,
hence existing applications like webcamd are expecting that.
This problem was introduced by SVN change 214221 where cdev=
was replaced by ugen= by accident. Solve this problem by
redefining cdev= in devd notifications.

MFC after 3 days.

Approved by: thompsa (mentor)


# 214830 05-Nov-2010 n_hibma

Bugfix: Move the 'at <location string' to the beginning of the attach
notification. devd would stop evaluating at 'at' (not '<k>=<v>') and
hence prevent 'port=X' (and 'bus=<"on" string>) from making it into the
environment for the devd action.

Reviewed by: hselasky
MFC after: 2 weeks


# 214809 04-Nov-2010 n_hibma

Don't terminate the notification with \n. This is done in
usb_device.c:devctl_notify_f().


# 214429 27-Oct-2010 hselasky

Add support for setting per-interface PnP information.

Submitted by: Nick Hibma
Approved by: thompsa (mentor)


# 214221 22-Oct-2010 hselasky

Add possibility to generate devctl notifications regardless of UGEN presence.

Submitted by: Nick Hibma
Approved by: thompsa (mentor)


# 213435 04-Oct-2010 hselasky

This commit adds full support for USB 3.0 devices in host and device
mode in the USB core. The patch mostly consists of updating the USB
HUB code to support USB 3.0 HUBs. This patch also add some more USB
controller methods to support more active-alike USB controllers like
the XHCI which needs to be informed about various device state events.

USB 3.0 HUBs are not tested yet, due to lack of hardware, but are
believed to work.

After this update the initial device descriptor is only read twice
when we know that the bMaxPacketSize is too small for a single packet
transfer of this descriptor.

Approved by: thompsa (mentor)


# 212136 02-Sep-2010 thompsa

Reduce the need to accesss struct usb_device by providing functions to access
the product, manufacturer and serial strings.

Submitted by: Hans Petter Selasky


# 212135 02-Sep-2010 thompsa

Add support for power mode filtering as some USB hardware does not support
power saving.

Submitted by: Hans Petter Selasky


# 209062 11-Jun-2010 avg

fix a few cases where a string is passed via format argument instead of
via %s

Most of the cases looked harmless, but this is done for the sake of
correctness. In one case it even allowed to drop an intermediate buffer.

Found by: clang
MFC after: 2 week


# 208008 12-May-2010 thompsa

If a USB device is suspended and a USB set config request is issued when the
USB enumeration lock is locked, then the USB stack fails to resume the device
because locking the USB enumeration lock is part of the resume procedure. To
solve this issue a new lock is introduced which only protects the suspend and
resume callbacks, which can be dropped inside the usbd_do_request_flags()
function, to allow suspend and resume during so-called enumeration operations.

Submitted by: Hans Petter Selasky


# 207080 22-Apr-2010 thompsa

Use a more obvious prefix for the USB control (endpoint 0) transfers rather
than default_*.


# 207079 22-Apr-2010 thompsa

Properly name the sxlocks, mutexes and condvars.


# 207078 22-Apr-2010 thompsa

Use SX_DUPOK rather than making the string unique.


# 207027 21-Apr-2010 thompsa

Also add the usb mode to the devd string as the usb controller can work in both
host or device (gadget) modes.

Suggested by: HPS


# 207020 21-Apr-2010 thompsa

Change usb devd events from fake attach to a notify. The ugen device is not a
proper device_t so it faked the devctl event to appear like one, this is now a
notify which allows more information to be passed.

We notify for both the device attach/detach and for each usb interface. A devd
rule can now match on the interface properties, including composite devices
which may have a uvideo interface and also usound and possibly uhid too.

An example to match a umass device with a scsi subclass and BBB protocol would be

notify 100 {
match "system" "USB";
match "subsystem" "INTERFACE";
match "type" "ATTACH";
match "intclass" "0x08";
match "intsubclass" "0x06";
match "intprotocol" "0x50";
action ...
};

The old attach devctl event has been retained for the moment to make merging to
8.1 easier. This was never compatible with 7.x or earlier due to the ugen regex
change needed.

Reviewed by: warner
MFC after: 1 week


# 205036 11-Mar-2010 thompsa

Implement USB kernel driver detach from userland.

Submitted by: Hans Petter Selasky


# 201681 06-Jan-2010 thompsa

Improve u3g device ejecting by providing additional methods for the eject
command in the usb_msctest routines, as well as a general tidyup.

This now properly ejects the ZTE MF636, Option Gi0322 and Novatel MC950D
devices I have on my desk.


# 201680 06-Jan-2010 thompsa

scratch_size was incorrectly passed as language ID when retrieving the language
ID table, this broke string retrieval on some devices.

Submitted by: Hans Petter Selasky
Reported by: Renato Botelho


# 200653 17-Dec-2009 thompsa

Use the EVENTHANDLER system to hook into the usb device configuration and
perform a function such as ejecting a 3G autoinstaller disk. The eventhandler
system properly tracks threads and is safe to unload, remove the
setting/clearing of a function pointer in the kernel by u3g(4) which included a
tsleep for safety.


# 199816 25-Nov-2009 thompsa

Remove overuse of exclamation marks in kernel printfs, there mere fact a
message has been printed is enough to get someones attention. Also remove the
line number for DPRINTF/DPRINTFN, it already prints the funtion name and a
unique message.


# 199672 22-Nov-2009 thompsa

Improve High Speed slot allocation mechanism by moving the computation to the
endpoint rather than per xfer and provide functions around get/free of resources.

Submitted by: Hans Petter Selasky


# 197561 28-Sep-2009 thompsa

Correct buffer sizes used so that they match. The old code could give the
impression that a overflow situation existed but was not possible.

Reported by: kib
Submitted by: Hans Petter Selasky


# 197559 28-Sep-2009 thompsa

Add support for USB language selection.

PR: usb/138563
Reported by: Bruce Cran
Submitted by: Hans Petter Selasky


# 197558 28-Sep-2009 thompsa

Fix NULL-pointer dereference in usb_endpoint_foreach().

PR: usb/138389
Submitted by: Patroklos Argyroudis at census, inc


# 197553 28-Sep-2009 thompsa

MFp4 @ 168387

- clean up USB detach logic. There seems to be some problems detaching multiple
USB HUBs connected in series from the root.

- after this patch the rule is:
1) Always use device_detach() on the USB HUB first.
2) Never just device_delete_child() on the USB HUB, because that function
will traverse to all the device leaves and free them first, and then the USB
stack will free the devices twice which doesn't work very well.

- make sure the did DMA delay gets set after the timeout has elapsed to make
logic more clear. There is no functional difference.

Submitted by: Hans Petter Selasky


# 196498 24-Aug-2009 alfred

- Patch to allow USB controller to resume operation after
being polled.

- Remove the need for Giant from the USB HUB driver.

- Leave device unconfigured instead of disabling the USB port
when Huawei Autoinstall disk detection triggers. This should
fix problems that the Huawei device is not detected after
Autoinstall eject is issued.
- Reported by: Nikolay Antsiferov

- Fix memory use after free race for USB character devices.
- Reported by: Lucius Windschuh

- Factor out the enumeration lock into three functions to make the
coming newbus lock conversion more easy.
- usbd_enum_lock
- usbd_enum_unlock
- usbd_enum_is_locked

Submitted by: hps


# 196219 14-Aug-2009 jhb

Purge mergeinfo from files that were temporarily renamed while USB2 was
imported into the tree alongside USB.

Approved by: re (mergeinfo blanket)


# 195963 29-Jul-2009 alfred

USB core:
- add support for defragging of written device data.
- improve handling of alternate settings in device side mode.
- correct return value from usbd_get_no_alts() function.
- reported by: HPS
- P4 ID: 166156, 166168

- report USB device release information to devd and pnpinfo.
- reported by: MIHIRA Sanpei Yoshiro
- P4 ID: 166221

Submitted by: hps
Approved by: re


# 195121 27-Jun-2009 thompsa

Sync to p4

- Add support for devices that handle set and clear stall in hardware.
- Add missing get timestamp function
- Add more xfer flags

Submitted by: Hans Petter Selasky
Approved by: re (kib)


# 194677 23-Jun-2009 thompsa

- Make struct usb_xfer opaque so that drivers can not access the internals
- Reduce the number of headers needed for a usb driver, the common case is just usb.h and usbdi.h


# 194271 15-Jun-2009 thompsa

Fix usb2_find_descriptor function name.


# 194228 14-Jun-2009 thompsa

s/usb2_/usb_|usbd_/ on all function names for the USB stack.


# 194227 14-Jun-2009 thompsa

Remove usb2_cv_* and just use the kernel condvar implementation, it was needed
earlier since condition variables didnt work with Giant but this was fixed 10
months ago.


# 193644 07-Jun-2009 thompsa

Rename usb pipes to endpoints as it better represents what they are, and struct
usb_pipe may be used for a different purpose later on.


# 193045 29-May-2009 thompsa

s/usb2_/usb_/ on all typedefs for the USB stack.


# 193042 29-May-2009 thompsa

Free device strings.

Spotted by: HPS


# 192984 28-May-2009 thompsa

s/usb2_/usb_/ on all C structs for the USB stack.


# 192938 27-May-2009 thompsa

Allocate the usb serial, manufacturer and product strings rather than use char
arrays in the usb_device struct. This also eliminates USB_HAVE_STRINGS.


# 192502 20-May-2009 thompsa

Rename the usb sysctl tree from hw.usb2.* back to hw.usb.*.

Submitted by: Hans Petter Selasky


# 192500 20-May-2009 thompsa

Use enums for speed and rev data types.


# 192499 20-May-2009 thompsa

- rename usb2_mode to usb_mode [1]
- change variable types to use the enum

Submitted by: Hans Petter Selasky [1]


# 191824 05-May-2009 thompsa

Revert part of r191494 which used the udev state to mark suspending, this needs
to be set via two variables (peer_suspended and self_suspended) and can not be
merged into one.

Submitted by: Hans Petter Selasky
Pointy hat: me


# 191498 25-Apr-2009 thompsa

Make the state string descriptions public.


# 191494 25-Apr-2009 thompsa

Track the usb device state as its powered on, addressed and configured. This helps
to avoid touching the device when it is not going to respond and would otherwise
timeout.

Implement the suspend tracking as a udev state too.


# 191402 22-Apr-2009 thompsa

MFp4 //depot/projects/usb@160930

Change the roothub exec functions to take the usb request and data pointers
directly rather than placing them on the parent bus struct.

Submitted by: Hans Petter Selasky


# 191398 22-Apr-2009 thompsa

MFp4 //depot/projects/usb@160655

Fix possible issue with clear-stall and set-config happening at the same time.

Submitted by: Hans Petter Selasky


# 191397 22-Apr-2009 thompsa

MFp4 //depot/projects/usb@160614

Fix errornous printout.

Submitted by: Hans Petter Selasky


# 191395 22-Apr-2009 thompsa

MFp4 //depot/projects/usb@160413

Use direct reference to parent high-speed HUB instead of indirect, due to
pointer clearing race at detach of parent USB HUB.

Reported by: kientzle
Submitted by: Hans Petter Selasky
PR: usb/133545


# 190754 05-Apr-2009 thompsa

Provide a better commit log for r190735, forced by making a whitespace change.

Refactor how we interface with the root HUB. This is achieved by making a
direct call from usb2_do_request to the host controller for root hub requests,
this call will perform the controller specific register read/writes and return
the error code.

This cuts out a lot of code in the host controller files and saves one thread
per USB bus.

Submitted by: Hans Petter Selasky


# 190749 05-Apr-2009 piso

Remove pointeless mergeinfo that crept in from r190633.


# 190743 05-Apr-2009 thompsa

MFp4 //depot/projects/usb@160056

Remove code for unused and unlikely quirk, "uq_power_claim"

Submitted by: Hans Petter Selasky


# 190739 05-Apr-2009 thompsa

MFp4 //depot/projects/usb@159948

Add more debugging output on enumeration failures.

Submitted by: Hans Petter Selasky


# 190735 05-Apr-2009 thompsa

MFp4 //depot/projects/usb@159922

Refactor how we interface with the root HUB. This cuts around 1200 lines of
code totally and saves one thread per USB bus.

Submitted by: Hans Petter Selasky


# 190734 05-Apr-2009 thompsa

MFp4 //depot/projects/usb@159909

- make usb2_power_mask_t 16-bit
- remove "usb2_config_sub" structure from "usb2_config". To compensate for this
"usb2_config" has a new field called "usb_mode" which select for which mode
the current xfer entry is active. Options are: a) Device mode only b) Host
mode only (default-by-zero) c) Both modes. This change was scripted using
the following sed script: "s/\.mh\././g".
- the standard packet size table in "usb_transfer.c" is now a function, hence
the code for the function uses less memory than the table itself.

Submitted by: Hans Petter Selasky


# 190732 05-Apr-2009 thompsa

MFp4 //depot/projects/usb@159897

Add new endpoint direction values for use with usb2_config

Submitted by: Hans Petter Selasky


# 190731 05-Apr-2009 thompsa

MFp4 //depot/projects/usb@159871

- bugfixes after the memory usage reduction patch
- Use "udev->pipes_max" instead of USB_EP_MAX
- Use correct "bmRequestType" for getting the config descriptor.

Submitted by: Hans Petter Selasky


# 190730 05-Apr-2009 thompsa

MFp4 //depot/projects/usb@159866

- memory usage reduction by only allocating the required USB pipes and USB
interfaces.
- cleanup some USB parsing functions to be more flexible.

Submitted by: Hans Petter Selasky


# 190727 05-Apr-2009 thompsa

MFp4 //depot/projects/usb@159811

First patch in a series of memory save patches.

Submitted by: Hans Petter Selasky


# 190723 05-Apr-2009 thompsa

MFp4 //depot/projects/usb@159677

Remove redundant locking.

Submitted by: Hans Petter Selasky


# 190633 01-Apr-2009 piso

Implement an ipfw action to reassemble ip packets: reass.


# 190581 30-Mar-2009 mav

Integrate user/mav/ata branch:

Add ch_suspend/ch_resume methods for PCI controllers and implement them
for AHCI. Refactor AHCI channel initialization according to it.

Fix Port Multipliers operation. It is far from perfect yet, but works now.
Tested with JMicron JMB363 AHCI + SiI 3726 PMP pair.
Previous version was also tested with SiI 4726 PMP.

Hardware sponsored by: Vitsch Electronics / VEHosting.nl


# 190328 23-Mar-2009 thompsa

Fix order of debug printf items, addr and config# were swapped.


# 190306 22-Mar-2009 kan

Do not pass uninitialized data buffer to devctl_queue_data function.
This was botched in revision 190191.


# 190191 20-Mar-2009 thompsa

Fix compile with USB_HAVE_BUSDMA/USB_HAVE_UGEN/USB_HAVE_STRINGS.

Submitted by: Hans Petter Selasky


# 190181 20-Mar-2009 thompsa

MFp4 //depot/projects/usb @159431,159437,159438

- start using the new USB typedefs in the USB core
- Remove usage of USB_ADD_BYTES()

Submitted by: Hans Petter Selasky


# 190180 20-Mar-2009 thompsa

MFp4 //depot/projects/usb@159392

Add ifdefs for making parts of usb conditional.

Submitted by: Hans Petter Selasky


# 190174 20-Mar-2009 thompsa

MFp4 //depot/projects/usb @159430

- Move tunable defines into usb_core.h and dependancy towards usb_defs.h
- Leave hardcoded defines in "usb_defs.h".
- Allow overriding all tunable defines.
- Add more customisable typedefs.
- Correct maximum device number.

Submitted by: Hans Petter Selasky


# 189599 09-Mar-2009 thompsa

MFp4 //depot/projects/usb 158942,158948

Allow USB to be compiled without ugen support.

Submitted by: Hans Petter Selasky


# 189173 28-Feb-2009 thompsa

A couple of style nits in the last commit
- unwrap short lines
- move variable initialisation out of the declaration.


# 189172 28-Feb-2009 thompsa

- Remove the usb interface number from the device nodes as it is not needed.
- Do not recreate the device nodes in set_alt_interface as the endpoints do not
change.

Submitted by: Hans Petter Selasky


# 189110 27-Feb-2009 thompsa

Change USB over to make_dev() for all device nodes, previously it hooked into
the devfs clone handler to open the (invisible) devices on the fly.

The /dev entries are layed out as follows,

/dev/usbctl = master device
/dev/usb/0.1.0.5 = usb device, (<bus>.<dev>.<iface>.<endpoint>)
/dev/ugen0.1 -> usb/0.1.0.0 = ugen link to ctrl endpoint

This also removes the custom permissions model from USB. Bump
__FreeBSD_version to 800066.

Submitted by: rink (earlier version)


# 188986 24-Feb-2009 thompsa

MFp4 //depot/projects/usb@157958

- We don't need to exit the Giant mutex when sleeping. This is done
automatically. Replace Giant by NULL mutex for all control requests in the
enumeration path.
- Optimise away duplicate alternate interface selection requests in USB Host
mode.

Submitted by: Hans Petter Selasky


# 188985 24-Feb-2009 thompsa

MFp4 //depot/projects/usb@157909

Changes to make implementing USB NDIS easier.

Submitted by: Hans Petter Selasky


# 188942 23-Feb-2009 thompsa

Move the new USB stack into its new home.


# 188746 18-Feb-2009 thompsa

Switch over to usbdevs.h generated at compile time.


# 188411 09-Feb-2009 thompsa

MFp4 //depot/projects/usb; 157069, 157429, 157430

- Change "usb2_pause_mtx" so that it takes the timeout value in ticks
- Factor out USB ethernet and USB serial driver specific control request.
- USB process naming cleanup.

Submitted by: Hans Petter Selasky


# 187180 13-Jan-2009 thompsa

MFp4: //depot/projects/usb@155957

Make code more compliant with SuperSpeed USB and Wireless USB.

Submitted by: Hans Petter Selasky


# 187174 13-Jan-2009 thompsa

MFp4: //depot/projects/usb@155842

Reduce the number of callback processes to 4 per
USB controller. There are two rough categories:
1) Giant locked USB transfers.
2) Non-Giant locked USB transfers.
On a real system with many USB devices plugged in the
number of processes reported by "ps auxw | grep USBPROC"
was reduced from 40 to 18.

Submitted by: Hans Petter Selasky


# 187171 13-Jan-2009 thompsa

MFp4: //depot/projects/usb@155829

Code style changes requested by:
M. Warner Losh

Submitted by: Hans Petter Selasky


# 187170 13-Jan-2009 thompsa

MFp4: //depot/projects/usb@155820

USB memory usage reduction patch.

Submitted by: Hans Petter Selasky


# 186730 03-Jan-2009 alfred

Sync with usb4bsd:

src/lib/libusb20/libusb20_desc.c

Make "libusb20_desc_foreach()" more readable.

src/sys/dev/usb2/controller/*.[ch]
src/sys/dev/usb2/core/*.[ch]

Implement support for USB power save for all HC's.

Implement support for Big-endian EHCI.

Move Huawei quirks back into "u3g" driver.

Improve device enumeration.

src/sys/dev/usb2/ethernet/*[ch]

Patches for supporting new AXE Gigabit chipset.

src/sys/dev/usb2/serial/*[ch]

Fix IOCTL return code.

src/sys/dev/usb2/wlan/*[ch]

Sync with old USB stack.

Submitted by: hps


# 185950 11-Dec-2008 thompsa

Remove superfluous return statements from the end of void functions.


# 185948 11-Dec-2008 thompsa

Format and wrap function declarations.


# 185290 25-Nov-2008 alfred

src/lib/libusb20/libusb20_compat01.c

Fix some issues about re-scanning of the devices.

src/lib/libusb20/libusb20_ugen20.c

Fix issue about libusb20 having to release the
USB transfers before doing a SET_CONFIG, else
the kernel will kill the file handle.

src/sys/dev/usb2/core/usb2_device.
src/sys/dev/usb2/core/usb2_generic.c
src/sys/dev/usb2/core/usb2_generic.h

Add support for U3G devices.
Improve and cleanup FIFO free handling.
Improve device re-enumeration.

src/sys/dev/usb2/core/usb2_msctest.c
src/sys/dev/usb2/core/usb2_msctest.h

Fix some problems in the USB Mass Storage Test.
Add Huawei vendor specific quirks.

src/sys/dev/usb2/core/usb2_request.c

Improve device re-enumeration.

src/sys/dev/usb2/ethernet/if_aue2.c
src/sys/dev/usb2/include/usb2_devid.h
src/sys/dev/usb2/include/usb2_devtable.h
src/sys/dev/usb2/quirk/usb2_quirk.c

Integrate changes from the old USB driver.

src/sys/dev/usb2/include/usb2_standard.h

Add definition of USB3.0 structures from USB.org.

src/sys/dev/usb2/serial/u3g2.c
src/sys/dev/usb2/serial/ugensa2.c
src/sys/modules/usb2/Makefile
src/sys/modules/usb2/serial_3g/Makefile

Import U3G driver.

Submitted by: Hans Petter Selasky (usb4bsd)


# 185087 19-Nov-2008 alfred

src/sys/dev/usb2/controller/uss820dci_pccard.c
src/sys/dev/usb2/core/usbdevs
src/sys/dev/usb2/include/urio2_ioctl.h
src/sys/dev/usb2/storage/ustorage2_fs.h

These files are not used any more.

src/usr.sbin/Makefile
src/etc/mtree/BSD.include.dist
src/include/Makefile
src/lib/Makefile
src/share/man/man7/hier.7
src/share/mk/bsd.libnames.mk
src/etc/mtree/BSD.include.dist

Make "usbconfig" and "libusb20" a part of the default build.

src/sys/dev/usb/rio500_usb.h
src/sys/dev/usb2/storage/urio2.c

Use common include file.

src/sys/dev/usb2/bluetooth/ng_ubt2.c

Make USB bluetooth depend on "ng_hci" module.

src/sys/dev/usb2/controller/ehci2.c
src/sys/dev/usb2/controller/ehci2.h

Patches for Marvell EHCI.

src/sys/dev/usb2/core/usb2_busdma.c

Bugfix for 64-bit platforms. Need to unload the previously loaded DMA
map and some cleanup regarding some corner cases.

src/sys/dev/usb2/core/usb2_core.h
src/sys/dev/usb2/core/usb2_dev.c
src/sys/dev/usb2/core/usb2_dev.h

Bugfix for libusb filesystem interface.

New feature: Add support for filtering device data at the expense of the
userland process.

Add some more comments.

Some minor code styling.

Remove unused function, usb2_fifo_get_data_next().

Fix an issue about "fifo_index" being used instead of "ep_index".

src/sys/dev/usb2/core/usb2_device.c
src/sys/dev/usb2/core/usb2_generic.c

Bugfix for Linux USB compat layer. Do not free non-generic FIFOs when
doing an alternate setting.

Cleanup USB IOCTL and USB reference handling.
Fix a corner case where USB-FS was left initialised after
setting a new configuration or alternate setting.

src/sys/dev/usb2/core/usb2_hub.c

Improvement: Check all USB HUB ports by default at least one time.

src/sys/dev/usb2/core/usb2_request.c

Bugfix: Make sure destination ASCII string is properly zero terminated
in all cases.

Improvement: Skip invalid characters instead of replacing with a dot.

src/sys/dev/usb2/core/usb2_util.c
src/sys/dev/usb2/image/uscanner2.c

Spelling.

src/sys/dev/usb2/include/Makefile

Share "usbdevs" with the old USB stack.

src/sys/dev/usb2/include/usb2_devid.h
src/sys/dev/usb2/include/usb2_devtable.h

Regenerate files.

Alfred: Please fix the RCS tag at the top.

src/sys/dev/usb2/include/usb2_ioctl.h

Fix compilation of "kdump".

src/sys/dev/usb2/serial/ubsa2.c
src/sys/dev/usb2/serial/ugensa2.c

Remove device ID's which will end up in a new 3G driver.

src/sys/dev/usb2/sound/uaudio2.c

Correct a debug printout.

src/sys/dev/usb2/storage/umass2.c

Sync with old USB stack.

src/lib/libusb20/libusb20.3

Add more documentation.

src/lib/libusb20/libusb20.c

Various bugfixes and improvements.

src/usr.sbin/usbconfig/dump.c
src/usr.sbin/usbconfig/usbconfig.c

New commands for dumping strings and doing custom USB requests from
the command line.

Remove keyword requirements from generated files:
"head/sys/dev/usb2/include/usb2_devid.h"
"head/sys/dev/usb2/include/usb2_devtable.h"


# 184824 10-Nov-2008 thompsa

Convert the two main locking areas into macros to make it clear on what we are
grabbing and why. These are now:

USB_BUS_LOCK/USB_BUS_UNLOCK
USB_XFER_LOCK/USB_XFER_UNLOCK

Reviewed by: alfred


# 184610 04-Nov-2008 alfred

Bring in USB4BSD, Hans Petter Selasky rework of the USB stack
that includes significant features and SMP safety.

This commit includes a more or less complete rewrite of the *BSD USB
stack, including Host Controller and Device Controller drivers and
updating all existing USB drivers to use the new USB API:

1) A brief feature list:

- A new and mutex enabled USB API.

- Many USB drivers are now running Giant free.

- Linux USB kernel compatibility layer.

- New UGEN backend and libusb library, finally solves the "driver
unloading" problem. The new BSD licensed libusb20 library is fully
compatible with libusb-0.1.12 from sourceforge.

- New "usbconfig" utility, for easy configuration of USB.

- Full support for Split transactions, which means you can use your
full speed USB audio device on a high speed USB HUB.

- Full support for HS ISOC transactions, which makes writing drivers
for various HS webcams possible, for example.

- Full support for USB on embedded platforms, mostly cache flushing
and buffer invalidating stuff.

- Safer parsing of USB descriptors.

- Autodetect of annoying USB install disks.

- Support for USB device side mode, also called USB gadget mode,
using the same API like the USB host side. In other words the new
USB stack is symmetric with regard to host and device side.

- Support for USB transfers like I/O vectors, means more throughput
and less interrupts.

- ... see the FreeBSD quarterly status reports under "USB project"

2) To enable the driver in the default kernel build:

2.a) Remove all existing USB device options from your kernel config
file.

2.b) Add the following USB device options to your kernel configuration
file:

# USB core support
device usb2_core

# USB controller support
device usb2_controller
device usb2_controller_ehci
device usb2_controller_ohci
device usb2_controller_uhci

# USB mass storage support
device usb2_storage
device usb2_storage_mass

# USB ethernet support, requires miibus
device usb2_ethernet
device usb2_ethernet_aue
device usb2_ethernet_axe
device usb2_ethernet_cdce
device usb2_ethernet_cue
device usb2_ethernet_kue
device usb2_ethernet_rue
device usb2_ethernet_dav

# USB wireless LAN support
device usb2_wlan
device usb2_wlan_rum
device usb2_wlan_ral
device usb2_wlan_zyd

# USB serial device support
device usb2_serial
device usb2_serial_ark
device usb2_serial_bsa
device usb2_serial_bser
device usb2_serial_chcom
device usb2_serial_cycom
device usb2_serial_foma
device usb2_serial_ftdi
device usb2_serial_gensa
device usb2_serial_ipaq
device usb2_serial_lpt
device usb2_serial_mct
device usb2_serial_modem
device usb2_serial_moscom
device usb2_serial_plcom
device usb2_serial_visor
device usb2_serial_vscom

# USB bluetooth support
device usb2_bluetooth
device usb2_bluetooth_ng

# USB input device support
device usb2_input
device usb2_input_hid
device usb2_input_kbd
device usb2_input_ms

# USB sound and MIDI device support
device usb2_sound

2) To enable the driver at runtime:

2.a) Unload all existing USB modules. If USB is compiled into the
kernel then you might have to build a new kernel.

2.b) Load the "usb2_xxx.ko" modules under /boot/kernel having the same
base name like the kernel device option.

Submitted by: Hans Petter Selasky hselasky at c2i dot net
Reviewed by: imp, alfred