21 Dec, 2020

1 commit

  • commit 8010622c86ca5bb44bc98492f5968726fc7c7a21 upstream.

    UAS does not share the pessimistic assumption storage is making that
    devices cannot deal with WRITE_SAME. A few devices supported by UAS,
    are reported to not deal well with WRITE_SAME. Those need a quirk.

    Add it to the device that needs it.

    Reported-by: David C. Partridge
    Signed-off-by: Oliver Neukum
    Cc: stable
    Link: https://lore.kernel.org/r/20201209152639.9195-1-oneukum@suse.com
    Signed-off-by: Greg Kroah-Hartman

    Oliver Neukum
     

19 Feb, 2020

1 commit

  • Make structs const to reduce data size ~20KB.

    Change function arguments and prototypes as necessary to compile.

    $ size (x86-64 defconfig pre)
    text data bss dec hex filename
    12281 10948 480 23709 5c9d ./drivers/usb/storage/usb.o
    111 10528 8 10647 2997 ./drivers/usb/storage/usual-tables.o

    $ size (x86-64 defconfig post)
    text data bss dec hex filename
    22809 420 480 23709 5c9d drivers/usb/storage/usb.o
    10551 0 0 10551 2937 drivers/usb/storage/usual-tables.o

    Signed-off-by: Joe Perches
    Acked-by: Alan Stern
    Link: https://lore.kernel.org/r/cf13bd2d790ae3afbf5da55ea7bed12e00c5119d.camel@perches.com
    Signed-off-by: Greg Kroah-Hartman

    Joe Perches
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

13 Sep, 2016

1 commit

  • Some SATA to USB bridges fail to cooperate with some
    drives resulting in no cache being present being reported
    to the host. That causes the host to skip sending
    a command to synchronize caches. That causes data loss
    when the drive is powered down.

    Signed-off-by: Oliver Neukum
    Reviewed-by: Martin K. Petersen
    Acked-by: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Oliver Neukum
     

14 Apr, 2016

1 commit

  • Add a new NO_REPORT_LUNS quirk and set it for Seagate drives with
    an usb-id of: 0bc2:331a, as these will fail to respond to a
    REPORT_LUNS command.

    Cc: stable@vger.kernel.org
    Reported-and-tested-by: David Webb
    Signed-off-by: Hans de Goede
    Acked-by: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     

28 Apr, 2015

1 commit

  • The usb-storage driver sets max_sectors = 240 in its scsi-host template,
    for uas we do not want to do that for all devices, but testing has shown
    that some devices need it.

    This commit adds a US_FL_MAX_SECTORS_240 flag for such devices, and
    implements support for it in uas.c, while at it it also adds support
    for US_FL_MAX_SECTORS_64 to uas.c.

    Cc: stable@vger.kernel.org # 3.16
    Signed-off-by: Hans de Goede
    Acked-by: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     

24 Sep, 2014

2 commits

  • Besides the ASM1051 (*) needing sdev->no_report_opcodes = 1, it turns out that
    the JMicron JMS567 also needs it to work properly with uas (usb-storage always
    sets it). Since some of the scsi devs were not to keen on the idea to
    outrightly set sdev->no_report_opcodes = 1 for all uas devices, so add a quirk
    for this, and set it for the JMS567.

    *) Which has become a non-issue since we've completely blacklisted uas on
    the ASM1051 for other reasons

    Cc: stable@vger.kernel.org
    Reported-and-tested-by: Claudio Bizzarri
    Signed-off-by: Hans de Goede
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     
  • And set this quirk for the Seagate Expansion Desk (0bc2:2312), as that one
    seems to hang upon receiving an ATA_12 or ATA_16 command.

    https://bugzilla.kernel.org/show_bug.cgi?id=79511
    https://bbs.archlinux.org/viewtopic.php?id=183190

    While at it also add missing documentation for the u value for usb-storage
    quirks.

    Cc: stable@vger.kernel.org # 3.16, 3.17
    Signed-off-by: Hans de Goede

    --
    Changes in v2: Add documentation for new t and u usb-storage.quirks flags
    Changes in v3: Fix typo in documentation
    Changes in v4: Also apply the quirk to (0bc2:3312)
    Changes in v5: Rebased on 3.17-rc5, drop u documentation, already upstream
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     

01 Jul, 2014

1 commit

  • Some buggy JMicron USB-ATA bridges don't know how to translate the FUA
    bit in READs or WRITEs. This patch adds an entry in unusual_devs.h
    and a blacklist flag to tell the sd driver not to use FUA.

    Signed-off-by: Alan Stern
    Reported-by: Michael Büsch
    Tested-by: Michael Büsch
    Acked-by: James Bottomley
    CC: Matthew Dharm
    CC:
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     

