Up to [DragonFly] / src / sys / dev / usbmisc / umass
Request diff between arbitrary revisions
Keyword substitution: kv
Default branch: MAIN
Add missing `)'.
Fix some NULL pointer dereferences, most of the in debug code though. Found-by: LLVM/Clang Static Analyzer
Sync CAM with FreeBSD using lockmgr locks instead of mutexes. Note: This is mostly a code sync with FreeBSD which improves stability in addition to the items listed below. This provides a framework for releasing the mplock, but for now it's still there. Add an xpt_print function to reduce most of the xpt_print_path/printf pairs. Convert the core code to use it. Initial cut at Basic Domain Validation. Make cam_xpt's pronouncements match camcontrol (Tagged -> Command) Queueing. Pay attention to return value from xpt_bus_register in xpt_init. Add an xpt_rescan function and a thread that will field rescan requests. The purpose of this is to allow a SIM (or other entities) to request a bus rescan and have it then fielded in a different (process) context from the caller. Check the return value from cam_periph_acquire. Drop the periph/sim lock when calling disk_destroy(). Drop the topology lock before calling the periph oninvalidate and dtor vectors. For the XPT_SASYNC_CB operation, only decouple the broadcast to the bus and device lists instead of decoupling the whole operation. This avoids problems with SIMs going away. Split the camisr into per-SIM done queues. This optimizes the locking a little bit and allows for direct dispatch of the doneq from certain contexts that would otherwise face recursive locking problems. Zero the CCBs when mallocing them. Only schedule the xpt_finishconfig_task once. Eliminate the use of M_TEMP. Add a helper function for registering async callbacks. Release the bus reference that is acquired when doing a CAMIOCOMMAND ioctl. Zero scsi_readcapacity allocations so we can really tell if there has been data returned. Remove duplicate includes and fix typos. Add a bunch of definitions and structures to support newer drivers. When probing a newly found device, don't automatically assume that the device supports retrieving a serial number. Instead, first query the list of VPD pages it does support, and only query the serial number if it's supported, else silently move on. This eliminates a lot of noise during verbose booting, and will likely eliminate the need for most NOSERIAL quirks. Reduce diffs from FreeBSD. Obtained-from: FreeBSD
Make CAM_NEW_TRAN_CODE default. As previously mentioned, this makes a huge performance difference for one of my disks, and future work depends on this change. Obtained-from: FreeBSD
Update the list of USB device IDs for umass(4) and needed routines. Reviewed-by: hasso@ Taken-from: FreeBSD
Pay attention to the timeout value passed down by the upper layer. This fix makes USB CD/DVD writers work. Obtained-from: NetBSD via FreeBSD
Make NO_GETMAXLUN quirk really do something useful. Obtained-from: FreeBSD
When attached to a high-speed device, report a more appropriate base transfer speed to CAM. The actual value used (40MB/s) is fairly arbitrary, but assumes the same 33% overhead as was implied by the 1MB/s figure we used for USB1 devices. Obtained-from: FreeBSD
Pass all ATAPI commands through. Fixes detecting capabilities of DVD writers. Obtained-from: FreeBSD with modifications.
Fixes for CAM_NEW_TRAN_CODE. This commit is taken from a FreeBSD changeset, and is not intended to be comprehensive. Some drivers will still not compile/work with the CAM_NEW_TRAN_CODE option, but this opens the door for wider testing. Obtained-from: FreeBSD
Kill devinfo handling in drivers, set device description in one place - usbd_probe_and_attach() and let generic device code to output descriptions. Obtained-from: FreeBSD with modifications
Nuke usbdevs and references to it.
Kill usage of USB_VENDOR_FOO and USB_PRODUCT_BAR defines mostly using two methods: - USB_DEVICE(vendor_id, product_id) macro. - Using C99 structure initialisers. While at it, kill all custom "vendor and product id pair" structures and custom walkthrough methods for these structures.
Nuke USB_DECLARE_DRIVER and USB_DECLARE_DRIVER_INIT macros.
Nuke USB_MATCH*, USB_ATTACH* and USB_DETACH* macros.
Nuke SIMPLEQ_* and logprintf.
Nuke device_ptr_t, USBBASEDEVICE, USBDEVNAME(), USBDEVUNIT(), USBGETSOFTC(), USBDEVPTRNAME() and Static with help from sed(1).
Nuke the code specific to NetBSD/OpenBSD/FreeBSD at first. I doubt anyone will update these pieces and I don't intend to review macros for all platforms. There is the chance though that I might kill something which should stay in the code in form "TODO: port it to DF". So, please review and kick me.
xpt_bus_deregister() never returns 0, don't test for it. Assert that the sim is attached if a backend sim function is called, because cam_sim_free() now replaces the functions when the sim is detached.
Refuse to poll a detached sim.
Rename printf -> kprintf in sys/ and add some defines where necessary (files which are used in userland, too).
Rename sprintf -> ksprintf Rename snprintf -> knsprintf Make allowances for source files that are compiled for both userland and the kernel.
Rename malloc->kmalloc, free->kfree, and realloc->krealloc. Pass 1
Add a missing ohci_waitintr() call that allows polled operation of bulk transfers to have a chance of working. Kernel crash dumps to umass() work with this change. Submitted-by: Gary <firstname.lastname@example.org> Taken-from: FreeBSD PR:usb/93720
Plug memory leak in umass. Submitted-by: Gary <email@example.com> Taken-from: FreeBSD/NetBSD
Bring in FreeBSD rev 1.123: revision 1.123 date: 2005-07-19 07:18:23 +0200; author: delphij; state: Exp; lines: +5 -0; PLAY_MSF, PLAY_TRACK, PLAY_TRACK_REL, PAUSE, PLAY_12 commands to pass through umass(4), in order to make cdcontrol(1) to issue commands to a USB CD driver. The command IDs were obtained from the CAM subsystem. This was tested on half dozen of USB CD drivers from different vendors. Suggested by: "intron" <intron at intron dot ac> PR: usb/83439 Reviewed by: sanpei MFC After: 1 week Submitted-by: Xin Li <firstname.lastname@example.org>
Cleanup missing and duplicate defines from the last commit, rename an entry in umass to conform. Reported-by: "Alexander \"alxl\" Lobachov" <email@example.com>
When a umass storage device is unplugged there might be pending requests which either fail or wind up in limbo. The state machine will attempt to issue a BBB RESET, but since this does not occur on our bulk or interrupt pipes simply aborting the pipes is not sufficient to ensure that all of our xfer requests have been idled. We must also wait for any in-progress RESET's to complete, which is accomplished by testing sc->transfer_state. Otherwise we may wind up freeing an active xfer request and blow up.
timeout/untimeout ==> callout_*
When detaching UMASS, abort all the pipes before detaching the sim. Note sim detachment path is: umass_cam_detach_sim -> xpt_bus_deregister -> cam_sim_free. If there is anything pending as of the cam_sim_free() bad things will happen.
Do some M_WAITOK<->M_INTWAIT cleanups. Code entered from userland, such as device open and device ioctl, generally use M_WAITOK, while low level structures such as the capacity structure are allocated using M_INTWAIT.
The cam_sim structure was being deallocated unconditionally by device driver detach routines. The problem with this is that part of the CAM bus structure may still be active (for example, with pending timeout()'s), and even though the bus, target, and device is freed, since the sim IS freed any accesses through the sim will hit 0xdeadc0de. This case most often occurs with USB UMASS devices. The CAM_XPT and CAM_SIM layer has been revamped. CAM_DEV_UNCONFIGURED is now accounted for in the device->refcount, and the cam_sim structure is now ref-counted as well. Additionally, the cam_simq* code which handles the device queues has been revamped to refcount as well, so shared device queues (raid and multi-channel devices) are not free()'d before all references have gone away. scsi_low free'd its cam_sim twice. Fixed. USB was improperly using M_NOWAIT. All M_NOWAIT instances have been renamed to M_INTWAIT.
Actively manage cam rescan timeouts in the usb subsystem. This does not fix any known issues but it should make things a bit more robust.
Add defined(__FreeBSD__) and defined(__DragonFly__) where appropiriate.
Bring in the entire FreeBSD-5 USB infrastructure. As of this commit my USB camera, Hard Drive, Mouse, and Sony memory key all work and I can even unplug and replug them in without crashing the port. Not all drivers and subsystems compile as of this commit, but the ones that do not are very close.
Synchronize the USB, CAM, and TASKQUEUE subsystems with FreeBSD RELENG_4. Also update the $FreeBSD$ ids in the files to the synchronized rev numbers. This has the side effect of bringing in some additional SCSI robustness checks, bug fixes, quirk inheritance between subsystems (e.g. USB now sets PIM_NO_6_BYTE by default and CAM now understands it). This also brings in a huge amount of SCSI CD code that had been MFCd to FreeBSD-4 from FreeBSD-5.
Misc cleanups to take care of GCC3.x warnings. Missing 'U' and 'LL' postfixes on large unsigned or 64 bit constants, non-storage structural declarations embedded in structures, deprecated use of __FUNCTION__, missing 'break' statements in the last switch case, goto label ops where the label occurs just before an end-brace (many of which appear to be fixable with 'break' or 'continue' instead and existed simply due to programmer-paranoia), garbage data in #endif lines that was not commented out. GCC3 also caught some argument count issues in kernel printfs. Many of these (obvious) fixes are similar to or copied from 5.x. Also fix a few other minor issues such as certain drivers declaring a proc pointer instead of a thread pointer. Move -ffreestanding from CWARNFLAGS to CFLAGS. It doesn't belong in CWARNFLAGS.
kernel tree reorganization stage 1: Major cvs repository work (not logged as commits) plus a major reworking of the #include's to accomodate the relocations. * CVS repository files manually moved. Old directories left intact and empty (temporary). * Reorganize all filesystems into vfs/, most devices into dev/, sub-divide devices by function. * Begin to move device-specific architecture files to the device subdirs rather then throwing them all into, e.g. i386/include * Reorganize files related to system busses, placing the related code in a new bus/ directory. Also move cam to bus/cam though this may not have been the best idea in retrospect. * Reorganize emulation code and place it in a new emulation/ directory. * Remove the -I- compiler option in order to allow #include file localization, rename all config generated X.h files to use_X.h to clean up the conflicts. * Remove /usr/src/include (or /usr/include) dependancies during the kernel build, beyond what is normally needed to compile helper programs. * Make config create 'machine' softlinks for architecture specific directories outside of the standard <arch>/include. * Bump the config rev. WARNING! after this commit /usr/include and /usr/src/sys/compile/* should be regenerated from scratch.
Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most ids have been removed from !lint sections and moved into comment sections.
import from FreeBSD RELENG_4 184.108.40.206