08 Jan, 2009

4 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
     
  • This patch (as1173) merges usb-storage's CB and CBI transports into a
    single routine. So much of their code is common, it's silly to keep
    them separate.

    Signed-off-by: Alan Stern
    CC: Matthew Dharm
    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
     
  • This patch (as1161) changes the interface to
    usb_lock_device_for_reset(). The existing interface is apparently not
    very clear, judging from the fact that several of its callers don't
    use it correctly. The new interface always returns 0 for success and
    it always requires the caller to unlock the device afterward.

    The new routine will not return immediately if it is called while the
    driver's probe method is running. Instead it will wait until the
    probe is over and the device has been unlocked. This shouldn't cause
    any problems; I don't know of any cases where drivers call
    usb_lock_device_for_reset() during probe.

    Signed-off-by: Alan Stern
    Cc: Pete Zaitcev
    Signed-off-by: Greg Kroah-Hartman

    Alan Stern
     

18 Oct, 2008

1 commit

  • This patch (as1118) addresses a problem with certain USB mass-storage
    devices. These devices sometimes return less data than asked for and
    then provide no sense data to explain the problem. Currently
    usb-storage leaves it up to the SCSI layer to decide how this should
    be handled, and the SCSI layer interprets the lack of sense data to
    mean that nothing went wrong. But if we got less data than required
    then something definitely _did_ go wrong, and we should say so.

    The patch tells the SCSI layer to retry the command when this sort of
    thing happens. Retrying may not solve the underlying problem, but
    it's better than believing that data was transferred when it wasn't.

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

    Alan Stern
     

14 Aug, 2008

1 commit

  • This patch (as1119) will help to reduce the clutter of usb-storage's
    unusual_devs file by automatically detecting some devices that need
    the IGNORE_RESIDUE flag. The idea is that devices should never return
    a non-zero residue for an INQUIRY or a READ CAPACITY command unless
    they failed to transfer all the requested data. So if one of these
    commands transfers a standard amount of data but there is a positive
    residue, we know that the residue is bogus and we can set the flag.

    This fixes the problems reported in Bugzilla #11125.

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

    Alan Stern
     

22 Jul, 2008

5 commits

  • This patch renames the existing usb_reset_device in hub.c to
    usb_reset_and_verify_device and renames the existing
    usb_reset_composite_device to usb_reset_device. Also the new
    usb_reset_and_verify_device does't need to be EXPORTED .

    The idea of the patch is that external interface driver
    should warn the other interfaces' driver of the same
    device before and after reseting the usb device. One interface
    driver shoud call _old_ usb_reset_composite_device instead of
    _old_ usb_reset_device since it can't assume the device contains
    only one interface. The _old_ usb_reset_composite_device
    is safe for single interface device also. we rename the two
    functions to make the change easily.

    This patch is under guideline from Alan Stern.

    Signed-off-by: Ming Lei

    Ming Lei
     
  • From the current implementation of usb_reset_composite_device
    function, the iface parameter is no longer useful. This function
    doesn't do something special for the iface usb_interface,compared
    with other interfaces in the usb_device. So remove the parameter
    and fix the related caller.

    Signed-off-by: Ming Lei
    Acked-by: Alan Stern
    Signed-off-by: Greg Kroah-Hartman

    Ming Lei
     
  • This patch removes CVS keywords that weren't updated for a long time
    from comments.

    Signed-off-by: Adrian Bunk
    Signed-off-by: Greg Kroah-Hartman

    Adrian Bunk
     
  • This patch (as1092) implements "soft" unbinding for usb-storage. When
    the disconnect routine is called, all commands and reset delays are
    allowed to complete normally until after scsi_remove_host() returns.
    This means that the commands needed for an orderly shutdown will be
    sent through to the device.

    Unlike before, the driver will now execute every command that it
    accepts. Hence there's no need for special code to catch unexecuted
    commands and fail them.

    The new sequence of events when disconnect runs goes as follows:

    If the device is truly unplugged, set the DISCONNECTING
    flag so we won't try to access it any more.

    If the SCSI-scanning thread hasn't started up yet, prevent
    it from doing anything by setting the new DONT_SCAN flag.
    Then wake it up and wait for it to terminate.

    Remove the SCSI host. This unbinds the upper-level drivers,
    doing an orderly shutdown. Commands sent to quiesce the
    device will be transmitted normally, unless the device is
    unplugged.

    Set the DISCONNECTING flag so that we won't accept any new
    commands that might get submitted (there aren't supposed to be
    any) and we won't try to access the device for resets.

    Tell the control thread to exit by waking it up with no
    pending command, and wait for it to terminate.

    Go on to do all the other normal stuff: releasing resources,
    freeing memory, and so on.

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

    Alan Stern
     
  • This patch (as1089) separates out the dynamic atomic bitflags and the
    static bitfields in usb-storage. Until now the two sorts of flags
    have been sharing the same word; this has always been awkward.

    To help prevent possible confusion, the two new fields each have a
    different name from the original. us->fflags contains the fixed
    bitfields (mostly taken from the USB ID table in unusual_devs.h), and
    us->dflags contains the dynamic atomic bitflags (used with set_bit,
    test_bit, and so on).

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

    Alan Stern
     

