1. 27 Jul, 2010 16 commits
    • Stefan Richter's avatar
      tools/firewire: nosy-dump: work around segfault in decode_fcp · a8461c0f
      Stefan Richter authored
      If I run "nosy-dump --view=transaction" with my camcorder on battery
      instead of mains, it segfaults very quickly because of !t->request.
      Perhaps this is because of increased likelyhood of incomplete
      transactions (ack_busy when host writes to camcorder's FCP_Request)
      and a bug deeper in nosy-dump's transaction housekeeping.  This is a
      quick workaround to get me going.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      a8461c0f
    • Stefan Richter's avatar
      tools/firewire: nosy-dump: fix it on x86-64 · 1bcc69fb
      Stefan Richter authored
      Replace 'unsigned long' and the (unaffected) 'unsigned int' by uint32_t
      if they represent quadlets.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      1bcc69fb
    • Stefan Richter's avatar
      tools/firewire: add userspace front-end of nosy · 9f6d3c4b
      Stefan Richter authored
      This adds nosy-dump, the userspace part of nosy, the IEEE 1394 traffic
      sniffer for Texas Instruments PCILynx/ PCILynx2 based cards.  Author is
      Kristian Høgsberg.
      
      The files added here are taken from
      git://anongit.freedesktop.org/~krh/nosy commit ee29be97 (2009-11-10)
      with the following changes by Stefan Richter:
        - Parts pertaining to the kernel module removed from Makefile.
        - dist target removed from the Makefile.
        - Mentioned nosy-dump in the Kconfig help to nosy's kernel component.
        - Add copyright notice to nosy-dump.c.  This is a duplicate of the
          respective notice in the kernel component nosy.c except for a time
          span of 2002 - 2006, according to Kristian's git log.
      
      "git shortlog decode-fcp.c list.h nosy-dump.[ch]" from nosy's git
      repository:
      
      Jonathan Woithe (1):
            Save logs on Ctrl-C
      
      Kristian Høgsberg (11):
            Pull over nosy from mercurial repo.
            Remove some fields from default view, add logging feature.
            Use infinite time out for poll(), mark more detail fields.
            Fix byte ordering macro.
            Add decoding of iso data and lock packets.
            Add flag to indicate data length field.
            Add cycle start packet decoding, add --iso and --cycle-start flags.
            Distinguish between phy-packets and 0-length iso data.
            Fix transaction and stats view.
            Add simple AV/C decoder.
            Don't break down on big payloads.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      Acked-by: default avatarKristian Høgsberg <krh@bitplanet.net>
      9f6d3c4b
    • Stefan Richter's avatar
      firewire: nosy: note ioctls in ioctl-number.txt · aed69d2b
      Stefan Richter authored
      These are the ioctls for the special-purpose misc device /dev/nosy, the
      interface to the IEEE 1394 packet sniffer/ protocol analyzer driver.
      Currently only the numbers 00...02 are in use; let's block a few more
      for unforeseen use cases.
      
      Cc: Randy Dunlap <rdunlap@xenotime.net>
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      aed69d2b
    • Stefan Richter's avatar
      firewire: nosy: use generic printk macros · 7429b17d
      Stefan Richter authored
      Replace home-grown printk wrapper macros by ones from kernel.h and
      device.h.
      
      Also raise the log level in set_phy_reg() from debug to error because
      these are really error conditions.  Could even be WARN_ON.  Lower the
      log level in the device probe and driver shutdown from notice to info.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      7429b17d
    • Stefan Richter's avatar
      firewire: nosy: endianess fixes and annotations · fd8c8d46
      Stefan Richter authored
      1.)  The DMA programs (struct pcl) are PCI-endian = little endian data
      (except for the 3rd quadlet in a PCL which the controller does not
      touch).  Annotate them as such.
      
      Fix all accesses of the PCL to work with big endian CPUs also.  Not
      actually tested, I only have a little endian PC to test with.  This
      includes replacement of a bitfield struct pcl_status by open-coded
      shift and mask operations.
      
      2.)  The two __attribute__ ((packed)) at struct pcl are not really
      required since it consists of u32/__le32 only, i.e. there will be no
      padding with or without the attribute.
      
      3.)  The received IEEE 1394 data are byteswapped by the controller from
      IEEE 1394 endian = big endian to PCI endian = little endian because the
      PCL_BIGENDIAN control bit is set.  Therefore annotate the DMA buffer as
      a __le32 array.
      
      Fix the one access of the DMA buffer (the check of the transaction code
      of link packets) to work with big endian CPUs.  Also fix the two
      accesses of the client bounce buffer (the reading of packet length).
      
      4.)  Add a comment to the userspace ABI header that all of the data gets
      out as little endian data, except for the timestamp which is CPU endian.
      (We could make it little endian too, but why?  Vice versa, an ioctl
      could be added to dump packet data in big endian byte order...)
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      fd8c8d46
    • Stefan Richter's avatar
    • Stefan Richter's avatar
      firewire: nosy: fix device shutdown with active client · 424d66ce
      Stefan Richter authored
      Fix race between nosy_open() and remove_card() by replacing the
      unprotected array of card pointers by a mutex-protected list of cards.
      
      Make card instances reference-counted and let each client hold a
      reference.
      
      Notify clients about card removal via POLLHUP in poll()'s events
      bitmap; also let read() fail with errno=ENODEV if the card was removed
      and everything in the buffer was read.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      424d66ce
    • Stefan Richter's avatar
      firewire: nosy: handle errors in device probe · b6d9c125
      Stefan Richter authored
      and add a missing pci_disable_device() to device shutdown.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      b6d9c125
    • Stefan Richter's avatar
      firewire: nosy: fix IRQ handler for card ejection · 16547667
      Stefan Richter authored
      Untested, I don't have a PCILynx CardBus card.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      16547667
    • Stefan Richter's avatar
      firewire: nosy: unroll some simple functions · 55e77c06
      Stefan Richter authored
      nosy_start/stop_snoop() and nosy_add/remove_client() are simple enough
      to be inlined into their callers.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      55e77c06
    • Stefan Richter's avatar
      firewire: nosy: use flagless variants of spinlock accessors · 685c3f80
      Stefan Richter authored
      nosy_start/stop_snoop() are always only called by the ioctl method, i.e.
      with IRQs enabled.  packet_handler() and bus_reset_handler() are always
      only called by the IRQ handler.  Hence neither one needs to track IRQ
      flags.
      
      To underline the call context of packet_handler() and
      bus_reset_handler(), rename these functions to *_irq_handler().
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      685c3f80
    • Stefan Richter's avatar
      firewire: nosy: fix list corruption by NOSY_IOC_STOP · a2d39db9
      Stefan Richter authored
      nosy_stop_snoop() would blow up the second time it was called without
      nosy_start_snoop() in between.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      a2d39db9
    • Stefan Richter's avatar
      firewire: nosy: convert to unlocked ioctl · c7b2a99c
      Stefan Richter authored
      The required serialization of NOSY_IOC_START and NOSY_IOC_STOP is
      already provided by the client_list_lock.
      
      NOSY_IOC_FILTER does not really require serialization since accesses
      to tcode_mask are atomic on any sane CPU architecture.  Nevertheless,
      make it explicit that we want this to be atomic by means of
      client_list_lock (which also surrounds the other tcode_mask access in
      the IRQ handler).  While we are at it, change the type of tcode_mask to
      u32 for consistency with the user API.
      
      NOSY_IOC_GET_STATS does not require serialization against itself.  But
      there is a bug here regarding concurrent updates of the two counters
      by the IRQ handler.  Fix it by taking the client_list_lock in this ioctl
      too.
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      c7b2a99c
    • Stefan Richter's avatar
      firewire: nosy: misc cleanups · b5e47729
      Stefan Richter authored
      Extend copyright note to 2007, c.f. Kristian's git log.
      
      Includes:
        - replace some <asm/*.h> by <linux/*.h>
        - add required indirectly included <linux/spinlock.h>
        - order alphabetically
      
      Coding style related changes:
        - change to utf8
        - normalize whitespace
        - normalize comment style
        - remove usages of __FUNCTION__
        - remove an unnecessary cast from void *
      
      Const and static declarations:
        - driver_name is not const in pci_driver.name, drop const qualifier
        - driver_name can be taken from KBUILD_MODNAME
        - the global variable minors[] can and should be static
        - constify struct file_operations instance
      
      Data types:
        - Remove unused struct member struct packet.code.  struct packet is
          only used for driver-internal bookkeeping; it does not appear on the
          wire or in DMA programs or the userspace ABI.  Hence the unused
          member .code can be removed without worries.
      
      Preprocessor macros:
        - unroll a preprocessor macro that containd a return
        - use list_for_each_entry
      
      Printk:
        - add missing terminating \n in some format strings
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      b5e47729
    • Stefan Richter's avatar
      firewire: new driver: nosy - IEEE 1394 traffic sniffer · 28646821
      Stefan Richter authored
      This adds the traffic sniffer driver for Texas Instruments PCILynx/
      PCILynx2 based cards.  The use cases for nosy are analysis of
      nonstandard protocols and as an aid in development of drivers,
      applications, or firmwares.
      
      Author of the driver is Kristian Høgsberg.  Known contributers are
      Jody McIntyre and Jonathan Woithe.
      
      Nosy programs PCILynx chips to operate in promiscuous mode, which is a
      feature that is not found in OHCI-1394 controllers.  Hence, only special
      hardware as mentioned in the Kconfig help text is suitable for nosy.
      
      This is only the kernelspace part of nosy.  There is a userspace
      interface to it, called nosy-dump, proposed to be added into the tools/
      subdirectory of the kernel sources in a subsequent change.  Kernelspace
      and userspave component of nosy communicate via a 'misc' character
      device file called /dev/nosy with a simple ioctl() and read() based
      protocol, as described by nosy-user.h.
      
      The files added here are taken from
      git://anongit.freedesktop.org/~krh/nosy commit ee29be97 (2009-11-10)
      with the following changes by Stefan Richter:
        - Kconfig and Makefile hunks are written from scratch.
        - Commented out version printk in nosy.c.
        - Included missing <linux/sched.h>, reported by Stephen Rothwell.
      
      "git shortlog nosy{-user.h,.c,.h}" from nosy's git repository:
      
      Jonathan Woithe (2):
            Nosy updates for recent kernels
            Fix uninitialised memory (needed for 2.6.31 kernel)
      
      Kristian Høgsberg (5):
            Pull over nosy from mercurial repo.
            Use a misc device instead.
            Add simple AV/C decoder.
            Don't break down on big payloads.
            Set parent device for misc device.
      
      As a low-level IEEE 1394 driver, its files are placed into
      drivers/firewire/ although nosy is not part of the firewire driver
      stack.
      
      I am aware of the following literature from Texas Instruments about
      PCILynx programming:
            SCPA020A - PCILynx 1394 to PCI Bus Interface TSB12LV21BPGF
                       Functional Specification
            SLLA023  - Initialization and Asynchronous Programming of the
                       TSB12LV21A 1394 Device
      Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
      Acked-by: default avatarKristian Høgsberg <krh@bitplanet.net>
      28646821
  2. 16 May, 2010 6 commits
  3. 15 May, 2010 17 commits
  4. 14 May, 2010 1 commit