1. 09 Jun, 2010 2 commits
    • Clemens Ladisch's avatar
      firewire: ohci: add MSI support · 262444ee
      Clemens Ladisch authored
      This patch adds support for message-signaled interrupts.
      
      Any native PCI-Express OHCI controller should support MSI, but most are
      just PCI cores behind a PCI-E/PCI bridge.  The only chips that are known
      to claim to support MSI are the Lucent/Agere/LSI FW643 and the VIA
      VT6315, none of which I have been able to test.
      
      Due to the high level of trust I have in the competence of these and any
      future chip makers, I thought it a good idea to add a disable-MSI quirk.
      Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
      
      Tested Agere FW643 rev 07 [11c1:5901] and JMicron JMB381 [197b:2380].
      Added a quirks list entry for JMB38X since it kept its count of MSI
      events consistently at zero.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      262444ee
    • Stefan Richter's avatar
      firewire: ohci: do not enable interrupts without the handler · 148c7866
      Stefan Richter authored
      On 26 Apr 2010, Clemens Ladisch wrote:
      > In theory, none of the interrupts should occur before the link is
      > enabled.  In practice, I'd rather make sure to not set the master
      > interrupt enable bit until we have installed the interrupt handler.
      
      and proposed to move OHCI1394_masterIntEnable out of the present
      reg_write() into a new one before the HCControl.linkEnable reg_write().
      
      Why not defer setting /all/ of the bits until right before linkEnable?
      Reviewed-by: default avatarClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      148c7866
  2. 31 May, 2010 1 commit
  3. 25 May, 2010 1 commit
    • Stefan Richter's avatar
      ieee1394: schedule for removal · 3014420b
      Stefan Richter authored
      All application domains that are supported by the old ieee1394 driver
      stack are supported by the newer firewire driver stack too.  There is
      now good and extensive experience with the newer stack from deployment
      in Fedora since F7 as well as by enthusiast users of other
      distributions.
      
      The new drivers have consequently been recommended as the default ones
      since 2.6.33, in order to fix some severe usability problems of FireWire
      on Linux due to limitations of the old stack.  It is now high time to
      announce when the obsolete drivers will be removed.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      Acked-by: default avatarJarod Wilson <jarod@redhat.com>
      3014420b
  4. 18 May, 2010 2 commits
  5. 19 Apr, 2010 2 commits
    • Clemens Ladisch's avatar
      firewire: core: make transaction label allocation more robust · 7906054f
      Clemens Ladisch authored
      If one request is so long-lived that it does not get a response before
      the following 63 requests, its bit in tlabel_mask is still set when the
      next request tries to allocate a transaction label for that number.  In
      this state, while the first request is not completed or timed out, no
      new requests can be submitted.
      
      To fix this, skip over any label still in use, and do not error out
      unless we have entirely run out of labels.
      Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      7906054f
    • Stefan Richter's avatar
      firewire: core: clean up config ROM related defined constants · edd5bdaf
      Stefan Richter authored
      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: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      edd5bdaf
  6. 10 Apr, 2010 13 commits
  7. 24 Mar, 2010 2 commits
    • Stefan Richter's avatar
      firewire: core: align driver match with modalias · fe43d6d9
      Stefan Richter authored
      The driver match strategy was:
        - Match vendor/model/specifier/version of the unit directory.
        - If that was a miss, match vendor from the root directory and
          model/specifier/version of the unit directory.
      
      This was inconsistent with how the modalias string was constructed
      until recently (take vendor/model from root directory and specifier/
      version from unit directory).  It was also inconsistent with how it is
      done since the parent commit:
        - Use vendor/model/specifier/version of the unit directory if possible,
        - fall back to one or more of vendor/model/specifier/version from the
          root directory depending on which ones are not present at the unit
          directory.
      
      Fix this inconsistency by sharing the ROM scanner function between
      modalias printer function and driver match function.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      fe43d6d9
    • Stefan Richter's avatar
      firewire: core: fix Model_ID in modalias · 5ae73518
      Stefan Richter authored
      The modalias string of devices that represent units on a FireWire node
      did not show Module_ID entries within unit directories.  This was
      because firewire-core searched only the root directory of the
      configuration ROM for a Model_ID entry.
      
      We now search first the root directory, then the unit directory.  IOW
      honor a unit directory's Model_ID if present, otherwise fall back to the
      root directory's model ID (if present).
      
      Furthermore, apply the same change to Vendor_ID.  This had the same
      issue but it was less apparent because most devices provide Vendor_ID
      only in the root directory.
      
      And finally, also use this strategy for the remaining two IDs in the
      modalias, Specifier_ID and Version.  It does not actually make sense to
      look for them elsewhere than in the unit directory because they are
      mandatory there.  However, a uniform search order simplifies the
      implementation and has no adverse affect in practice.
      
      Side notes:
        - The older counterpart of this, nodemgr.c of ieee1394, looked for
          Vendor_ID first in the root directory, then in the unit directory,
          and for Model_ID only in the unit directory.
        - There is a single mainline driver which requires Vendor_ID and
          Model_ID --- the firedtv driver.  This one worked because FireDTVs
          provide Vendor_ID in the root directory and Model_ID identically in
          root directory and unit directory.
        - Apart from firedtv, there are currently no drivers known to me
          (including userspace drivers) that look at the Vendor_ID or Model_ID
          of the modalias.
      Reported-by: default avatarMaciej Żenczykowski <zenczykowski@gmail.com>
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      5ae73518
  8. 17 Mar, 2010 1 commit
    • Clemens Ladisch's avatar
      firewire: ohci: add cycle timer quirk for the TI TSB12LV22 · 8301b91b
      Clemens Ladisch authored
      Among the many entries in the TSB12LV22 errata list (TI literature
      number SLLS312) is the following:
      
        PCI Slave reads of the Cycle Timer register may occasionally get an
        incorrect value.
        Software may be able to validate value by reading the register
        multiple times rapidly and evaluating for a reasonable difference.
      
      Signed-off-by: Clemens Ladisch <clemens@ladisch.de> (untested)
      Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (added #define)
      8301b91b
  9. 15 Mar, 2010 1 commit
  10. 24 Feb, 2010 15 commits
    • Stefan Richter's avatar
      firewire: ohci: extend initialization log message · 6fdb2ee2
      Stefan Richter authored
      by the number of available isochronous DMA contexts and active quirks
      which is occasionally useful information.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      6fdb2ee2
    • Stefan Richter's avatar
      firewire: ohci: fix IR/IT context mask mixup · 4802f16d
      Stefan Richter authored
      This bug was present in firewire-ohci since day one:  The number of
      available isochronous receive DMA contexts was mixed up with that of
      available isochronous transmit DMA contexts.
      
      This is harmless on a few chips which offer the same number of contexts
      in both directions, but most chips nowadays implement only the standard
      minimum of 4 IR contexts, but 8 IT contexts.  If a user attempted to run
      a lot of IR contexts at once, results with more than four were therefore
      unpredictable.  I suppose the controller would simply refuse to start
      DMA of any unimplemented context.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      4802f16d
    • Stefan Richter's avatar
      firewire: ohci: add module parameter to activate quirk fixes · 3e9cc2f3
      Stefan Richter authored
      This way, we can advise users of precompiled kernel packages to test
      existing quirk fixes on chips which have not been listed yet, without
      them having to build a kernel from source.
      
      Note, to use this feature on a machine with more than one controller,
      steps like these are necessary:
      # lspci | grep 1394
      # ls /sys/bus/pci/drivers/firewire_ohci/
      # echo -n "0000:03:02.0" > /sys/bus/pci/drivers/firewire_ohci/unbind
      # echo 2 > /sys/module/firewire_ohci/parameters/quirks
      # echo -n "0000:03:02.0" > /sys/bus/pci/drivers/firewire_ohci/bind
      # echo 0 > /sys/module/firewire_ohci/parameters/quirks
      
      The parameter can also be used to switch off quirk flags that were
      hardwired into firewire-ohci's quirks table.  Simply specify a non-zero
      quirks value but without any known flags, e.g. 0x100.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      3e9cc2f3
    • Stefan Richter's avatar
      firewire: ohci: use an ID table for quirks detection · 4a635593
      Stefan Richter authored
      We don't have a lot of quirks to take into account (especially since
      dual-buffer IR is out of the picture), but still, a table-based approach
      is more organized than a series of if () clauses.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      4a635593
    • Stefan Richter's avatar
      firewire: ohci: reorder struct fw_ohci for better cache efficiency · ecb1cf9c
      Stefan Richter authored
      The config_rom struct members are only accessed during relatively
      infrequent self-ID-complete interrupts and only if the local config ROM
      was changed, while the ar_, at_, ir_, it_ members are used very
      frequently during I/O.  Hence move the config_rom members further down.
      
      More importantly, make the huge self_id_buffer member the last one; this
      is only accessed in self-ID-complete interrupts.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      ecb1cf9c
    • Stefan Richter's avatar
      firewire: ohci: remove unused dualbuffer IR code · 6498ba04
      Stefan Richter authored
      This code was no longer used since 2.6.33, "firewire: ohci: always use
      packet-per-buffer mode for isochronous reception" commit 090699c0.  If
      anybody needs this code in the future for special purposes, it can be
      brought back in.  But it must not be re-enabled by default; drivers
      (kernelspace or userspace drivers) should only get this mode if they
      explicitly request it.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      6498ba04
    • Stefan Richter's avatar
    • Stefan Richter's avatar
      firewire: core: change type of a data buffer · 6e95dea7
      Stefan Richter authored
      from array of char to union of structs.  I already used a union to size
      the buffer which holds ioctl arguments; more consequent is to define it
      as an instance of this union in the first place.
      
      Also rename several local variables from "request" to "a"(rgument) since
      the term request can be mistaken to mean a transaction subaction, e.g.
      an instance of struct fw_request.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      6e95dea7
    • Stefan Richter's avatar
      firewire: cdev: increment ABI version number · e94b6d77
      Stefan Richter authored
      so that clients can detect whether the FW_CDEV_IOC_GET_CYCLE_TIMER ioctl
      is reliable (on all tested controllers, especially the widely used VIA
      controllers, also NEC controllers, see commits b677532b and 1c1517ef).
      
      Also add a comment on the 2.6.32 iso xmit enhancement and on dual-buffer
      IR having been disabled in 2.6.33.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      e94b6d77
    • Stefan Richter's avatar
      firewire: cdev: add more flexible cycle timer ioctl · abfe5a01
      Stefan Richter authored
      The system time from CLOCK_REALTIME is not monotonic, hence problematic
      for the main user of the FW_CDEV_IOC_GET_CYCLE_TIMER ioctl.  This issue
      exists in its successor ABI, i.e. raw1394, too.
      http://subversion.ffado.org/ticket/242
      
      We now offer an alternative ioctl which lets the caller choose between
      CLOCK_REALTIME, CLOCK_MONOTONIC, and CLOCK_MONOTONIC_RAW as source of
      the local time, very similar to the clock_gettime libc function.  The
      format of the local time return value matches that of clock_gettime
      (seconds and nanoseconds, instead of a single microseconds value from
      the existing ioctl).
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      abfe5a01
    • Stefan Richter's avatar
      firewire: core: rename an internal function · fd6e0c51
      Stefan Richter authored
      according to what it really does.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      fd6e0c51
    • Stefan Richter's avatar
      firewire: core: fix an information leak · 137d9ebf
      Stefan Richter authored
      If a device exposes a sparsely populated configuration ROM,
      firewire-core's sysfs interface and character device file interface
      showed random data in the gaps between config ROM blocks.  Fix this by
      zero-initialization of the config ROM reader's scratch buffer.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      137d9ebf
    • Stefan Richter's avatar
      firewire: core: increase stack size of config ROM reader · 58aaa542
      Stefan Richter authored
      The stack size of 16 was artificially chosen and may be too small in
      extreme cases.  A device won't be accessible then.
      
      Since it doesn't really matter to the slab allocator whether we ask for
      1088 bytes or 2048 bytes of scratch memory, just allocate 2048 bytes for
      the sum of temporary config ROM image and stack, and we will never ever
      overflow the stack (because there simply can't be more stack items than
      ROM entries).
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      58aaa542
    • Stefan Richter's avatar
      firewire: core: don't fail device creation in case of too large config ROM blocks · 2799d5c5
      Stefan Richter authored
      It never happened yet, but better safe than sorry:  If a device's config
      ROM contains a block which overlaps the boundary at 0xfffff00007ff, just
      ignore that one block instead of refusing to add the device
      representation.  That way, upper layers (kernelspace or userspace
      drivers) might still be able to use the device to some degree.
      
      That's better than total inaccessibility of the device.  Worse, the core
      would have logged only a generic "giving up on config rom" message which
      could only be debugged by feeding a firewire-ohci debug logging session
      through a config ROM interpreter, IOW would likely remain undiagnosed.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      2799d5c5
    • Stefan Richter's avatar
      firewire: core: fix "giving up on config rom" with Panasonic AG-DV2500 · d54423c6
      Stefan Richter authored
      The Panasonic AG-DV2500 tape deck contains an invalid entry in its
      configuration ROM root directory:  A leaf pointer with the undefined key
      ID 0 and an offset that points way out of the standard config ROM area.
      This caused firewire-core to dismiss the device with the generic log
      message "giving up on config rom for node id...", after which it was of
      course impossible to access the tape deck with dvgrab or any other
      program.  https://bugzilla.redhat.com/show_bug.cgi?id=449252#c29
      
      The fix is to simply ignore this invalid ROM entry and proceed to read
      the valid rest of the ROM.  There is a catch though:  When the kernel
      later iterates over the ROM, it would be nasty having to check again for
      such too large ROM offsets.  Therefore we manipulate the defective or
      unsupported ROM entry to become a harmless immediate entry that won't
      have any side effects later (an entry with the value 0x00000000).
      
      Reported-by: George Chriss
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      d54423c6