05 Mar, 2014

1 commit


17 Oct, 2013

1 commit

  • Some USB drive enclosures do not correctly report an
    overflow condition if they hold a drive with a capacity
    over 2TB and are confronted with a READ_CAPACITY_10.
    They answer with their capacity modulo 2TB.
    The generic layer cannot cope with that. It must be told
    to use READ_CAPACITY_16 from the beginning.

    Signed-off-by: Oliver Neukum
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Oliver Neukum
     

06 Sep, 2012

1 commit

  • The "Low Performance USB Block driver" has been removed which a user of
    libusual. Now we have only the usb-storage driver as the only driver in
    tree. This makes libusual needless.
    This patch removes libusal, fixes up all users. The usual-table is now
    linked into usb-storage.
    usb_usual.h remains in public include directory because some staging
    users seem to need it.

    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Greg Kroah-Hartman

    Sebastian Andrzej Siewior
     

20 Jul, 2012

1 commit


08 Jun, 2011

1 commit

  • Some USB mass-storage devices have bugs that cause them not to handle
    the first READ(10) command they receive correctly. The Corsair
    Padlock v2 returns completely bogus data for its first read (possibly
    it returns the data in encrypted form even though the device is
    supposed to be unlocked). The Feiya SD/SDHC card reader fails to
    complete the first READ(10) command after it is plugged in or after a
    new card is inserted, returning a status code that indicates it thinks
    the command was invalid, which prevents the kernel from retrying the
    read.

    Since the first read of a new device or a new medium is for the
    partition sector, the kernel is unable to retrieve the device's
    partition table. Users have to manually issue an "hdparm -z" or
    "blockdev --rereadpt" command before they can access the device.

    This patch (as1470) works around the problem. It adds a new quirk
    flag, US_FL_INVALID_READ10, indicating that the first READ(10) should
    always be retried immediately, as should any failing READ(10) commands
    (provided the preceding READ(10) command succeeded, to avoid getting
    stuck in a loop). The patch also adds appropriate unusual_devs
    entries containing the new flag.

    Signed-off-by: Alan Stern
    Tested-by: Sven Geggus
    Tested-by: Paul Hartman
    CC: Matthew Dharm
    CC:
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     

23 Oct, 2010

