1. 28 7月, 2013 1 次提交
  2. 10 6月, 2013 1 次提交
    • S
      firewire: introduce fw_driver.probe and .remove methods · 94a87157
      Stefan Richter 提交于
      FireWire upper layer drivers are converted from generic
          struct driver.probe() and .remove()
      to bus-specific
          struct fw_driver.probe() and .remove().
      
      The new .probe() adds a const struct ieee1394_device_id *id argument,
      indicating the entry in the driver's device identifiers table which
      matched the fw_unit to be probed.  This new argument is used by the
      snd-firewire-speakers driver to look up device-specific parameters and
      methods.  There is at least one other FireWire audio driver currently in
      development in which this will be useful too.
      
      The new .remove() drops the unused error return code.
      
      Although all in-tree drivers are being converted to the new methods,
      support for the old methods is left in place in this commit.  This
      allows public developer trees to merge this commit and then move to the
      new fw_driver methods.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Acked-by: Clemens Ladisch <clemens@ladisch.de> (for sound/firewire/)
      Cc: Peter Hurley <peter@hurleysoftware.com> (for drivers/staging/fwserial/)
      94a87157
  3. 28 9月, 2012 1 次提交
    • S
      firewire: addendum to address handler RCU conversion · 4d50c443
      Stefan Richter 提交于
      Follow up on commit c285f6ff6787 "firewire: remove global lock around
      address handlers, convert to RCU":
      
        - address_handler_lock no longer serializes the address handler, only
          its function to serialize updates to the list of handlers remains.
          Rename the lock to address_handler_list_lock.
      
        - Callers of fw_core_remove_address_handler() must be able to sleep.
          Comment on this in the API documentation.
      
        - The counterpart fw_core_add_address_handler() is by nature something
          which is used in process context.  Replace spin_lock_bh() by
          spin_lock() in fw_core_add_address_handler() and in
          fw_core_remove_address_handler(), and document that process context
          is now required for fw_core_add_address_handler().
      
        - Extend the documentation of fw_address_callback_t.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      4d50c443
  4. 30 6月, 2012 1 次提交
  5. 27 5月, 2012 1 次提交
  6. 10 5月, 2012 2 次提交
    • C
      firewire: Move fw_card kref functions into linux/firewire.h · fc5f80b1
      Chris Boot 提交于
      When writing a firewire driver that doesn't deal with struct fw_device
      objects (e.g. it only publishes FireWire units and doesn't subscribe to
      them), you likely need to keep referenced to struct fw_card objects so
      that you can send messages to other nodes. This patch moves
      fw_card_put(), fw_card_get() and fw_card_release() into the public
      include/linux/firewire.h header instead of drivers/firewire/core.h, and
      adds EXPORT_SYMBOL_GPL(fw_card_release).
      
      The firewire-sbp-target module requires these so it can keep a reference
      to the fw_card object in order that it can fetch ORBs to execute and
      read/write related data and status information.
      Signed-off-by: NChris Boot <bootc@bootc.net>
      Acked-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Cc: Clemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      fc5f80b1
    • C
      firewire: Add function to get speed from opaque struct fw_request · 253d9237
      Chris Boot 提交于
      Sometimes it's useful to know the FireWire speed of the request that has
      just come in to a fw_address_handler callback. As struct fw_request is
      opaque we can't peek inside to get the speed out of the struct fw_packet
      that's just inside. For example, the SBP-2 spec says:
      
      "The speed at which the block write request to the MANAGEMENT_AGENT
      register is received shall determine the speed used by the target for
      all subsequent requests to read the initiator’s configuration ROM, fetch
      ORB’s from initiator memory or store status at the initiator’s
      status_FIFO. Command block ORB’s separately specify the speed for
      requests addressed to the data buffer or page table."
      
      [ ANSI T10/1155D Revision 4 page 53/54 ]
      Signed-off-by: NChris Boot <bootc@bootc.net>
      Acked-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Cc: Clemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
      253d9237
  7. 18 4月, 2012 2 次提交
    • C
      firewire: move rcode_string() to core · 7bdbff67
      Clemens Ladisch 提交于
      There is nothing audio-specific about the rcode_string() helper, so move
      it from snd-firewire-lib into firewire-core to allow other code to use it.
      Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (fixed sound/firewire/cmp.c)
      7bdbff67
    • S
      firewire: core: fix DMA mapping direction · 0b6c4857
      Stefan Richter 提交于
      Seen with recent libdc1394:  If a client mmap()s the buffer of an
      isochronous reception buffer with PROT_READ|PROT_WRITE instead of just
      PROT_READ, firewire-core sets the wrong DMA mapping direction during
      buffer initialization.
      
      The fix is to split fw_iso_buffer_init() into allocation and DMA mapping
      and to perform the latter after both buffer and DMA context were
      allocated.  Buffer allocation and context allocation may happen in any
      order, but we need the context type (reception or transmission) in order
      to set the DMA direction of the buffer.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      0b6c4857
  8. 03 4月, 2012 1 次提交
  9. 19 3月, 2012 1 次提交
  10. 16 3月, 2012 1 次提交
    • P
      device.h: audit and cleanup users in main include dir · 313162d0
      Paul Gortmaker 提交于
      The <linux/device.h> header includes a lot of stuff, and
      it in turn gets a lot of use just for the basic "struct device"
      which appears so often.
      
      Clean up the users as follows:
      
      1) For those headers only needing "struct device" as a pointer
      in fcn args, replace the include with exactly that.
      
      2) For headers not really using anything from device.h, simply
      delete the include altogether.
      
      3) For headers relying on getting device.h implicitly before
      being included themselves, now explicitly include device.h
      
      4) For files in which doing #1 or #2 uncovers an implicit
      dependency on some other header, fix by explicitly adding
      the required header(s).
      
      Any C files that were implicitly relying on device.h to be
      present have already been dealt with in advance.
      
      Total removals from #1 and #2: 51.  Total additions coming
      from #3: 9.  Total other implicit dependencies from #4: 7.
      
      As of 3.3-rc1, there were 110, so a net removal of 42 gives
      about a 38% reduction in device.h presence in include/*
      Signed-off-by: NPaul Gortmaker <paul.gortmaker@windriver.com>
      313162d0
  11. 23 2月, 2012 1 次提交
    • S
      firewire: core: prefix log messages with card name · 26b4950d
      Stefan Richter 提交于
      Associate all log messages from firewire-core with the respective card
      because some people have more than one card.  E.g.
          firewire_ohci 0000:04:00.0: added OHCI v1.10 device as card 0, 8 IR + 8 IT contexts, quirks 0x0
          firewire_ohci 0000:05:00.0: added OHCI v1.10 device as card 1, 8 IR + 8 IT contexts, quirks 0x0
          firewire_core: created device fw0: GUID 0814438400000389, S800
          firewire_core: phy config: new root=ffc1, gap_count=5
          firewire_core: created device fw1: GUID 0814438400000388, S800
          firewire_core: created device fw2: GUID 0001d202e06800d1, S800
      turns into
          firewire_ohci 0000:04:00.0: added OHCI v1.10 device as card 0, 8 IR + 8 IT contexts, quirks 0x0
          firewire_ohci 0000:05:00.0: added OHCI v1.10 device as card 1, 8 IR + 8 IT contexts, quirks 0x0
          firewire_core 0000:04:00.0: created device fw0: GUID 0814438400000389, S800
          firewire_core 0000:04:00.0: phy config: new root=ffc1, gap_count=5
          firewire_core 0000:05:00.0: created device fw1: GUID 0814438400000388, S800
          firewire_core 0000:04:00.0: created device fw2: GUID 0001d202e06800d1, S800
      
      This increases the module size slightly; to keep this in check, turn the
      former printk wrapper macros into functions.  Their implementation is
      largely copied from driver core's dev_printk counterparts.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      26b4950d
  12. 16 1月, 2012 1 次提交
  13. 27 7月, 2011 1 次提交
  14. 11 5月, 2011 3 次提交
    • S
      firewire: sbp2: parallelize login, reconnect, logout · 105e53f8
      Stefan Richter 提交于
      The struct sbp2_logical_unit.work items can all be executed in parallel
      but are not reentrant.  Furthermore, reconnect or re-login work must be
      executed in a WQ_MEM_RECLAIM workqueue.
      
      Hence replace the old single-threaded firewire-sbp2 workqueue by a
      concurrency-managed but non-reentrant workqueue with rescuer.
      firewire-core already maintains one, hence use this one.
      
      In earlier versions of this change, I observed occasional failures of
      parallel INQUIRY to an Initio INIC-2430 FireWire 800 to dual IDE bridge.
      More testing indicates that parallel INQUIRY is not actually a problem,
      but too quick successions of logout and login + INQUIRY, e.g. a quick
      sequence of cable plugout and plugin, can result in failed INQUIRY.
      This does not seem to be something that should or could be addressed by
      serialization.
      
      Another dual-LU device to which I currently have access to, an
      OXUF924DSB FireWire 800 to dual SATA bridge with firmware from MacPower,
      has been successfully tested with this too.
      
      This change is beneficial to environments with two or more FireWire
      storage devices, especially if they are located on the same bus.
      Management tasks that should be performed as soon and as quickly as
      possible, especially reconnect, are no longer held up by tasks on other
      devices that may take a long time, especially login with INQUIRY and sd
      or sr driver probe.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      105e53f8
    • C
      firewire: optimize iso queueing by setting wake only after the last packet · 13882a82
      Clemens Ladisch 提交于
      When queueing iso packets, the run time is dominated by the two
      MMIO accesses that set the DMA context's wake bit.  Because most
      drivers submit packets in batches, we can save much time by
      removing all but the last wakeup.
      
      The internal kernel API is changed to require a call to
      fw_iso_context_queue_flush() after a batch of queued packets.
      The user space API does not change, so one call to
      FW_CDEV_IOC_QUEUE_ISO must specify multiple packets to take
      advantage of this optimization.
      
      In my measurements, this patch reduces the time needed to queue
      fifty skip packets from userspace to one sixth on a 2.5 GHz CPU,
      or to one third at 800 MHz.
      Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      13882a82
    • S
      firewire: octlet AT payloads can be stack-allocated · f30e6d3e
      Stefan Richter 提交于
      We do not need slab allocations anymore in order to satisfy
      streaming DMA mapping constraints, thanks to commit da28947e
      "firewire: ohci: avoid separate DMA mapping for small AT payloads".
      
      (Besides, the slab-allocated buffers that firewire-core, firewire-sbp2,
      and firedtv used to provide for 8-byte write and lock requests were
      still not fully portable since they crossed cacheline boundaries or
      shared a cacheline with unrelated CPU-accessed data.  snd-firewire-lib
      got this aspect right by using an extra kmalloc/ kfree just for the
      8-byte transaction buffer.)
      
      This change replaces kmalloc'ed lock transaction scratch buffers in
      firewire-core, firedtv, and snd-firewire-lib by local stack allocations.
      Perhaps the most notable result of the change is simpler locking because
      there is no need to serialize usages of preallocated per-device buffers
      anymore.  Also, allocations and deallocations are simpler.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      Acked-by: NClemens Ladisch <clemens@ladisch.de>
      f30e6d3e
  15. 15 3月, 2011 1 次提交
  16. 23 1月, 2011 1 次提交
  17. 04 1月, 2011 1 次提交
  18. 30 7月, 2010 1 次提交
    • S
      firewire: add isochronous multichannel reception · 872e330e
      Stefan Richter 提交于
      This adds the DMA context programming and userspace ABI for multichannel
      reception, i.e. for listening on multiple channel numbers by means of a
      single DMA context.
      
      The use case is reception of more streams than there are IR DMA units
      offered by the link layer.  This is already implemented by the older
      ohci1394 + ieee1394 + raw1394 stack.  And as discussed recently on
      linux1394-devel, this feature is occasionally used in practice.
      
      The big drawbacks of this mode are that buffer layout and interrupt
      generation necessarily differ from single-channel reception:  Headers
      and trailers are not stripped from packets, packets are not aligned with
      buffer chunks, interrupts are per buffer chunk, not per packet.
      
      These drawbacks also cause a rather hefty code footprint to support this
      rarely used OHCI-1394 feature.  (367 lines added, among them 94 lines of
      added userspace ABI documentation.)
      
      This implementation enforces that a multichannel reception context may
      only listen to channels to which no single-channel context on the same
      link layer is presently listening to.  OHCI-1394 would allow to overlay
      single-channel contexts by the multi-channel context, but this would be
      a departure from the present first-come-first-served policy of IR
      context creation.
      
      The implementation is heavily based on an earlier one by Jay Fenlason.
      Thanks Jay.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      872e330e
  19. 23 7月, 2010 2 次提交
    • S
      firewire: cdev: add PHY packet reception · bf54e146
      Stefan Richter 提交于
      Add an FW_CDEV_IOC_RECEIVE_PHY_PACKETS ioctl() and
      FW_CDEV_EVENT_PHY_PACKET_RECEIVED poll()/read() event for /dev/fw*.
      This can be used to get information from remote PHYs by remote access
      PHY packets.
      
      This is also the 2nd half of the functionality (the receive part) to
      support a userspace implementation of a VersaPHY transaction layer.
      
      Safety considerations:
      
        - PHY packets are generally broadcasts, hence some kind of elevated
          privileges should be required of a process to be able to listen in
          on PHY packets.  This implementation assumes that a process that is
          allowed to open the /dev/fw* of a local node does have this
          privilege.
      
          There was an inconclusive discussion about introducing POSIX
          capabilities as a means to check for user privileges for these
          kinds of operations.
      
      Other limitations:
      
        - PHY packet reception may be switched on by ioctl() but cannot be
          switched off again.  It would be trivial to provide an off switch,
          but this is not worth the code.  The client should simply close()
          the fd then, or just ignore further events.
      
        - For sake of simplicity of API and kernel-side implementation, no
          filter per packet content is provided.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      bf54e146
    • S
      firewire: normalize status values in packet callbacks · 18d0cdfd
      Stefan Richter 提交于
      core-transaction.c transmit_complete_callback() and close_transaction()
      expect packet callback status to be an ACK or RCODE, and ACKs get
      translated to RCODEs for transaction callbacks.
      
      An old comment on the packet callback API (been there from the initial
      submission of the stack) and the dummy_driver implementation of
      send_request/send_response deviated from this as they also included
      -ERRNO in the range of status values.
      
      Let's narrow status values down to ACK and RCODE to prevent surprises.
      RCODE_CANCELLED is chosen as the dummy_driver's RCODE as its meaning of
      "transaction timed out" comes closest to what happens when a transaction
      coincides with card removal.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      18d0cdfd
  20. 13 7月, 2010 1 次提交
    • S
      firewire: core: integrate software-forced bus resets with bus management · 02d37bed
      Stefan Richter 提交于
      Bus resets which are triggered
        - by the kernel drivers after updates of the local nodes' config ROM,
        - by userspace software via ioctl
      shall be deferred until after >=2 seconds after the last bus reset.
      
      If multiple modifications of the local nodes' config ROM happen in a row,
      only a single bus reset should happen after them.
      
      When the local node's link goes from inactive to active or vice versa,
      and at the two occasions of bus resets mentioned above --- and if the
      current gap count differs from 63 --- the bus reset should be preceded
      by a PHY configuration packet that reaffirms the gap count.  Otherwise a
      bus manager would have to reset the bus again right after that.
      
      This is necessary to promote bus stability, e.g. leave grace periods for
      allocations and reallocations of isochronous channels and bandwidth,
      SBP-2 reconnections etc.; see IEEE 1394 clause 8.2.1.
      
      This change implements all of the above by moving bus reset initiation
      into a delayed work (except for bus resets which are triggered by the
      bus manager workqueue job and are performed there immediately).  It
      comes with a necessary addition to the card driver methods that allows
      to get the current gap count from PHY registers.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      02d37bed
  21. 08 7月, 2010 1 次提交
  22. 21 6月, 2010 1 次提交
    • S
      firewire: remove an unused function argument · 33e553fe
      Stefan Richter 提交于
      void (*fw_address_callback_t)(..., int speed, ...) is the speed that a
      remote node chose to transmit a request to us.  In case of split
      transactions, firewire-core will transmit the response at that speed.
      
      Upper layer drivers on the other hand (firewire-net, -sbp2, firedtv, and
      userspace drivers) cannot do anything useful with that speed datum,
      except log it for debug purposes.  But data that is merely potentially
      (not even actually) used for debug purposes does not belong into the API.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      33e553fe
  23. 19 6月, 2010 2 次提交
  24. 10 6月, 2010 4 次提交
  25. 19 5月, 2010 1 次提交
    • C
      firewire: core: use separate timeout for each transaction · 5c40cbfe
      Clemens Ladisch 提交于
      Using a single timeout for all transaction that need to be flushed does
      not work if the submission of new transactions can defer the timeout
      indefinitely into the future.  We need to have timeouts that do not
      change due to other transactions; the simplest way to do this is with a
      separate timer for each transaction.
      Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (+ one lockdep annotation)
      5c40cbfe
  26. 20 4月, 2010 1 次提交
    • S
      firewire: core: clean up config ROM related defined constants · edd5bdaf
      Stefan Richter 提交于
      Clemens Ladisch pointed out that
        - BIB_IMC is not named like the field is called in the standard,
        - readers of the code may get worried about the magic 0x0c0083c0,
        - a CSR_NODE_CAPABILITIES key is there in the header but not put to
          good use.
      
      So let's rename BIB_IMC, add a defined constant for Node_Capabilities
      and a comment which reassures people that somebody thought about it and
      they don't have to (or if they still do, tell them where they have to
      look for confirmation), and prune our incomplete and arbitrary set of
      defined constants of CSR key IDs.  And there is a nother magic number,
      that of Bus_Information_Block.Bus_Name, to be defined and commented.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      edd5bdaf
  27. 30 12月, 2009 4 次提交
  28. 31 10月, 2009 1 次提交
    • S
      firewire: ohci: 0 may be a valid DMA address · 19593ffd
      Stefan Richter 提交于
      I was told that there are obscure architectures with non-coherent DMA
      which may DMA-map to bus address 0.  We shall not use 0 as a magic
      number of uninitialized bus address variables.
      
      The packet->payload_length > 0 test cannot be used either (except in
      at_context_queue_packet) because local requests are not DMA-mapped
      regardless of payload_length.  Hence add a state flag to struct
      fw_packet.
      Signed-off-by: NStefan Richter <stefanr@s5r6.in-berlin.de>
      19593ffd