aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/usb/usbdi.h
Commit message (Collapse)AuthorAgeFilesLines
* sys: Remove $FreeBSD$: two-line .h patternWarner Losh2023-08-161-2/+0
| | | | Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* Send a zero-length-packet first when opening a BULK endpoint for USB serialHans Petter Selasky2021-07-151-0/+3
| | | | | | | | | | port devices. If it gets eaten it is fine. Many USB device side implementations don't properly support the clear endpoint halt command and if they do, data is lost because the transmit FIFO is typically reset when this command is received. Tested by: jmg MFC after: 1 week Sponsored by: NVIDIA Networking
* Improve handling of alternate settings in the USB stack.Hans Petter Selasky2020-12-151-1/+3
| | | | | | | | | | | | | | | | | Allow setting the alternate interface number to fail when there is only one alternate setting present, to comply with the USB specification. Refactor how iface->num_altsetting is computed. Bump the __FreeBSD_version due to change of core USB structure. PR: 251856 MFC after: 1 week Submitted by: Ma, Horse <Shichun.Ma@dell.com> Sponsored by: Mellanox Technologies // NVIDIA Networking Notes: svn path=/head/; revision=368659
* Fix build of USB bootloader code by adding checks for _STANDALONE being defined.Hans Petter Selasky2020-11-181-3/+3
| | | | | | | | | | Currently the USB bootloader code is not part of buildworld. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Notes: svn path=/head/; revision=367787
* usb: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-2/+0
| | | | Notes: svn path=/head/; revision=365084
* Implement helper function, usbd_get_max_frame_length(), which allows kernelHans Petter Selasky2020-05-281-0/+3
| | | | | | | | | | device drivers to correctly predict the default USB transfer frame length. MFC after: 3 days Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=361581
* Extract eventfilter declarations to sys/_eventfilter.hConrad Meyer2019-05-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | This allows replacing "sys/eventfilter.h" includes with "sys/_eventfilter.h" in other header files (e.g., sys/{bus,conf,cpu}.h) and reduces header pollution substantially. EVENTHANDLER_DECLARE and EVENTHANDLER_LIST_DECLAREs were moved out of .c files into appropriate headers (e.g., sys/proc.h, powernv/opal.h). As a side effect of reduced header pollution, many .c files and headers no longer contain needed definitions. The remainder of the patch addresses adding appropriate includes to fix those files. LOCK_DEBUG and LOCK_FILE_LINE_ARG are moved to sys/_lock.h, as required by sys/mutex.h since r326106 (but silently protected by header pollution prior to this change). No functional change (intended). Of course, any out of tree modules that relied on header pollution for sys/eventhandler.h, sys/lock.h, or sys/mutex.h inclusion need to be fixed. __FreeBSD_version has been bumped. Notes: svn path=/head/; revision=347984
* Reapply, with minor tweaks, r338025, from the original commit:Warner Losh2018-09-261-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove unused and easy to misuse PNP macro parameter Inspired by r338025, just remove the element size parameter to the MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to have correct pointer (or array) type. Since all invocations of the macro already had this property and the emitted PNP data continues to include the element size, there is no functional change. Mostly done with the coccinelle 'spatch' tool: $ cat modpnpsize0.cocci @normaltables@ identifier b,c; expression a,d,e; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,d, -sizeof(d[0]), e); @singletons@ identifier b,c,d; expression a; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,&d, -sizeof(d), 1); $ rg -l MODULE_PNP_INFO -- sys | \ xargs spatch --in-place --sp-file modpnpsize0.cocci (Note that coccinelle invokes diff(1) via a PATH search and expects diff to tolerate the -B flag, which BSD diff does not. So I had to link gdiff into PATH as diff to use spatch.) Tinderbox'd (-DMAKE_JUST_KERNELS). Approved by: re (glen) Notes: svn path=/head/; revision=338948
* Back out r338035 until Warner is finished churning GSoC PNP patchesConrad Meyer2018-08-191-3/+3
| | | | | | | | | | I was not aware Warner was making or planning to make forward progress in this area and have since been informed of that. It's easy to apply/reapply when churn dies down. Notes: svn path=/head/; revision=338037
* Remove unused and easy to misuse PNP macro parameterConrad Meyer2018-08-191-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inspired by r338025, just remove the element size parameter to the MODULE_PNP_INFO macro entirely. The 'table' parameter is now required to have correct pointer (or array) type. Since all invocations of the macro already had this property and the emitted PNP data continues to include the element size, there is no functional change. Mostly done with the coccinelle 'spatch' tool: $ cat modpnpsize0.cocci @normaltables@ identifier b,c; expression a,d,e; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,d, -sizeof(d[0]), e); @singletons@ identifier b,c,d; expression a; declarer MODULE_PNP_INFO; @@ MODULE_PNP_INFO(a,b,c,&d, -sizeof(d), 1); $ rg -l MODULE_PNP_INFO -- sys | \ xargs spatch --in-place --sp-file modpnpsize0.cocci (Note that coccinelle invokes diff(1) via a PATH search and expects diff to tolerate the -B flag, which BSD diff does not. So I had to link gdiff into PATH as diff to use spatch.) Tinderbox'd (-DMAKE_JUST_KERNELS). Notes: svn path=/head/; revision=338035
* Correct the PNP information generated by the usb driver to match theWarner Losh2018-02-171-4/+4
| | | | | | | | | | | | artificial NOMATCH usb does in lieu of creating a device_t for devices with no drivers. Also, correct bus to be 'uhub' since where USB devices attach, even though 'usb' is more logical, we need the physical bus here. Submitted by: hps@ Notes: svn path=/head/; revision=329440
* Fix for incorrect PnP information used by devmatch(8).Hans Petter Selasky2018-02-131-1/+1
| | | | | | | | MFC after: 1 week Sponsored by: Mellanox Technologies Notes: svn path=/head/; revision=329198
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* Improve USB polling mode by not locking any mutexes, asserting anyHans Petter Selasky2016-09-141-2/+55
| | | | | | | | | | | | | | | | | | | | | mutexes or using any callouts when active. Trying to lock a mutex when KDB is active or the scheduler is stopped can result in infinite wait loops. The same goes for calling callout related functions which in turn lock mutexes. If the USB controller at which a USB keyboard is connected is idle when KDB is entered, polling the USB keyboard via USB will always succeed. Else polling may fail depending on which state the USB subsystem and USB interrupt handler is in. This is unavoidable unless KDB can wait for USB interrupt threads to complete before stalling the CPU(s). Tested by: Bruce Evans <bde@freebsd.org> MFC after: 4 weeks Notes: svn path=/head/; revision=305806
* dev/usb: minor spelling fixes in comments.Pedro F. Giffuni2016-05-021-1/+1
| | | | | | | | | No functional change. Reviewed by: hselasky Notes: svn path=/head/; revision=298932
* Update metadata for "tools/tools/bus_autoconf" after r292080. UseHans Petter Selasky2015-12-291-8/+4
| | | | | | | | BYTE_ORDER instead of _BYTE_ORDER due to 3rd party USB software for now. Notes: svn path=/head/; revision=292865
* Create a USB_PNP_INFO and use it to export the existing PNPWarner Losh2015-12-111-16/+53
| | | | | | | | | | | | | | tables. Some drivers needed some slight re-arrangement of declarations to accommodate this. Change the USB pnp tables slightly to allow better compatibility with the system by moving linux driver info from start of each entry to the end. All other PNP tables in the system have the per-device flags and such at the end of the elements rather that at the beginning. Differential Review: https://reviews.freebsd.org/D3458 Notes: svn path=/head/; revision=292080
* Improve the realtime properties of USB transfers for embedded systemsHans Petter Selasky2015-08-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | like RPI-B and RPI-2. Description of problem: USB transfers can process data in their callbacks sometimes causing unacceptable latency for other USB transfers. Separate BULK completion callbacks from CONTROL, INTERRUPT and ISOCHRONOUS callbacks, and give BULK completion callbacks lesser execution priority than the others. This way USB audio won't be interfered by heavy USB ethernet usage for example. Further serve USB transfer completion in a round robin fashion, instead of only serving the most CPU hungry. This has been done by adding a third flag to USB transfer queue structure which keeps track of looping callbacks. The "command" callback function then decides what to do when looping. MFC after: 2 weeks Notes: svn path=/head/; revision=286773
* Resolve a deadlock setting the USB configuration index from userspaceHans Petter Selasky2014-06-081-0/+2
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=267240
* Workaround for USB MIDI adapters which use non-supported values ofHans Petter Selasky2014-03-141-0/+1
| | | | | | | | | wMaxPacketSize for BULK endpoints. MFC after: 1 week Notes: svn path=/head/; revision=263159
* USB method structures for USB controllers and USB pipes should beHans Petter Selasky2013-12-111-1/+1
| | | | | | | | constant and does not need to be modified. This also saves a small amount of RAM. Notes: svn path=/head/; revision=259218
* Make use of USB ID sections configurable.Hans Petter Selasky2013-02-011-0/+9
| | | | Notes: svn path=/head/; revision=246194
* Modify the FreeBSD USB kernel code so that it can be compiled directlyHans Petter Selasky2013-01-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=246122
* Allocate separate USB buffers for DMA'ed data, so thatHans Petter Selasky2012-12-201-2/+2
| | | | | | | | | | | | | | | | DMA data does not reside next to non DMA data. This might cause more memory to be allocated, but solves problems on platforms using manual cache synchronization. Add a convenience function to get the buffer only from a USB transfer's page cache structure. MFC after: 1 week Suggested by: imp Notes: svn path=/head/; revision=244500
* Add support for the so-called streams feature of BULK endpointsHans Petter Selasky2012-08-121-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=239214
* Fix compiler warnings, mostly signed issues,Hans Petter Selasky2012-04-021-1/+1
| | | | | | | | | when USB modules are compiled with WARNS=9. MFC after: 1 weeks Notes: svn path=/head/; revision=233774
* Refactor auto-quirk solution so that we break as few externalHans Petter Selasky2011-09-101-1/+0
| | | | | | | | | | | | drivers as possible. PR: usb/160299 Approved by: re (kib) Suggested by: rwatson MFC after: 0 days Notes: svn path=/head/; revision=225469
* This patch adds automatic detection of USB mass storage devicesHans Petter Selasky2011-09-021-0/+3
| | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=225350
* Use synchronous device destruction instead of asynchronous, so that a newHans Petter Selasky2011-08-111-1/+2
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=224777
* - Export the USB device ID format to userspace tools.Hans Petter Selasky2011-06-251-1/+7
| | | | | | | MFC after: 14 days Notes: svn path=/head/; revision=223538
* - Move all USB device ID arrays into so-called sections,Hans Petter Selasky2011-06-241-0/+12
| | | | | | | | | | | | | | | sorted according to the mode which they support: host, device or dual mode - Add generic tool to extract these data: tools/bus_autoconf Discussed with: imp Suggested by: Robert Millan <rmh@debian.org> PR: misc/157903 MFC after: 14 days Notes: svn path=/head/; revision=223486
* Improve enumeration of Low- and Full-speed devices connected through aHans Petter Selasky2011-06-061-0/+1
| | | | | | | | | | | | 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 Notes: svn path=/head/; revision=222786
* usb: change to one-pass probing of device driversAndriy Gapon2011-05-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=222051
* - Improvements to USB PF solutionHans Petter Selasky2011-04-031-0/+2
| | | | | | | | | | | | | | | | | - Add more fields for USB device and host mode - Add more information to USB PF header so that decoding can easily be done by software analyzer tools like Wireshark. - Optimise usbdump to display USB streams in text format more efficiently. - Software using USB PF must be recompiled after this commit, due to structure changes. MFC after: 7 days Approved by: thompsa (mentor) Notes: svn path=/head/; revision=220301
* - Add support for software pre-scaling of ISOCHRONOUS transfers.Hans Petter Selasky2011-02-281-0/+10
| | | | | | | | MFC after: 14 days Approved by: thompsa (mentor) Notes: svn path=/head/; revision=219100
* Add support for setting per-interface PnP information.Hans Petter Selasky2010-10-271-0/+3
| | | | | | | | Submitted by: Nick Hibma Approved by: thompsa (mentor) Notes: svn path=/head/; revision=214429
* This commit adds full support for USB 3.0 devices in host and deviceHans Petter Selasky2010-10-041-0/+1
| | | | | | | | | | | | | | | | | | | 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) Notes: svn path=/head/; revision=213435
* Add support for power mode filtering as some USB hardware does not supportAndrew Thompson2010-09-021-0/+1
| | | | | | | | | power saving. Submitted by: Hans Petter Selasky Notes: svn path=/head/; revision=212135
* Use the EVENTHANDLER system to hook into the usb device configuration andAndrew Thompson2009-12-171-0/+12
| | | | | | | | | | 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. Notes: svn path=/head/; revision=200653
* Improve High Speed slot allocation mechanism by moving the computation to theAndrew Thompson2009-11-221-1/+10
| | | | | | | | | endpoint rather than per xfer and provide functions around get/free of resources. Submitted by: Hans Petter Selasky Notes: svn path=/head/; revision=199672
* improve support for high speed isochronous endpoints which does not run 1:1,Andrew Thompson2009-11-081-0/+1
| | | | | | | | | but needs intervalling 1:2, 1:4 or 1:8 Submitted by: Hans Petter Selasky Notes: svn path=/head/; revision=199059
* Missed this file for r195963:Alfred Perlstein2009-07-301-0/+3
| | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=195968
* Sync to p4Andrew Thompson2009-06-271-0/+3
| | | | | | | | | | | | - 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) Notes: svn path=/head/; revision=195121
* Fix a typeo in the frame len function to unbreak the build, make it shorterAndrew Thompson2009-06-231-2/+2
| | | | | | | while I am here. Notes: svn path=/head/; revision=194682
* - Make struct usb_xfer opaque so that drivers can not access the internalsAndrew Thompson2009-06-231-0/+532
| | | | | | | - Reduce the number of headers needed for a usb driver, the common case is just usb.h and usbdi.h Notes: svn path=/head/; revision=194677
* Move usb to a graveyard location under sys/legacy/dev, it is intended that theAndrew Thompson2009-02-231-289/+0
| | | | | | | | | | new USB2 stack will fully replace this for 8.0. Remove kernel modules, a subsequent commit will update conf/files. Unhook usbdevs from the build. Notes: svn path=/head/; revision=188939
* Merge WIP from p4:Sam Leffler2008-12-131-1/+2
| | | | | | | | | | | | | | | | | | | | | o recognize ixp435 cpu o change memory layout for for ixp4xx to not assume memory is aliases to 0x10000000 (Cambria/ixp435 memory starts at zero) o handle 64 irqs for ixp435 o dual EHCI USB 2.0 controller integral to ixp435 o overhaul NPE code for ixp435 and better MAC+MII naming o updated NPE firmware (including NPE-A image for ixp435/ixp465) o Gateworks Cambria board support: - IDE compact flash - MCU - front panel LED on i2c bus - Octal LED latch Sanity-tested with NFS-root on Avila and Cambria boards. Requires pending boot2 mods for CF-boot on Cambria. Notes: svn path=/projects/cambria/; revision=186011
* Add a reset device command to ugen.c.Nick Hibma2008-11-131-0/+1
| | | | | | | | This is needed to make some devices work that require a firmware upload and a USB reset afterwards. Notes: svn path=/head/; revision=184941
* add support for %b printing of request + xfer flagsSam Leffler2008-03-201-0/+2
| | | | Notes: svn path=/head/; revision=177429