4 commits

  • Some Rockbox based mp4 players will crash when ever they see a
    read_capacity_16 scsi command. So add a new US_FL which tells the scsi sd
    driver to not issue any read_capacity_16 scsi commands.

    Signed-off-by: Hans de Goede
    Cc: James Bottomley
    Cc: Alan Stern
    Cc: Matthew Dharm
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     
  • Appotech ax3003 (the larger brother of the ax203) based devices are even
    more buggy then the ax203. They will go of into lala land when ever they
    see a READ_DISC_INFO scsi command. So add a new US_FL which tells the
    scsi sr driver to not issue any READ_DISC_INFO scsi commands.

    [akpm@linux-foundation.org: fix build]
    Signed-off-by: Hans de Goede
    Cc: James Bottomley
    Cc: Alan Stern
    Cc: Matthew Dharm
    Signed-off-by: Andrew Morton
    Signed-off-by: Greg Kroah-Hartman

    Hans de Goede
     
  • The libusual header file is hard to use from code that isn't part
    of libusual. As the comment suggests, these definitions are moved to
    their own header file, paralleling other USB classes.

    Signed-off-by: Matthew Wilcox
    Cc: Alan Stern
    [mina86@mina86.com: updated to use USB_ prefix and added #include guard]
    Signed-off-by: Michal Nazarewicz
    Signed-off-by: Greg Kroah-Hartman

    index 0000000..d7fc910

    Matthew Wilcox
     
  • This commit changes prefix for some of the USB mass storage
    class related macros (ie. USB_SC_ for subclass and USB_PR_
    for class).

    Signed-off-by: Michal Nazarewicz
    Cc: Alan Stern
    Cc: Matthew Wilcox
    Signed-off-by: Greg Kroah-Hartman

    Michal Nazarewicz
     

12 Dec, 2009

1 commit

  • This patch (as1311) fixes a problem in usb-storage: Some devices are
    pretty broken when it comes to reporting sense data. The information
    they send back indicates that they have more than 18 bytes of sense
    data available, but when the system asks for more than 18 they fail or
    hang. The symptom is that probing fails with multiple resets.

    The patch adds a new BAD_SENSE flag to indicate that usb-storage
    should never ask for more than 18 bytes of sense data. The flag can
    be set in an unusual_devs entry or via the "quirks=" module parameter,
    and it is set automatically whenever a REQUEST SENSE command for more
    than 18 bytes fails or times out.

    An unusual_devs entry is added for the Agfa photo frame, which uses a
    Prolific chip having this bug.

    Signed-off-by: Alan Stern
    Tested-by: Daniel Kukula
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     

25 Mar, 2009

1 commit

  • This patch (as1206) is the first step in converting usb-storage's
    subdrivers into separate modules. It makes the following large-scale
    changes:

    Remove a bunch of unnecessary #ifdef's from usb_usual.h.
    Not truly necessary, but it does clean things up.

    Move the USB device-ID table (which is duplicated between
    libusual and usb-storage) into its own source file,
    usual-tables.c, and arrange for this to be linked with
    either libusual or usb-storage according to whether
    USB_LIBUSUAL is configured.

    Add to usual-tables.c a new usb_usual_ignore_device()
    function to detect whether a particular device needs to be
    managed by a subdriver and not by the standard handlers
    in usb-storage.

    Export a whole bunch of functions in usb-storage, renaming
    some of them because their names don't already begin with
    "usb_stor_". These functions will be needed by the new
    subdriver modules.

    Split usb-storage's probe routine into two functions.
    The subdrivers will call the probe1 routine, then fill in
    their transport and protocol settings, and then call the
    probe2 routine.

    Take the default cases and error checking out of
    get_transport() and get_protocol(), which run during
    probe1, and instead put a check for invalid transport
    or protocol values into the probe2 function.

    Add a new probe routine to be used for standard devices,
    i.e., those that don't need a subdriver. This new routine
    checks whether the device should be ignored (because it
    should be handled by ub or by a subdriver), and if not,
    calls the probe1 and probe2 functions.

    Signed-off-by: Alan Stern
    CC: Matthew Dharm
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     

08 Jan, 2009

2 commits

  • This patch (as1189b) adds some hacks to usb-storage for dealing with
    the growing problems involving bad capacity values and last-sector
    accesses:

    A new flag, US_FL_CAPACITY_OK, is created to indicate that
    the device is known to report its capacity correctly. An
    unusual_devs entry for Linux's own File-backed Storage Gadget
    is added with this flag set, since g_file_storage always
    reports the correct capacity and since the capacity need
    not be even (it is determined by the size of the backing
    file).

    An entry in unusual_devs.h which has only the CAPACITY_OK
    flag set shouldn't prejudice libusual, since the device will
    work perfectly well with either usb-storage or ub. So a
    new macro, COMPLIANT_DEV, is added to let libusual know
    about these entries.

    When a last-sector access succeeds and the total number of
    sectors is odd (the unexpected case, in which guessing that
    the number is even might cause trouble), a WARN is triggered.
    The kerneloops.org project will collect these warnings,
    allowing us to add CAPACITY_OK flags for the devices in
    question before implementing the default-to-even heuristic.
    If users want to prevent the stack dump produced by the WARN,
    they can disable the hack by adding an unusual_devs entry
    for their device with the CAPACITY_OK flag.

    When a last-sector access fails three times in a row and
    neither the FIX_CAPACITY nor the CAPACITY_OK flag is set,
    we assume the last-sector bug is present. We replace the
    existing status and sense data with values that will cause
    the SCSI core to fail the access immediately rather than
    retry indefinitely. This should fix the difficulties
    people have been having with Nokia phones.

    Signed-off-by: Alan Stern
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     
  • Add the SANE SENSE flag to indicate that a device is capable of handling
    more than 18-bytes of sense data. This functionality is required for
    USB-ATA bridges implementing SAT. A future patch will actually enable this
    function for several devices.

    The logic behind this is that we can detect support for SANE_SENSE in a few ways:
    1) ATA PASS THROUGH (12) or (16) execute successfully
    2) SPC-3 or higher is in use
    3) A previous CHECK CONDITION occurred with sense format 70-73 and had
    a length greater than 18-bytes total

    Signed-off-by: Ben Efros
    Signed-off-by: Matthew Dharm
    Signed-off-by: Greg Kroah-Hartman

    Ben Efros
     

25 Apr, 2008

