1. 23 9月, 2009 11 次提交
    • A
      USB: usbfs: add USBDEVFS_URB_BULK_CONTINUATION flag · 01c6460f
      Alan Stern 提交于
      This patch (as1283) adds a new flag, USBDEVFS_URB_BULK_CONTINUATION,
      to usbfs.  It is intended for userspace libraries such as libusb and
      openusb.  When they have to break up a single usbfs bulk transfer into
      multiple URBs, they will set the flag on all but the first URB of the
      series.
      
      If an error other than an unlink occurs, the kernel will automatically
      cancel all the following URBs for the same endpoint and refuse to
      accept new submissions, until an URB is encountered that is not marked
      as a BULK_CONTINUATION.  Such an URB would indicate the start of a new
      transfer or the presence of an older library, so the kernel returns to
      normal operation.
      
      This enables libraries to delimit bulk transfers correctly, even in
      the presence of early termination as indicated by short packets.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      
      01c6460f
    • G
      USB: Clean up root hub string descriptors · 392ca68b
      George Spelvin 提交于
      The previous code had a bug that would add a trailing null byte to
      the returned descriptor.
      Signed-off-by: NGeorge Spelvin <linux@horizon.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      392ca68b
    • J
      USB: make usb_buffer_map_sg consistent with doc · 2912282c
      Jiri Slaby 提交于
      usb_buffer_map_sg should return negative on error according to
      its documentation. But dma_map_sg returns 0 on error. Take this
      into account and return -ENOMEM in such situation.
      
      While at it, return -EINVAL instead of -1 when wrong input is
      passed in.
      
      If this wasn't done, usb_sg_* operations used after usb_sg_init
      which returned 0 may cause oopses/deadlocks since we don't init
      structures/entries, esp. completion and status entry.
      Signed-off-by: NJiri Slaby <jirislaby@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      2912282c
    • M
      USB: increase usbdevfs max isoc buffer size · 5971897f
      Markus Rechberger 提交于
      The current limit only allows isochronous transfers up to 32kbyte/urb,
      updating this to 192 kbyte/urb improves the reliability of the
      transfer. USB 2.0 transfer is possible with 32kbyte but increases the
      chance of corrupted/incomplete data when the system is performing some
      other tasks in the background.
      
      http://www.spinics.net/lists/linux-usb/msg19955.htmlSigned-off-by: NMarkus Rechberger <mrechberger@gmail.com>
      Cc: Oliver Neukum <oliver@neukum.org>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      5971897f
    • A
      USB: don't lose mode switch events on suspended devices · 527101ce
      Alan Stern 提交于
      This patch (as1268) changes the way usbcore handles child devices that
      undergo a disconnection and reconnection while the parent hub is
      suspended.  Currently, if the child isn't enabled for remote wakeup we
      leave it alone, figuring that it will go through a reset-resume when
      somebody tries to use it.
      
      However this isn't a good approach if the reason for the disconnection
      is that the child decided to switch modes or in some other way alter
      its descriptors.  In that case we want to re-enumerate it as soon as
      possible, not wait until somebody forces a reset-resume.
      
      To resolve the issue, this patch treats reconnected suspended child
      devices as though they had requested a remote wakeup, even if they
      weren't enabled for it.  The mode switch or descriptor change will be
      detected during the reset part of the reset-resume, and the device
      will be re-enumerated immediately.
      
      The disadvantage of this change is that it will cause autosuspended
      devices to be resumed when the computer wakes up from a system sleep
      during which the root hub was reset or lost power.  This shouldn't
      matter much; some people would even argue that autosuspended devices
      should _always_ be resumed when the system wakes up!
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Tested-by: N"Yang Fei-AFY095" <fei.yang@motorola.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      527101ce
    • A
      USB: check for hub driver not bound to root hub device · 25118084
      Alan Stern 提交于
      This patch (as1267) changes usb_kick_khubd() and hdev_to_hub() to make
      them more resilient against situations where a hub device isn't bound
      to the hub driver.  The code assumes that if a root hub was
      successfully registered then it must be bound to the hub driver.
      
      But this assumption can fail if the user manually unbinds the hub
      driver, or more importantly, if the host controller dies causing
      usb_set_configuration to fail.
      
      To protect against these possibilities, make hdev_to_hub() check that
      the hub device is configured before dereferencing the active
      configuration, and make usb_kick_khubd() check that the pointer to the
      hub's private data structure isn't NULL.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      25118084
    • A
      USB: make the "usbfs_snoop" log more pertinent · 4c6e8971
      Alan Stern 提交于
      This patch (as1261) reduces the amount of detailed URB information
      logged by usbfs when the usbfs_snoop parameter is enabled.
      
      Currently we don't display the final status value for a completed URB.
      But we do display the entire data buffer twice: both before submission
      and after completion.  The after-completion display doesn't limit
      itself to the actual_length value.  But since usbmon is readily
      available in virtually all distributions, there's no reason for usbfs
      to print out any buffer contents at all!
      
      So this patch restricts the information to: userspace buffer pointer,
      endpoint number, type, and direction, length or actual_length, and
      timeout value or status.  Now everything fits neatly into a single
      line.
      
      Along with those changes, the patch also fixes the snoop output for
      the REAPURBNDELAY and REAPURBNDELAY32 ioctls.  The current version
      omits the 'N' from the names.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      4c6e8971
    • A
      USB: make intf.pm_usage an atomic_t · ccf5b801
      Alan Stern 提交于
      This patch (as1260) changes the pm_usage_cnt field in struct
      usb_interface from an int to an atomic_t.  This is so that drivers can
      invoke the usb_autopm_get_interface_async() and
      usb_autopm_put_interface_async() routines without locking and without
      fear of corrupting the pm_usage_cnt value.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      ccf5b801
    • A
      USB: add API for userspace drivers to "claim" ports · 7cbe5dca
      Alan Stern 提交于
      This patch (as1258) implements a feature that users have been asking
      for: It gives programs the ability to "claim" a port on a hub, via a
      new usbfs ioctl.  A device plugged into a "claimed" port will not be
      touched by the kernel beyond the immediate necessities of
      initialization and enumeration.
      
      In particular, when a device is plugged into a "claimed" port, the
      kernel will not select and install a configuration.  And when a config
      is installed by usbfs or sysfs, the kernel will not probe any drivers
      for any of the interfaces.  (However the kernel will fetch various
      string descriptors during enumeration.  One could argue that this
      isn't really necessary, but the strings are exported in sysfs.)
      
      The patch does not guarantee exclusive access to these devices; it is
      still possible for more than one program to open the device file
      concurrently.  Programs are responsible for coordinating access among
      themselves.
      
      A demonstration program showing how to use the new interface can be 
      found in an attachment to
      
      	http://marc.info/?l=linux-usb&m=124345857431452&w=2
      
      The patch also makes a small simplification to the hub driver,
      replacing a bunch of more-or-less useless variants of "out of memory"
      with a single message.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7cbe5dca
    • P
      USB: Let usb_sg_init to set transfer_buffer more often · 81bf46f3
      Pete Zaitcev 提交于
      This fix permits the "new" usbmon to access usb-storage's data buffer
      without DMA remapping tricks. It should be compatible with PIO controllers
      and not add any new crashes. Note that from now on PIO controllers and
      usbmon are uniform in their access pattern and if one crashes then
      the other will too. Hopefuly neither does.
      
      As a side effect, we get rid for #ifdefs, which were a little ugly.
      Signed-off-by: NPete Zaitcev <zaitcev@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      81bf46f3
    • S
      USB: Fix SS endpoint companion descriptor parsing. · 6682bb39
      Sarah Sharp 提交于
      When there's a descriptor after the SuperSpeed endpoint companion
      descriptor, the previous code would have skipped over twice the length it
      was supposed to.  This code fixes crashes seen with UASP devices (which
      have a UASP descriptor after the SS endpoint companion descriptor).
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6682bb39
  2. 22 9月, 2009 1 次提交
  3. 20 9月, 2009 1 次提交
  4. 16 9月, 2009 1 次提交
  5. 08 8月, 2009 2 次提交
  6. 29 7月, 2009 1 次提交
    • S
      USB: Fix parsing of SuperSpeed Endpoint Companion descriptor. · 9f8e4438
      Sarah Sharp 提交于
      usb_parse_ss_endpoint_companion() was supposed to allocate a structure to
      hold the SuperSpeed Endpoint Companion descriptor, and either copy the
      values the device returned, or fill in default values if the device
      descriptor did not include the companion descriptor.
      
      However, the previous code would miss the last endpoint in a configuration
      with no descriptors after it.  Make usb_parse_endpoint() allocate the SS
      endpoint companion descriptor and fill it with default values, even if
      we've run out of buffer space in this configuration descriptor.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9f8e4438
  7. 13 7月, 2009 7 次提交
    • A
      USB: handle zero-length usbfs submissions correctly · 9180135b
      Alan Stern 提交于
      This patch (as1262) fixes a bug in usbfs: It refuses to accept
      zero-length transfers, and it insists that the buffer pointer be valid
      even if there is no data being transferred.
      
      The patch also consolidates a bunch of repetitive access_ok() checks
      into a single check, which incidentally fixes the lack of such a check
      for Isochronous URBs.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9180135b
    • D
      USB: fix LANGID=0 regression · 0cce2eda
      Daniel Mack 提交于
      commit b7af0bb2 ("USB: allow malformed LANGID descriptors") broke support
      for devices without string descriptor support.
      
      Reporting string descriptors is optional to USB devices, and a device
      lets us know it can't deal with strings by responding to the LANGID
      request with a STALL token.
      
      The kernel handled that correctly before b7af0bb2 came in, but failed
      hard if the LANGID was reported but broken. More than that, if a device
      was not able to provide string descriptors, the LANGID was retrieved
      over and over again at each string read request.
      
      This patch changes the behaviour so that
      
       a) the LANGID is only queried once
       b) devices which can't handle string requests are not asked again
       c) devices with malformed LANGID values have a sane fallback to 0x0409
      Signed-off-by: NDaniel Mack <daniel@caiaq.de>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0cce2eda
    • O
      USB: fix race leading to a write after kfree in usbfs · 516a1a07
      Oliver Neukum 提交于
      this fixes a race between async_completed() and proc_reapurbnonblock().
      
      CPU A                   CPU B
      
      spin_lock(&ps->lock);
      list_move_tail(&as->asynclist, &ps->async_completed);
      spin_unlock(&ps->lock);
      
                                      if (!(as = async_getcompleted(ps)))
                                              return -EAGAIN;
                                      return processcompl(as, (void __user * __user *)arg);
      
      processcompl() calls free_async() which calls kfree(as)
      
      as->status = urb->status;
      if (as->signr) {
              sinfo.si_signo = as->signr;
              sinfo.si_errno = as->status;
              sinfo.si_code = SI_ASYNCIO;
              sinfo.si_addr = as->userurb;
              kill_pid_info_as_uid(as->signr, &sinfo, as->pid, as->uid,
                                    as->euid, as->secid);
      }
      snoop(&urb->dev->dev, "urb complete\n");
      snoop_urb(urb, as->userurb);
      
      write after kfree
      Signed-off-by: NOliver Neukum <oliver@neukum.org>
      516a1a07
    • G
      Revert USB: usbfs: deprecate and hide option for !embedded · e12df02a
      Greg Kroah-Hartman 提交于
      This reverts commit cc71329b, so that
      Red Hat machines can boot properly.  It seems that the Red Hat initrd
      code tries to watch the /proc/bus/usb/devices file to monitor usb
      devices showing up.  While this task is prone to lots of races and does
      not show the true state of the system, they seem to like it.
      
      So for now, don't move this option under the EMBEDDED config option.
      
      
      Cc: Scott James Remnant <scott@canonical.com>
      Cc: Kay Sievers <kay.sievers@vrfy.org>
      Cc: Dave Airlie <airlied@gmail.com>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Jeff Chua <jeff.chua.linux@gmail.com>
      Cc: Dave Jones <davej@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e12df02a
    • F
      USB: add missing class descriptions used in usb/devices file · bf7fbb02
      Frans Pop 提交于
      Added descriptions (for WIRELESS_CONTROLLER and MISC) were taken from
      the usb-devices script now included in usbutils.
      
      Also sort the classes in the same order as in include/linux/usb/ch9.h
      for easier comparison for future updates.
      Signed-off-by: NFrans Pop <elendil@planet.nl>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      bf7fbb02
    • O
      USB: fix memleak in usbfs · d794a021
      Oliver Neukum 提交于
      This patch fixes a memory leak in devio.c::processcompl
      
      If writing to user space fails the packet must be discarded, as it
      already has been removed from the queue of completed packets.
      Signed-off-by: NOliver Neukum <oliver@neukum.org>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d794a021
    • A
      USB: fix the clear_tt_buffer interface · cb88a1b8
      Alan Stern 提交于
      This patch (as1255) updates the interface for calling
      usb_hub_clear_tt_buffer().  Even the name of the function is changed!
      
      When an async URB (i.e., Control or Bulk) going through a high-speed
      hub to a non-high-speed device is cancelled or fails, the hub's
      Transaction Translator buffer may be left busy still trying to
      complete the transaction.  The buffer has to be cleared; that's what
      usb_hub_clear_tt_buffer() does.
      
      It isn't safe to send any more URBs to the same endpoint until the TT
      buffer is fully clear.  Therefore the HCD needs to be told when the
      Clear-TT-Buffer request has finished.  This patch adds a callback
      method to struct hc_driver for that purpose, and makes the hub driver
      invoke the callback at the proper time.
      
      The patch also changes a couple of names; "hub_tt_kevent" and
      "tt.kevent" now look rather antiquated.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Cc: stable <stable@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      cb88a1b8
  8. 09 7月, 2009 1 次提交
  9. 16 6月, 2009 15 次提交
    • V
      USB: xhci: replace if-elseif-else with switch-case · 7dd19e69
      Viral Mehta 提交于
      Replace if-elseif-else with switch-case
      to keep the code consistent which is semantically same
      
      Switch-case is used here,
      http://www.spinics.net/lists/linux-usb/msg17201.html
      Making consistent at other places in usb/core
      
      Also easier to read and maintain when USB4.0, 5.0, ... comes
      Signed-off-by: NViral Mehta <viral.mehta@einfochips.com>
      Tested-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7dd19e69
    • S
      USB: Change names of SuperSpeed ep companion descriptor structs. · f0058c62
      Sarah Sharp 提交于
      Differentiate between SuperSpeed endpoint companion descriptor and the
      wireless USB endpoint companion descriptor.  Make all structure names for
      this descriptor have "ss" (SuperSpeed) in them.  David Vrabel asked for
      this change in http://marc.info/?l=linux-usb&m=124091465109367&w=2Reported-by: NDavid Vrabel <david.vrabel@csr.com>
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      f0058c62
    • S
      USB: Push scatter gather lists down to host controller drivers. · e04748e3
      Sarah Sharp 提交于
      This is the original patch I created before David Vrabel posted a better
      patch (http://marc.info/?l=linux-usb&m=123377477209109&w=2) that does
      basically the same thing.  This patch will get replaced with his
      (modified) patch later.
      
      Allow USB device drivers that use usb_sg_init() and usb_sg_wait() to push
      bulk endpoint scatter gather lists down to the host controller drivers.
      This allows host controller drivers to more efficiently enqueue these
      transfers, and allows the xHCI host controller to better take advantage of
      USB 3.0 "bursts" for bulk endpoints.
      
      This patch currently only enables scatter gather lists for bulk endpoints.
      Other endpoint types that use the usb_sg_* functions will not have their
      scatter gather lists pushed down to the host controller.  For periodic
      endpoints, we want each scatterlist entry to be a separate transfer.
      Eventually, HCDs could parse these scatter-gather lists for periodic
      endpoints also.  For now, we use the old code and call usb_submit_urb()
      for each scatterlist entry.
      
      The caller of usb_sg_init() can request that all bytes in the scatter
      gather list be transferred by passing in a length of zero.  Handle that
      request for a bulk endpoint under xHCI by walking the scatter gather list
      and calculating the length.  We could let the HCD handle a zero length in
      this case, but I'm not sure if the core layers in between will get
      confused by this.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e04748e3
    • S
      USB: Support for bandwidth allocation. · 79abb1ab
      Sarah Sharp 提交于
      Originally, the USB core had no support for allocating bandwidth when a
      particular configuration or alternate setting for an interface was
      selected.  Instead, the device driver's URB submission would fail if
      there was not enough bandwidth for a periodic endpoint.  Drivers could
      work around this, by using the scatter-gather list API to guarantee
      bandwidth.
      
      This patch adds host controller API to allow the USB core to allocate or
      deallocate bandwidth for an endpoint.  Endpoints are added to or dropped
      from a copy of the current schedule by calling add_endpoint() or
      drop_endpoint(), and then the schedule is atomically evaluated with a
      call to check_bandwidth().  This allows all the endpoints for a new
      configuration or alternate setting to be added at the same time that the
      endpoints from the old configuration or alt setting are dropped.
      
      Endpoints must be added to the schedule before any URBs are submitted to
      them.  The HCD must be allowed to reject a new configuration or alt
      setting before the control transfer is sent to the device requesting the
      change.  It may reject the change because there is not enough bandwidth,
      not enough internal resources (such as memory on an embedded host
      controller), or perhaps even for security reasons in a virtualized
      environment.
      
      If the call to check_bandwidth() fails, the USB core must call
      reset_bandwidth().  This causes the schedule to be reverted back to the
      state it was in just after the last successful check_bandwidth() call.
      
      If the call succeeds, the host controller driver (and hardware) will have
      changed its internal state to match the new configuration or alternate
      setting.  The USB core can then issue a control transfer to the device to
      change the configuration or alt setting.  This allows the core to test new
      configurations or alternate settings before unbinding drivers bound to
      interfaces in the old configuration.
      
      WIP:
      
      The USB core must add endpoints from all interfaces in a configuration
      to the schedule, because a driver may claim that interface at any time.
      A slight optimization might be to add the endpoints to the schedule once
      a driver claims that interface.  FIXME
      
      This patch does not cover changing alternate settings, but it does
      handle a configuration change or de-configuration.  FIXME
      
      The code for managing the schedule is currently HCD specific.  A generic
      scheduling algorithm could be added for host controllers without
      built-in scheduling support.  For now, if a host controller does not
      define the check_bandwidth() function, the call to
      usb_hcd_check_bandwidth() will always succeed.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      79abb1ab
    • S
      USB: Parse and store the SuperSpeed endpoint companion descriptors. · 663c30d0
      Sarah Sharp 提交于
      The USB 3.0 bus specification added an "Endpoint Companion" descriptor that is
      supposed to follow all SuperSpeed Endpoint descriptors.  This descriptor is used
      to extend the bus protocol to allow more packets to be sent to an endpoint per
      "microframe".  The word microframe was removed from the USB 3.0 specification
      because the host controller does not send Start Of Frame (SOF) symbols down the
      USB 3.0 wires.
      
      The descriptor defines a bMaxBurst field, which indicates the number of packets
      of wMaxPacketSize that a SuperSpeed device can send or recieve in a service
      interval.  All non-control endpoints may set this value as high as 16 packets
      (bMaxBurst = 15).
      
      The descriptor also allows isochronous endpoints to further specify that they
      can send and receive multiple bursts per service interval.  The bmAttributes
      allows them to specify a "Mult" of up to 3 (bmAttributes = 2).
      
      Bulk endpoints use bmAttributes to report the number of "Streams" they support.
      This was an extension of the endpoint pipe concept to allow multiple mass
      storage device commands to be outstanding for one bulk endpoint at a time.  This
      should allow USB 3.0 mass storage devices to support SCSI command queueing.
      Bulk endpoints can say they support up to 2^16 (65,536) streams.
      
      The information in the endpoint companion descriptor must be stored with the
      other device, config, interface, and endpoint descriptors because the host
      controller needs to access them quickly, and we need to install some default
      values if a SuperSpeed device doesn't provide an endpoint companion descriptor.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      663c30d0
    • S
      USB: Support for addressing a USB device under xHCI · c6515272
      Sarah Sharp 提交于
      Add host controller driver API and a slot_id variable to struct
      usb_device.  This allows the xHCI host controller driver to ask the
      hardware to allocate a slot for the device when a struct usb_device is
      allocated.  The slot needs to be allocated at that point because the
      hardware can run out of internal resources, and we want to know that very
      early in the device connection process.  Don't call this new API for root
      hubs, since they aren't real devices.
      
      Add HCD API to let the host controller choose the device address.  This is
      especially important for xHCI hardware running in a virtualized
      environment.  The guests running under the VM don't need to know which
      addresses on the bus are taken, because the hardware picks the address for
      them.  Announce SuperSpeed USB devices after the address has been assigned
      by the hardware.
      
      Don't use the new get descriptor/set address scheme with xHCI.  Unless
      special handling is done in the host controller driver, the xHC can't
      issue control transfers before you set the device address.  Support for
      the older addressing scheme will be added when the xHCI driver supports
      the Block Set Address Request (BSR) flag in the Address Device command.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      c6515272
    • S
      USB: Add route string to struct usb_device. · 7206b001
      Sarah Sharp 提交于
      This patch adds a hex route string to each USB device.  The route string is used
      by the USB 3.0 host controller to send packets through the device tree.  USB 3.0
      hubs use this string to route packets to the correct port.  This is fundamental
      bus change from USB 2.0, where all packets were broadcast across the bus.
      
      Devices (including hubs) under a root port receive the route string 0x0.  Every
      four bits in the route string represent a port on a hub.  This length works
      because USB 3.0 hubs are limited to 15 ports, and USB 2.0 hubs (with potentially
      more ports) will never see packets with a route string.  A port number of 0
      means the packet is destined for that hub.
      
      For example, a peripheral device might have a route string of 0x00097.
      This means the device is connected to port 9 of the hub at depth 1.
      The hub at depth 1 is connected to port 7 of a hub at depth 0.
      The hub at depth 0 is connected to a root port.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      7206b001
    • S
      USB: Don't reset USB 3.0 devices on port change detection. · e7b77172
      Sarah Sharp 提交于
      The USB 3.0 bus specification defines a new connection sequence for USB 3.0
      hubs and roothubs.  USB 3.0 devices are reset and link trained by the hub
      before the port status change notification is sent to the host OS.  This means
      that an entire tree of devices can be trained in parallel on power up, and the
      OS no longer needs to reset USB 3.0 devices.  Change the USB core's hub port
      init sequence so that it does not reset USB 3.0 devices.
      
      The port status change from the roothub and from the USB 3.0 hub will report
      the SuperSpeed connect correctly.  This patch currently only handles the
      roothub case.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      e7b77172
    • S
      USB: Add USB 3.0 roothub support to USB core. · d2e9b4d6
      Sarah Sharp 提交于
      Add USB 3.0 root hub descriptors.  This is a kludge because I reused the old
      USB 2.0 descriptors, instead of using the new USB 3.0 hub descriptors with
      endpoint companion descriptors and other descriptors.  I did this because I
      wasn't ready to add USB 3.0 hub changes to khubd.  For now, a USB 3.0 roothub
      looks like a USB 2.0 roothub, with a higher speed.
      
      USB 3.0 hubs have no transaction translator (TT).
      
      Make USB core debugging handle super speed ports.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      d2e9b4d6
    • S
      USB: Add SuperSpeed to the list of USB device speeds. · 6b403b02
      Sarah Sharp 提交于
      Modify the USB core to handle the new USB 3.0 speed, "SuperSpeed".  This
      is 5.0 Gbps (wire speed).  There are probably more places that check for
      speed that I've missed.
      
      SuperSpeed devices have a 512 byte endpoint 0 max packet size.  This shows
      up as a bMaxPacketSize0 set to 0x09 (see table 9-8 of the USB 3.0 bus
      spec).
      
      xHCI spec says that the xHC can handle intervals up to 2^15 microframes.  That
      might change when real silicon becomes available.
      
      Add FIXME note for SuperSpeed isochronous endpoints.  They can transmit up
      to 16 packets in one "burst" before they wait for an acknowledgment of the
      packets.  They can do up to 3 bursts per microframe (determined by the
      mult value in the endpoint companion descriptor).  The xHCI driver doesn't
      have support for isoc yet, so fix this later.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6b403b02
    • S
      USB: xhci: BIOS handoff and HW initialization. · 66d4eadd
      Sarah Sharp 提交于
      Add PCI initialization code to take control of the xHCI host controller
      away from the BIOS, halt, and reset the host controller.  The xHCI spec
      says that BIOSes must give up the host controller within 5 seconds.
      
      Add some host controller glue functions to handle hardware initialization
      and memory allocation for the host controller.  The current xHCI
      prototypes use PCI interrupts, but the xHCI spec requires MSI-X
      interrupts.  Add code to support MSI-X interrupts, but use the PCI
      interrupts for now.
      Signed-off-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      66d4eadd
    • F
      USB: Avoid PM error messages during resume if a device was disconnected · 23a54e56
      Frans Pop 提交于
      Currently if a laptop is suspended e.g. while docked and then resumed after
      undocking it, the following errors get generated because the USB hub in the
      docking station and the devices connected to it are no longer available:
      pm_op(): usb_dev_resume+0x0/0x10 returns -19
      PM: Device 1-2 failed to resume: error -19
      pm_op(): usb_dev_resume+0x0/0x10 returns -19
      PM: Device 1-2.2 failed to resume: error -19
      pm_op(): usb_dev_resume+0x0/0x10 returns -19
      PM: Device 1-2.3 failed to resume: error -19
      
      As the removal of USB devices while a system is suspended is a relatively
      common use case and in most cases not an error, just return success on
      -ENODEV. The user gets informed anyway as the USB subsystem generates
      regular disconnect messages for the devices shortly afterwards:
      usb 1-2: USB disconnect, address 3
      usb 1-2.2: USB disconnect, address 4
      usblp0: removed
      usb 1-2.3: USB disconnect, address 5
      Signed-off-by: NFrans Pop <elendil@planet.nl>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      23a54e56
    • F
      USB: replace dma_sync_single and dma_sync_sg with dma_sync_single_for_cpu and dma_sync_sg_for_cpu · 9b8e7ba6
      FUJITA Tomonori 提交于
      This replaces dma_sync_single() and dma_sync_sg() with
      dma_sync_single_for_cpu() and dma_sync_sg_for_cpu() respectively
      because they is an obsolete API; include/linux/dma-mapping.h says:
      
      /* Backwards compat, remove in 2.7.x */
      #define dma_sync_single		dma_sync_single_for_cpu
      #define dma_sync_sg		dma_sync_sg_for_cpu
      Signed-off-by: NFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      9b8e7ba6
    • K
      usb: convert endpoint devices to bus-less childs of the usb interface · 55129666
      Kay Sievers 提交于
      The endpoint devices look like simple attribute groups now, and no longer
      like devices with a specific subsystem. They will also no longer emit uevents.
      
      It also removes the device node requests for endpoint devices, which are not
      implemented for now.
      Signed-off-by: NKay Sievers <kay.sievers@vrfy.org>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      55129666
    • A
      USB: new flag for resume-from-hibernation · 6ec4beb5
      Alan Stern 提交于
      This patch (as1237) changes the way the PCI host controller drivers
      avoid retaining bogus hardware states during resume-from-hibernation.
      Previously we had reset the hardware as part of preparing to reinstate
      the memory image.  But we can do better now with the new PM framework,
      since we know exactly which resume operations are from hibernation.
      
      The pci_resume method is changed to accept a flag indicating whether
      the system is resuming from hibernation.  When this flag is set, the
      drivers will reset the hardware to get rid of any existing state.
      
      Similarly, the pci_suspend method is changed to remove the
      pm_message_t argument.  It's no longer needed, since no special action
      has to be taken when preparing to reinstate the memory image.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Acked-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      6ec4beb5