summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usb_device.h
Commit message (Collapse)AuthorAgeFilesLines
* MFC r277136:hselasky2015-02-051-0/+1
| | | | | | | | | | 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. While at it ensure that "flag_iserror" is only written when "priv_mtx" is locked, which is protecting it.
* MFC r267240:hselasky2014-06-111-0/+2
| | | | | | | | | 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 r260588 and r260589:hselasky2014-01-241-3/+9
| | | | | | | | | | - 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.
* MFC r257206:hselasky2013-10-301-0/+3
| | | | | | | | 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. Approved by: re (glebius)
* - Add more defines to limit USB memory usage and number of allocationshselasky2013-05-031-0/+4
| | | | | | | | 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.
* Add some defines to limit USB memory usage in reduced memory systems.hselasky2013-05-031-0/+8
|
* Resolve a LOR after r246616. Protect control requests using the USB devicehselasky2013-02-131-1/+0
| | | | | | | | | 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
* - Move scratch data from the USB bus structure to the USB device structurehselasky2013-02-101-2/+71
| | | | | | | | | | 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
* Fix spelling.hselasky2012-08-101-1/+1
| | | | MFC after: 2 weeks
* This patch adds automatic detection of USB mass storage deviceshselasky2011-09-021-0/+1
| | | | | | | | | | | | 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
* Use synchronous device destruction instead of asynchronous, so that a newhselasky2011-08-111-1/+7
| | | | | | | | | 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
* Improve enumeration of Low- and Full-speed devices connected through ahselasky2011-06-061-0/+2
| | | | | | | | | 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
* This commit adds full support for USB 3.0 devices in host and devicehselasky2010-10-041-5/+8
| | | | | | | | | | | | | | | | 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)
* Serialise USB re-enumeration with the USB explore thread.hselasky2010-10-041-0/+1
| | | | | | | This patch can solve problems when multiple USB devices are re-enumerated at the same time on the same bus. Approved by: thompsa (mentor)
* If a USB device is suspended and a USB set config request is issued when thethompsa2010-05-121-0/+3
| | | | | | | | | | 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
* Use a more obvious prefix for the USB control (endpoint 0) transfers ratherthompsa2010-04-221-5/+5
| | | | than default_*.
* Properly name the sxlocks, mutexes and condvars.thompsa2010-04-221-3/+5
|
* Implement USB kernel driver detach from userland.thompsa2010-03-111-0/+1
| | | | Submitted by: Hans Petter Selasky
* MFp4 @ 168387thompsa2009-09-281-1/+0
| | | | | | | | | | | | | | | | - 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
* - Patch to allow USB controller to resume operation afteralfred2009-08-241-0/+3
| | | | | | | | | | | | | | | | | | | | | | | 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
* - Make struct usb_xfer opaque so that drivers can not access the internalsthompsa2009-06-231-45/+1
| | | | - Reduce the number of headers needed for a usb driver, the common case is just usb.h and usbdi.h
* Fix usb2_find_descriptor function name.thompsa2009-06-151-1/+1
|
* Fix _USB2_* refernces in the header protection defines.thompsa2009-06-151-3/+3
|
* s/usb2_/usb_|usbd_/ on all function names for the USB stack.thompsa2009-06-151-18/+18
|
* Rename usb pipes to endpoints as it better represents what they are, and structthompsa2009-06-071-14/+14
| | | | usb_pipe may be used for a different purpose later on.
* Revert the size_t part of the last commit for the moment, this blows up thethompsa2009-05-301-3/+3
| | | | USB_ADD_BYTES macro.
* s/usb2_/usb_/ on all typedefs for the USB stack.thompsa2009-05-291-12/+12
|
* s/usb2_/usb_/ on all C structs for the USB stack.thompsa2009-05-281-53/+96
|
* Allocate the usb serial, manufacturer and product strings rather than use charthompsa2009-05-271-5/+3
| | | | arrays in the usb_device struct. This also eliminates USB_HAVE_STRINGS.
* Use enums for speed and rev data types.thompsa2009-05-211-5/+5
|
* - rename usb2_mode to usb_mode [1]thompsa2009-05-211-2/+2
| | | | | | - change variable types to use the enum Submitted by: Hans Petter Selasky [1]
* Revert part of r191494 which used the udev state to mark suspending, this needsthompsa2009-05-051-2/+10
| | | | | | | | 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
* Track the usb device state as its powered on, addressed and configured. This ↵thompsa2009-04-251-2/+3
| | | | | | | | | 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.
* MFp4 //depot/projects/usb@160413thompsa2009-04-221-0/+1
| | | | | | | | | 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
* MFp4 //depot/projects/usb@160056thompsa2009-04-051-1/+0
| | | | | | Remove code for unused and unlikely quirk, "uq_power_claim" Submitted by: Hans Petter Selasky
* MFp4 //depot/projects/usb@159909thompsa2009-04-051-1/+0
| | | | | | | | | | | | | - 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
* MFp4 //depot/projects/usb@159866thompsa2009-04-051-6/+18
| | | | | | | | - 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
* MFp4 //depot/projects/usb@159797thompsa2009-04-051-1/+0
| | | | | | Remove unused field in "struct usb2_pipe". Submitted by: Hans Petter Selasky
* Fix compile with USB_HAVE_BUSDMA/USB_HAVE_UGEN/USB_HAVE_STRINGS.thompsa2009-03-201-5/+6
| | | | Submitted by: Hans Petter Selasky
* MFp4 //depot/projects/usb @159431,159437,159438thompsa2009-03-201-5/+5
| | | | | | | - start using the new USB typedefs in the USB core - Remove usage of USB_ADD_BYTES() Submitted by: Hans Petter Selasky
* MFp4 //depot/projects/usb@159392thompsa2009-03-201-0/+3
| | | | | | Add ifdefs for making parts of usb conditional. Submitted by: Hans Petter Selasky
* MFp4 //depot/projects/usb 159225,159241,159292thompsa2009-03-171-2/+0
| | | | | | | | | | | 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
* - Remove the usb interface number from the device nodes as it is not needed.thompsa2009-02-281-2/+0
| | | | | | | - Do not recreate the device nodes in set_alt_interface as the endpoints do not change. Submitted by: Hans Petter Selasky
* Change USB over to make_dev() for all device nodes, previously it hooked intothompsa2009-02-271-2/+9
| | | | | | | | | | | | | | | 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)
* MFp4 //depot/projects/usb@157974thompsa2009-02-241-0/+4
| | | | | | | Add support for setting and getting the USB template value through libusb20 and usbconfig. Submitted by: Hans Petter Selasky
* MFp4 //depot/projects/usb@157909thompsa2009-02-241-0/+1
| | | | | | Changes to make implementing USB NDIS easier. Submitted by: Hans Petter Selasky
* Move the new USB stack into its new home.thompsa2009-02-231-0/+187
OpenPOWER on IntegriCloud