25 Apr, 2008

3 commits

  • urb->context code cleanup

    Signed-off-by: Ming Lei
    Signed-off-by: Greg Kroah-Hartman

    Ming Lei
     
  • __FUNCTION__ is gcc-specific, use __func__

    Signed-off-by: Harvey Harrison
    Signed-off-by: Greg Kroah-Hartman

    Harvey Harrison
     
  • 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
     

22 Feb, 2008

1 commit

  • This patch (as1032) removes the Clear-Halt calls in
    usb_stor_Bulk_max_lun(). Evidently some devices (such as the Oracom
    MP3 player) really don't like to receive these requests when their
    bulk endpoints aren't halted.

    The only reason for adding them originally was to get an ancient
    ZIP-100 drive to work. But since this device has only a single LUN,
    we don't need to send it a Get-Max-LUN request at all. Adding an
    unusual_devs entry for the ZIP-100 with the SINGLE_LUN flag set will
    cause this step to be skipped.

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

    Alan Stern
     

12 Jan, 2008

1 commit

  • - This patch depends on:
    usb: transport.c use scsi_eh API in REQUEST_SENSE execution

    - Use scsi data accessors and remove of !use_sg code path.
    - New usb_stor_bulk_srb() for use by drivers

    [jejb: updated with corrective fix.

    had a bug in residual handling in the new usb_stor_bulk_srb()
    function. Found by Gabriel C. in -mm tree.

    Tested-by: Gabriel C
    ]

    Signed-off-by: Boaz Harrosh
    Acked-by: Matthew Dharm
    Signed-off-by: James Bottomley

    Boaz Harrosh
     

13 Oct, 2007

1 commit


08 Dec, 2006

1 commit


05 Oct, 2006