1 commit

  • I have got a cypress usb-ide bridge and I would like to tune or monitor
    my disk with tools like hdparm, hddtemp or smartctl.

    My controller support a way to send raw ATA command to the disk with
    something call atacb (see
    http://download.cypress.com.edgesuite.net/design_resources/datasheets/contents/cy7c68300c_8.pdf).

    Atacb support can be added for each application, but there is some disadvantages :
    - all application need to be patched
    - A race is possible if there other accesses, because the emulation can
    be split in 2 atacb scsi transactions. One for sending the command, one
    for reading the register (if ck_cond is set).

    I have implemented the emulation in usb-storage with a special proto_handler,
    and an unsual entry.

    Signed-off-by: Matthieu CASTET
    Signed-off-by: Matthew Dharm
    Signed-off-by: Greg Kroah-Hartman

    matthieu castet
     

25 Mar, 2008

1 commit

  • Motorola ROKR Z6 cellphone has bugs in its USB, so it is impossible to use
    it as mass storage. Patch describes new "unusual" USB device for it with
    FIX_INQUIRY and FIX_CAPACITY flags and new BULK_IGNORE_TAG flag.
    Last flag relaxes check for equality of bcs->Tag and us->tag in
    usb_stor_Bulk_transport routine.

    Signed-off-by: Constantin Baranov
    Signed-off-by: Matthew Dharm
    Signed-off-by: Daniel Drake
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Constantin Baranov
     

02 Feb, 2008

1 commit

  • This patch (as1011) adds a #define for the newly-created Lockable
    (i.e., password-protected) subclass 0x07 for USB mass-storage devices.
    The private ISD200 entry (which had been mapped to subclass 0x07) is
    moved to 0xf0, which is unlikely to conflict with any official
    subclass designation.

    The US_SC_MIN and US_SC_MAX constants aren't used anywhere, so the
    patch removes them.

    Signed-off-by: Alan Stern
    Cc: Matthew Dharm
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     

18 Dec, 2007

1 commit

  • When a device cannot handle the smallest previously limited transfer
    size (64 blocks) without stalling, limit the device to the amount of
    packets that fit in a platform native page.

    The lowest possible limit is PAGE_CACHE_SIZE, so if the device is ever
    used on a platform that has larger than 8K pages, you lose unless you
    can convince the device firmware folks to fix the issue.

    Cc: Mathew Dharm
    Cc: Alan Stern
    Cc: Pete Zaitcev
    Signed-off-by: Doug Maxey
    Signed-off-by: Greg Kroah-Hartman

    Doug Maxey
     

17 Feb, 2007

1 commit


28 Sep, 2006

1 commit

  • This changeset from Keith Bennett (via Bob Copeland) moves the Karma
    initializer to its own file and adds trapping of the START_STOP command to
    enable eject of the device.

    Signed-off-by: Keith Bennett
    Signed-off-by: Bob Copeland
    Signed-off-by: Matthew Dharm
    Signed-off-by: Greg Kroah-Hartman

    Matthew Dharm
     

03 Aug, 2006

1 commit

  • This patch adds a new unusual_devs flag for when usb-storage needs to ignore
    a device that it would otherwise claim.

    We need to ignore the ZyXEL G220F as it is a virtual CDROM drive which
    includes the windows driver for this USB-WLAN adapter. After the windows
    driver is installed on a windows system, it converts it into a WLAN adapter
    (by ejecting the virtual disc).

    The virtual CDROM is of no interest to Linux users. The zd1211rw driver will
    automatically perform the eject operation, we just need to ensure that
    usb-storage does not claim the device.

    Signed-off-by: Daniel Drake
    Signed-off-by: Matthew Dharm
    Signed-off-by: Phil Dibowitz
    Signed-off-by: Greg Kroah-Hartman

    Daniel Drake
     

13 Jul, 2006

1 commit


26 Apr, 2006

1 commit


05 Jan, 2006

2 commits

  • This patch adds another usb-storage subdriver, which supports two fairly
    old dual-XD/SmartMedia reader-writers (USB1.1 devices).

    This driver was written by Daniel Drake -- he notes
    that he wrote this driver without specs, however a vendor-supplied GPL
    driver for the previous generation of products ("sma03") did prove to be
    quite useful, as did the sddr09 driver which also has to deal with
    low-level physical block layout on SmartMedia.

    The original patch has been reformed by me, as it clashed with the
    libusual patches.

    We really need to consolidate some of this common SmartMedia code, and
    get together with the MTD guys to share it with them as well.

    Signed-off-by: Daniel Drake
    Signed-off-by: Matthew Dharm
    Signed-off-by: Greg Kroah-Hartman

    Matthew Dharm
     
  • This patch adds a shim driver libusual, which routes devices between
    usb-storage and ub according to the common table, based on unusual_devs.h.
    The help and example syntax is in Kconfig.

    Signed-off-by: Pete Zaitcev
    Signed-off-by: Greg Kroah-Hartman

    Pete Zaitcev