| #
b4daeded
|
| 26-Jan-2026 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
usb: umass: add SCSIEJECT quirk and fix RTW8821CU_CD (USB mode switch)
Several Realtek (and lots other) USB dongles present themselves as CDROM device first. Upon eject they do a mode switch and su
usb: umass: add SCSIEJECT quirk and fix RTW8821CU_CD (USB mode switch)
Several Realtek (and lots other) USB dongles present themselves as CDROM device first. Upon eject they do a mode switch and suddenly are a different kind of device (sometimes even with different IDs), e.g., a wireless dongle.
In order to avoid the CDROM stage and rather than adding the quirk handling to more drivers, add support to umass and if enabled automatically eject the "CDROM" to make it the real device.
Longer-term some other drivers could stop using their hand-rolled support for this. It is unclear as-to how much we need the list of (eject) quirks from u3g here, or if these are very specific to that kind of devices.
Sponsored by: The FreeBSD Foundation Fixes: b3b6a959c85a, 9c0cce328363 Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D54901
show more ...
|
| #
ec3cc37b
|
| 07-May-2025 |
Warner Losh <imp@FreeBSD.org> |
umass: Bring in small fix from NetBSD's umass
When completing a request for UFI, don't fail the request on non-zero asc/ascq values if we've done a request sense.
This idea is from umass.c 1.100 by
umass: Bring in small fix from NetBSD's umass
When completing a request for UFI, don't fail the request on non-zero asc/ascq values if we've done a request sense.
This idea is from umass.c 1.100 by mycroft. He used it to help elminate the INQUIRY_SHORT quirk that we still have. However, it will make little difference because we treat both return values the same for CBI. And it appears we have (maybe bogusly) some devices that specify this quirk that aren't CBI.
Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49475
show more ...
|
| #
ff77f1ca
|
| 07-May-2025 |
Warner Losh <imp@FreeBSD.org> |
umass: Fix a direct call to sc_transform
Call umass_std_transform instead of following the sc_transform member to get the standard transforms now that has moved to umass_std_transform. Pass NULL as
umass: Fix a direct call to sc_transform
Call umass_std_transform instead of following the sc_transform member to get the standard transforms now that has moved to umass_std_transform. Pass NULL as the CCB so that we don't stomp on the status that was just set (and allow that in std_transform).
Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49474
show more ...
|
| #
43030e34
|
| 07-May-2025 |
Warner Losh <imp@FreeBSD.org> |
umass: Be more consistent about how we fail bad commands
Elsewhere, if we fail a command, we use SCSI code ILLEGAL REQUEST/24/00, but here we were using the CAM code for illegal request.
Sponsored
umass: Be more consistent about how we fail bad commands
Elsewhere, if we fail a command, we use SCSI code ILLEGAL REQUEST/24/00, but here we were using the CAM code for illegal request.
Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49473
show more ...
|
| #
86de66a6
|
| 07-May-2025 |
Warner Losh <imp@FreeBSD.org> |
umass: Move INQUIRY and TEST UNIT READY quirks to umass_std_transform
Only doing a short inquiry and converting TUR to START STOP UNIT are the same everywhere, so move those quirks to umass_std_tran
umass: Move INQUIRY and TEST UNIT READY quirks to umass_std_transform
Only doing a short inquiry and converting TUR to START STOP UNIT are the same everywhere, so move those quirks to umass_std_transform.
Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49472
show more ...
|
| #
b8e77c8b
|
| 07-May-2025 |
Warner Losh <imp@FreeBSD.org> |
umass: Move common code into umass_std_transform
Move the length checks, and byte copying into umass_std_transform. The copies are typically small and this simplifies the code a lot. Move zeroing th
umass: Move common code into umass_std_transform
Move the length checks, and byte copying into umass_std_transform. The copies are typically small and this simplifies the code a lot. Move zeroing the buffer now to only when we change TEST UNIT READY to START STOP.
Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49471
show more ...
|
| #
bff8730c
|
| 07-May-2025 |
Warner Losh <imp@FreeBSD.org> |
umass: make *_transform() return a bool
These are now boolean, so make them return a boolean.
Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49470
|
| #
49633d5d
|
| 07-May-2025 |
Warner Losh <imp@FreeBSD.org> |
umass: Simplify umass_std_transform to eliminate fake success
Now that nothing returns (2) to fake the success of the command, eliminate that magic number by eliminating the case.
Sponsored by: Ne
umass: Simplify umass_std_transform to eliminate fake success
Now that nothing returns (2) to fake the success of the command, eliminate that magic number by eliminating the case.
Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49469
show more ...
|
| #
a945c21a
|
| 07-May-2025 |
Warner Losh <imp@FreeBSD.org> |
umass: Fail SYNCHRONIZE_CACHE for UFI
Just go ahead and fail SYNCHRONIZE_CACHE commands for UFI. This standard doesn't have a cache to flush, and the upper layers (aka da) will notice sync cache fai
umass: Fail SYNCHRONIZE_CACHE for UFI
Just go ahead and fail SYNCHRONIZE_CACHE commands for UFI. This standard doesn't have a cache to flush, and the upper layers (aka da) will notice sync cache failed and won't send it again.
Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49468
show more ...
|
| #
db860eb3
|
| 07-May-2025 |
Warner Losh <imp@FreeBSD.org> |
umass: Document the ideal that it's better to fail bad commands
Generally, lying to the periph drivers about commands working is a bad idea. They cannot get a global insight into the actual capaciti
umass: Document the ideal that it's better to fail bad commands
Generally, lying to the periph drivers about commands working is a bad idea. They cannot get a global insight into the actual capacities of the device when commands just work. There's good reason to intercept bad commands at times, and to prevent the device from being exposed to commands that, for example, hand the device. However, upper layer periph drivers is the better place to cope with devices that don't support the commands since it can make other inferences about the device when it has wider knowledge.
But this represents a change in philosphy, so document that as well. This shift happened for some commands a while ago. Many of the quirks existed only to avoid whining errors on boot that were benign and were a big burden. So da and cd slowly stopped the whining. Except in cases where the command hangs the drive, we should limit new quirks and avoid overly broad quirks (things work, but are less performant or reliable, again mostly to avoid harmless errors that are no longer printed).
Other sims will likely need some help with this.
Differential Revision: https://reviews.freebsd.org/D49467 Sponsored by: Netflix
show more ...
|
| #
966c6be6
|
| 07-May-2025 |
Warner Losh <imp@FreeBSD.org> |
umass: fail synchronize_cache
When we know the umass device doesn't support synchronize cache (either probed or hard quirk), fail the command w/o sending it to the device. The da driver is the only
umass: fail synchronize_cache
When we know the umass device doesn't support synchronize cache (either probed or hard quirk), fail the command w/o sending it to the device. The da driver is the only driver that sends this command, and since this filter was written has grown the ability to catch the failure and never send the command again.
In an ideal world, we'd let the da driver work this out. However, there's a lot of devices that hang when this command is sent in a way that's impossible to detect other than a black list. There's also a number that require a hard USB endpoint reset to recover, which the autoquirk code takes care of. So umass has to act as a filter.
By failing this command, we're able to avoid upper level BIO_FLUSH commands by tagging the underlying disk as not supporting that.
Differential Revision: https://reviews.freebsd.org/D49466 Sponsored by: Netflix
show more ...
|
| #
668cef02
|
| 07-May-2025 |
Warner Losh <imp@FreeBSD.org> |
umass: Move illegal opcode return to a function
Move illegal opcode completion of ccb to its own function. da can cope with a number of different failures now (it didn't used to), so we should retur
umass: Move illegal opcode return to a function
Move illegal opcode completion of ccb to its own function. da can cope with a number of different failures now (it didn't used to), so we should return the unnsupported commands as illegal rather than faking completion. This will allow da to, in the future, do more intelligent things in response to these quirks. Other SIMs will need to do this too.
Differential Revision: https://reviews.freebsd.org/D49465 Sponsored by: Netflix
show more ...
|
| #
048d6ca3
|
| 10-Mar-2025 |
Warner Losh <imp@FreeBSD.org> |
umass: Remove some 20-year-old dead code
A REQUEST SENSE CDB was just copied into the cmd buffer, so testing for INQUIRY will always fail. Remove the dead code.
This code was added, apparently by
umass: Remove some 20-year-old dead code
A REQUEST SENSE CDB was just copied into the cmd buffer, so testing for INQUIRY will always fail. Remove the dead code.
This code was added, apparently by mistake in 2003. 8541fbec7900e merged changes from NetBSD's umass_scsipi.c 1.8 to address some BBB bulk-in clear problems. NetBSD had fixed a problem in the FORCE_SHORT_INQUIRY quirk code they had ported from FreeBSD that FreeBSD also needed. That merge also included the dead code, which was not in NetBSD.
Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D49311
show more ...
|
| #
ca48e43b
|
| 04-Mar-2025 |
Warner Losh <imp@FreeBSD.org> |
usb: Kill left-over cdefs.h includes
These includes were for __FBSD_RCSID() macro. They weren't formatted like the rest of the tree so weren't trimmed automatically when that script was run. Trim th
usb: Kill left-over cdefs.h includes
These includes were for __FBSD_RCSID() macro. They weren't formatted like the rest of the tree so weren't trimmed automatically when that script was run. Trim them now.
MFC After: 1 week Sponsored by: Netflix
show more ...
|
| #
fdaf7d0f
|
| 03-Feb-2025 |
Warner Losh <imp@FreeBSD.org> |
umass: Print quirks with %b
Print the quirks in a more human-readable form. When testing a dozen different removeable devices, the hex numbers quickly blur...
Sponsored by: Netflix
|
| #
c64b3f32
|
| 28-Jan-2025 |
Warner Losh <imp@FreeBSD.org> |
umass: Add comment for ASC/ASCQ 24h/00h INVALID FIELD IN CDB
Add a comment for what this asc/ascq combo means. Very few people have this memorized.
Sponsored by: Netflix
|
| #
685dc743
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
| #
95ee2897
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
|
| #
4d846d26
|
| 10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
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
show more ...
|
| #
bc9372d7
|
| 06-May-2022 |
John Baldwin <jhb@FreeBSD.org> |
usb: Remove unused devclass arguments to DRIVER_MODULE.
|
| #
7520b888
|
| 21-Feb-2022 |
Hans Petter Selasky <hselasky@FreeBSD.org> |
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 - U
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
show more ...
|
| #
30f8afd0
|
| 28-Jun-2021 |
Warner Losh <imp@FreeBSD.org> |
cam: fix xpt_bus_register and xpt_bus_deregister return errno
xpt_bus_register and xpt_bus_deregister returns a hybrid error that's neither a cam_status, nor an errno, but a mix of both. Update xpt
cam: fix xpt_bus_register and xpt_bus_deregister return errno
xpt_bus_register and xpt_bus_deregister returns a hybrid error that's neither a cam_status, nor an errno, but a mix of both. Update xpt_bus_register and xpt_bus_deregister to return an errno. The vast majority of current users compare against zero, which can also be spelled CAM_SUCCESS. Nobody uses CAM_FAILURE, so remove that symbol to prevent comfusion (nothing returns it either).
Where the return value is saved, ensure that the variable 'error' is used to store an errno and 'status' is used to store a cam_status where it makes the code clearer (usually just in functions that already mix and match). Where the return value isn't used at all, avoid storing it at all.
Reviewed by: scottl@, mav@ (earlier version) Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30860
show more ...
|
| #
cc384c67
|
| 03-Jun-2021 |
Warner Losh <imp@FreeBSD.org> |
cam: prefer cam_sim_softc() over accessing cam_sim structure directly.
Use the accessor function to get the softc for this sim. This also drops an unneeded cast.
Sponsored by: Netflix Reviewed by:
cam: prefer cam_sim_softc() over accessing cam_sim structure directly.
Use the accessor function to get the softc for this sim. This also drops an unneeded cast.
Sponsored by: Netflix Reviewed by: mav@, hselasky@ Differential Revision: https://reviews.freebsd.org/D30360
show more ...
|
| #
9d2d0446
|
| 01-Dec-2020 |
Bjoern A. Zeeb <bz@FreeBSD.org> |
USB umass: add quirk to not probe
Some USB WLAN devices have "on-board" storage showing up as umass and making the root mount wait for a very long time. The WLAN drivers know how to deal with that a
USB umass: add quirk to not probe
Some USB WLAN devices have "on-board" storage showing up as umass and making the root mount wait for a very long time. The WLAN drivers know how to deal with that an issue an eject command later when attaching themselves. Introduce a quirk to not probe these devices as umass and avoid hangs and confusion altogether.
Reviewed by: hselasky, imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27434
show more ...
|
| #
cd853791
|
| 28-Nov-2020 |
Konstantin Belousov <kib@FreeBSD.org> |
Make MAXPHYS tunable. Bump MAXPHYS to 1M.
Replace MAXPHYS by runtime variable maxphys. It is initialized from MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys.
Make b_pag
Make MAXPHYS tunable. Bump MAXPHYS to 1M.
Replace MAXPHYS by runtime variable maxphys. It is initialized from MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys.
Make b_pages[] array in struct buf flexible. Size b_pages[] for buffer cache buffers exactly to atop(maxbcachebuf) (currently it is sized to atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1. The +1 for pbufs allow several pbuf consumers, among them vmapbuf(), to use unaligned buffers still sized to maxphys, esp. when such buffers come from userspace (*). Overall, we save significant amount of otherwise wasted memory in b_pages[] for buffer cache buffers, while bumping MAXPHYS to desired high value.
Eliminate all direct uses of the MAXPHYS constant in kernel and driver sources, except a place which initialize maxphys. Some random (and arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted straight. Some drivers, which use MAXPHYS to size embeded structures, get private MAXPHYS-like constant; their convertion is out of scope for this work.
Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs, dev/siis, where either submitted by, or based on changes by mav.
Suggested by: mav (*) Reviewed by: imp, mav, imp, mckusick, scottl (intermediate versions) Tested by: pho Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D27225
show more ...
|