Commit Graph

4362 Commits

Author SHA1 Message Date
Warner Losh
7a1bef40f1 ustorage_fs_verify: eliminate write only variables file_offset and file_offset
Sponsored by:		Netflix
2022-04-04 22:30:40 -06:00
Warner Losh
f7097359c8 mgue: eliminate write only variables ret, err and error
Sponsored by:		Netflix
2022-04-04 22:30:38 -06:00
Warner Losh
11110685fc cp2112iic_intr_write_callback: eliminate write only variable psc
Sponsored by:		Netflix
2022-04-04 22:30:36 -06:00
Warner Losh
53c1f1fc60 wsp_intr_callback: eliminate write only variable h
Sponsored by:		Netflix
2022-04-04 22:30:33 -06:00
Warner Losh
12312f7583 uss820dci: eliminate unused variables sc, ep_no
Sponsored by:		Netflix
2022-04-04 22:30:31 -06:00
Warner Losh
6ccdcae1b9 uhci_xfer_setup: eliminate write only variable sc
Sponsored by:		Netflix
2022-04-04 22:30:29 -06:00
Warner Losh
ab59cd6a0b musb: eliminate write only variable sc
Sponsored by:		Netflix
2022-04-04 22:30:26 -06:00
Warner Losh
e73b02f66b atmegadci: eliminate unused variables sc, ep_no
Sponsored by:		Netflix
2022-04-04 22:30:23 -06:00
Gordon Bergling
9094c3a71b usb(3): Fix a few typos in source code comments
- s/paniced/panicked/

MFC after:	3 days
2022-04-02 10:14:32 +02:00
Hans Petter Selasky
88162f7abd ulpt(4): Add support for Epson TM-U220B.
Submitted by:		Archimedes Gaviola <archimedes.gaviola@gmail.com>
MFC after:		1 week
Sponsored by:		NVIDIA Networking
2022-04-02 02:29:05 +02:00
Greg Lehey
31e076d70b Add devices and quirks for some Olympus cameras.
Reviewed by:	hps@
Fixes:	   	Problems attaching Olympus cameras.
MFC after:	2 weeks
2022-03-23 12:40:28 +11:00
Hans Petter Selasky
6bce8a35cf usb(4): Check return value from bus_generic_get_device_path().
MFC after:		1 week
Sponsored by:		NVIDIA Networking
2022-03-17 15:27:50 +01:00
Hans Petter Selasky
5e203517e0 usb(4): Use the global BUS topology lock where appropriate.
MFC after:		1 week
Sponsored by:		NVIDIA Networking
2022-03-17 15:27:45 +01:00
Hans Petter Selasky
19837718ab xhci(4): Add quirk for "Fresco Logic FL1009 USB3.0 xHCI Controller".
Submitted by:		John F Carr <jfc@mit.edu>
MFC after:		1 week
Sponsored by:		NVIDIA Networking
2022-03-16 16:49:00 +01:00
Hans Petter Selasky
c7cd6f809d usb(4): Don't skip calling uhub_explore_sub() even on HUB port errors.
This should fix an issue where the "udev->re_enumerate_wait" field never gets
processed and reset. In this case usbconfig will wait forever and never return.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-03-08 19:59:23 +01:00
Hans Petter Selasky
a75444c143 u3g(4): Add new USB IDs.
Submitted by:	Matthew Luckie <mjl@luckie.org.nz>
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-03-08 11:03:33 +01:00
Hans Petter Selasky
33cbbf268f xhci(4): Add quirk for "TUSB73x0 USB3.0 xHCI Controller".
Tested by:	br@
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-03-03 18:14:21 +01:00
Hans Petter Selasky
fcca9fd98c usbhid(4): Be more restrictive about what requests are allowed from user-space.
MFC after:	1 month
Sponsored by:	NVIDIA Networking
2022-03-03 10:24:43 +01:00
Hans Petter Selasky
8ed5bb59e9 usb(4): Factor out the usb_check_request() function.
No functional change.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-03-03 10:24:24 +01:00
Vladimir Kondratyev
82e38b012c usbhid(4): Implement USB_REQUEST command in hid_ioctl method
This command is intended to be compatible with USB_REQUEST ioctl.
It is required to perform arbitrary control endpoint requests by device
drivers which can switch between HID and native non-HID modes.

MFC after:	2 month
2022-03-03 02:35:23 +03:00
Warner Losh
9c750429af Add USB UEFI locator support
Sponsored by:		Netflix
Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D32788
2022-03-01 08:06:42 -07:00
Warner Losh
cae7d9ec83 bus: Add ACPI locator support
Add support for printing ACPI paths. This is a bit of a degenerate case
for this interface since it's always just the device handle if the
device has one. But it is illustrtive of how to do this for a few nodes
in the tree.

