1. 11 Dec, 2009 1 commit
  2. 20 Nov, 2009 1 commit
    • Jay Fenlason's avatar
      firewire: ohci: pass correct iso xmit timestamps to core · 31769cef
      Jay Fenlason authored
      
      
      Here is the final set of patches I used to get ffado to work with the
      new firewire stack.  With these patches, I was able to start ardour
      and record from and playback to my PreSonus Inspire1394 from a
      (mostly) Fedora 12 system.
      Signed-off-by: default avatarJay Fenlason <fenlason@redhat.com>
      
      Until now, firewire-ohci exposed only the transmit cycle of the last
      transmitted packet at each isochronous transmit complete event.  This
      made it impossible for FFADO (FireWire audio drivers in userspace) to
      synchronize audio-out streams.  The fix is to store the timestamp of
      each packet in the iso xmit event.  As a bonus, the transfer status is
      stored too.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      31769cef
  3. 18 Nov, 2009 1 commit
    • Jay Fenlason's avatar
      firewire: ohci: Make cycleMatch ISO transmission work · 5ed1f321
      Jay Fenlason authored
      
      
      Calling the START_ISO ioctl with a nonnegative cycle paramater has
      never worked.  Last night I got around to figuring out why.  Most of
      this patch is a big comment explaining why we enable an interrupt
      source then don't actually do anything when we get one.  As the
      comment says, we should do more, but we don't have a way to tell
      userspace what happened. . .
      Signed-off-by: default avatarJay Fenlason <fenlason@redhat.com>
      Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (edited comment)
      5ed1f321
  4. 31 Oct, 2009 1 commit
    • Stefan Richter's avatar
      firewire: ohci: 0 may be a valid DMA address · 19593ffd
      Stefan Richter authored
      
      
      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: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      19593ffd
  5. 14 Oct, 2009 1 commit
    • Stefan Richter's avatar
      firewire: optimize config ROM creation · 8e85973e
      Stefan Richter authored
      
      
      The config ROM image of the local node was created in CPU byte order,
      then a temporary big endian copy was created to compute the CRC, and
      finally the card driver created its own big endian copy.
      
      We now generate it in big endian byte order in the first place to avoid
      one byte order conversion and the temporary on-stack copy of the ROM
      image (1000 bytes stack usage in process context).  Furthermore, two
      1000 bytes memset()s are replaced by one 1000 bytes - ROM length sized
      memset.
      
      The trivial fw_memcpy_{from,to}_be32() helpers are now superfluous and
      removed.  The newly added __compute_block_crc() function will be folded
      into fw_compute_block_crc() in a subsequent change.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      8e85973e
  6. 12 Sep, 2009 1 commit
    • Stefan Richter's avatar
      firewire: ohci: fix Self ID Count register mask (safeguard against buffer overflow) · 928ec5f1
      Stefan Richter authored
      
      
      The selfIDSize field of Self ID Count is 9 bits wide, and we are only
      interested in the high 8 bits.  Fix the mask accordingly.  The
      previously too large mask didn't do damage though because the next few
      bits in the register are reserved and therefore zero with presently
      existing hardware.
      
      Also, check for the maximum possible self ID count of 252 (according to
      OHCI 1.1 clause 11.2 and IEEE 1394a-2000 clause 4.3.4.1, i.e. up to four
      self IDs of up to 63 nodes, even though IEEE 1394 up to edition 2008
      defines only up to three self IDs per node).  More than 252 self IDs
      would only happen if the self ID receive DMA unit malfunctioned, which
      would likely be caught by other self ID buffer checks.  However, check
      it early to be sure.  More than 253 quadlets would overflow the Topology
      Map CSR.
      
      Reported-By: PaX Team
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      928ec5f1
  7. 05 Sep, 2009 2 commits
  8. 05 Jun, 2009 4 commits
    • Stefan Richter's avatar
      firewire: rename source files · e71d31da
      Stefan Richter authored
      
      
      The source files of firewire-core, firewire-ohci, firewire-sbp2, i.e.
       "drivers/firewire/fw-*.c"
      are renamed to
       "drivers/firewire/core-*.c",
       "drivers/firewire/ohci.c",
       "drivers/firewire/sbp2.c".
      
      The old fw- prefix was redundant to the directory name.  The new core-
      prefix distinguishes the files according to which driver they belong to.
      
      This change comes a little late, but still before further firewire
      drivers are added as anticipated RSN.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      e71d31da
    • Stefan Richter's avatar
      firewire: reorganize header files · 77c9a5da
      Stefan Richter authored
      
      
      The three header files of firewire-core, i.e.
       "drivers/firewire/fw-device.h",
       "drivers/firewire/fw-topology.h",
       "drivers/firewire/fw-transaction.h",
      are replaced by
       "drivers/firewire/core.h",
       "include/linux/firewire.h".
      
      The latter includes everything which a firewire high-level driver (like
      firewire-sbp2) needs besides linux/firewire-constants.h, while core.h
      contains the rest which is needed by firewire-core itself and by low-
      level drivers (card drivers) like firewire-ohci.
      
      High-level drivers can now also reside outside of drivers/firewire
      without having to add drivers/firewire to the header file search path in
      makefiles.  At least the firedtv driver will be such a driver.
      
      I also considered to spread the contents of core.h over several files,
      one for each .c file where the respective implementation resides.  But
      it turned out that most core .c files will end up including most of the
      core .h files.  Also, the combined core.h isn't unreasonably big, and it
      will lose more of its contents to linux/firewire.h anyway soon when more
      firewire drivers are added.  (IP-over-1394, firedtv, and there are plans
      for one or two more.)
      
      Furthermore, fw-ohci.h is renamed to ohci.h.  The name of core.h and
      ohci.h is chosen with regard to name changes of the .c files in a
      follow-up change.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      77c9a5da
    • Stefan Richter's avatar
      firewire: clean up includes · e8ca9702
      Stefan Richter authored
      
      
      Include required headers which were only indirectly included.
      Remove unused includes and an unused constant.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      e8ca9702
    • Stefan Richter's avatar
      firewire: ohci: access bus_seconds atomically · 3dcdc500
      Stefan Richter authored
      
      
      In the unlikely event that card->driver->get_bus_time() is called during
      a cycle64Seconds interrupt, we could read garbage unless atomic accesses
      are used.
      
      The switch to atomic ops requires to change the 64 seconds counter from
      unsigned to signed, but this shouldn't matter to the end result.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      3dcdc500
  9. 24 Mar, 2009 6 commits
    • Jay Fenlason's avatar
      firewire: implement asynchronous stream transmission · f8c2287c
      Jay Fenlason authored
      
      
      Allow userspace and other firewire drivers (fw-ipv4 I'm looking at
      you!) to send Asynchronous Transmit Streams as described in 7.8.3 of
      release 1.1 of the 1394 Open Host Controller Interface Specification.
      Signed-off-by: default avatarJay Fenlason <fenlason@redhat.com>
      Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (tweaks)
      f8c2287c
    • Stefan Richter's avatar
      firewire: normalize a variable name · e1eff7a3
      Stefan Richter authored
      
      
      Standardize on  if (err)
                              handle_error;
                 and  if (ret < 0)
                              handle_error;
      
      Don't call a variable err if we store values in it which mean success.
      Also, offset some return statements by a blank line since this how we do
      it in drivers/firewire.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      e1eff7a3
    • Stefan Richter's avatar
      firewire: prevent creation of multiple IR DMA contexts for the same channel · 4817ed24
      Stefan Richter authored
      
      
      OHCI-1394 1.1 clause 10.4.3 says:  "If more than one IR DMA context
      specifies receives for packets from the same isochronous channel, the
      context destination for that channel's packets is undefined."
      
      Any userspace client and in the future also kernelspace clients can
      allocate IR DMA contexts for any channel.  We don't want them to
      interfere with each other, hence it is preferable to return -EBUSY if
      allocation of a second context for a channel is attempted.
      
      Notes:
        - This limitation is OHCI-1394 specific, therefore its proper place of
          implementation is down in the low-level driver.
      
        - Since the <linux/firewire-cdev.h> ABI simply maps one userspace iso
          client context to one hardware iso context, this OHCI-1394
          limitation alas requires userspace to implement its own multiplexing
          of iso reception from the same channel and card to multiple clients
          when needed.
      
        - The limitation is independent of channel allocation at the IRM; the
          latter is really only important for the initiation of iso 
          transmission but not of iso reception.
      
        - We don't need to do the same for IT DMA because OHCI-1394 does not
          have any ties between IT contexts and channels.  Only the voluntary
          channel allocation protocol via the IRM, globally to the FireWire
          bus, can ensure proper isochronous transmit behaviour anyway.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      4817ed24
    • Stefan Richter's avatar
      firewire: remove line breaks before function names · 53dca511
      Stefan Richter authored
      
      
      type
          function_name(parameters);
      
      is nice to look at but was not used consistently.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      53dca511
    • Stefan Richter's avatar
      firewire: standardize a variable name · 2dbd7d7e
      Stefan Richter authored
      
      
      "ret" is the new "retval".
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      2dbd7d7e
    • David Moore's avatar
      firewire: Include iso timestamp in headers when header_size > 4 · 1aa292bb
      David Moore authored
      
      
      Previously, when an iso context had header_size > 4, the iso header
      (len/tag/channel/tcode/sy) was passed to userspace followed by quadlets
      stripped from the payload.  This patch changes the behavior:
      header_size = 8 now passes the header quadlet followed by the timestamp
      quadlet.  When header_size > 8, quadlets are stripped from the payload.
      The header_size = 4 case remains identical.
      
      Since this alters the semantics of the API, the firewire API version
      needs to be bumped concurrently with this change.
      
      This change also refactors the header copying code slightly to be much
      easier to read.
      Signed-off-by: default avatarDavid Moore <dcm@acm.org>
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      1aa292bb
  10. 24 Jan, 2009 2 commits
  11. 10 Dec, 2008 1 commit
  12. 31 Oct, 2008 1 commit
  13. 26 Oct, 2008 2 commits
  14. 26 Jul, 2008 1 commit
    • FUJITA Tomonori's avatar
      dma-mapping: add the device argument to dma_mapping_error() · 8d8bb39b
      FUJITA Tomonori authored
      Add per-device dma_mapping_ops support for CONFIG_X86_64 as POWER
      architecture does:
      
      This enables us to cleanly fix the Calgary IOMMU issue that some devices
      are not behind the IOMMU (http://lkml.org/lkml/2008/5/8/423
      
      ).
      
      I think that per-device dma_mapping_ops support would be also helpful for
      KVM people to support PCI passthrough but Andi thinks that this makes it
      difficult to support the PCI passthrough (see the above thread).  So I
      CC'ed this to KVM camp.  Comments are appreciated.
      
      A pointer to dma_mapping_ops to struct dev_archdata is added.  If the
      pointer is non NULL, DMA operations in asm/dma-mapping.h use it.  If it's
      NULL, the system-wide dma_ops pointer is used as before.
      
      If it's useful for KVM people, I plan to implement a mechanism to register
      a hook called when a new pci (or dma capable) device is created (it works
      with hot plugging).  It enables IOMMUs to set up an appropriate
      dma_mapping_ops per device.
      
      The major obstacle is that dma_mapping_error doesn't take a pointer to the
      device unlike other DMA operations.  So x86 can't have dma_mapping_ops per
      device.  Note all the POWER IOMMUs use the same dma_mapping_error function
      so this is not a problem for POWER but x86 IOMMUs use different
      dma_mapping_error functions.
      
      The first patch adds the device argument to dma_mapping_error.  The patch
      is trivial but large since it touches lots of drivers and dma-mapping.h in
      all the architecture.
      
      This patch:
      
      dma_mapping_error() doesn't take a pointer to the device unlike other DMA
      operations.  So we can't have dma_mapping_ops per device.
      
      Note that POWER already has dma_mapping_ops per device but all the POWER
      IOMMUs use the same dma_mapping_error function.  x86 IOMMUs use device
      argument.
      
      [akpm@linux-foundation.org: fix sge]
      [akpm@linux-foundation.org: fix svc_rdma]
      [akpm@linux-foundation.org: build fix]
      [akpm@linux-foundation.org: fix bnx2x]
      [akpm@linux-foundation.org: fix s2io]
      [akpm@linux-foundation.org: fix pasemi_mac]
      [akpm@linux-foundation.org: fix sdhci]
      [akpm@linux-foundation.org: build fix]
      [akpm@linux-foundation.org: fix sparc]
      [akpm@linux-foundation.org: fix ibmvscsi]
      Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
      Cc: Muli Ben-Yehuda <muli@il.ibm.com>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Avi Kivity <avi@qumranet.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8d8bb39b
  15. 25 Jul, 2008 1 commit
  16. 14 Jul, 2008 1 commit
  17. 18 Jun, 2008 4 commits
  18. 18 Apr, 2008 9 commits
    • Stefan Richter's avatar
      firewire: remove unused struct member · e09770db
      Stefan Richter authored
      
      
      request_generation is internal to fw-ohci and unneeded in fw_card.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      e09770db
    • Stefan Richter's avatar
      firewire: fw-ohci: work around generation bug in TI controllers (fix AV/C and more) · d34316a4
      Stefan Richter authored
      Unlike the ohci1394 driver, fw-ohci uses the selfIDGeneration field of
      bus reset packets to determine the generation of incoming requests as
      per OHCI 1.1 clause 8.4.2.3.  This is more precise --- provided that the
      controller inserts the correct generation.  Texas Instruments chips
      often don't.
      
      This prevented the transmission of response packets, which for example
      broke AV/C transactions as used when communicating with miniDV cameras
      and any other AV/C devices.
      
      There is apparently no way to detect and adjust incorrect generations.
      Therefore we ignore the generation of bus reset packets from TI chips
      and use the generation of the self ID buffer instead.  Alas this is
      received at a slightly wrong time.  In rare cases, this could cause us
      to not respond to legitimate requests or to respond to expired requests.
      (The latter is less likely because the bus reset packet AR event is
      typically handled before the self ID complete event.)
      
      Bug reported by Mladen Kuntner, who was extraordinarily patient while
      dealing with the driver maintainers.  Fix confirmed to be required and
      effective for TSB82AA2 and a TSB43AB22 or TSB43AB22A.
      https://bugzilla.redhat.com/show_bug.cgi?id=243081
      
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      Signed-off-by: default avatarJarod Wilson <jwilson@redhat.com>
      d34316a4
    • Stefan Richter's avatar
      firewire: fw-ohci: extend logging of bus generations and node ID · 08ddb2f4
      Stefan Richter authored
      
      
      Extend the logging of "AR evt_bus_reset, link internal" to "AR
      evt_bus_reset, generation ${selfIDGeneration}".  That way we can check
      whether this generation matches the one seen in self ID complete event
      logging.  See OHCI 1.1 clause 8.4.2.3.
      
      Also extend logging of "firewire_ohci: * selfIDs, generation *" by
      "local node ID ffc*" in self ID logging to make the local node in AT/AR
      event logs more obvious.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      Signed-off-by: default avatarJarod Wilson <jwilson@redhat.com>
      08ddb2f4
    • Stefan Richter's avatar
      firewire: fw-ohci: conditionally log busReset interrupts · a007bb85
      Stefan Richter authored
      
      
      Add a debug option to watch bus reset interrupt events.  Half of this
      patch is taken from Jarod Wilson's first version of the JMicron fix.
      
      BusReset interrupts are only generated if the respective module
      parameter flag was set before the controller is being initialized.
      Else we keep this event masked to reduce IRQ load in normal operation
      and to avoid potential problems with buggy chips.
      
      Note, this is unlike the other IRQ events whose logging can be enabled
      any time after chip initialization.  This and the influence on what
      interrupts the chip generates is why I added an extra flag for it.
      
      Also, reorder the debug parameter flags according to their perceived
      usefulness.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      Signed-off-by: default avatarJarod Wilson <jwilson@redhat.com>
      a007bb85
    • Jarod Wilson's avatar
      firewire: fw-ohci: don't append to AT context when it's not active · 76f73ca1
      Jarod Wilson authored
      
      
      I finally tracked down the issues with this JMicron PCI-e card in my
      possession to a failure to comply with section 7.2.3.2 of the OHCI 1.1
      specification (thanks to Kristian for the pointer to illustrate that it
      is indeed a flaw in this card, not the driver). The controller should
      simply flush the packets we've appended to its AT queue if a bus reset
      occurs before they've been transmitted and we'll try again, but
      something goes wrong and the controller winds up hung.
      
      However, we can avoid the problem by simply checking if the
      IntEvent.busReset register had been set before we try appending to the
      AT context. When busReset is set, the AT context is completely halted
      until busReset is cleared, so there's no point in appending AT packets
      until the register is cleared. So at_context_queue_packet() now checks
      for busReset being set, and bails with an RCODE_GENERATION packet ack,
      which results in us trying to append the packet again after recognizing
      the fact there has been a bus reset, and clearing busReset.
      Signed-off-by: default avatarJarod Wilson <jwilson@redhat.com>
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      76f73ca1
    • Jarod Wilson's avatar
      firewire: fw-ohci: log regAccessFail events · 75f7832e
      Jarod Wilson authored
      
      
      While trying to debug this piece of crap JMicron PCI-e controller in my
      possession, one thought was that perhaps I was encountering register access
      failures. I'm not, but logging them would be good, so we can see if they
      are a real problem we should be taking into account anywhere in the code.
      Signed-off-by: default avatarJarod Wilson <jwilson@redhat.com>
      Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (added list contact)
      75f7832e
    • Jarod Wilson's avatar
      firewire: fw-ohci: make sure HCControl register LPS bit is set · 02214724
      Jarod Wilson authored
      
      
      I've now witnessed multiple occasions where one of my controllers (a very
      poorly working JMicron PCIe card) fails to get its registers properly set
      up in ohci_enable(), apparently due to an occasionally very slow to
      initiate SClk. The easy fix for this problem is to add a tiny while loop
      to try again a time or three after initially enabling LPS before we
      move on (or give up).
      
      Of course, the card still isn't fully functional yet, but this gets it at
      least one tiny step closer...
      Signed-off-by: default avatarJarod Wilson <jwilson@redhat.com>
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      02214724
    • Stefan Richter's avatar
      firewire: fw-ohci: missing PPC PMac feature calls in failure path · 130d5496
      Stefan Richter authored
      
      
      Balance ohci_pmac_on and ohci_pmac_off if pci_driver.probe fails.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      130d5496
    • Stefan Richter's avatar
      firewire: fw-ohci: untangle a mixed unsigned/signed expression · 43286568
      Stefan Richter authored
      
      
      and make another expression more readable.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      43286568