1 commit

  • Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
    of passing regs around manually through all ~1800 interrupt handlers in the
    Linux kernel.

    The regs pointer is used in few places, but it potentially costs both stack
    space and code to pass it around. On the FRV arch, removing the regs parameter
    from all the genirq function results in a 20% speed up of the IRQ exit path
    (ie: from leaving timer_interrupt() to leaving do_IRQ()).

    Where appropriate, an arch may override the generic storage facility and do
    something different with the variable. On FRV, for instance, the address is
    maintained in GR28 at all times inside the kernel as part of general exception
    handling.

    Having looked over the code, it appears that the parameter may be handed down
    through up to twenty or so layers of functions. Consider a USB character
    device attached to a USB hub, attached to a USB controller that posts its
    interrupts through a cascaded auxiliary interrupt controller. A character
    device driver may want to pass regs to the sysrq handler through the input
    layer which adds another few layers of parameter passing.

    I've build this code with allyesconfig for x86_64 and i386. I've runtested the
    main part of the code on FRV and i386, though I can't test most of the drivers.
    I've also done partial conversion for powerpc and MIPS - these at least compile
    with minimal configurations.

    This will affect all archs. Mostly the changes should be relatively easy.
    Take do_IRQ(), store the regs pointer at the beginning, saving the old one:

    struct pt_regs *old_regs = set_irq_regs(regs);

    And put the old one back at the end:

    set_irq_regs(old_regs);

    Don't pass regs through to generic_handle_irq() or __do_IRQ().

    In timer_interrupt(), this sort of change will be necessary:

    - update_process_times(user_mode(regs));
    - profile_tick(CPU_PROFILING, regs);
    + update_process_times(user_mode(get_irq_regs()));
    + profile_tick(CPU_PROFILING);

    I'd like to move update_process_times()'s use of get_irq_regs() into itself,
    except that i386, alone of the archs, uses something other than user_mode().

    Some notes on the interrupt handling in the drivers:

    (*) input_dev() is now gone entirely. The regs pointer is no longer stored in
    the input_dev struct.

    (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
    something different depending on whether it's been supplied with a regs
    pointer or not.

    (*) Various IRQ handler function pointers have been moved to type
    irq_handler_t.

    Signed-Off-By: David Howells
    (cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)

    David Howells
     

28 Sep, 2006

1 commit

  • The purpose of this patch is to split off the case when a device does
    not reply on the lower level (which is reported by HC hardware), and
    a case when the device accepted the request, but does not reply at
    upper level. This redefinition allows to diagnose issues easier,
    without asking the user if the -110 happened "immediately".

    The usbmon splits such cases already thanks to its timestamp, but
    it's not always available.

    I adjusted all drivers which I found affected (by searching for "urb").
    Out of tree drivers may suffer a little bit, but I do not expect much
    breakage. At worst they may print a few messages.

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

    Pete Zaitcev
     

11 Jul, 2006

1 commit

  • We all failed to notice that Franck's recent update to usb-storage allowed
    an URB to complete after its context data was no longer valid. This patch
    (as746) makes the driver wait for the URB to complete whenever there's a
    timeout.

    Although timeouts in usb-storage are relatively uncommon, they do occur.
    Without this patch the code in 2.6.18-rc1 will fault within an interrupt
    handler, which is not nice at all.

    Signed-off-by: Alan Stern
    Cc: Greg KH
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alan Stern
     

01 Jul, 2006

1 commit


22 Jun, 2006

2 commits


29 Oct, 2005

2 commits

  • This patch is from Alan Stern (as560). It has been rediffed against a
    current tree.

    This patch allocates a separate buffer for usb-storage to use when
    auto-sensing. Up to now we have been using the sense buffer embedded in a
    scsi_cmnd struct, which is dangerous on hosts that (a) don't do
    cache-coherent DMA or (b) have DMA alignment restrictions.

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

    Alan Stern
     
  • This patch is originally from Alan Stern (as557). It has been re-diffed
    against a current tree, and I also corrected a minor merging error.

    Some time ago we introduced a delay before device scanning, because many
    devices do not like to receive SCSI commands right after enumeration.
    Now it turns out there's a device that doesn't like to receive
    Get-Max-LUN right after enumeration either. Accordingly this patch
    delays the Get-Max-LUN request until the beginning of the scanning
    procedure. This fixes Bugzilla entry #5010.

    Three things are worth noting. First, I removed the locking code from
    usb_stor_acquire_resources. It's not needed, because the locking is to
    protect against disconnect events and acquire_resources is only called
    during probe (so the disconnect routine can't be called). Second, I
    initialized to 0 the buffer used for the Get-Max-LUN response. It's not
    really necessary, but it will prevent random values from showing up in
    the debugging log when the request fails. Third, I added a test against
    the SINGLE_LUN flag. This will allow us to use the flag to indicate
    Bulk-only devices that can't handle Get-Max-LUN.

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

    Alan Stern
     

09 Sep, 2005

2 commits

  • 29 July 2005, Cambridge, MA:

    This afternoon Alan Stern submitted a patch to remove the URB_ASYNC_UNLINK
    flag from the Linux kernel. Mr. Stern explained, "This flag is a relic
    from an earlier, less-well-designed system. For over a year it hasn't
    been used for anything other than printing warning messages."

    An anonymous spokesman for the Linux kernel development community
    commented, "This is exactly the sort of thing we see happening all the
    time. As the kernel evolves, support for old techniques and old code can
    be jettisoned and replaced by newer, better approaches. Proprietary
    operating systems do not have the freedom or flexibility to change so
    quickly."

    Mr. Stern, a staff member at Harvard University's Rowland Institute who
    works on Linux only as a hobby, noted that the patch (labelled as548) did
    not update two files, keyspan.c and option.c, in the USB drivers' "serial"
    subdirectory. "Those files need more extensive changes," he remarked.
    "They examine the status field of several URBs at times when they're not
    supposed to. That will need to be fixed before the URB_ASYNC_UNLINK flag
    is removed."

    Greg Kroah-Hartman, the kernel maintainer responsible for overseeing all
    of Linux's USB drivers, did not respond to our inquiries or return our
    calls. His only comment was "Applied, thanks."

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

    Alan Stern
     
  • This patch started life as as531 from Alan Stern. It has been rediffed
    against the latest tree.

    The SCSI people have deprecated the use of scsi_cmnd.serial_number for
    anything other than printk. Worse than that, the SCSI core doesn't
    always increment the number (when the error handler is running, for
    example). So this patch creates a locally-stored value for use in
    bulk-only tags. The net result is a simplification, since we no longer
    have to save & restore the serial_number value while autosensing.

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

    Matthew Dharm
     

28 Jun, 2005

2 commits

  • This patch causes a port reset whenever there's a transport error or abort.
    If that fails it reverts back to doing a mass-storage device reset. It
    started life as as497 and was rediffed by me.

    This makes error recovery a lot quicker and more reliable.

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

    Matthew Dharm
     
  • This patch does two things to help reset recovery. It started life as
    as496 and was rediffed by me.

    First, the patch checks the result of a CLEAR_HALT request and doesn't reset the
    endpoint's data toggle unless the request succeeded.

    Second, it reduces the timeout for a device reset from 20 seconds to 5
    seconds.

    If all goes well, then I've finally figured quilt out and this patch should
    apply cleanly.

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

    Matthew Dharm
     

19 Apr, 2005

1 commit

  • This patch changes the delay for the US_FL_GO_SLOW patch from 110us to 125.
    Some delays need this extra delay includign Jan De Luyck's drive which spawned
    the original increase from 110 to 110us. 125 is a microframe, so this delay
    seems to make sense more than just be a random delay (thanks to David Brownell
    for pointing that out after my original patch).

    Signed-off-by: Phil Dibowitz
    Signed-off-by: Greg Kroah-Hartman

    Index: gregkh-2.6/drivers/usb/storage/transport.c
    ===================================================================

    Phil Dibowitz
     

17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds