summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/usbdivar.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Instead of passing the flags as part of a struct that's supposed to bepatrick2020-03-211-2/+1
| | | | | | | filled by the callee, change the usb_allocmem() API to take another argument for the flags. ok mpi@
* Switch USB to use non-coherent buffers for data transfers. Sincepatrick2020-03-191-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the import in '99 all buffers allocated using usb_allocmem() have been mapped COHERENT. On some ARM SoCs, where the USB controller is not coherent with the caches, this means the buffers were mapped uncached. This drastically reduces the performance, especially on reads. We already added cache syncs before and after USB transfers, but so far those have essentially been no-ops. Since other drivers make use of the same allocation code, and those haven't been proven to have correct syncs, we can't just remove the COHERENT flag. This splits the allocation into coherent and non-coherent blocks. All drivers who call usb_allocmem() themselves now pass a flag to show they require coherent blocks. Onced verified that they also work fine without coherent, or once they have been refactored, we can remove this again. On a ure(4) connected to an i.MX8MQ, the receive performance is 10x as fast as before. The Raspberry Pi's ethernet receive speed doubled. Debugged using dt(4) Original diff from Marius Strobl Feedback from kettenis@ Tested on an i.MX8MQ (arm64) by patrick@ Tested on a Raspberry Pi (arm64) by tobhe@ Tested on an ERL (octeon) by Janne Johansson ok mpi@ gerhard@ tobhe@
* Free sizes for the subdevs array.mpi2018-11-271-1/+2
| | | | ok anton@, visa@
* Revert free sizes for `subdevs' array, it is incorrect.mpi2018-11-201-2/+1
| | | | Reported by anton@ and Natasha Kerensikova
* free(9) size for USB subdevs array.mpi2018-11-171-1/+2
| | | | ok ratchov@, visa@
* free(9) sizes for endpoints array.mpi2018-11-101-2/+3
| | | | ok okan@, tedu@, visa@
* Simplify/refactor the way vendor/product/serial informations arelandry2018-05-011-3/+1
| | | | | | | | | | | | | | | | | | gathered from usb devices. Cache them early in usbd_new_device() instead of querying the device several times (the content wont change anyway) and uselessly generating usb traffic (which could conflict with other access..) The heuristic stays the same, first look in the device descriptor, then try to match against usb_known_vendors/usb_known_products, then fallback to use the idVendor/idProduct codes. Remove the now useless 'usedev' parameter from usbd_fill_deviceinfo(). Tested from bsd & bsd.rd. suggested by and ok mpi@
* Fill the 'card' member of v4l2_capability struct with the usb productlandry2018-04-241-1/+3
| | | | | | | | name coming from usbd_devinfo_vp() instead of the dummy "Generic USB video class device" string, makes it easier to differentiate multiple webcams in firefox's webrtc permission dialog. ok/help mpi@
* Add support for dumping USB transfers via bpf(4) using USBPcap headers.mpi2018-02-031-1/+14
| | | | ok deraadt@, dlg@
* A pile of sizes to free(9). In test for a few days in snapshots.deraadt2017-04-081-1/+2
| | | | | Errors will result in nice clean panic messages so we know what's wrong. Reviewed by dhill visa natano jsg.
* Get rid of usbd_get_device_strings() because we use it only once.mpi2016-05-231-2/+1
| | | | | | Return a char * rather using a void function for usbd_get_device_string() ok patrick@
* Cache vendor, product and serial info for each usb device. This allowspatrick2016-05-181-1/+6
| | | | | | | | | | | ioctl(USB_DEVICEINFO) not to issue any further requests to gather information. Thus reducing stress on connected usb devices. This fixes an issue where usbdevs called in a loop causes a USB mass storage device to halt operation. Adapted from a similar commit in NetBSD. ok mpi@
* Always clear a port reset feature after setting it, or at least try to.mpi2014-12-211-2/+2
| | | | | | Otherwise we might leave a port in an unwanted state. Found while investigating timeout issues on xhci(4).
* When a bus is explored, do not probe the ports which status hasn'tmpi2014-11-111-2/+2
| | | | | | | | changed. This saves a lot of I/O when attaching/detaching devices and might help with some timing related problems. Has been in snap for ten days, committing now so that people testing xhci(4) test the same thing w/ snapshots and their own kernel.
* Add some fields needed for TT support.mpi2014-11-101-4/+5
|
* Remove USB locators. They are currently unused and this wont change duempi2014-11-101-34/+3
| | | | to the way USB buses are discovered.
* Remove the port status argument from usbd_reset_port(). We don't dompi2014-11-011-5/+3
| | | | | anything with it and it simplifies this mess in order to implement warm reset.
* Use understandable messages when the per-xfer poison value is incorrect.mpi2014-10-311-4/+2
| | | | Prodded by a comment from stsp@.
* XFER_FREE is not used, ciao.mpi2014-10-301-2/+1
|
* Do not store the whole USB hub descriptor in the "struct usbd_hub"mpi2014-08-091-2/+3
| | | | to help integrating super speed hubs that use a different descriptor.
* autoconf(9) is your friend and it knows you more than you think. Itmpi2014-07-091-2/+2
| | | | | | | | | even knows your children! So let him handle the seperation correctly. Do not rewrite your own custom config_detach_children(9) and as a bonus start removing the usbd_port tentacles from the stack. ok pirofti@, yuo@, miod@, deraadt@
* Adds an optional bus function to set the address of a new device andmpi2014-07-091-1/+3
| | | | | | | | | explicitly set it when required. Right now xhci(4) does not need such function because it assigns addresses when the first pipe of a device is opened. ok yuo@, pirofti@
* Apart from the early exploration done to find a console keyboard duringmpi2014-05-281-1/+2
| | | | | | | | | | | the boot process, USB devices must be attached or detached from the usb task thread in order to avoid races with periodical explorations issued by uhub(4) interrupts. Respect this rule when detaching root hubs during a suspend/resume cycle and avoid some hangs due to the aforementioned race. Tested by Mattieu Baptiste, thanks!
* It's been a quarter century: we can assume volatile is present with that name.guenther2014-03-291-2/+2
| | | | ok dlg@ mpi@ deraadt@
* Have some style.pirofti2014-03-141-28/+28
| | | | Okay mpi@
* Add defines for upcoming USB 3.0 support.mpi2014-03-081-2/+3
|
* Turn usbd_xfer_isread() into a public function so that we can usempi2014-03-061-1/+10
| | | | | it in various drivers, mainly HC, instead of always rerolling our own.
* Add include guards.mpi2014-03-061-1/+6
|
* Move the abort_task storage to the generic USB xfer structure insteadmpi2013-11-011-1/+2
| | | | of defining it in every controller specific structure.
* Make uhub_explore() return an int rather than a usbd_satus. This hasmpi2013-10-191-2/+2
| | | | | | | no direct impact since its return value is never checked but it allows me to get rid of one (usless) status value. Note that usbd_status should be used for USB transfers.
* Remove bogus and useless refcounting of usbd pipes that could lead tompi2013-08-131-2/+1
| | | | | | | memory leaks and abort the pipe if requests are still pending because most of our drivers don't do anything if usbd_close_pipe() fails. ok miod@
* These functions should only used in the usb-autoconf glue, do not exposempi2013-08-081-3/+1
| | | | them.
* Give back to usb(4) what is usb(4)'s. In other words use the usb_* prefixmpi2013-04-261-6/+1
| | | | | | | for functions related to the usb(4) driver and keep usbd_* for generic USB layer functions. ok mglocker@
* Remove allocm() and freem() from the USB bus interface now that theympi2013-04-191-4/+1
| | | | | | are only used as wrappers around usb_{alloc,free}mem(). ok deraadt@, mglocker@
* Get rid of various 'typedef struct' definitions and use plain structuremglocker2013-04-151-30/+30
| | | | | | | | | definitions instead. We don't change usb.h for now to stay compatible with userland. Tested by mpi@ on macppc and myself on i386. ok mpi@
* proc.h is way too much header for usb to handle.tedu2013-03-281-1/+3
|
* No need for two similar functions to free/remove USB device descriptors.mpi2013-03-161-3/+2
|
* Don't use a pointer to an opaque softc, we'll need to access its unitmpi2012-05-151-6/+2
| | | | | | number. No functional change. ok miod@
* Remove usb_event_cookie_t type and instances of it found in various structs;miod2012-01-081-2/+1
| | | | leftover from the "usb event" stuff removal. Diff from Tobias Ulmer.
* * instead of NULLing pointers to interface descriptors in the uaa, markjakemsr2011-01-161-1/+3
| | | | | | | | | | | | | interfaces as being claimed in the usbd_device's copy of the interface descriptors * allow ugen(4) to be attached if there are unused interfaces in a configuration that has had drivers attached * make ugen(4) aware that it may be sharing a device with (an)other driver(s), and if so: * do not let ugen(4) change the configuration * do not let ugen(4) access the already claimed interfaces discussed with deraadt and miod
* * add a process reference counting variable to struct usbd_devicejakemsr2010-12-301-2/+3
| | | | | | * add functions to increment and decrement the reference count, and a function to wait until the reference count is zero ok martynas@
* * add dying flag to struct usbd_devicejakemsr2010-12-061-1/+2
| | | | | | | | | * add usbd_deactivate(), which should be use to set the dying flag in struct usbd_device * add usbd_is_dying(), which can be used to check if either the device or the associated bus dying flag has been set * use usbd_is_dying() to check if the deivce or bus is dying before issuing transfers or requests
* add a 'dying' flag to struct usbd_bus. use this to signify the busjakemsr2010-09-231-1/+2
| | | | | | | | | is dying, instead of setting a flag in struct usb_softc. as usbd_device_handle has a pointer to the usbd_bus it's attached to, usb devices, and functions they run or functions run on their behalf, can now easily check if their bus is dying. use this to stop usbd_do_request* from running and the usb task thread from adding new tasks when a device's bus is dying.
* instead of running usb_explore() from individual kthreads for eachjakemsr2010-09-231-3/+6
| | | | | | | USB bus, make usb_explore() a usb_task. reduces races during normal USB device detach, since now usb_tasks and detach happen in the same process. ok yuo@, matthew@ helped with the task thread loop
* Avoid using the trick of malloc'ing more than a struct to grow the arrayderaadt2009-11-121-2/+2
| | | | | | | | of the last element. Bad technique. Use a pointer to the array. The author (or later people) will often not pay attention to the consequences of structure padding & alignment issues when they add new fields to the base structure, and there will be fireworks. tested by jasper, too
* Get rid of __HAVE_GENERIC_SOFT_INTERRUPTS now that all our platforms support it.kettenis2009-11-041-4/+1
| | | | ok jsing@, miod@
* Reinstate SPLUSBCHECK checks (DIAGNOSTIC-only), but implemented as splassert(),miod2009-08-301-15/+1
| | | | | | | which is exactly what it was trying to do. Tested on all *hci controllers with a bunch of usb devices by at least ckuethe@ and I.
* add usb2.0 to usb1.1(ohci/uchi) handover request to usb subsystem.yuo2008-06-291-1/+3
| | | | | | | | | | | add new quirk entry for uvideo which is required isoc transfer. Some usb2.0 devices use isochronous transfer but current usb subsystem does not support isoc transfer in ehci(usb2.0) bus. This patch introduce new psuedo usb hub request UHF_PORT_DISOWN_TO_1_1 to handover the device to ehci to usb1.1 bus(ohci or uhci). ok mglocker@ deraadt@ fgsch@
* First pass at removing clauses 3 and 4 from NetBSD licenses.ray2008-06-261-8/+1
| | | | | | | | | Not sure what's more surprising: how long it took for NetBSD to catch up to the rest of the BSDs (including UCB), or the amount of code that NetBSD has claimed for itself without attributing to the actual authors. OK deraadt@
* Replace the USB_USE_SOFTINTR macro with __HAVE_GENERIC_SOFT_INTTERUPTSmbalmer2007-06-151-5/+1
| | | | | | | | (which was used to define USB_USE_SOFTINTR). No binary changes. ok dlg, mk.