IEEE 1394 updates for Linux 2.6.29.y (v1021 2009-11-23) Documentation/debugging-via-ohci1394.txt | 8 drivers/firewire/Kconfig | 60 drivers/firewire/Makefile | 12 drivers/firewire/core-card.c | 557 ++++ drivers/firewire/core-cdev.c | 1481 ++++++++++++ drivers/firewire/core-device.c | 1228 ++++++++++ drivers/firewire/core-iso.c | 338 ++ drivers/firewire/core-topology.c | 575 ++++ drivers/firewire/core-transaction.c | 975 +++++++ drivers/firewire/core.h | 222 + drivers/firewire/fw-card.c | 547 ---- drivers/firewire/fw-cdev.c | 1049 -------- drivers/firewire/fw-device.c | 1083 -------- drivers/firewire/fw-device.h | 187 - drivers/firewire/fw-iso.c | 158 - drivers/firewire/fw-ohci.c | 2619 --------------------- drivers/firewire/fw-ohci.h | 157 - drivers/firewire/fw-sbp2.c | 1653 ------------- drivers/firewire/fw-topology.c | 563 ---- drivers/firewire/fw-topology.h | 76 drivers/firewire/fw-transaction.c | 979 -------- drivers/firewire/fw-transaction.h | 482 --- drivers/firewire/net.c | 1655 +++++++++++++ drivers/firewire/ohci.c | 2688 ++++++++++++++++++++++ drivers/firewire/ohci.h | 157 + drivers/firewire/sbp2.c | 1668 +++++++++++++ drivers/ieee1394/Kconfig | 19 drivers/ieee1394/csr.c | 8 drivers/ieee1394/dv1394.c | 2 drivers/ieee1394/eth1394.c | 4 drivers/ieee1394/highlevel.c | 2 drivers/ieee1394/nodemgr.c | 4 drivers/ieee1394/nodemgr.h | 2 drivers/ieee1394/ohci1394.c | 8 drivers/ieee1394/raw1394.c | 18 drivers/ieee1394/sbp2.c | 13 drivers/ieee1394/sbp2.h | 8 drivers/ieee1394/video1394.c | 2 drivers/media/dvb/firewire/Kconfig | 7 drivers/media/dvb/firewire/Makefile | 1 drivers/media/dvb/firewire/firedtv-1394.c | 42 drivers/media/dvb/firewire/firedtv-avc.c | 735 +++--- drivers/media/dvb/firewire/firedtv-dvb.c | 16 drivers/media/dvb/firewire/firedtv-fe.c | 8 drivers/media/dvb/firewire/firedtv-fw.c | 376 +++ drivers/media/dvb/firewire/firedtv-rc.c | 2 drivers/media/dvb/firewire/firedtv.h | 23 include/linux/firewire-cdev.h | 226 + include/linux/firewire.h | 419 +++ 49 files changed, 13106 insertions(+), 10016 deletions(-) Date: Sat, 21 Nov 2009 00:05:56 +0100 (CET) From: Jay Fenlason firewire: ohci: pass correct iso xmit timestamps to core 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: Jay Fenlason 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: Stefan Richter --- drivers/firewire/ohci.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) Date: Wed, 18 Nov 2009 20:03:31 +0100 (CET) From: Stefan Richter firedtv: reduce memset()s Before each FCP transdaction, the entire 512 bytes of the FCP frame were cleared, then values filled in. Clear only the bytes between filled-in bytes and end of the - request frame, or - response frame if data from a larger response will be needed, or - whole frame if data from a variable length response will be taken. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-avc.c | 146 ++++++++++------------- 1 file changed, 65 insertions(+), 81 deletions(-) Date: Wed, 18 Nov 2009 20:03:03 +0100 (CET) From: Stefan Richter firedtv: remove check for interrupting signal FCP transactions as well as CMP transactions were serialized with mutex_lock_interruptible. It is extremely unlikly though that a signal will arrive while a concurrent process holds the mutex. And even if one does, the duration of a transaction is reasonably short (1.2 seconds if all retries time out, usually much shorter). Hence simplify the code to plain mutex_lock. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-avc.c | 51 ++++++++--------------- 1 file changed, 17 insertions(+), 34 deletions(-) Date: Wed, 18 Nov 2009 20:02:01 +0100 (CET) From: Stefan Richter firedtv: do not DMA-map stack addresses This is a portability fix and reduces stack usage. The DMA mapping API cannot map on-stack addresses, as explained in Documentation/DMA-mapping.txt. Convert the two cases of on-stack packet payload buffers in firedtv (payload of write requests in avc_write and of lock requests in cmp_lock) to slab-allocated memory. We use the 512 bytes sized FCP frame buffer in struct firedtv for this purpose. Previously it held only incoming FCP responses, now it holds pending FCP requests and is then overwriten by an FCP response from the tuner subunit. Ditto for CMP lock requests and responses. Accesses to the payload buffer are serialized by fdtv->avc_mutex. As a welcome side effect, stack usage of the AV/C transaction functions is reduced by 512 bytes. Alas, avc_register_remote_control() is a special case: It previously did not wait for a response. To fit better in with the other FCP transactions, let it wait for an interim response. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-1394.c | 9 + drivers/media/dvb/firewire/firedtv-avc.c | 437 +++++++++++++--------- drivers/media/dvb/firewire/firedtv-dvb.c | 1 - drivers/media/dvb/firewire/firedtv-fw.c | 2 drivers/media/dvb/firewire/firedtv.h | 6 5 files changed, 264 insertions(+), 191 deletions(-) Date: Wed, 18 Nov 2009 20:01:34 +0100 (CET) From: Stefan Richter firedtv: remove an unnecessary function argument All read transactions initiated by firedtv are only quadlet-sized, hence the backend->read call can be simplified a little. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-1394.c | 4 ++-- drivers/media/dvb/firewire/firedtv-avc.c | 8 ++++---- drivers/media/dvb/firewire/firedtv-fw.c | 5 ++--- drivers/media/dvb/firewire/firedtv.h | 2 +- 4 files changed, 9 insertions(+), 10 deletions(-) Date: Wed, 18 Nov 2009 20:01:14 +0100 (CET) From: Stefan Richter firedtv: packet requeuing is likely to succeed Packet DMA buffers are queued either initially all at once (then, a queueing failure will cause firedtv to release the DMA context as a whole) or subsequently one by one as they recycled after use (then a failure is extremely unlikely). Therefore we can be a little less cautious when counting at which packet buffer to set the interrupt flag. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-fw.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) Date: Wed, 18 Nov 2009 20:00:55 +0100 (CET) From: Stefan Richter firedtv: shrink buffer pointer table Cache only addresses of whole pages, not of each buffer chunk. Besides, page addresses can be obtained by page_address() instead of kmap() since they were allocated in lowmem. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-fw.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) Date: Tue, 17 Nov 2009 12:29:17 -0500 From: Jay Fenlason firewire: ohci: Make cycleMatch ISO transmission work 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: Jay Fenlason Signed-off-by: Stefan Richter (edited comment) --- drivers/firewire/ohci.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) Date: Fri, 13 Nov 2009 12:53:08 +0100 (CET) From: Akinobu Mita ieee1394: Use hweight32 Use hweight32 instead of counting for each bit Signed-off-by: Akinobu Mita Signed-off-by: Stefan Richter (add required include) --- drivers/ieee1394/ohci1394.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) Date: Sun, 8 Nov 2009 22:30:54 +0100 (CET) From: Stefan Richter firedtv: port to new firewire core The firedtv DVB driver will now work not only on top of the old ieee1394 driver stack but also on the new firewire driver stack. Alongside to the firedtv-1394.c backend for driver binding and I/O, the firedtv-fw.c backend is added. Depending on which of the two 1394 stacks is configured, one or the other or both backends will be built into the firedtv driver. This has been tested with a DVB-T and a DVB-C box on x86-64 and x86-32 together with a few different controllers (Agere FW323, a NEC chip, TI TSB82AA2, TSB43AB22/A, VIA VT6306). Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/Kconfig | 7 + drivers/media/dvb/firewire/Makefile | 1 + drivers/media/dvb/firewire/firedtv-1394.c | 6 drivers/media/dvb/firewire/firedtv-dvb.c | 15 + drivers/media/dvb/firewire/firedtv-fw.c | 385 ++++++++++++++++++++++ drivers/media/dvb/firewire/firedtv.h | 15 + 6 files changed, 420 insertions(+), 9 deletions(-) Date: Sun, 8 Nov 2009 22:29:41 +0100 (CET) From: Stefan Richter firedtv: add missing include, rename a constant Add #include for dvb_dmx_swfilter_packets(). This was already indirectly included via firedtv.h, but don't rely on it. The 4 bytes which were referred to as FIREWIRE_HEADER_SIZE are actually the source packet header from IEC 61883-4 (MPEG2-TS data transmission over 1394), not e.g. the IEEE 1394 isochronous packet header. So choose a more precise name. Also, express the payload size as a preprocessor constant too. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-1394.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) Date: Sun, 8 Nov 2009 22:29:08 +0100 (CET) From: Stefan Richter firedtv: reform lock transaction backend call Preparation for the port of firedtv to the firewire-core kernel API: The fdtv->backend->lock() hook and thus the CMP code is slightly changed to better fit with the new API. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-1394.c | 11 ++++- drivers/media/dvb/firewire/firedtv-avc.c | 50 ++++++++++++---------- drivers/media/dvb/firewire/firedtv.h | 2 3 files changed, 37 insertions(+), 26 deletions(-) Date: Sun, 8 Nov 2009 22:28:45 +0100 (CET) From: Stefan Richter firedtv: move remote control workqueue handling into rc source file Preparation for the port of firedtv to the firewire-core kernel API: Canceling of the remote control workqueue job is factored into firedtv-rc.c. Plus trivial whitespace change. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-1394.c | 5 +++-- drivers/media/dvb/firewire/firedtv-rc.c | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) Date: Sat, 17 Oct 2009 22:46:25 +0200 (CEST) From: Stefan Richter firedtv: fix regression: tuning fails due to bogus error return Since 2.6.32(-rc1), DVB core checks the return value of dvb_frontend_ops.set_frontend. Now it becomes apparent that firedtv always returned a bogus value from its set_frontend method. Signed-off-by: Stefan Richter [commit modified by Mauro Carvalho Chehab ] --- drivers/media/dvb/firewire/firedtv-fe.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) Date: Thu, 15 Oct 2009 21:16:53 +0200 (CEST) From: Stefan Richter firewire: cdev: reduce stack usage by ioctl_dispatch Replace a hardcoded buffer size by a sizeof union {}. This shrinks the stack-allocated ioctl argument buffer from 256 to 40 bytes. (This is not much, but subsequent stack usage particularly by the queue_iso ioctl handler adds up.) The new form is also easier to keep up to date than a hardcoded size if more ioctls are added. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) Date: Wed, 14 Oct 2009 20:40:10 +0200 (CEST) From: Stefan Richter firewire: ohci: 0 may be a valid DMA address 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: Stefan Richter --- drivers/firewire/core-transaction.c | 4 ++-- drivers/firewire/ohci.c | 9 +++++---- include/linux/firewire.h | 1 + 3 files changed, 8 insertions(+), 6 deletions(-) Date: Wed, 14 Oct 2009 20:37:36 +0200 (CEST) From: Stefan Richter firewire: core: WARN on wrong usage of core transaction functions In the code path which creates request packets, clearly mark a switch branch which must never be reached with a WARN. In the code path which creates response packets, replace a BUG by a friendlier to debug WARN. Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) Date: Thu, 8 Oct 2009 00:42:53 +0200 (CEST) From: Stefan Richter firewire: core: optimize Topology Map creation The Topology Map of the local node was created in CPU byte order, then a temporary big endian copy was created to compute the CRC, and when a read request to the Topology Map arrived it had to be converted to big endian byte order again. We now generate it in big endian byte order in the first place. This also rids us of 1000 bytes stack usage in tasklet context. Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 17 ++--------------- drivers/firewire/core-topology.c | 17 ++++++++++------- drivers/firewire/core-transaction.c | 9 ++------- drivers/firewire/core.h | 2 +- include/linux/firewire.h | 2 +- 5 files changed, 16 insertions(+), 31 deletions(-) Date: Thu, 8 Oct 2009 00:42:27 +0200 (CEST) From: Stefan Richter firewire: core: clarify generate_config_rom usage Move the static config ROM buffer into the scope of the two callers of generate_config_rom(). That way the ROM length can be passed over as return value rather than through a pointer argument. It also becomes more obvious that accesses to the config ROM buffer have to be serialized and how this is accomplished. And firewire-core.ko shrinks a bit as well. Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) Date: Thu, 8 Oct 2009 00:41:59 +0200 (CEST) From: Stefan Richter firewire: optimize config ROM creation 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: Stefan Richter --- drivers/firewire/core-card.c | 62 +++++++++++++++++++++-------------- drivers/firewire/core.h | 7 ++-- drivers/firewire/ohci.c | 30 +++++++++++------ include/linux/firewire.h | 14 -------- 4 files changed, 60 insertions(+), 53 deletions(-) Date: Thu, 8 Oct 2009 00:41:38 +0200 (CEST) From: Stefan Richter firewire: cdev: normalize variable names Unify some names: - "e" for pointers to subtypes of struct event, - "event" for struct members and pointers to struct event, - "r" for pointers to subtypes of struct client_resource, - "resource" for struct members and pointers to struct client_resource, - other names for struct members and pointers to other types. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 46 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 23 deletions(-) Date: Thu, 8 Oct 2009 00:41:10 +0200 (CEST) From: Stefan Richter firewire: normalize style of queue_work wrappers A few stylistic changes to unify some code patterns in the subsystem: - The similar queue_delayed_work helpers fw_schedule_bm_work, schedule_iso_resource, and sbp2_queue_work now have the same call convention. - Two conditional calls of schedule_iso_resource are factored into another small helper. - An sbp2_target_get helper is added as counterpart to sbp2_target_put. Object size of firewire-core is decreased a little bit, object size of firewire-sbp2 remains unchanged. Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 5 +---- drivers/firewire/core-cdev.c | 38 +++++++++++++++++----------------- drivers/firewire/sbp2.c | 9 ++++++-- 3 files changed, 27 insertions(+), 25 deletions(-) Date: Thu, 8 Oct 2009 00:39:56 +0200 (CEST) From: Stefan Richter firewire: cdev: fix memory leak in an error path If copy_from_user in an FW_CDEV_IOC_SEND_RESPONSE ioctl failed, an inbound_transaction_resource instance is no longer referenced and needs to be freed. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) Date: Thu, 8 Oct 2009 00:39:31 +0200 (CEST) From: Stefan Richter firewire: sbp2: provide fallback if mgt_ORB_timeout is missing The Unit_Characteristics entry of an SBP-2 unit directory is not mandatory as far as I can tell. If it is missing, we would probably fail to log in into the target because firewire-sbp2 would not wait for status after it sent the login request. The fix moves the cleanup of tgt->mgt_orb_timeout into a place where it is executed exactly once before login, rather than 0..n times depending on the target's config ROM. With targets with one or more Unit_Characteristics entries, the result is the same as before. Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) Date: Sat, 3 Oct 2009 10:37:58 +0200 (CEST) From: Henrik Kurelid firedtv: length field corrupt in ca2host if length>127 This solves a problem in firedtv that has become major for Swedish DVB-T users the last month or so. It will most likely solve issues seen by other users as well. If the length of an AVC message is greater than 127, the length field should be encoded in LV mode instead of V mode. V mode can only be used if the length is 127 or less. This patch ensures that the CA_PMT message is always encoded in LV mode so PMT message of greater lengths can be supported. Signed-off-by: Henrik Kurelid Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-avc.c | 38 ++++++++++++----------- 1 file changed, 20 insertions(+), 18 deletions(-) Date: Tue, 29 Sep 2009 15:13:58 -0700 From: "Justin P. Mattock" ieee1394: update URLs in debugging-via-ohci1394.txt Update URLs of the userspace tools to use ohci1394_dma=early for debugging. Seems the address ftp://ftp.suse.de/private/bk/firewire/tools/* is not very helpful. After a quick search, seems this was talked about: http://www.mail-archive.com/kgdb-bugreport@lists.sourceforge.net/msg02761.html (can't find the original thread). Signed-off-by: Justin P. Mattock Signed-off-by: Stefan Richter --- Documentation/debugging-via-ohci1394.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Date: Sun, 6 Sep 2009 19:34:17 +0200 (CEST) From: Stefan Richter ieee1394: sbp2: remove a workaround for Momobay FX-3A The inquiry delay is not necessary anymore in tests on a recent kernel. Signed-off-by: Stefan Richter --- drivers/ieee1394/sbp2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) Date: Sun, 6 Sep 2009 19:33:50 +0200 (CEST) From: Stefan Richter firewire: sbp2: remove a workaround for Momobay FX-3A The inquiry delay does more harm than good in tests on a recent kernel. Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) Date: Sun, 6 Sep 2009 18:51:27 +0200 (CEST) From: Stefan Richter firewire: sbp2: fix status reception Per SBP-2 clause 5.3, a target shall store 8...32 bytes of status information. Trailing zeros after the first 8 bytes don't need to be stored, they are implicit. Fix the status write handler to clear all unwritten status data. Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) Date: Tue, 8 Sep 2009 01:13:53 +0200 (CEST) From: Stefan Richter firewire: core: fix topology map response handler This register is 1 kBytes large. Adjust topology_map.length to prevent registration of other response handlers in this region and to make sure that we respond to requests to the upper half of the register. Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Sun, 6 Sep 2009 18:50:29 +0200 (CEST) From: Stefan Richter firewire: core: fix race with parallel PCI device probe The config ROM buffer received from generate_config_rom is a globally shared static buffer. Extend the card_mutex protection in fw_add_card until after the config ROM was copied into the card driver's buffer. Otherwise, parallelized card driver probes may end up with ROM contents that were meant for a different card. firewire-ohci's card->driver->enable hook is safe to be called within the card_mutex. Furthermore, it is safe to reorder card_list update versus card enable, which simplifies the code a little. Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) Date: Sun, 6 Sep 2009 18:49:48 +0200 (CEST) From: Stefan Richter firewire: core: header file cleanup fw_card_get, fw_card_put, fw_card_release are currently not exported for use outside the firewire-core. Move their definitions/ declarations from the subsystem header file to the core header file. Signed-off-by: Stefan Richter --- drivers/firewire/core.h | 14 ++++++++++++++ include/linux/firewire.h | 14 -------------- 2 files changed, 14 insertions(+), 14 deletions(-) Date: Sun, 6 Sep 2009 18:49:17 +0200 (CEST) From: Stefan Richter firewire: ohci: fix Self ID Count register mask (safeguard against buffer overflow) 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: Stefan Richter --- drivers/firewire/ohci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Date: Sat, 5 Sep 2009 13:23:49 +0200 (CEST) From: Stefan Richter firewire: core: fix crash in iso resource management This fixes a regression due to post 2.6.30 commit "firewire: core: do not DMA-map stack addresses" 6fdc03709433ccc2005f0f593ae9d9dd04f7b485. As David Moore noted, a previously correct sizeof() expression became wrong since the commit changed its argument from an array to a pointer. This resulted in an oops in ohci_cancel_packet in the shared workqueue thread's context when an isochronous resource was to be freed. Reported-by: Jonathan Cameron Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 2 ++ drivers/firewire/core-iso.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) Date: Thu, 3 Sep 2009 23:07:35 +0200 (CEST) From: Stefan Richter firewire: sbp2: fix freeing of unallocated memory If a target writes invalid status (typically status of a command that already timed out), firewire-sbp2 attempts to put away an ORB that doesn't exist. https://bugzilla.redhat.com/show_bug.cgi?id=519772 Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Date: Fri, 28 Aug 2009 13:26:03 +0200 (CEST) From: Stefan Richter firewire: ohci: fix Ricoh R5C832, video reception In dual-buffer DMA mode, no video frames are ever received from R5C832 by libdc1394. Fallback to packet-per-buffer DMA works reliably. http://thread.gmane.org/gmane.linux.kernel.firewire.devel/13393/focus=13476 Reported-by: Jonathan Cameron Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 5 +++++ 1 file changed, 5 insertions(+) Date: Fri, 28 Aug 2009 13:25:15 +0200 (CEST) From: Stefan Richter firewire: ohci: fix Agere FW643 and multiple cameras An Agere FW643 OHCI 1.1 card works fine for video reception from one camera but fails early if receiving from two cameras. After a short while, no IR IRQ events occur and the context control register does not react anymore. This happens regardless whether both IR DMA contexts are dual-buffer or one is dual-buffer and the other packet-per-buffer. This can be worked around by disabling dual buffer DMA mode entirely. http://sourceforge.net/mailarchive/message.php?msg_name=4A7C0594.2020208%40gmail.com (Reported by Samuel Audet.) In another report (by Jonathan Cameron), an FW643 works OK with two cameras in dual buffer mode. Whether this is due to different chip revisions or different usage patterns (different video formats) is not yet clear. However, as far as the current capabilities of firewire-core's isochronous I/O interface are concerned, simply switching off dual-buffer on non-working and working FW643s alike is not a problem in practice. We only need to revisit this issue if we are going to enhance the interface, e.g. so that applications can explicitly choose modes. Reported-by: Samuel Audet Reported-by: Jonathan Cameron Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 9 +++++++++ 1 file changed, 9 insertions(+) Date: Sat, 1 Aug 2009 13:05:16 +0200 (CEST) From: Stefan Richter firedtv: combine some debug logging code Shrinks source and kernel object size a bit. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-avc.c | 109 ++++++++++------------- 1 file changed, 49 insertions(+), 60 deletions(-) Date: Sat, 1 Aug 2009 13:04:06 +0200 (CEST) From: Henrik Kurelid firedtv: refine AVC debugging The current AVC debugging can clog the log down a lot since many applications tend to check the signal strength very often. This patch enables users to select which AVC messages to log using a bitmask. In addition, it also enables the possibility to debug application PMTs sent to the driver. This will be usable since the CA support is still poorly tested for lots of CAMs and CA systems. Signed-off-by: Henrik Kurelid Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-avc.c | 78 +++++++++++++++++++---- 1 file changed, 66 insertions(+), 12 deletions(-) Date: Sat, 1 Aug 2009 13:02:38 +0200 (CEST) From: Henrik Kurelid firedtv: add PID filtering for SW zigzag retune The AVC protocol uses the same command for tuning and PID filtering and since dvb-core uses a software zigzagging to do automatic retuning this could cause all PID filters to be cleared. PID filter information is now included in all DSD commands to the card. Background: There is a problem in the firedtv driver that causes recordings to stop if the SW zigzag algorithm in dvb-core kicks in with a retune after the application has set up the PID filters. Since tuning and setting PID filters uses the same AVC command (DSD) and only the replace subfunction is supported by the card, it is not possible to do a retune without setting the PID filters. This means that the PID filtering has to be sent in each tune. This problem applies to C and T cards since S and S2 cards tune using a vendor specific command. The patch corrects the problem by sending the PID list in each tune. I have tested it on my T card with a good result. How to trigger problem: Zap to a channel and output AV to a file, e.g. "tzap -c channels.conf SVT1 -r -o SVT1.ts". After a short while, pull the antenna cable from the card. The lock on the channel will disappear and the TS file will stop increasing in size. Wait a couple of seconds. Replug the cable again. You will get a lock on the channel again, but the TS file will never increase in size agains sinze no PIDS are filtered. Signed-off-by: Henrik Kurelid Tested with kaffeine with DVB-T and DVB-C: Fixes retuning after antenna was plugged out and back in with DVB-T. Does not fix this with DVB-C, but also doesn't regress on DVB-C. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-avc.c | 40 +++++++++++++++++------ 1 file changed, 30 insertions(+), 10 deletions(-) Date: Sun, 19 Jul 2009 21:40:39 +0200 From: Michael Buesch ieee1394: raw1394: Do not leak memory on failed trylock. Do not leak the allocated memory in case the mutex_trylock() failed to acquire the lock. Signed-off-by: Michael Buesch This bug does not happen in practice: All raw1394 clients use libraw1394, and accesses to a libraw1394 handle need to be serialized by the client. This is documented in libraw1394's API reference. Signed-off-by: Stefan Richter --- drivers/ieee1394/raw1394.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Date: Tue, 30 Jun 2009 20:28:31 +0200 (CEST) From: Stefan Richter ieee1394: sbp2: add support for disks >2 TB (and 16 bytes long CDBs) Increase the command ORB data structure to transport up to 16 bytes long CDBs (instead of 12 bytes), and tell the SCSI mid layer about it. This is notably necessary for READ CAPACITY(16) and friends, i.e. support of large disks. Signed-off-by: Stefan Richter --- drivers/ieee1394/sbp2.c | 1 + drivers/ieee1394/sbp2.h | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) Date: Tue, 30 Jun 2009 20:27:59 +0200 (CEST) From: Stefan Richter firewire: sbp2: add support for disks >2 TB (and 16 bytes long CDBs) Increase the command ORB data structure to transport up to 16 bytes long CDBs (instead of 12 bytes), and tell the SCSI mid layer about it. This is notably necessary for READ CAPACITY(16) and friends, i.e. support of large disks. Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) Date: Sat, 20 Jun 2009 13:23:59 +0200 (CEST) From: Stefan Richter firewire: core: do not DMA-map stack addresses The DMA mapping API cannot map on-stack addresses, as explained in Documentation/DMA-mapping.txt. Convert the two cases of on-stack packet payload buffers in firewire-core (payload of lock requests in the bus manager work and in iso resource management) to slab-allocated memory. There are a number on-stack buffers for quadlet write or quadlet read requests in firewire-core and firewire-sbp2. These are harmless; they are copied to/ from card driver internal DMA buffers since quadlet payloads are inlined with packet headers. Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 14 +++++++------- drivers/firewire/core-cdev.c | 4 +++- drivers/firewire/core-iso.c | 24 +++++++++++++----------- drivers/firewire/core.h | 3 ++- include/linux/firewire.h | 1 + 5 files changed, 26 insertions(+), 20 deletions(-) Date: Tue, 16 Jun 2009 22:36:34 +0200 (CEST) From: Stefan Richter firewire: new stack is no longer experimental The new stack is now recommended over the old one if used for industrial video (IIDC/DCAM) or for storage devices (SBP-2) due to better performance, improved compatibility, added features, and security. It should also be functionally on par with and is more secure than the old ieee1394 stack in the use case of consumer video devices. IP-over-1394 support for the new stack is currently emerging, and a backend of the firedtv DVB driver to the new stack should be available soon. The one remaining area where the old stack is still required are audio devices, as the new stack is not yet able to support the FFADO FireWire audio framework. Signed-off-by: Stefan Richter --- drivers/firewire/Kconfig | 52 ++++++++++++++++++--------------------- drivers/ieee1394/Kconfig | 19 ++++---------- 2 files changed, 30 insertions(+), 41 deletions(-) Date: Tue, 16 Jun 2009 22:35:32 +0200 (CEST) From: Stefan Richter firewire: net: better FIFO address range check and rcodes The AR req handler should not check the generation; higher level code is the better place to handle bus generation changes. The target node ID just needs to be checked for not being the "all nodes" address; in this case don't handle the request and don't respond. Use Address_Error and Type_Error rcodes as appropriate. Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) Date: Tue, 16 Jun 2009 20:43:55 +0200 (CEST) From: Stefan Richter firewire: net: fix card driver reloading Fix some problems from "firewire: net: allow for unordered unit discovery": - fwnet_remove was missing a list_del, causing fwnet_probe to crash if called after fwnet_remove, e.g. if firewire-ohci was unloaded and reloaded. - fwnet_probe should set its new_netdev flag only if it actually allocated a net_device. - Use dev_set_drvdata and dev_get_drvdata instead of deprecated direct access to device.driver_data. Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) Date: Tue, 16 Jun 2009 19:15:25 +0200 (CEST) From: Stefan Richter firewire: core: fix iso context shutdown on card removal If isochronous contexts existed when firewire-ohci was unloaded, the core iso shutdown functions crashed with NULL dereferences, and buffers etc. weren't released. How the fix works: We first copy the card driver's iso shutdown hooks into the dummy driver, then fw_destroy_nodes notifies upper layers of devices going away, these should shut down (including their iso contexts), wait_for_completion(&card->done) will be triggered after upper layers gave up all fw_device references, after which the card driver's shutdown proceeds. Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) Date: Mon, 15 Jun 2009 00:38:50 +0200 (CEST) From: Stefan Richter firewire: core: fix DMA unmapping in iso buffer removal dmap_unmap_page() shall use the same direction as dma_map_page(). Signed-off-by: Stefan Richter --- drivers/firewire/core-iso.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Date: Sun, 14 Jun 2009 11:47:44 +0200 (CEST) From: Stefan Richter firewire: net: adjust net_device ops The .ndo_tx_timeout callback is currently without function; delete it. Give .watchdog_timeo a proper time value; lower it to 2 seconds. Decrease the .tx_queue_len from 1000 (as in Ethernet card drivers) to 10 because we have only 64 transaction labels available, and responders might have further limits of their AR req contexts. Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) Date: Sun, 14 Jun 2009 11:46:57 +0200 (CEST) From: Stefan Richter firewire: net: remove unused code Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) Date: Sun, 14 Jun 2009 11:45:27 +0200 (CEST) From: Stefan Richter firewire: net: allow for unordered unit discovery Decouple the creation and destruction of the net_device from the order of discovery and removal of nodes with RFC 2734 unit directories since there is no reliable order. The net_device is now created when the first RFC 2734 unit on a card is discovered, and destroyed when the last RFC 2734 unit on a card went away. This includes all remote units as well as the local unit, which is therefore tracked as a peer now too. Also, locking around the list of peers is slightly extended to guard against peer removal. As a side effect, fwnet_peer.pdg_lock has become superfluous and is deleted. Peer data (max_rec, speed, node ID, generation) are updated more carefully. Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 2 - drivers/firewire/net.c | 454 ++++++++++++++++------------------- include/linux/firewire.h | 4 - 3 files changed, 207 insertions(+), 253 deletions(-) Date: Sun, 7 Jun 2009 22:57:53 +0200 From: Stefan Richter firewire: net: style changes Change names of types, variables, functions. Omit debug code. Use get_unaligned*, put_unaligned*. Annotate big endian data. Handle errors in __init. Change whitespace. Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 2 drivers/firewire/net.c | 2073 +++++++++++++++++------------------ include/linux/firewire.h | 9 - 3 files changed, 985 insertions(+), 1099 deletions(-) Date: Sun, 7 Jun 2009 22:57:53 +0200 From: Stefan Richter firewire: net: add Kconfig item, rename driver The driver is now called firewire-net. It might implement the transport of other networking protocols in the future, notably IPv6 per RFC 3146. Signed-off-by: Stefan Richter --- drivers/firewire/Kconfig | 12 + drivers/firewire/Makefile | 6 drivers/firewire/fw-ipv4.c | 1819 ------------------------------------- drivers/firewire/net.c | 1819 +++++++++++++++++++++++++++++++++++++ drivers/ieee1394/Kconfig | 2 5 files changed, 1835 insertions(+), 1823 deletions(-) Date: Mon, 18 May 2009 13:08:06 -0400 From: Jay Fenlason firewire: add IPv4 support Implement IPv4 over IEEE 1394 as per RFC 2734 for the newer firewire stack. This feature has only been present in the older ieee1394 stack via the eth1394 driver. Still to do: - fix ipv4_priv and ipv4_node lifetime logic - fix determination of speeds and max payloads - fix bus reset handling - fix unaligned memory accesses - fix coding style - further testing/ improvement of fragment reassembly - perhaps multicast support Signed-off-by: Jay Fenlason Signed-off-by: Stefan Richter (rebased, copyright note, changelog) --- drivers/firewire/Makefile | 2 + drivers/firewire/core-card.c | 4 + drivers/firewire/core-iso.c | 7 + drivers/firewire/core.h | 87 -- drivers/firewire/fw-ipv4.c | 1819 +++++++++++++++++++++++++++++++++++ include/linux/firewire.h | 94 ++ 6 files changed, 1926 insertions(+), 87 deletions(-) Date: Sun, 14 Jun 2009 13:23:58 +0200 (CEST) From: Stefan Richter firewire: core: use more outbound tlabels Tlabel is a 6 bits wide datum. Wrap it after 63 rather than 31 for more safety against transaction label exhaustion and potential responders' transaction layer bugs. (As noted by Guus Sliepen, this change requires an expansion of tlabel_mask to 64 bits.) Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 8 ++++---- include/linux/firewire.h | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) Date: Tue, 9 Jun 2009 23:56:55 +0200 (CEST) From: Stefan Richter firewire: core: don't update Broadcast_Channel if RFC 2734 conditions aren't met This extra check will avoid Broadcast_Channel register related traffic to many IIDC, SBP-2, and AV/C devices which aren't IRMC or have a max_rec < 8 (i.e. support < 512 bytes async payload). This avoids a little bit of traffic after bus reset and is even more careful with devices which don't implement this CSR. The assumption is that no other protocol than IP over 1394 uses the broadcast channel for streams. Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 18 +++++++++++++++++- include/linux/firewire.h | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) Date: Sat, 6 Jun 2009 18:37:25 +0200 (CEST) From: Stefan Richter firewire: core: prepare for non-core children of card devices The IP-over-1394 driver will add child devices beneath card devices which are not of type fw_device. Hence firewire-core's callbacks in device_for_each_child() and device_find_child() need to check for the device type now. Initial version written by Jay Fenlason. Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 8 +------- drivers/firewire/core-device.c | 24 ++++++++++++++++++++---- drivers/firewire/core.h | 2 +- 3 files changed, 22 insertions(+), 12 deletions(-) Date: Sat, 6 Jun 2009 18:36:24 +0200 (CEST) From: Stefan Richter firewire: core: include linux/uaccess.h instead of asm/uaccess.h Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Sat, 6 Jun 2009 18:35:27 +0200 (CEST) From: Stefan Richter firewire: add parent-of-unit accessor Retrieval of an fw_unit's parent is a common pattern in high-level code. Wrap it up as device = fw_parent_device(unit). Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 4 ++-- drivers/firewire/sbp2.c | 37 +++++++++++++++++++++---------------- include/linux/firewire.h | 5 +++++ 3 files changed, 28 insertions(+), 18 deletions(-) Date: Fri, 5 Jun 2009 16:43:16 +0200 (CEST) From: Stefan Richter firewire: rename source files 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: Stefan Richter --- drivers/firewire/Makefile | 8 drivers/firewire/core-card.c | 567 +++++++ drivers/firewire/core-cdev.c | 1458 +++++++++++++++++++ drivers/firewire/core-device.c | 1196 ++++++++++++++++ drivers/firewire/core-iso.c | 329 ++++ drivers/firewire/core-topology.c | 572 +++++++ drivers/firewire/core-transaction.c | 978 +++++++++++++ drivers/firewire/fw-card.c | 567 ------- drivers/firewire/fw-cdev.c | 1458 ------------------- drivers/firewire/fw-device.c | 1196 ---------------- drivers/firewire/fw-iso.c | 329 ---- drivers/firewire/fw-ohci.c | 2636 ------------------------------------ drivers/firewire/fw-sbp2.c | 1651 ---------------------- drivers/firewire/fw-topology.c | 572 ------- drivers/firewire/fw-transaction.c | 978 ------------- drivers/firewire/ohci.c | 2636 ++++++++++++++++++++++++++++++++++++ drivers/firewire/sbp2.c | 1651 ++++++++++++++++++++++ 17 files changed, 9391 insertions(+), 9391 deletions(-) Date: Fri, 5 Jun 2009 16:39:58 +0200 (CEST) From: Stefan Richter firewire: reorganize header files 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: Stefan Richter --- drivers/firewire/core.h | 293 ++++++++++++++++++++++++ drivers/firewire/fw-card.c | 6 drivers/firewire/fw-cdev.c | 5 drivers/firewire/fw-device.c | 9 drivers/firewire/fw-device.h | 190 ---------------- drivers/firewire/fw-iso.c | 4 drivers/firewire/fw-ohci.c | 5 drivers/firewire/fw-ohci.h | 157 ------------- drivers/firewire/fw-sbp2.c | 4 drivers/firewire/fw-topology.c | 10 drivers/firewire/fw-topology.h | 77 ------ drivers/firewire/fw-transaction.c | 8 drivers/firewire/fw-transaction.h | 446 -------------------------------------- drivers/firewire/ohci.h | 157 +++++++++++++ include/linux/firewire.h | 350 +++++++++++++++++++++++++++++ 15 files changed, 830 insertions(+), 891 deletions(-) Date: Thu, 4 Jun 2009 21:09:38 +0200 (CEST) From: Stefan Richter firewire: clean up includes Include required headers which were only indirectly included. Remove unused includes and an unused constant. Signed-off-by: Stefan Richter --- drivers/firewire/fw-card.c | 15 ++++++++++++--- drivers/firewire/fw-device.c | 3 +++ drivers/firewire/fw-iso.c | 2 ++ drivers/firewire/fw-ohci.c | 7 ++++++- drivers/firewire/fw-sbp2.c | 12 ++++++++++-- drivers/firewire/fw-topology.c | 16 ++++++++++++---- drivers/firewire/fw-transaction.c | 28 ++++++++++++++++------------ 7 files changed, 61 insertions(+), 22 deletions(-) Date: Thu, 4 Jun 2009 21:08:43 +0200 (CEST) From: Stefan Richter firewire: ohci: access bus_seconds atomically 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: Stefan Richter --- drivers/firewire/fw-ohci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) Date: Mon, 16 Feb 2009 00:22:05 +0100 (CET) From: Stefan Richter firewire: also use vendor ID in root directory for driver matches Due to AV/C protocol extensions, FireDTV devices need a vendor-specific driver. But their configuration ROM features a vendor ID only in the root directory, not in the unit directory. Signed-off-by: Stefan Richter --- drivers/firewire/fw-device.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) Date: Sun, 15 Feb 2009 23:12:34 +0100 (CET) From: Stefan Richter firewire: share device ID table type with ieee1394 That way, the new firedtv driver will be able to use a single ID table in builds against ieee1394 core and/or against firewire core. Signed-off-by: Stefan Richter --- drivers/firewire/fw-device.c | 16 +++++++++------- drivers/firewire/fw-device.h | 19 +++---------------- drivers/firewire/fw-sbp2.c | 5 +++-- 3 files changed, 15 insertions(+), 25 deletions(-) Date: Sat, 23 May 2009 00:03:29 +0200 From: Stefan Richter firewire: core: add sysfs attribute for easier udev rules This adds the attribute /sys/bus/firewire/devices/fw[0-9]+/units. It can be used in udev rules like the following ones: # IIDC devices: industrial cameras and some webcams SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x00010?*", GROUP="video" # AV/C devices: camcorders, set-top boxes, TV sets, audio devices, ... SUBSYSTEM=="firewire", ATTR{units}=="*0x00a02d:0x010001*", GROUP="video" Background: firewire-core manages two device types: - fw_device is a FireWire node. A character device file is associated with it. - fw_unit is a unit directory on a node. Each fw_device may have 0..n children of type fw_unit. The units tell us what kinds of protocols a node implements. We want to set ownership or ACLs or permissions of the character device file of an fw_device, or/and create symlinks to it, based on available protocols. Until now udev rules had to look at the fw_unit devices and then modify their parent's character device file accordingly. This is problematic for two reasons: 1) It happens sometime after the creation of the fw_device, 2) an access policy may require that information from all children is evaluated before a decision about the parent is made. Problem 1) can ultimately not be avoided since this is the nature of FireWire nodes: They may add or remove unit directories at any point in time. However, we can still help userland a lot by providing the protocol type information of all units in a summary sysfs attribute directly at the fw_device. This way, - the information is immediately available at the affected device when userspace goes about to handle an ADD or CHANGE event of the fw_device, - with most policies, it won't be necessary anymore to dig through child attributes. The new attribute is called "units". It contains space-separated tuples of specifier_id and version of each present unit. The delimiter within tuples is a colon. Specifier_id and version are printed as 0x%06x. Here is an example of a node which implements an IPv4 unit and an IPv6 unit: $ cat /sys/bus/firewire/devices/fw2/units 0x00005e:0x000001 0x00005e:0x000002 Signed-off-by: Stefan Richter --- drivers/firewire/fw-device.c | 50 +++++++++++++++++++++++++++++++++++++++++++ drivers/firewire/fw-device.h | 2 - 2 files changed, 51 insertions(+), 1 deletion(-) Date: Fri, 22 May 2009 23:16:27 +0200 (CEST) From: Stefan Richter firewire: core: check for missing struct update at build time, not run time struct fw_attribute_group.attrs.[] must have enough room for all attributes. This can and should be checked at build time. Our previous check at run time was a little late and not reliable since most of the time less than the available attributes are populated. Furthermore, omit an increment of an index at its last usage. Signed-off-by: Stefan Richter --- drivers/firewire/fw-device.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) Date: Wed, 13 May 2009 21:42:14 +0200 (CEST) From: Stefan Richter firewire: core: improve check for local node My recently added test for a device being local in fw-cdev.c got it slightly wrong: Comparisons of node IDs are only valid if the generation is current, which I forgot to check. Normally, serialization by card->lock takes care of this, but a device in FW_DEVICE_GONE state will necessarily have a wrong generation and invalid node_id. The "is it local?" check is made 100% correct and simpler now by means of a struct fw_device flag which is set at fw_device creation. Besides the fw-cdev site which was to be fixed, there is another site which can make use of the new flag, and an RFC-2734 driver will benefit from it too. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 6 +----- drivers/firewire/fw-device.c | 3 ++- drivers/firewire/fw-device.h | 1 + 3 files changed, 4 insertions(+), 6 deletions(-) Date: Thu, 5 Mar 2009 19:13:43 +0100 (CET) From: Stefan Richter DVB: firedtv: fix printk format mismatch Eliminate drivers/media/dvb/firewire/firedtv-avc.c: In function 'debug_fcp': drivers/media/dvb/firewire/firedtv-avc.c:156: warning: format '%d' expects type 'int', but argument 5 has type 'size_t' Acked-by: Mauro Carvalho Chehab Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-avc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Date: Sun, 15 Feb 2009 23:11:38 +0100 (CET) From: Stefan Richter ieee1394: constify device ID tables Signed-off-by: Stefan Richter --- drivers/ieee1394/dv1394.c | 2 +- drivers/ieee1394/eth1394.c | 2 +- drivers/ieee1394/nodemgr.c | 4 ++-- drivers/ieee1394/nodemgr.h | 2 +- drivers/ieee1394/raw1394.c | 2 +- drivers/ieee1394/sbp2.c | 2 +- drivers/ieee1394/video1394.c | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) Date: Sun, 15 Feb 2009 22:49:24 +0100 (CET) From: Stefan Richter ieee1394: raw1394: add sparse annotations to raw1394_compat_write Eliminate the following warnings in raw1394_compat_write()'s error return path, seen on x86-64 with CONFIG_COMPAT=y: drivers/ieee1394/raw1394.c:381:17: warning: incorrect type in return expression (different address spaces) drivers/ieee1394/raw1394.c:381:17: expected char const [noderef] * drivers/ieee1394/raw1394.c:381:17: got void * drivers/ieee1394/raw1394.c:2252:14: warning: incorrect type in argument 1 (different address spaces) drivers/ieee1394/raw1394.c:2252:14: expected void const *ptr drivers/ieee1394/raw1394.c:2252:14: got char const [noderef] *[assigned] buffer drivers/ieee1394/raw1394.c:2253:19: warning: incorrect type in argument 1 (different address spaces) drivers/ieee1394/raw1394.c:2253:19: expected void const *ptr drivers/ieee1394/raw1394.c:2253:19: got char const [noderef] *[assigned] buffer Signed-off-by: Stefan Richter --- drivers/ieee1394/raw1394.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) Date: Mon, 9 Feb 2009 22:05:06 +0100 From: Tobias Klauser ieee1394: Storage class should be before const qualifier The C99 specification states in section 6.11.5: The placement of a storage-class specifier other than at the beginning of the declaration specifiers in a declaration is an obsolescent feature. Signed-off-by: Tobias Klauser Signed-off-by: Stefan Richter --- drivers/ieee1394/csr.c | 8 ++++---- drivers/ieee1394/eth1394.c | 2 +- drivers/ieee1394/highlevel.c | 2 +- drivers/ieee1394/raw1394.c | 2 +- drivers/ieee1394/sbp2.c | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) Date: Sat, 24 Jan 2009 19:41:46 +0100 (CET) From: Stefan Richter ieee1394: sbp2: follow up on "ieee1394: inherit ud vendor_id from node vendor_id" Signed-off-by: Stefan Richter --- drivers/ieee1394/sbp2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) Date: Tue, 10 Mar 2009 21:09:28 +0100 (CET) From: Stefan Richter firewire: core: optimize propagation of BROADCAST_CHANNEL Cache the test result of whether a device implements BROADCAST_CHANNEL. This minimizes traffic on the bus after each bus reset. A majority of devices does not implement BROADCAST_CHANNEL. Remove busy retries; just rely on the hardware to retry requests to busy responders. Remove unnecessary log messages. Rename the flag is_irm to broadcast_channel_allocated to better reflect its meaning. Reset the flag earlier in fw_core_handle_bus_reset. Pass the generation down as a call parameter; that way generation can't be newer than card->broadcast_channel_allocated and device->node_id. Signed-off-by: Stefan Richter --- drivers/firewire/fw-card.c | 85 +----------------------------- drivers/firewire/fw-device.c | 45 ++++++++++++++- drivers/firewire/fw-device.h | 5 + drivers/firewire/fw-topology.c | 1 drivers/firewire/fw-transaction.h | 6 -- 5 files changed, 52 insertions(+), 90 deletions(-) Date: Tue, 10 Mar 2009 21:08:37 +0100 (CET) From: Stefan Richter firewire: core: simplify broadcast channel allocation fw-iso.c has channel allocation code now, use it. Signed-off-by: Stefan Richter --- drivers/firewire/fw-card.c | 124 +++++++++---------------------------- 1 file changed, 33 insertions(+), 91 deletions(-) Date: Tue, 10 Mar 2009 21:07:46 +0100 (CET) From: Stefan Richter firewire: core: increase bus manager grace period Per IEEE 1394 clause 8.4.2.5, bus manager capable nodes which are not incumbent shall wait at least 125ms before trying to establish themselves as bus manager. Signed-off-by: Stefan Richter --- drivers/firewire/fw-card.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) Date: Tue, 10 Mar 2009 21:07:06 +0100 (CET) From: Stefan Richter firewire: core: drop unused call parameters of close_transaction All callers inserted NULL and 0 here. Signed-off-by: Stefan Richter --- drivers/firewire/fw-transaction.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) Date: Tue, 10 Mar 2009 21:02:21 +0100 (CET) From: Stefan Richter firewire: cdev: add closure to async stream ioctl This changes the as yet unreleased FW_CDEV_IOC_SEND_STREAM_PACKET ioctl to generate an fw_cdev_event_response event just like the other two ioctls for asynchronous request transmission do. This way, clients get feedback on successful or unsuccessful transmission. This also adds input validation for length, tag, channel, sy, speed. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 46 ++++++++++++------------------ drivers/firewire/fw-transaction.c | 42 ++++++++++----------------- drivers/firewire/fw-transaction.h | 9 +++-- include/linux/firewire-cdev.h | 31 ++++++++++---------- 4 files changed, 56 insertions(+), 72 deletions(-) Date: Tue, 10 Mar 2009 21:01:54 +0100 (CET) From: Stefan Richter firewire: cdev: simplify FW_CDEV_IOC_SEND_REQUEST return value This changes the ioctl() return value of FW_CDEV_IOC_SEND_REQUEST and of the as yet unreleased FW_CDEV_IOC_SEND_BROADCAST_REQUEST. They used to return sizeof(struct fw_cdev_send_request *) + data_length which is obviously a failed attempt to emulate the return value of raw1394's respective interface which uses write() instead of ioctl(). However, the first summand, as size of a kernel pointer, is entirely meaningless to clients and the second summand is already known to clients. And the result does not resemble raw1394's write() return code anyway. So simplify it to a constant non-negative value, i.e. 0. The only dangers here would be that future client implementations check for error by ret != 0 instead of ret < 0 when running on top of an old kernel; or that current clients interpret ret = 0 or more as failure. But both are hypothetical cases which don't justify to return irritating values. While we touch this code, also remove "& 0x1f" from tcode in the call of fw_send_request. The tcode cannot be bigger than 0x1f at this point. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) Date: Tue, 10 Mar 2009 21:01:08 +0100 (CET) From: Stefan Richter firewire: cdev: fix race of ioctl_send_request with bus reset The bus reset handler concurrently frees client->device->node. Use device->node_id instead. This is equivalent to device->node->node_id while device->generation is current. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Tue, 10 Mar 2009 21:00:23 +0100 (CET) From: Stefan Richter firewire: cdev: secure add_descriptor ioctl The access permissions and ownership or ACL of /dev/fw* character device files will typically be set based on the device type of the respective nodes, as obtained by firewire-core from descriptors in the device's configuration ROM. An example policy is to deny write permission by default but grant write permission to files of AV/C video and audio devices and IIDC video devices. The FW_CDEV_IOC_ADD_DESCRIPTOR ioctl could be used to partly subvert such a policy: Find a device file with relaxed permissions, use the ioctl to add a descriptor with AV/C marker to the local node's ROM, thus gain access to the local node's character device file. (This is only possible if there are udev scripts installed which actively relax permissions for known device types and if there is a device of such a type connected.) Accessibility of the local node's device file is relevant to host security if the host contains two or more IEEE 1394 link layer controllers which are plugged into a single bus. Therefore change the ABI to deny FW_CDEV_IOC_ADD_DESCRIPTOR if the file belongs to a remote node. (This change has no impact on known implementers of the ABI: None of them uses the ioctl yet.) Also clarify the documentation: The ioctl affects all local nodes, not just one local node. Cc: stable@kernel.org Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 8 ++++++++ include/linux/firewire-cdev.h | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) Date: Tue, 10 Mar 2009 20:59:16 +0100 (CET) From: Stefan Richter firewire: cdev: amendment to "add ioctl to query maximum transmission speed" The as yet unreleased FW_CDEV_IOC_GET_SPEED ioctl puts only a single integer into the parameter buffer. We can use ioctl()'s return value instead. (Also: Some whitespace change in firewire-cdev.h.) Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 11 +++++----- include/linux/firewire-cdev.h | 37 ++++++++++++---------------------- 2 files changed, 20 insertions(+), 28 deletions(-) Date: Mon, 23 Feb 2009 15:59:34 -0500 From: Jay Fenlason firewire: broadcast channel support This patch adds the ISO broadcast channel support that is required of a 1394a IRM. In specific, if the local device the IRM, it allocates ISO channel 31 and sets the broadcast channel register of all devices on the local bus to BROADCAST_CHANNEL_INITIAL | BROADCAST_CHANNEL_VALID to indicate that channel 31 can be use for broadcast messages. One minor complication is that on startup the local device may become IRM before all the devices on the bus have been enumerated by the stack. Therefore we have to keep a "the local device is IRM" flag and possibly set the broadcast channel register of new devices at enumeration time. Signed-off-by: Jay Fenlason Signed-off-by: Stefan Richter --- drivers/firewire/fw-card.c | 172 ++++++++++++++++++++++++++++-- drivers/firewire/fw-device.c | 3 drivers/firewire/fw-transaction.h | 8 + 3 files changed, 177 insertions(+), 6 deletions(-) Date: Thu, 5 Mar 2009 19:08:40 +0100 (CET) From: Jay Fenlason firewire: implement asynchronous stream transmission 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: Jay Fenlason Signed-off-by: Stefan Richter (tweaks) --- drivers/firewire/fw-cdev.c | 33 ++++++++++++++++++++++++++++++ drivers/firewire/fw-ohci.c | 21 +++++++++++++++++-- drivers/firewire/fw-transaction.c | 25 ++++++++++++++++++++++ drivers/firewire/fw-transaction.h | 4 +++ include/linux/firewire-cdev.h | 27 ++++++++++++++++++++++++ 5 files changed, 108 insertions(+), 2 deletions(-) Date: Thu, 5 Mar 2009 19:07:00 +0100 (CET) From: Stefan Richter firewire: core: normalize a function argument name It's called "payload" rather than "data" almost everywhere in fw-transaction.c. Signed-off-by: Stefan Richter --- drivers/firewire/fw-transaction.c | 6 +++--- drivers/firewire/fw-transaction.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) Date: Tue, 3 Feb 2009 17:55:19 +0100 (CET) From: Stefan Richter firewire: normalize a variable name 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: Stefan Richter --- drivers/firewire/fw-card.c | 9 +++++---- drivers/firewire/fw-device.c | 6 +++--- drivers/firewire/fw-iso.c | 10 ++++++---- drivers/firewire/fw-ohci.c | 3 ++- 4 files changed, 16 insertions(+), 12 deletions(-) Date: Sat, 17 Jan 2009 22:45:54 +0100 (CET) From: Stefan Richter firewire: core: remove condition which is always false reread_bus_info_block() only gets to see devices whose config_rom_length is at least 6 (ROM header, bus info block, root directory header). Signed-off-by: Stefan Richter --- drivers/firewire/fw-device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Sat, 17 Jan 2009 22:45:54 +0100 (CET) From: Stefan Richter firewire: core: move some functions Signed-off-by: Stefan Richter --- drivers/firewire/fw-device.c | 90 +++++++++++++++++------------------ 1 file changed, 44 insertions(+), 46 deletions(-) Date: Sat, 17 Jan 2009 22:45:54 +0100 (CET) From: Stefan Richter firewire: core: clean up includes Signed-off-by: Stefan Richter --- drivers/firewire/fw-device.c | 20 +++++++++++--------- drivers/firewire/fw-device.h | 13 +++++++++++-- 2 files changed, 22 insertions(+), 11 deletions(-) Date: Sun, 11 Jan 2009 13:44:46 +0100 (CET) From: Stefan Richter firewire: cdev: simplify a schedule_delayed_work wrapper The kernel API documentation says that queue_delayed_work() returns 0 (only) if the work was already queued. The return codes of schedule_delayed_work() are not documented but the same. In init_iso_resource(), the work has never been queued yet, hence we can assume schedule_delayed_work() to be a guaranteed success there. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) Date: Thu, 8 Jan 2009 23:07:40 +0100 (CET) From: Stefan Richter firewire: cdev: add ioctls for iso resource management, amendment Some fixes: - Remove stale documentation. - Fix a != vs. == thinko that got in the way of channel management. - Try bandwidth deallocation even if channel deallocation failed. A simplification: - fw_cdev_allocate_iso_resource.channels is now ordered like libdc1394's dc1394_iso_allocate_channel() channels_allowed argument. By the way, I looked closer at cards from NEC, TI, and VIA, and noticed that they all don't implement IEEE 1394a behaviour which is meant to deviate from IEEE 1212's notion of lock compare-swap. This means that we have to do two lock transactions instead of one in many cases where one transaction would already succeed on a fully 1394a compliant IRM. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 2 - drivers/firewire/fw-iso.c | 38 +++++++++++++++++++--------------- include/linux/firewire-cdev.h | 10 +++----- 3 files changed, 27 insertions(+), 23 deletions(-) Date: Wed, 7 Jan 2009 20:14:53 +0100 (CET) From: Stefan Richter firewire: cdev: increment fw_cdev_version, update documentation Necessary due to Date: Tue, 22 Jul 2008 23:23:40 -0700 From: David Moore Subject: firewire: Include iso timestamp in headers when header_size > 4 Side note: The lack of upwards compatibility sounds worse than it is. All existing client implementations, libraw1394 and libdc1394, set header_size = 4. And since the ABI v1 behaviour does not offer any advantages over the new behaviour, we deliberately do not provide the old behaviour anymore. Also add documentation about the format of fw_cdev_get_cycle_timer which may be used in conjunction with the timestamp of iso packets but has a different format. Signed-off-by: Stefan Richter --- include/linux/firewire-cdev.h | 35 +++++++++++++++++++++++++++++----- 1 file changed, 30 insertions(+), 5 deletions(-) Date: Mon, 5 Jan 2009 20:28:10 +0100 (CET) From: Stefan Richter firewire: cdev: shut down iso context before freeing the buffer DMA must be halted before we DMA-unmap and free the DMA buffer. Since we cannot rely on the client to stop the context before it closes the fd, we have to reorder fw_iso_buffer_destroy vs. fw_iso_context_destroy. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Date: Sun, 4 Jan 2009 16:23:29 +0100 (CET) From: Stefan Richter firewire: cdev: replace some spin_lock_irqsave by spin_lock_irq All of these functions are entered with IRQs enabled. Hence the unconditional spin_unlock_irq can be used. Function: Caller context: dequeue_event() client process, via read(2) fill_bus_reset_event() fw-device.c update worqueue job release_client_resource() client process, via ioctl(2) fw_device_op_release() client process, via close(2) Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) Date: Sun, 4 Jan 2009 16:23:29 +0100 (CET) From: Stefan Richter firewire: cdev: extend transaction payload size check Make the size check of ioctl_send_request and ioctl_send_broadcast_request speed dependent. Also change the error return code from -EINVAL to -EIO to distinguish this from other errors concerning the ioctl parameters. Another payload size limit for which we don't check here though is the remote node's Bus_Info_Block.max_rec. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) Date: Sun, 4 Jan 2009 16:23:29 +0100 (CET) From: Stefan Richter firewire: cdev: restrict broadcast write requests to Units Space We don't want random users write to Memory Space (e.g. PCs with physical DMA filters down) or to core CSRs like Reset_Start. This does not protect SBP-2 target CSRs. But properly behaving SBP-2 targets ignore broadcast write requests to these registers, and the maximum damage which can happen with laxer targets is DOS. But there are ways to create DOS situations anyway if there are devices with weak device file permissions (like audio/video devices) present at the same bus as an SBP-2 target. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 4 ++++ 1 file changed, 4 insertions(+) Date: Sun, 4 Jan 2009 16:23:29 +0100 (CET) From: Jay Fenlason, Stefan Richter firewire: cdev: add ioctl for broadcast write requests Write transactions to the broadcast node ID are a convenient way to trigger functions of multiple nodes at once. IIDC is a protocol which can make use of this if multiple cameras with same command_regs_base are connected at the same bus. Based on Date: Wed, 10 Sep 2008 11:32:16 -0400 From: Jay Fenlason Subject: [patch] SEND_BROADCAST_REQUEST Changes: ioctl_send_request() and ioctl_send_broadcast_request() now share code. Broadcast speed corrected to S100. Check for proper tcode. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 74 +++++++++++++++++++++------------- include/linux/firewire-cdev.h | 1 2 files changed, 48 insertions(+), 27 deletions(-) Date: Sun, 4 Jan 2009 16:23:29 +0100 (CET) From: Stefan Richter firewire: cdev: add ioctl to query maximum transmission speed While the speed of asynchronous transactions is automatically chosen by the kernel, the speed of isochronous streams has to be chosen by the initiating client. In case of 1394a bus topologies, the maximum possible speed could be figured out with some effort by evaluation of the remote node's link speed field in the config ROM, the local node's link speed field, and the PHY speeds and topologic information in the local node's or IRM's topology map CSR. However, this does not work in case of 1394b buses. Hence add an ioctl to export the maximum speed which the kernel already determined. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 10 ++++++++++ include/linux/firewire-cdev.h | 10 ++++++++++ 2 files changed, 20 insertions(+) Date: Sun, 4 Jan 2009 16:23:29 +0100 (CET) From: Stefan Richter firewire: cdev: add ioctls for manual iso resource management This adds ioctls for allocation and deallocation of a channel or/and bandwidth without auto-reallocation and without auto-deallocation. The benefit of these ioctls is that libraw1394-style isochronous resource management can be implemented without write access to the IRM's character device file. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 67 +++++++++++++++++++++++++++------- include/linux/firewire-cdev.h | 42 ++++++++++++++++----- 2 files changed, 86 insertions(+), 23 deletions(-) Date: Sun, 4 Jan 2009 16:23:29 +0100 (CET) From: Jay Fenlason, Stefan Richter firewire: cdev: add ioctls for isochronous resource management Based on Date: Tue, 18 Nov 2008 11:41:27 -0500 From: Jay Fenlason Subject: [Patch V4] Add ISO resource management support with several changes to the ABI and implementation. Only the part of the ABI which enables auto-reallocation and auto-deallocation is included here. This implements ioctls for kernel-assisted allocation of isochronous channels and isochronous bandwidth. The benefits are: - The client does not have to have write access to the /dev/fw* device corresponding to the IRM. - The client does not have to perform reallocation after bus resets. - Channel and bandwidth are deallocated by the kernel if the file is closed before the client deallocated the resources. Thus resources are released even if the client crashes. It is anticipated that future in-kernel code (firewire-core IRM code; the firewire port of firedtv), will use the fw-iso.c portions of this code too. Signed-off-by: Stefan Richter Tested-by: David Moore --- drivers/firewire/fw-cdev.c | 215 +++++++++++++++++++++++++++++- drivers/firewire/fw-iso.c | 176 +++++++++++++++++++++++- drivers/firewire/fw-transaction.h | 4 include/linux/firewire-cdev.h | 100 ++++++++++++- 4 files changed, 475 insertions(+), 20 deletions(-) Date: Sun, 4 Jan 2009 16:23:29 +0100 (CET) From: Stefan Richter firewire: core: topology header fix Signed-off-by: Stefan Richter --- drivers/firewire/fw-topology.h | 6 ++++++ 1 file changed, 6 insertions(+) Date: Sun, 4 Jan 2009 16:23:29 +0100 (CET) From: Stefan Richter firewire: cdev: sort includes Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) Date: Sun, 4 Jan 2009 16:23:29 +0100 (CET) From: Stefan Richter firewire: cdev: unify names of struct types and of their instances to indicate that they are specializations of struct event or of struct client_resource, respectively. struct response was both an event and a client_resource; it is now split into struct outbound_transaction_resource and ~_event in order to document more explicitly which types of client resources exist. struct request and struct_request_event are renamed to struct inbound_transaction_resource and ~_event because requests and responses occur in outbound and in inbound transactions. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 337 ++++++++++++++++++------------------- 1 file changed, 169 insertions(+), 168 deletions(-) Date: Sun, 4 Jan 2009 16:23:29 +0100 (CET) From: Stefan Richter firewire: cdev: reference-count client instances The lifetime of struct client instances must be longer than the lifetime of any client resource. This fixes a possible race between fw_device_op_release and transaction completions. It also prepares for new ioctls for isochronous resource management which will involve delayed processing of client resources. Signed-off-by: Stefan Richter Reviewed-by: David Moore --- drivers/firewire/fw-cdev.c | 55 ++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 9 deletions(-) Date: Fri, 2 Jan 2009 12:47:13 +0100 (CET) From: Stefan Richter firewire: cdev: fix documentation of FW_CDEV_IOC_GET_INFO The FW_CDEV_IOC_GET_INFO ioctl looks at client->device->config_rom, not at the local node's config ROM. We could fix the implementation or the documentation. I believe the way how it is currently implemented is more useful than the way how it is currently documented. In fact, libdc1394 uses the ABI already as implemented, not as documented. Hence let's change the documentation. Signed-off-by: Stefan Richter --- include/linux/firewire-cdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Sun, 21 Dec 2008 16:39:46 +0100 (CET) From: Stefan Richter firewire: prevent creation of multiple IR DMA contexts for the same channel 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 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: Stefan Richter --- drivers/firewire/fw-iso.c | 3 ++- drivers/firewire/fw-ohci.c | 14 +++++++++++--- drivers/firewire/fw-transaction.h | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) Date: Sun, 21 Dec 2008 16:49:57 +0100 (CET) From: Stefan Richter firewire: cdev: use list_first_entry Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Sun, 14 Dec 2008 21:47:36 +0100 (CET) From: Stefan Richter firewire: core: remove unused definitions Signed-off-by: Stefan Richter --- drivers/firewire/fw-transaction.h | 12 ------------ 1 file changed, 12 deletions(-) Date: Sun, 14 Dec 2008 21:47:04 +0100 (CET) From: Stefan Richter firewire: remove line breaks before function names type function_name(parameters); is nice to look at but was not used consistently. Signed-off-by: Stefan Richter --- drivers/firewire/fw-card.c | 68 ++++++------------ drivers/firewire/fw-cdev.c | 88 ++++++++++-------------- drivers/firewire/fw-device.c | 40 ++++------- drivers/firewire/fw-device.h | 3 drivers/firewire/fw-iso.c | 28 +++---- drivers/firewire/fw-ohci.c | 100 ++++++++++++--------------- drivers/firewire/fw-sbp2.c | 57 ++++++--------- drivers/firewire/fw-topology.c | 28 +++---- drivers/firewire/fw-topology.h | 13 +-- drivers/firewire/fw-transaction.c | 92 ++++++++++--------------- drivers/firewire/fw-transaction.h | 109 +++++++++--------------------- 11 files changed, 249 insertions(+), 377 deletions(-) Date: Sun, 14 Dec 2008 21:45:45 +0100 (CET) From: Stefan Richter firewire: standardize a variable name "ret" is the new "retval". Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 44 ++++++++++++------------- drivers/firewire/fw-iso.c | 12 +++---- drivers/firewire/fw-ohci.c | 51 ++++++++++++++---------------- drivers/firewire/fw-transaction.c | 8 ++-- 4 files changed, 57 insertions(+), 58 deletions(-) Date: Sun, 14 Dec 2008 21:45:14 +0100 (CET) From: Stefan Richter firewire: core: remove obsolete assertions This code never changes. Signed-off-by: Stefan Richter --- drivers/firewire/fw-transaction.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) Date: Sun, 14 Dec 2008 19:21:31 +0100 (CET) From: Stefan Richter firewire: core: remove outdated comment Signed-off-by: Stefan Richter --- drivers/firewire/fw-transaction.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) Date: Sun, 14 Dec 2008 19:21:01 +0100 (CET) From: Stefan Richter firewire: cdev: address handler input validation Like before my commit 1415d9189e8c59aa9c77a3bba419dcea062c145f, fw_core_add_address_handler() does not align the address region now. Instead the caller is required to pass valid parameters. Since one of the callers of fw_core_add_address_handler() is the cdev userspace interface, we now check for valid input. If the client is buggy, we give it a hint with -EINVAL. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 5 +++-- drivers/firewire/fw-transaction.c | 27 ++++++++++++++++++--------- 2 files changed, 21 insertions(+), 11 deletions(-) Date: Sun, 21 Dec 2008 16:47:17 +0100 (CET) From: Jay Fenlason firewire: cdev: use an idr rather than a linked list for resources The current code uses a linked list and a counter for storing resources and the corresponding handle numbers. By changing to an idr we can be safe from counter wrap-around giving two resources the same handle. Furthermore, the deallocation ioctls now check whether the resource to be freed is of the intended type. Signed-off-by: Jay Fenlason Some rework by Stefan R: - The idr API documentation says we get an ID within 0...0x7fffffff. Hence we can rest assured that idr handles fit into cdev handles. - Fix some races. Add a client->in_shutdown flag for this purpose. - Add allocation retry to add_client_resource(). - It is possible to use idr_for_each() in fw_device_op_release(). - Fix ioctl_send_response() regression. - Small style changes. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 165 +++++++++++++++++++++++++------------ 1 file changed, 114 insertions(+), 51 deletions(-) Date: Sun, 14 Dec 2008 19:19:23 +0100 (CET) From: Stefan Richter firewire: cdev: fix race of fw_device_op_release with bus reset Unlink the client from the fw_device earlier in order to prevent bus reset events being added to client->event_list during shutdown. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Date: Fri, 5 Dec 2008 22:44:42 +0100 (CET) From: Stefan Richter firewire: cdev: tcodes input validation The behaviour of fw-transaction.c::fw_send_request is ill-defined for any other tcodes than read/ write/ lock request tcodes. Therefore prevent requests with wrong tcodes from entering the transaction layer. Maybe fw_send_request should check them itself, but I am not inclined to change it and fw_fill_request from void-valued functions to ones which return error codes and pass those up. Besides, maybe fw_send_request is going to support one more tcode than ioctl_send_request in the future (TCODE_STREAM_DATA). Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) Date: Fri, 5 Dec 2008 22:43:41 +0100 (CET) From: Stefan Richter firewire: cdev: documentation fixlet Reported-by: Jay Fenlason Signed-off-by: Stefan Richter --- include/linux/firewire-cdev.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Sun, 5 Oct 2008 10:37:11 +0200 (CEST) From: Stefan Richter firewire: convert client_list_lock to mutex So far it is only taken in non-atomic contexts. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 20 ++++++++------------ drivers/firewire/fw-device.c | 3 ++- drivers/firewire/fw-device.h | 7 ++++--- 3 files changed, 14 insertions(+), 16 deletions(-) Date: Fri, 3 Oct 2008 11:19:09 -0400 From: Jay Fenlason firewire: add a client_list_lock This adds a client_list_lock, which only protects the device's client_list, so that future versions of the driver can call code that takes the card->lock while holding the client_list_lock. Adding this lock is much simpler than adding __ versions of all the functions that the future version may need. The one ordering issue is to make sure code never takes the client_list_lock with card->lock held. Since client_list_lock is only used in three places, that isn't hard. Signed-off-by: Jay Fenlason Update fill_bus_reset_event() accordingly. Include linux/spinlock.h. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 28 +++++++++++++--------------- drivers/firewire/fw-device.c | 2 ++ drivers/firewire/fw-device.h | 3 +++ 3 files changed, 18 insertions(+), 15 deletions(-) Date: Tue, 22 Jul 2008 23:23:40 -0700 From: David Moore firewire: Include iso timestamp in headers when header_size > 4 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: David Moore Signed-off-by: Stefan Richter --- drivers/firewire/fw-ohci.c | 73 +++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 38 deletions(-)