Sponsored by:		Netflix
Reviewed by:		jhb
Differential Revision:	https://reviews.freebsd.org/D32748
2022-03-01 08:06:41 -07:00
Mark Johnston
ceb246c7b2 cdce: Fix a -Wunused-but-set-variable warning
MFC after:	1 week
2022-02-28 11:08:55 -05:00
Mark Johnston
f4a5d1f6c4 axe: Fix a -Wunused-but-set-variable warning
MFC after:	1 week
2022-02-28 11:07:19 -05:00
Mark Johnston
9218449b98 axge: Fix a -Wunused-but-set-variable warning
MFC after:	1 week
2022-02-28 10:54:32 -05:00
Hans Petter Selasky
7520b88860 usb(4): Automagically apply all quirks for USB mass storage devices.
Currently there are five quirks the USB stack tries to automagically detect:
- UQ_MSC_NO_PREVENT_ALLOW
- UQ_MSC_NO_SYNC_CACHE
- UQ_MSC_NO_TEST_UNIT_READY
- UQ_MSC_NO_GETMAXLUN
- UQ_MSC_NO_START_STOP

If any of the quirks above are set, no further quirks will be probed.

If any of the USB mass storage tests fail, the USB device is
re-enumerated as a last resort to clear any error states from the
device. Then the USB stack will try to probe and attach the umass<N>
device passing the detected quirks.

While at it give more details in dmesg about what is going on.

Tested by:		several
Submitted by:		Idwer Vollering <vidwer_fbsdbugs@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D30919
MFC after:		1 week
Sponsored by:		NVIDIA Networking
2022-02-24 10:28:55 +01:00
Emmanuel Vadot
fb6cebd8bd usb: Make ext_resources non-optional
EXT_RESOURCES have been introduced in 12-CURRENT and all supported
releases have it enabled in their kernel config.

MFC after:      1 month
Differential Revision:	https://reviews.freebsd.org/D33827
2022-02-21 17:28:52 +01:00
Hans Petter Selasky
e85af89fa7 Add more USB host controller PCI ID's.
Submitted by:	Gary Jennejohn <gljennjohn@gmail.com>
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-08 00:29:24 +01:00
Jung-uk Kim
379797d4b4 usb(4): Belatedly add a PCI device ID for AMD Bolton chipset 2022-02-07 13:48:09 -05:00
Hans Petter Selasky
42cf33dd1a Add new USB host controller PCI ID's.
Submitted by:	Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-06 13:18:35 +01:00
Hans Petter Selasky
a88e1a04df usb(4): Ignore port resume failures.
If port resume fails, likely the USB device is detached. Ignore such errors,
because else the USB stack might try forever trying to resume the device,
before it will proceed detaching it.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-02 13:00:48 +01:00
Alexander V. Chernikov
217481a333 u3g: Add support Quectel EM12-G modem.
Submitted by:	<tda.77793 at gmail.com>
PR:		260218
MFC after:	2 weeks
2022-01-29 09:59:20 +00:00
Andrew Turner
a3cea15680 Fix undefined behaviour in the USB controllers
The USB controller drivers assume they can cast a NULL pointer to a
struct and find the address of a member. KUBSan complains about this so
replace with the __offsetof and __containerof macros that use either a
builtin function where available, or the same NULL pointer on older
compilers without the builtin.

Reviewers: hselasky

Subscribers: imp

Reviewed by:	hselasky
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D33865
2022-01-12 13:53:19 +00:00
Hans Petter Selasky
75d20a5e38 rtwn(4): Add new USB ID.
Submitted by:	Wensi <supdrewin@outlook.com>
PR:		261098
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-01-11 21:19:53 +01:00
Hans Petter Selasky
2891a28052 rtwn(4): Add new USB ID.
Submitted by:	arved@
PR:		260952
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-01-07 14:02:30 +01:00
Hans Petter Selasky
34bedcee3c uchcom(4): Add new USB ID.
Submitted by:	darius@dons.net.au
PR:		260783
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-01-07 14:02:30 +01:00
Warner Losh
44796b7e82 mips: remove saf1761
The saf1761 OTG support was only for mips targets (BERI?). Retire it.

Sponsored by:		Netflix
Reviewed by:		brooks
Differential Revision:	https://reviews.freebsd.org/D33706
2022-01-04 16:01:14 -07:00
Hans Petter Selasky
8b60419b79 usb(4): Fix build on 32-bit platforms after 0ec590d24e.
Cast pointer to "long" for now, to match the fueword() prototype.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2021-12-18 21:31:58 +01:00
Brooks Davis
ea972feea2 usb: remove COMPAT_32BIT ifdefs
Now that we have proper 32-bit compat support, remove COMPAT_32BIT
ifdefs to allow 32-bit code to use the 64-bit layout of USB ioctl
structs and struct usb_fs_endpoint.

