#
361208 |
|
18-May-2020 |
hselasky |
MFC r360925: Refresh the USB device strings when a USB device is re-enumerated.
Submitted by: Horse Ma <Shichun.Ma@dell.com> Sponsored by: Mellanox Technologies
|
#
356680 |
|
13-Jan-2020 |
hselasky |
MFC r356409: Add own counter for cancelled USB transfers. Do not count these as errors.
Bump the FreeBSD version to force recompilation of external modules.
Sponsored by: Mellanox Technologies
|
#
356395 |
|
06-Jan-2020 |
hselasky |
MFC r356135: Make USB statistics per device instead of per bus.
Bump the FreeBSD version due to structure change to force recompilation of external USB modules.
Sponsored by: Mellanox Technologies
|
#
331722 |
|
29-Mar-2018 |
eadler |
Revert r330897:
This was intended to be a non-functional change. It wasn't. The commit message was thus wrong. In addition it broke arm, and merged crypto related code.
Revert with prejudice.
This revert skips files touched in r316370 since that commit was since MFCed. This revert also skips files that require $FreeBSD$ property changes.
Thank you to those who helped me get out of this mess including but not limited to gonzo, kevans, rgrimes.
Requested by: gjb (re)
|
#
330897 |
|
14-Mar-2018 |
eadler |
Partial merge of the SPDX changes
These changes are incomplete but are making it difficult to determine what other changes can/should be merged.
No objections from: pfg
|
#
305733 |
|
12-Sep-2016 |
hselasky |
MFC r305421: Resolve deadlock between device_detach() and usbd_do_request_flags() by reviving the SX control request lock and refining which lock protects the common scratch area in "struct usb_device".
The SX control request lock was removed by r246759 because it caused a lock order reversal with the USB enumeration lock inside usbd_transfer_setup() as a function of r246616. It was thought that reducing the number of locks would resolve the LOR, but because some USB device drivers use usbd_do_request_flags() inside callback functions, like in taskqueues, a deadlock may occur when these are drained from device_detach(). By restoring the SX control request lock usbd_do_request_flags() is allowed to complete its execution when a USB device driver is detaching. By using the SX control request lock to protect the scratch area, the LOR introduced by r246616 is also resolved.
Bump the FreeBSD version while at it to force recompilation of all USB kernel modules.
Found by: avos@
|
#
302408 |
|
07-Jul-2016 |
gjb |
Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle. Prune svn:mergeinfo from the new branch, as nothing has been merged here.
Additional commits post-branch will follow.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
300667 |
|
25-May-2016 |
hselasky |
Check for signals when locking the USB enumeration thread from userspace, so that USB applications can be killed if an enumeration thread should be stuck for various reasons.
MFC after: 1 week
|
#
277136 |
|
13-Jan-2015 |
hselasky |
Resolve a special case deadlock: When two or more threads are simultaneously detaching kernel drivers on the same USB device we can get stuck in the "usb_wait_pending_ref_locked()" function because the conditions needed for allowing detach are not met. The "destroy_dev()" function waits for all system calls involving the given character device to return. Character device system calls may lock the USB enumeration lock, which is also held when "destroy_dev()" is called. This can sometimes lead to a deadlock not noticed by WITNESS. The current solution is to ensure the calling thread is the only one holding the USB enumeration lock and prevent other threads from getting refs while a USB device detach is ongoing. This turned out not to be sufficient. To solve this deadlock we could use "destroy_dev_sched()" to schedule the device destruction in the background, but then we don't know when it is safe to free() the private data of the character device. Instead a callback function is executed by the USB explore process to kill off any leftover USB character devices synchronously after the USB device explore code is finished and the USB enumeration lock is no longer locked. This makes porting easier and also ensures us that character devices must eventually go away after a USB device detach.
While at it ensure that "flag_iserror" is only written when "priv_mtx" is locked, which is protecting it.
MFC after: 5 days
|
#
267240 |
|
08-Jun-2014 |
hselasky |
Resolve a deadlock setting the USB configuration index from userspace on USB HUBs by moving the code into the USB explore threads. The deadlock happens because child devices of the USB HUB don't have the expected reference count when called from outside the explore thread. Only the HUB device itself, which the IOCTL interface locks, gets the correct reference count.
MFC after: 3 days
|
#
260589 |
|
13-Jan-2014 |
hselasky |
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.
MFC after: 1 week
|
#
259218 |
|
11-Dec-2013 |
hselasky |
USB method structures for USB controllers and USB pipes should be constant and does not need to be modified. This also saves a small amount of RAM.
|
#
257206 |
|
27-Oct-2013 |
hselasky |
Fix a deadlock when trying to power off a USB device. The deadlock happens because the code in question is trying to modify the parent USB port registers outside the USB explore thread.
MFC after: 3 days
|
#
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.
|
#
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
|
#
239176 |
|
10-Aug-2012 |
hselasky |
Fix spelling.
MFC after: 2 weeks
|
#
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
|
#
222786 |
|
06-Jun-2011 |
hselasky |
Improve enumeration of Low- and Full-speed devices connected through a High-speed USB HUB by resetting the transaction translator (TT) before trying re-enumeration. Also when clear-stall fails multiple times try a re-enumeration.
Suggested by: Trevor Blackwell MFC after: 14 days
|
#
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)
|
#
213432 |
|
04-Oct-2010 |
hselasky |
Serialise USB re-enumeration with the USB explore thread. This patch can solve problems when multiple USB devices are re-enumerated at the same time on the same bus.
Approved by: thompsa (mentor)
|
#
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.
|
#
205036 |
|
11-Mar-2010 |
thompsa |
Implement USB kernel driver detach from userland.
Submitted by: Hans Petter Selasky
|
#
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)
|
#
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.
|
#
194230 |
|
14-Jun-2009 |
thompsa |
Fix _USB2_* refernces in the header protection defines.
|
#
194228 |
|
14-Jun-2009 |
thompsa |
s/usb2_/usb_|usbd_/ on all function names for the USB stack.
|
#
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.
|
#
193074 |
|
29-May-2009 |
thompsa |
Revert the size_t part of the last commit for the moment, this blows up the USB_ADD_BYTES macro.
|
#
193045 |
|
29-May-2009 |
thompsa |
s/usb2_/usb_/ on all typedefs for the USB stack.
|
#
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.
|
#
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
|
#
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.
|
#
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
|
#
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
|
#
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
|
#
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
|
#
190725 |
|
05-Apr-2009 |
thompsa |
MFp4 //depot/projects/usb@159797
Remove unused field in "struct usb2_pipe".
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
|
#
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
|
#
189906 |
|
16-Mar-2009 |
thompsa |
MFp4 //depot/projects/usb 159225,159241,159292
Fix regression issue in the USB file system interface. - Use cdev_privdata pointer as indicator of correct file handle. - Remove redundant FIFO opened flags.
Don't send ZLP at close for ulpt and uscanner devices as this causes some models to stop working. This reverts back to the USB1 behaviour.
Submitted by: Hans Petter Selasky
|
#
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)
|
#
188987 |
|
24-Feb-2009 |
thompsa |
MFp4 //depot/projects/usb@157974
Add support for setting and getting the USB template value through libusb20 and usbconfig.
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.
|
#
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
|
#
185948 |
|
11-Dec-2008 |
thompsa |
Format and wrap function declarations.
|
#
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
|