This includes the removal of redundant alignment directives that had
no effect in practice.

Reviewed by:	hselasky, jrtc27 (prior version)
2021-12-17 21:28:39 +00:00
Brooks Davis
0ec590d24e usb: add 32-bit compat for FIFOs
Unlike most 32-bit compatability code, this isn't just a simple thunk
in the ioctl code.  An ioctl (USB_FS_INIT) is used to install a
pointer to an array of usb_fs_endpoint structs which are then used
by the ugen fifo code.  These struct contains an array of pointers
which requires translation.  We change the interfaces around
struct usb_fs_endpoint as follows:
 - We store the size of struct usb_fs_endpoint in struct usb_fifo
   in the USB_FS_INIT handler so we know the ABI of the userspace
   array.
 - APIs to manipulate userspace struct usb_fs_endpoint objects now
   take a struct usb_fifo and an index rather than a pointer to
   the object.  This allows most code to remain oblivious to the
   different struct usb_fs_endpoint sizes.
 - Add ugen_fs_copyin() which copies the struct usb_fs_endpoint
   from userspace, thunking it to the native size if required.
 - Uses of struct usb_fs_endpoint's ppBuffer member are now
   via ugen_fs_getbuffer() which produces a native pointer.
 - Updates to userspace are now handled by ugen_fs_update().

For clarity, single, fixed-sized members now are accessed with
fueword/suword rather than copyin/copyout.

Reviewed by:	hselasky, jrtc27 (prior version)
2021-12-17 21:28:14 +00:00
Brooks Davis
45b48cbc2b usb: real freebsd32 support for most ioctls
Use thunks or alternative access methods to support ioctls without
the COMPAT_32BIT hacks that store pointers in uint64_t's on 32-bit
platforms.  This should allow a normal i386 libusb to work.

On CheriBSD, the sizes of the structs will differ between CheriABI
(the default) and freebsd64 no matter what so we need proper compat
support there.  This change paves the way.

Reviewed by:	hselasky, jrtc27 (prior version)
2021-12-17 21:28:13 +00:00
Warner Losh
c6df6f5322 Create wrapper for Giant taken for newbus
Create a wrapper for newbus to take giant and for busses to take it too.
bus_topo_lock() should be called before interacting with newbus routines
and unlocked with bus_topo_unlock(). If you need the topology lock for
some reason, bus_topo_mtx() will provide that.

Sponsored by:		Netflix
Reviewed by:		mav
Differential Revision:	https://reviews.freebsd.org/D31831
2021-12-09 17:04:45 -07:00
Mitchell Horne
e43d081f35 ucom: s/sio/ucom/
Seems like a copy-paste error, or at least this made more sense when the
sio(4) driver still existed. This modifies the debug port name displayed
at boot, but otherwise has no functional change.

Reviewed by:	hselasky
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D33278
2021-12-06 10:10:27 -04:00
Andreas Wetzel
cd6f0b4769 rtwn/usb: add product ID for Asus USB N10 Nano Rev. B1
According to information found on the internet the following products
use exactly the same hardware but probably different USB IDs:
- Edimax EW-7811Un V2 (v2)
- Edimax EW-7811GLN 2.0A (v2)
I am not adding them as I cannot verify.

PR:		254280
MFC after:	1 week
2021-12-06 09:43:26 +02:00
Gleb Smirnoff
4b4cce02ac xhci: add PCI IDs for USB controllers found on Supermicro M12SWA-TF 2021-12-02 20:12:33 -08:00
Bjoern A. Zeeb
1910048eb9 USB: add CYUSB330x to usbdevs
Add the Cypress dual USB3/2 HUB CYUSB330x as found in SolidRun's
HoneyComb to usbdevs.
2021-11-29 17:44:08 +00:00
Edward Tomasz Napierala
1cde21402a cdceem(4): Fix "set but not used" warnings
No functional changes.

Sponsored By:	EPSRC
2021-11-29 16:45:15 +00:00
Alexander Motin
cfb0e4d76c xhci: Add PCI IDs for Thunderbolt 3/4 USB controllers.
MFC after:	2 weeks
2021-11-28 21:29:26 -05:00
Alexander Motin
83d7b2f335 xhci: Add PCI IDs from recent Intel CPUs.
MFC after:	2 weeks
2021-11-26 20:35:12 -05:00
Hans Petter Selasky
0229172a65 usb/u3g: Add support for Quectel EM05.
Pull Request:	https://github.com/freebsd/freebsd-src/pull/565
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2021-11-25 15:29:47 +01:00