IEEE 1394 updates for Linux 2.6.26-26lenny2 (v1306 2011-07-12) Documentation/ABI/stable/firewire-cdev | 103 Documentation/ABI/stable/sysfs-bus-firewire | 122 Documentation/debugging-via-ohci1394.txt | 8 drivers/Kconfig | 2 drivers/Makefile | 2 drivers/firewire/Kconfig | 94 drivers/firewire/Makefile | 14 drivers/firewire/core-card.c | 683 ++++ drivers/firewire/core-cdev.c | 1758 ++++++++++ drivers/firewire/core-device.c | 1278 +++++++ drivers/firewire/core-iso.c | 370 ++ drivers/firewire/core-topology.c | 571 +++ drivers/firewire/core-transaction.c | 1242 +++++++ drivers/firewire/core.h | 248 + drivers/firewire/fw-card.c | 545 --- drivers/firewire/fw-cdev.c | 1038 ------ drivers/firewire/fw-device.c | 1029 ------ drivers/firewire/fw-device.h | 185 - drivers/firewire/fw-iso.c | 158 drivers/firewire/fw-ohci.c | 2582 --------------- drivers/firewire/fw-ohci.h | 157 drivers/firewire/fw-sbp2.c | 1637 --------- drivers/firewire/fw-topology.c | 553 --- drivers/firewire/fw-topology.h | 76 drivers/firewire/fw-transaction.c | 939 ----- drivers/firewire/fw-transaction.h | 453 -- drivers/firewire/init_ohci1394_dma.c | 309 + drivers/firewire/net.c | 1728 ++++++++++ drivers/firewire/nosy-user.h | 25 drivers/firewire/nosy.c | 722 ++++ drivers/firewire/nosy.h | 237 + drivers/firewire/ohci.c | 3342 ++++++++++++++++++++ drivers/firewire/ohci.h | 158 drivers/firewire/sbp2.c | 1668 +++++++++ drivers/ieee1394/Kconfig | 80 drivers/ieee1394/Makefile | 2 drivers/ieee1394/csr.c | 12 drivers/ieee1394/csr.h | 10 drivers/ieee1394/csr1212.c | 79 drivers/ieee1394/csr1212.h | 9 drivers/ieee1394/dma.c | 2 drivers/ieee1394/dma.h | 1 drivers/ieee1394/dv1394-private.h | 44 drivers/ieee1394/dv1394.c | 63 drivers/ieee1394/eth1394.c | 35 drivers/ieee1394/eth1394.h | 16 drivers/ieee1394/highlevel.c | 36 drivers/ieee1394/highlevel.h | 20 drivers/ieee1394/hosts.c | 10 drivers/ieee1394/hosts.h | 6 drivers/ieee1394/ieee1394.h | 7 drivers/ieee1394/ieee1394_core.c | 19 drivers/ieee1394/ieee1394_transactions.c | 31 drivers/ieee1394/ieee1394_transactions.h | 2 drivers/ieee1394/init_ohci1394_dma.c | 285 - drivers/ieee1394/iso.h | 1 drivers/ieee1394/nodemgr.c | 363 -- drivers/ieee1394/nodemgr.h | 27 drivers/ieee1394/ohci1394.c | 36 drivers/ieee1394/ohci1394.h | 2 drivers/ieee1394/pcilynx.c | 2 drivers/ieee1394/pcilynx.h | 2 drivers/ieee1394/raw1394-private.h | 1 drivers/ieee1394/raw1394.c | 253 - drivers/ieee1394/sbp2.c | 347 +- drivers/ieee1394/sbp2.h | 42 drivers/ieee1394/video1394.c | 23 drivers/media/dvb/Kconfig | 4 drivers/media/dvb/Makefile | 2 drivers/media/dvb/firewire/Kconfig | 19 drivers/media/dvb/firewire/Makefile | 6 drivers/media/dvb/firewire/firedtv-avc.c | 1435 ++++++++ drivers/media/dvb/firewire/firedtv-ci.c | 258 + drivers/media/dvb/firewire/firedtv-dvb.c | 245 + drivers/media/dvb/firewire/firedtv-fe.c | 241 + drivers/media/dvb/firewire/firedtv-fw.c | 430 ++ drivers/media/dvb/firewire/firedtv-rc.c | 195 + drivers/media/dvb/firewire/firedtv.h | 168 + drivers/scsi/sd.c | 5 include/linux/firewire-cdev.h | 739 +++- include/linux/firewire-constants.h | 29 include/linux/firewire.h | 445 ++ include/scsi/scsi_device.h | 1 tools/firewire/Makefile | 19 tools/firewire/decode-fcp.c | 213 + tools/firewire/list.h | 62 tools/firewire/nosy-dump.c | 1031 ++++++ tools/firewire/nosy-dump.h | 173 + 88 files changed, 21069 insertions(+), 10555 deletions(-) Date: Sun, 10 Jul 2011 00:23:03 +0200 From: Stefan Richter firewire: ohci: do not bind to Pinnacle cards, prevent panic When firewire-ohci is bound to a Pinnacle MovieBoard, eventually a "Register access failure" is logged and an interrupt storm or a kernel panic happens. https://bugzilla.kernel.org/show_bug.cgi?id=36622 Until this is sorted out (if that is going to succeed at all), let's just prevent firewire-ohci from touching these devices. Signed-off-by: Stefan Richter Cc: --- drivers/firewire/ohci.c | 6 ++++++ 1 file changed, 6 insertions(+) Date: Sat, 9 Jul 2011 16:48:29 +0200 From: Stefan Richter firewire: document the sysfs ABIs of firewire-core and firewire-sbp2. Signed-off-by: Stefan Richter --- Documentation/ABI/stable/sysfs-bus-firewire | 122 ++++++++++++++++++++ 1 file changed, 122 insertions(+) Date: Sat, 9 Jul 2011 17:05:06 +0200 From: Stefan Richter firewire: cdev: ABI documentation enhancements Add overview documentation in Documentation/ABI/stable/firewire-cdev. Improve the inline reference documentation in firewire-cdev.h: - Add /* available since kernel... */ comments to event numbers consistent with the comments on ioctl numbers. - Shorten some documentation on an event and an ioctl that are less interesting to current programming because there are newer preferable variants. - Spell Configuration ROM (name of an IEEE 1212 register) in upper case. - Move the dummy FW_CDEV_VERSION out of the reader's field of vision. We should remove it from the header next year or so. Signed-off-by: Stefan Richter --- Documentation/ABI/stable/firewire-cdev | 103 +++++++++++++++++++++++++ include/linux/firewire-cdev.h | 71 +++++++---------- 2 files changed, 133 insertions(+), 41 deletions(-) Date: Sat, 9 Jul 2011 16:43:22 +0200 From: Stefan Richter firewire: cdev: prevent race between first get_info ioctl and bus reset event queuing Between open(2) of a /dev/fw* and the first FW_CDEV_IOC_GET_INFO ioctl(2) on it, the kernel already queues FW_CDEV_EVENT_BUS_RESET events to be read(2) by the client. The get_info ioctl is practically always issued right away after open, hence this condition only occurs if the client opens during a bus reset, especially during a rapid series of bus resets. The problem with this condition is two-fold: - These bus reset events carry the (as yet undocumented) @closure value of 0. But it is not the kernel's place to choose closures; they are privat to the client. E.g., this 0 value forced from the kernel makes it unsafe for clients to dereference it as a pointer to a closure object without NULL pointer check. - It is impossible for clients to determine the relative order of bus reset events from get_info ioctl(2) versus those from read(2), except in one way: By comparison of closure values. Again, such a procedure imposes complexity on clients and reduces freedom in use of the bus reset closure. So, change the ABI to suppress queuing of bus reset events before the first FW_CDEV_IOC_GET_INFO ioctl was issued by the client. Note, this ABI change cannot be version-controlled. The kernel cannot distinguish old from new clients before the first FW_CDEV_IOC_GET_INFO ioctl. We will try to back-merge this change into currently maintained stable/ longterm series, and we only document the new behaviour. The old behavior is now considered a kernel bug, which it basically is. Signed-off-by: Stefan Richter Cc: --- drivers/firewire/core-cdev.c | 18 ++++++++++-------- include/linux/firewire-cdev.h | 3 +++ 2 files changed, 13 insertions(+), 8 deletions(-) Date: Sat, 9 Jul 2011 16:42:26 +0200 From: Stefan Richter firewire: cdev: return -ENOTTY for unimplemented ioctls, not -EINVAL On Jun 27 Linus Torvalds wrote: > The correct error code for "I don't understand this ioctl" is ENOTTY. > The naming may be odd, but you should think of that error value as a > "unrecognized ioctl number, you're feeding me random numbers that I > don't understand and I assume for historical reasons that you tried to > do some tty operation on me". [...] > The EINVAL thing goes way back, and is a disaster. It predates Linux > itself, as far as I can tell. You'll find lots of man-pages that have > this line in it: > > EINVAL Request or argp is not valid. > > and it shows up in POSIX etc. And sadly, it generally shows up > _before_ the line that says > > ENOTTY The specified request does not apply to the kind of object > that the descriptor d references. > > so a lot of people get to the EINVAL, and never even notice the ENOTTY. [...] > At least glibc (and hopefully other C libraries) use a _string_ that > makes much more sense: strerror(ENOTTY) is "Inappropriate ioctl for > device" So let's correct this in the ABI while it is still young, relative to distributor adoption. Side note: We return -ENOTTY not only on _IOC_TYPE or _IOC_NR mismatch, but also on _IOC_SIZE mismatch. An ioctl with an unsupported size of argument structure can be seen as an unsupported version of that ioctl. Signed-off-by: Stefan Richter Cc: --- drivers/firewire/core-cdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Wed, 6 Jul 2011 19:33:15 +0200 From: Stefan Richter [media] firedtv: change some -EFAULT returns to more fitting error codes Mauro Carvalho Chehab wrote: > I'm validating if all drivers are behaving equally with respect to the > error codes returned to userspace, and double-checking with the API. > > On almost all places, -EFAULT code is used only to indicate when > copy_from_user/copy_to_user fails. However, firedtv uses a lot of > -EFAULT, where it seems to me that other error codes should be used > instead (like -EIO for bus transfer errors and -EINVAL/-ERANGE for > invalid/out of range parameters). This concerns only the CI (CAM) related code of firedtv of which I know little. Let's just pass through the error returns of lower level I/O code where applicable, and -EACCES (permission denied) when a seemingly valid but negative FCP response or an unknown-to-firedtv CA message is received. Signed-off-by: Stefan Richter Cc: Henrik Kurelid --- drivers/media/dvb/firewire/firedtv-avc.c | 2 drivers/media/dvb/firewire/firedtv-ci.c | 34 +++++++++++------------ 2 files changed, 17 insertions(+), 19 deletions(-) Date: Sun, 3 Jul 2011 17:39:26 +0200 From: Stefan Richter firewire: ohci: skip soft reset retries after card ejection The software reset in firewire-ohci's pci_remove does not have a great prospect of success if the card was already physically removed at this point. So let's skip the 500 ms that were spent in retries here. Also, replace a defined constant by its open-coded value. This is not a constant from a specification but an arbitrarily chosen retry limit. It was only used in this single place. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) Date: Wed, 22 Jun 2011 21:05:08 +0200 From: Stefan Richter firewire: ohci: fix PHY reg access after card ejection Detect and handle ejection of FireWire CardBus cards in PHY register accesses: - The last attempt of firewire-core to reset the bus during shutdown caused a spurious "firewire_ohci: failed to write phy reg" error message in the log. Skip this message as well as the prior retry loop that needlessly took 100 milliseconds. - In the unlikely case that a PHY register was read right after card ejection, a bogus value was obtained and possibly acted upon. Instead, fail the read attempt. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 6 ++++++ 1 file changed, 6 insertions(+) Date: Tue, 21 Jun 2011 15:24:26 +0200 From: Stefan Richter firewire: ohci: add a comment on PHY reg access serialization Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 6 ++++++ 1 file changed, 6 insertions(+) Date: Sun, 12 Jun 2011 14:30:57 +0200 From: Stefan Richter firewire: ohci: reduce potential context_stop latency Stopping an isochronous reception DMA context takes two loop iterations in context_stop on several controllers (JMicron, NEC, VIA). But there is no extra delay necessary between these two reg_read trials; the MMIO reads themselves are slow enough. Hence bring back the behavior from before commit dd6254e5c0efe01ad255188898cb3dadf98cb56d "firewire: ohci: remove superfluous posted write flushes" on these controllers by means of an "if (i)" condition. Isochronous context stop is performed in preemptible contexts (and only rarely), hence this change is of little impact. (Besides, Agere and TI controllers always, or almost always, have the context stopped already at the first ContextControl read.) More important is asynchronous transmit context stop, which is performed while local interrupts are disabled (on the two AT DMAs in bus_reset_tasklet, i.e. after a self-ID-complete event). In my experience with several controllers, tested with a usermode AT-request transmitter as well as with FTP transmission over firewire-net, the AT contexts were luckily already stopped at the first ContextControl read, i.e. never required another MMIO read let alone mdelay. A possible explanation for this is that the controllers which I tested perhaps stop AT DMA before they perform the self-ID reception DMA. But we cannot be sure about that and should keep the interrupts-disabled busy loop as short as possible. Hence, query the ContextControl register in 1000 udelay(10) intervals instead of 10 udelay(1000) intervals. I understand from an estimation by Clemens Ladisch that stopping a busy DMA context should take microseconds or at worst tens of microseconds, not milliseconds. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) Date: Mon, 16 May 2011 08:10:10 +0200 From: Clemens Ladisch firewire: ohci: remove superfluous posted write flushes The call to flush_writes() in context_stop() is superfluous because another register read is done immediately afterwards. The call to flush_writes() in ar_context_run() does not need to be done individually for each AR context, so move it to ohci_enable(). This also makes ohci_enable() clearer because it no longer depends on a side effect of ar_context_run() to flush its own register writes. Finally, the setting of a context's wake bit does not need to be flushed because neither the driver logic nor the API require the CPU to wait for this action. This removes the last MMIO reads from the packet queueing code paths. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) Date: Sun, 29 May 2011 19:07:19 +0200 From: August Lilleaas firewire: net: replacing deprecated __attribute__((packed)) with __packed Fixing a deprecation, replacing __attribute__((packed)) with __packed. It was deprecated for portability, specifically to avoid GCC specific code. See commit 82ddcb040570411fc2d421d96b3e69711c670328. Signed-off-by: August Lilleaas Signed-off-by: Stefan Richter (added include compiler.h) --- drivers/firewire/net.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) Date: Mon, 02 May 2011 09:33:56 +0200 From: Clemens Ladisch firewire: optimize iso queueing by setting wake only after the last packet When queueing iso packets, the run time is dominated by the two MMIO accesses that set the DMA context's wake bit. Because most drivers submit packets in batches, we can save much time by removing all but the last wakeup. The internal kernel API is changed to require a call to fw_iso_context_queue_flush() after a batch of queued packets. The user space API does not change, so one call to FW_CDEV_IOC_QUEUE_ISO must specify multiple packets to take advantage of this optimization. In my measurements, this patch reduces the time needed to queue fifty skip packets from userspace to one sixth on a 2.5 GHz CPU, or to one third at 800 MHz. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 5 +++++ drivers/firewire/core-cdev.c | 1 + drivers/firewire/core-iso.c | 6 ++++++ drivers/firewire/core.h | 2 ++ drivers/firewire/net.c | 4 +++- drivers/firewire/ohci.c | 19 +++++++++++++++---- drivers/media/dvb/firewire/firedtv-fw.c | 1 + include/linux/firewire.h | 1 + 8 files changed, 34 insertions(+), 5 deletions(-) Date: Mon, 2 May 2011 13:33:42 -0400 From: "B.J. Buchalter" firewire: Fix for broken configrom updates in quick succession Current implementation of ohci_set_config_rom() uses a deferred bus reset via fw_schedule_bus_reset(). If clients add multiple unit descriptors to the config_rom in quick succession, the deferred bus reset may not have fired before succeeding update requests have come in. This can lead to an incorrect partial update of the config_rom for both addition and removal of config_rom descriptors, as the ohci_set_config_rom() routine will return -EBUSY if a previous pending update has not been completed yet; the requested update just gets dropped on the floor. This patch recognizes that the "in-flight" update can be modified until it has been processed by the bus-reset, and the locking in the bus_reset_tasklet ensures that the update is done atomically with respect to modifications made by ohci_set_config_rom(). The -EBUSY error case is simply removed. [Stefan R: The bug always existed at least theoretically. But it became easy to trigger since 2.6.36 commit 02d37bed188c "firewire: core: integrate software-forced bus resets with bus management" which introduced long mandatory delays between janitorial bus resets.] Signed-off-by: Benjamin Buchalter Signed-off-by: Stefan Richter (trivial style changes) Cc: # 2.6.36.y and newer --- drivers/firewire/ohci.c | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) Date: Sun, 1 May 2011 21:06:42 +0200 From: Stefan Richter firewire: sbp2: octlet AT payloads can be stack-allocated We do not need slab allocations for ORB pointer write transactions anymore in order to satisfy streaming DMA mapping constraints, thanks to commit da28947e7e36 "firewire: ohci: avoid separate DMA mapping for small AT payloads". (Besides, the slab-allocated buffers that firewire-sbp2 used to provide for 8-byte write requests were still not fully portable since they shared a cacheline with unrelated CPU-accessed data.) Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Date: Fri, 22 Apr 2011 15:13:54 +0200 From: Stefan Richter firewire: octlet AT payloads can be stack-allocated We do not need slab allocations anymore in order to satisfy streaming DMA mapping constraints, thanks to commit da28947e7e36 "firewire: ohci: avoid separate DMA mapping for small AT payloads". (Besides, the slab-allocated buffers that firewire-core, firewire-sbp2, and firedtv used to provide for 8-byte write and lock requests were still not fully portable since they crossed cacheline boundaries or shared a cacheline with unrelated CPU-accessed data. snd-firewire-lib got this aspect right by using an extra kmalloc/ kfree just for the 8-byte transaction buffer.) This change replaces kmalloc'ed lock transaction scratch buffers in firewire-core, firedtv, and snd-firewire-lib by local stack allocations. Perhaps the most notable result of the change is simpler locking because there is no need to serialize usages of preallocated per-device buffers anymore. Also, allocations and deallocations are simpler. Signed-off-by: Stefan Richter Acked-by: Clemens Ladisch --- drivers/firewire/core-card.c | 16 ++++++++-------- drivers/firewire/core-cdev.c | 4 +--- drivers/firewire/core-iso.c | 21 +++++++++++---------- drivers/firewire/core-transaction.c | 7 ++++--- drivers/firewire/core.h | 2 +- drivers/media/dvb/firewire/firedtv-avc.c | 15 +-------------- include/linux/firewire.h | 1 - 7 files changed, 26 insertions(+), 40 deletions(-) Date: Tue, 12 Apr 2011 07:54:59 +0200 From: Clemens Ladisch firewire: ohci: optimize find_branch_descriptor() When z==2, the condition "key == 2" is superfluous because it cannot occur without "b == 3", as a descriptor with b!=3 and key==2 would be an OUTPUT_MORE_IMMEDIATE descriptor which cannot be used alone. Also remove magic numbers and needless computations on the b field. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) Date: Mon, 11 Apr 2011 09:57:54 +0200 From: Clemens Ladisch firewire: ohci: avoid separate DMA mapping for small AT payloads For AT packet payloads of up to eight bytes, we have enough unused space in the DMA descriptors list so that we can put a copy of the payload there and thus avoid having to create a separate streaming DMA mapping for the payload buffer. In a CPU-bound microbenchmark that just sends 8-byte packets, bandwidth was measured to increase by 5.7 %, from 1009 KB/s to 1067 KB/s. In practice, the only performance-sensitive usage of small asynchronous packets is the SBP-2 driver's write to the ORB_POINTER register during SCSI command submission. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) Date: Mon, 11 Apr 2011 09:56:12 +0200 From: Clemens Ladisch firewire: ohci: do not start DMA contexts before link is enabled OHCI 1.1 5.7.3 not only forbids enabling or starting any DMA contexts before the linkEnable bit is set, but also explicitly warns of undefined behaviour if this order is violated. Don't violate it then. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) Date: Tue, 15 Mar 2011 00:08:41 +0100 From: Stefan Richter firewire: core: ignore link-active bit of new nodes, fix device recognition Like the older ieee1394 core driver, firewire-core skipped scanning of any new node whose PHY sent a self ID without "link active" bit. If a device had this bit off mistakenly, it meant that it was inaccessible to kernel drivers with the old IEEE 1394 driver stack but could still be accessed by userspace drivers through the raw1394 interface. But with firewire-core, userspace drivers don't get to see such buggy devices anymore. This is effectively a driver regression since this device bug is otherwise harmless. We now attempt to scan all devices, even repeaters that don't have a link or powered-down devices that have everything but their PHY shut down when plugged in. This results in futile repeated scanning attempts in case of such devices that really don't have an active link, but this doesn't hurt since recent workqueue infrastructure lets us run more concurrent scanning jobs than we can shake a stick at. This should fix accessibility of Focusrite Saffire PRO 26 I/O: http://sourceforge.net/mailarchive/forum.php?thread_name=20110314215622.5c751bb0%40stein&forum_name=ffado-user Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) Date: Tue, 15 Mar 2011 00:04:42 +0100 From: Stefan Richter firewire: sbp2: revert obsolete 'fix stall with "Unsolicited response"' Now that firewire-core sets the local node's SPLIT_TIMEOUT to 2 seconds per default, commit a481e97d3cdc40b9d58271675bd4f0abb79d4872 is no longer required. Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) Date: Mon, 07 Mar 2011 11:21:15 +0100 From: Clemens Ladisch firewire: core: increase default SPLIT_TIMEOUT value The SPLIT_TIMEOUT mechanism is intended to detect requests that somehow got lost. However, when the timeout value is too low, transactions that could have been completed successfully will be cancelled. Furthermore, there are chips whose firmwares ignore the configured split timeout and send late split response; known examples are the DM1x00 (BeBoB), TCD22x0 (DICE), and some OXUF936QSE firmwares. This patch changes the default timeout to two seconds, which happens to be the default on other OSes, too. Actual lost requests are extremely rare, so there should be no practical downside to increasing the split timeout even on devices that work correctly. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) Date: Fri, 11 Mar 2011 04:17:27 +0300 From: Oleg Drokin firewire: ohci: Misleading kfree in ohci.c::pci_probe/remove It seems drivers/firewire/ohci.c is making some optimistic assumptions about struct fw_ohci and that member "card" will always remain the first member of the struct. Plus it's probably going to confuse a lot of static code analyzers too. So I wonder if there is a good reason not to free the ohci struct just like it was allocated instead of the tricky &ohci->card way? Signed-off-by: Oleg Drokin It is perhaps just a rudiment from before mainline submission of the driver. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Date: Sat, 26 Feb 2011 15:08:35 +0100 From: Stefan Richter firewire: ohci: omit IntEvent.busReset check rom AT queueing Since commit 82b662dc4102 "flush AT contexts after bus reset for OHCI 1.2", the driver takes care of any AT packets that were enqueued during a bus reset phase. The check from commit 76f73ca1b291 is therefore no longer necessary and the MMIO read can be avoided. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) Date: Sun, 6 Feb 2011 15:41:44 +0100 From: Stefan Richter firedtv: drop obsolete backend abstraction Since the drivers/ieee1394/ backend was removed from firedtv, its I/O no longer needs to be abstracted as exchangeable backend methods. Also, ieee1394 variants of module and device probe and removal are no longer there. Move module probe and removal into firedtv-fw.c where device probe and removal are implemented. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-avc.c | 15 +- drivers/media/dvb/firewire/firedtv-dvb.c | 130 -------------------- drivers/media/dvb/firewire/firedtv-fe.c | 8 drivers/media/dvb/firewire/firedtv-fw.c | 146 +++++++++++++++++++---- drivers/media/dvb/firewire/firedtv.h | 31 ++--- 5 files changed, 140 insertions(+), 190 deletions(-) Date: Sat, 5 Feb 2011 13:07:39 +0000 (+0100) From: Hans Verkuil firedtv: remove dependency on the deleted ieee1394 stack. X-Git-Url: http://git.linuxtv.org/hverkuil/media_tree.git?a=commitdiff_plain;h=f02c316436eef3baf349c489545edc7ade419ff6 The IEEE1394 stack was removed in 2.6.37, but not in this driver. Due to incorrect Kconfig dependencies this driver wasn't build since 2.6.37. This patch removes the IEEE1394 dependencies and fixes the Kconfig dependency, allowing it to be compiled once again. Signed-off-by: Hans Verkuil CC: Stefan Richter --- --- drivers/media/dvb/Kconfig | 2 drivers/media/dvb/firewire/Kconfig | 8 - drivers/media/dvb/firewire/Makefile | 5 - drivers/media/dvb/firewire/firedtv-1394.c | 299 ---------------------- drivers/media/dvb/firewire/firedtv-dvb.c | 5 - drivers/media/dvb/firewire/firedtv.h | 14 - 6 files changed, 3 insertions(+), 330 deletions(-) Date: Wed, 23 Feb 2011 09:27:40 +0100 From: Clemens Ladisch firewire: ohci: prevent starting of iso contexts with empty queue If a misguided program tried to start an isochronous context before it has queued any packets, the call would appear to succeed, but the context would not actually go into the running state, and the OHCI controller would then raise an unrecoverableError interrupt because the first Z value is zero and thus invalid. The driver logs such errors, but there is no mechanism to report this back to the program. Add an explicit check so that this error can be returned synchronously. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 4 ++++ 1 file changed, 4 insertions(+) Date: Wed, 16 Feb 2011 10:32:11 +0100 From: Clemens Ladisch firewire: ohci: prevent iso completion callbacks after context stop To prevent the iso packet callback from being called after fw_iso_context_stop() has returned, make sure that the context's tasklet has finished executing before that. This fixes access-after-free bugs that have so far been observed only in the upcoming snd-firewire-speakers driver, but can theoretically also happen in the firedtv driver. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 1 + 1 file changed, 1 insertion(+) Date: Mon, 31 Jan 2011 11:58:58 +0100 From: Clemens Ladisch firewire: core: rename some variables In manage_channel(), rename the variables "c" and "i" to the more expressive "bit" and "channel". Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-iso.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) Date: Sun, 23 Jan 2011 12:26:51 +0100 From: Stefan Richter firewire: nosy: should work on Power Mac G4 PCI too The first board generation of Power Mac G4 ("Yikes!", those with PCI graphics) still had a PCILynx controller like their G3 predecessors, but not the later AGP models. (Jonathan Woithe recalls to have heard of it, and some web sources reinforce it.) Signed-off-by: Stefan Richter --- drivers/firewire/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Date: Sat, 22 Jan 2011 15:05:03 +0100 From: Clemens Ladisch firewire: core: fix card->reset_jiffies overflow On a 32-bit machine with, e.g., HZ=1000, jiffies will overflow after about 50 days, so if there are between 25 and 50 days between bus resets, the card->reset_jiffies comparisons can get wrong results. To fix this, ensure that this timestamp always uses 64 bits. Signed-off-by: Clemens Ladisch Signed-off-by: "Stefan Richter" --- drivers/firewire/core-card.c | 5 +++-- drivers/firewire/core-cdev.c | 3 ++- drivers/firewire/core-device.c | 3 ++- drivers/firewire/core-topology.c | 2 +- include/linux/firewire.h | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) Date: Mon, 10 Jan 2011 17:29:03 +0100 From: Clemens Ladisch firewire: cdev: remove unneeded reference For outbound transactions, the IDR's and the callback's references now have exactly the same lifetime, so we do not need both of them. Signed-off-by: Clemens Ladisch Signed-off-by: "Stefan Richter" --- drivers/firewire/core-cdev.c | 5 ----- 1 file changed, 5 deletions(-) Date: Mon, 10 Jan 2011 17:28:39 +0100 From: Clemens Ladisch firewire: cdev: always wait for outbound transactions to complete We must not use fw_cancel_transaction() because it cannot correctly abort still-active transactions. The only place in core-cdev where this matters is when the file is released. Instead of trying to abort the transactions, we wait for them to complete normally, i.e., until all outbound transaction resources have been removed from the IDR tree. Signed-off-by: Clemens Ladisch Signed-off-by: "Stefan Richter" --- drivers/firewire/core-cdev.c | 42 +++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 14 deletions(-) Date: Mon, 10 Jan 2011 17:28:27 +0100 From: Clemens Ladisch firewire: cdev: remove unneeded idr_find() from complete_transaction() Outbound transactions are never aborted with release_client_resource(), so it is not necessary for complete_transaction() to check whether the resource is still registered. Only shutdown_resource() can abort such an transaction, and this is already handled with the in_shutdown check. Signed-off-by: Clemens Ladisch Signed-off-by: "Stefan Richter" --- drivers/firewire/core-cdev.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) Date: Mon, 10 Jan 2011 17:21:35 +0100 From: Clemens Ladisch firewire: ohci: log dead DMA contexts When a DMA context goes into the dead state (and the controller thus stops working correctly), logging this error and the controller's error code might be helpful for debugging. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 59 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 55 insertions(+), 4 deletions(-) Date: Thu, 20 Jan 2011 00:07:46 +0100 From: Stefan Richter firewire: net: is not experimental anymore thanks to Clemens' and Maxim's fixes to firewire-ohci and -net in the last two kernel releases. Signed-off-by: Stefan Richter --- drivers/firewire/Kconfig | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) Date: Sun, 16 Jan 2011 05:39:21 -0300 From: Stefan Richter [media] firedtv: fix remote control with newer Xorg evdev After a recent update of xf86-input-evdev and xorg-server, I noticed that X11 applications did not receive keypresses from the FireDTV infrared remote control anymore. Instead, the Xorg log featured lots of "FireDTV remote control: dropping event due to full queue!" exclamations. The Linux console did not have an issue with the FireDTV's RC though. The fix is to insert EV_SYN events after the key-down/-up events. Signed-off-by: Stefan Richter Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/firewire/firedtv-rc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) Date: Sat, 15 Jan 2011 18:19:48 +0100 From: Stefan Richter firewire: core: fix unstable I/O with Canon camcorder Regression since commit 10389536742c, "firewire: core: check for 1394a compliant IRM, fix inaccessibility of Sony camcorder": The camcorder Canon MV5i generates lots of bus resets when asynchronous requests are sent to it (e.g. Config ROM read requests or FCP Command write requests) if the camcorder is not root node. This causes drop- outs in videos or makes the camcorder entirely inaccessible. https://bugzilla.redhat.com/show_bug.cgi?id=633260 Fix this by allowing any Canon device, even if it is a pre-1394a IRM like MV5i are, to remain root node (if it is at least Cycle Master capable). With the FireWire controller cards that I tested, MV5i always becomes root node when plugged in and left to its own devices. Reported-by: Ralf Lange Signed-off-by: Stefan Richter Cc: # 2.6.32.y and newer --- drivers/firewire/core-card.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) Date: Mon, 13 Dec 2010 14:56:02 +0100 From: Clemens Ladisch firewire: use split transaction timeout only for split transactions Instead of starting the split transaction timeout timer when any request is submitted, start it only when the destination's ACK_PENDING has been received. This prevents us from using a timeout that is too short, and, if the controller's AT queue is emptying very slowly, from cancelling a packet that has not yet been sent. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 45 ++++++++++++++++++++-------- include/linux/firewire.h | 2 2 files changed, 33 insertions(+), 14 deletions(-) Date: Sat, 1 Jan 2011 15:17:05 +0100 From: Stefan Richter firewire: ohci: consolidate context status flags "firewire: ohci: restart iso DMA contexts on resume from low power mode" added the flag struct context.active and "firewire: ohci: cache the context run bit" added struct context.running. These flags contain the same information; combine them. Also, normalize whitespace in pci_resume(). Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) Date: Fri, 24 Dec 2010 14:42:46 +0100 From: Clemens Ladisch firewire: ohci: cache the context run bit The DMA context run control bit is entirely controlled by software, so it is safe to cache it. This allows the driver to avoid doing an additional MMIO read when queueing an AT packet. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Date: Sat, 1 Jan 2011 15:15:40 +0100 From: Stefan Richter firewire: ohci: flush AT contexts after bus reset - addendum Add comments - on why bus_reset_tasklet flushes AT queues, - that commit 76f73ca1b291 can possibly be reverted now. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 7 +++++++ 1 file changed, 7 insertions(+) Date: Fri, 24 Dec 2010 14:40:15 +0100 From: Clemens Ladisch firewire: ohci: flush AT contexts after bus reset for OHCI 1.2 The OHCI 1.2 (draft) specification, clause 7.2.3.3, allows and recommends that, after a bus reset, the controller does not flush all the packets in the AT queues. Therefore, the driver has to do this itself. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 46 ++++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 7 deletions(-) Date: Fri, 17 Dec 2010 22:22:33 +0100 From: Stefan Richter firewire: net: set carrier state at ifup At ifup, carrier status would be shown on even if it actually was off. [[On 2.6.37, also add an include for ethtool_ops rather than to rely on the one from netdevice.h.]] Note, we can alas not use fwnet_device_mutex to serialize access to dev->peer_count (as I originally wanted). This would cause a lock inversion: - fwnet_probe | takes fwnet_device_mutex + register_netdev | takes rtnl_mutex - devinet_ioctl | takes rtnl_mutex + fwnet_open | ...must not take fwnet_device_mutex Hence use the dev->lock spinlock for serialization. Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) Date: Wed, 8 Dec 2010 04:22:57 +0200 From: Maxim Levitsky firewire: net: add carrier detection To make userland, e.g. NetworkManager work with firewire, we need to detect whether cable is plugged or not. Simple and correct way of doing that is just counting number of peers. No peers - no link and vice versa. Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) Date: Mon, 29 Nov 2010 04:09:53 +0200 From: Maxim Levitsky firewire: net: ratelimit error messages Unfortunately its easy to trigger such error messages by removing the cable while sending streams of data over the link. Such errors are normal, and therefore this patch stops firewire-net from flooding the kernel log with these errors, by combining series of same errors together. Signed-off-by: Maxim Levitsky (Stefan R:) Eventually we should remove this logging when firewire-net and related firewire-ohci facilities have been stabilized. Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) Date: Mon, 29 Nov 2010 04:09:50 +0200 From: Maxim Levitsky firewire: ohci: restart iso DMA contexts on resume from low power mode Restore iso channels DMA so that iso channels could continue to work after resume from RAM/disk. Signed-off-by: Maxim Levitsky Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 54 ++++++++++++++++++++++++++++++++++------ 1 file changed, 46 insertions(+), 8 deletions(-) Date: Mon, 29 Nov 2010 04:09:49 +0200 From: Maxim Levitsky firewire: ohci: restore GUID on resume. Some lousy BIOSes, e.g. my Aspire 5720 BIOS forget to restore the GUID register on resume from RAM. Fix that by setting it to the last value that was read from it. Signed-off-by: Maxim Levitsky Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 7 +++++++ 1 file changed, 7 insertions(+) Date: Tue, 30 Nov 2010 08:25:05 +0100 From: Clemens Ladisch firewire: ohci: optimize iso context checks in the interrupt handler When the isochRx/isochTx bit is clear, we do not need to read the corresponding iso interrupt event register. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) Date: Tue, 30 Nov 2010 08:24:47 +0100 From: Clemens Ladisch firewire: make PHY packet header format consistent Change the header of PHY packets to be sent to include a pseudo transaction code. This makes the header consistent with that of received PHY packets, and allows at_context_queue_packet() and log_ar_at_event() to see the packet type directly instead of having to deduce it from the header length or even from the header contents. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 7 ++-- drivers/firewire/core-transaction.c | 7 ++-- drivers/firewire/core.h | 4 ++- drivers/firewire/ohci.c | 44 ++++++++++++++-------------- 4 files changed, 33 insertions(+), 29 deletions(-) Date: Tue, 30 Nov 2010 08:24:32 +0100 From: Clemens Ladisch firewire: ohci: properly clear posted write errors To remove the error information from the controller's queue and to allow more posted writes, the driver has to read the failed posted write address before clearing the postedWriteErr interrupt bit. Signed-off-by: Clemens Ladisch (Stefan R:) The spec is somewhat fuzzy about the actual requirements. To err on the safe side, let's do these two read accesses. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) Date: Tue, 30 Nov 2010 08:24:19 +0100 From: Clemens Ladisch firewire: ohci: flush MMIO writes in the interrupt handler Make sure that interrupt event clear bit writes are executed before the interrupt handler returns. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Date: Tue, 30 Nov 2010 08:24:01 +0100 From: Clemens Ladisch firewire: ohci: fix AT context initialization error handling Add proper error handling for the context_init() calls. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) Date: Sun Dec 12 17:13:48 CET 2010 From: Stefan Richter firewire: ohci: add revision field to quirks table 2.6.27 backport patch: Adjust quirks handling with firewire-ohci of current kernels. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 39 ++++++++++++++++++++++++++------------- 1 file changed, 26 insertions(+), 13 deletions(-) Date: Sun, 14 Nov 2010 14:35:40 +0100 (CET) From: Stefan Richter firewire: net: throttle TX queue before running out of tlabels This prevents firewire-net from submitting write requests in fast succession until failure due to all 64 transaction labels were used up for unfinished split transactions. The netif_stop/wake_queue API is used for this purpose. Without this stop/wake mechanism, datagrams were simply lost whenever the tlabel pool was exhausted. Plus, tlabel exhaustion by firewire-net also prevented other unrelated outbound transactions to be initiated. The chosen queue depth was checked by me to hit the maximum possible throughput with an OS X peer whose receive DMA is good enough to never reject requests due to busy inbound request FIFO. Current Linux peers show a mixed picture of -5%...+15% change in bandwidth; their current bottleneck are RCODE_BUSY situations (fewer or more, depending on TX queue depth) due to too small AR buffer in firewire-ohci. Maxim Levitsky tested this change with similar watermarks with a Linux peer and some pending firewire-ohci improvements that address the RCODE_BUSY problem and confirmed that these TX queue limits are good. Note: This removes some netif_wake_queue from reception code paths. They were apparently copy&paste artefacts from a nonsensical netif_wake_queue use in the older eth1394 driver. This belongs only into the transmit path. Signed-off-by: Stefan Richter Tested-by: Maxim Levitsky --- drivers/firewire/net.c | 59 ++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 24 deletions(-) Date: Sat, 6 Nov 2010 23:18:23 +0100 (CET) From: Stefan Richter firewire: net: replace lists by counters The current transmit code does not at all make use of - fwnet_device.packet_list and only very limited use of - fwnet_device.broadcasted_list, - fwnet_device.queued_packets. Their current function is to track whether the TX soft-IRQ finished dealing with an skb when the AT-req tasklet takes over, and to discard pending tx datagrams (if there are any) when the local node is removed. The latter does actually contain a race condition bug with TX soft-IRQ and AT-req tasklet. Instead of these lists and the corresponding link in fwnet_packet_task, - a flag in fwnet_packet_task to track whether fwnet_tx is done, - a counter of queued datagrams in fwnet_device do the job as well. The above mentioned theoretic race condition is resolved by letting fwnet_remove sleep until all datagrams were flushed. It may sleep almost arbitrarily long since fwnet_remove is executed in the context of a multithreaded (concurrency managed) workqueue. The type of max_payload is changed to u16 here to avoid waste in struct fwnet_packet_task. This value cannot exceed 4096 per IEEE 1394:2008 table 16-18 (or 32678 per specification of packet headers, if there is ever going to be something else than beta mode). Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 73 +++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 47 deletions(-) Date: Sat, 6 Nov 2010 16:57:28 +0100 (CET) From: Stefan Richter firewire: net: fix memory leaks a) fwnet_transmit_packet_done used to poison ptask->pt_link by list_del. If fwnet_send_packet checked later whether it was responsible to clean up (in the border case that the TX soft IRQ was outpaced by the AT-req tasklet on another CPU), it missed this because ptask->pt_link was no longer shown as empty. b) If fwnet_write_complete got an rcode other than RCODE_COMPLETE, we missed to free the skb and ptask entirely. Also, count stats.tx_dropped and stats.tx_errors when rcode != 0. Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) Date: Sat, 6 Nov 2010 12:36:13 +0100 (CET) From: Stefan Richter firewire: net: count stats.tx_packets and stats.tx_bytes Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) Date: Mon, 25 Oct 2010 11:43:05 +0200 From: Clemens Ladisch firewire: ohci: fix race when reading count in AR descriptor If the controller is storing a split packet and therefore changing d->res_count to zero between the two reads by the driver, we end up with an end pointer that is not at a packet boundary, and therefore overflow the buffer when handling the split packet. To fix this, read the field once, atomically. The compiler usually merges the two reads anyway, but for correctness, we have to enforce it. Signed-off-by: Clemens Ladisch Tested-by: Maxim Levitsky Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) Date: Mon, 25 Oct 2010 11:42:42 +0200 From: Clemens Ladisch firewire: ohci: avoid reallocation of AR buffers Freeing an AR buffer page just to allocate a new page immediately afterwards is not only a pointless effort but also dangerous because the allocation can fail, which would result in an oops later. Split ar_context_add_page() into two functions so that we can reuse the old page directly. Signed-off-by: Clemens Ladisch Tested-by: Maxim Levitsky Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) Date: Mon, 25 Oct 2010 11:42:20 +0200 From: Clemens Ladisch firewire: ohci: fix race in AR split packet handling When handling an AR buffer that has been completely filled, we assumed that its descriptor will not be read by the controller and can be overwritten. However, when the last received packet happens to end at the end of the buffer, the controller might not yet have moved on to the next buffer and might read the branch address later. If we overwrite and free the page before that, the DMA context will either go dead because of an invalid Z value, or go off into some random memory. To fix this, ensure that the descriptor does not get overwritten by using only the actual buffer instead of the entire page for reassembling the split packet. Furthermore, to avoid freeing the page too early, move on to the next buffer only when some data in it guarantees that the controller has moved on. This should eliminate the remaining firewire-net problems. Signed-off-by: Clemens Ladisch Cc: 2.6.22-2.6.36 Tested-by: Maxim Levitsky Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) Date: Mon, 25 Oct 2010 11:41:53 +0200 From: Clemens Ladisch firewire: ohci: fix buffer overflow in AR split packet handling When the controller had to split a received asynchronous packet into two buffers, the driver tries to reassemble it by copying both parts into the first page. However, if size + rest > PAGE_SIZE, i.e., if the yet unhandled packets before the split packet, the split packet itself, and any received packets after the split packet are together larger than one page, then the memory after the first page would get overwritten. To fix this, do not try to copy the data of all unhandled packets at once, but copy the possibly needed data every time when handling a packet. This gets rid of most of the infamous crashes and data corruptions when using firewire-net. Signed-off-by: Clemens Ladisch Cc: 2.6.22-2.6.36 Tested-by: Maxim Levitsky Signed-off-by: Stefan Richter (cast PAGE_SIZE to size_t) --- drivers/firewire/ohci.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) Date: Mon, 1 Mar 2010 11:56:42 +0000 (-0300) From: Henrik Kurelid firedtv: add parameter to fake ca_system_ids in CA_INFO The Digital Everywhere firmware have the shortcoming that ca_info_enq and ca_info are not supported. This means that we can never retrieve the correct ca_system_id to present in the CI message CA_INFO. Currently the driver uses the application id retrieved using app_info_req and app_info, but this id only match the correct ca_system_id as given in ca_info in some cases. This patch adds a parameter to the driver in order for the user to override what will be returned in the CA_INFO CI message. Up to four ca_system_ids can be specified. This is needed for users with CAMs that have different manufacturer id and ca_system_id and that uses applications that take this into account, like MythTV. Signed-off-by: Henrik Kurelid Signed-off-by: Stefan Richter Signed-off-by: Mauro Carvalho Chehab --- drivers/media/dvb/firewire/firedtv-avc.c | 31 ++++++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) Date: Sun, 17 Oct 2010 13:50:26 +0200 (CEST) From: Stefan Richter firewire: ohci: fix TI TSB82AA2 regression since 2.6.35 Revert commit 54672386ccf36ffa21d1de8e75624af83f9b0eeb "firewire: ohci: fix up configuration of TI chips". It caused massive slow-down and data corruption with a TSB82AA2 based StarTech EC1394B2 ExpressCard and FireWire 800 harddisks. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/657081 http://thread.gmane.org/gmane.linux.kernel.firewire.user/4013 The fact that some card EEPROMs do not program these enhancements may be related to TSB81BA3 phy chip errata, if not to bugs of TSB82AA2 itself. We could re-add these configuration steps, but only conditional on a whitelist of cards on which these enhancements bring a proven positive effect. Reported-and-tested-by: Eric Shattow Cc: Clemens Ladisch Cc: 2.6.35 Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 19 +------------------ drivers/firewire/ohci.h | 8 -------- 2 files changed, 1 insertion(+), 26 deletions(-) Date: Wed, 13 Oct 2010 14:25:44 +0200 (CEST) From: Stefan Richter firewire: nosy: char device is not seekable Amend .open handler accordingly and add proper .llseek handler. (The only client that uses this interface is nosy-dump in linux/tools/firewire and it knows not to seek in this char dev.) Signed-off-by: Stefan Richter --- drivers/firewire/nosy.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Date: Sun, 10 Oct 2010 00:54:02 +0200 From: Stefan Richter ieee1394: move init_ohci1394_dma to drivers/firewire/ because drivers/ieee1394/ will be deleted. Additional changes: - add some #include directives - adjust to use firewire/ohci.h instead of ieee1394/ohci1394.h, replace struct ti_ohci by a minimal struct ohci, replace quadlet_t from ieee1394_types.h by u32 - two or three trivial stylistic changes - __iomem annotation Signed-off-by: Stefan Richter --- drivers/firewire/Makefile | 1 + drivers/firewire/init_ohci1394_dma.c | 309 +++++++++++++++++++++++++++ drivers/ieee1394/Makefile | 2 - drivers/ieee1394/init_ohci1394_dma.c | 285 ------------------------- 4 files changed, 310 insertions(+), 287 deletions(-) Date: Wed, 15 Sep 2010 13:02:44 +0200 (CEST) From: Stefan Richter firewire: nosy: fix build when CONFIG_FIREWIRE=N drivers/firewire/nosy* is a stand-alone driver that does not depend on CONFIG_FIREWIRE. Hence let make descend into drivers/firewire/ also if that option is off. The stand-alone driver drivers/ieee1394/init_ohci1394_dma* will soon be moved into drivers/firewire/ too and will require the same makefile fix. Side effect: As mentioned in https://bugzilla.novell.com/show_bug.cgi?id=586172#c24 this influences the order in which either firewire-ohci or ohci1394 is going to be bound to an OHCI-1394 controller in case of a modular build of both drivers if no modprobe blacklist entries are configured. However, a user of such a setup cannot expect deterministic behavior anyway. The Kconfig help and the migration guide at ieee1394.wiki.kernel.org recommend blacklist entries when a dual IEEE 1394 stack build is being used. (The coexistence period of the two stacks is planned to end soon.) Cc: Michal Marek Signed-off-by: Stefan Richter --- drivers/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Mon, 6 Sep 2010 22:30:45 +0300 From: Heikki Lindholm firewire: ohci: activate cycle timer register quirk on Ricoh chips The Ricoh FireWire controllers appear to have the non-atomic cycle timer register access bug, so, activate the driver workaround by default. The behaviour was observed on: Ricoh Co Ltd R5C552 IEEE 1394 Controller [1180:0552] and Ricoh Co Ltd R5C832 IEEE 1394 Controller [1180:0832] (rev 04). Signed-off-by: Heikki Lindholm Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 1 + 1 file changed, 1 insertion(+) Date: Sat, 28 Aug 2010 14:21:26 +0200 (CEST) From: Stefan Richter firewire: ohci: work around VIA and NEC PHY packet reception bug VIA VT6306, VIA VT6308, and NEC OrangeLink controllers do not write packet event codes for received PHY packets (or perhaps write evt_no_status, hard to tell). Work around it by overwriting the packet's ACK by ack_complete, so that upper layers that listen to PHY packet reception get to see these packets. (Also tested: TI TSB82AA2, TI TSB43AB22/A, TI XIO2213A, Agere FW643, JMicron JMB381 --- these do not exhibit this bug.) Clemens proposed a quirks flag for that, IOW whitelist known misbehaving controllers for this workaround. Though to me it seems harmless enough to enable for all controllers. The log_ar_at_event() debug log will continue to show the original status from the DMA unit. Reported-by: Clemens Ladisch (VT6308) Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) Date: Wed, 18 Aug 2010 15:05:02 +0200 From: Clemens Ladisch firewire: core: do not use del_timer_sync() in interrupt context Because we might be in interrupt context, replace del_timer_sync() with del_timer(). If the timer is already running, we know that it will clean up the transaction, so we do not need to do any further processing in the normal transaction handler. Many thanks to Yong Zhang for diagnosing this. Reported-by: Stefan Richter Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) Date: Mon, 16 Aug 2010 23:45:54 +0200 (CEST) From: Stefan Richter firewire: net: fix unicast reception RCODE in failure paths The incoming request hander fwnet_receive_packet() expects subsequent datagram handling code to return non-zero on errors. However, almost none of the failure paths did so. Fix them all. (This error reporting is used to send and RCODE_CONFLICT_ERROR to the sender node in such failure cases. Two modes of failure exist: Out of memory, or firewire-net is unaware of any peer node to which a fragment or an ARP packet belongs. However, it is unclear whether a sender can actually make use of such information. A Linux peer apparently can't. Maybe it should all be simplified to void functions.) Reported-by: Julia Lawall Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) Date: Mon, 16 Aug 2010 22:13:34 +0200 (CEST) From: Stefan Richter firewire: sbp2: fix stall with "Unsolicited response" Fix I/O stalls with some 4-bay RAID enclosures which are based on OXUF936QSE: - Onnto dataTale RSM4QO, old firmware (not anymore with current firmware), - inXtron Hydra Super-S LCM, old as well as current firmware when used in RAID-5 mode, perhaps also in other RAID modes. The stalls happen during heavy or moderate disk traffic in periods that are a multiple of 5 minutes, roughly twice per hour. They are caused by the target responding too late to an ORB_Pointer register write: The target responds after Split_Timeout, hence firewire-core cancels the transaction, and firewire-sbp2 fails the SCSI request. The SCSI core retries the request, that fails again (and again), hence SCSI core calls firewire-sbp2's abort handler (and even the Management_Agent register write in the abort handler has the transaction timeout problem). During all that, the process which issued the I/O is stalled in I/O wait state. Meanwhile, the target actually acts on the first failed SCSI request: It responds to the ORB_Pointer write later (seen in the kernel log as "firewire_core: Unsolicited response") and also finishes the SCSI request with proper status (seen in the kernel log as "firewire_sbp2: status write for unknown orb"). So let's just ignore RCODE_CANCELLED in the transaction callback and wait for the target to complete the ORB nevertheless. This requires a small modification is sbp2_cancel_orbs(); it now needs to call orb->callback() regardless whether fw_cancel_transaction() found the transaction unfinished or finished. A different solution is to increase Split_Timeout on the local node. (Tested: 2000ms timeout; maybe 1000ms or something like that works too. 200ms is insufficient. Standard is 100ms.) However, I rather not do this because any software on any node could change the Split_Timeout to something unsuitable. Or such a large Split_Timeout may be undesirable for other purposes. Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) Date: Mon, 16 Aug 2010 21:58:03 +0200 (CEST) From: Stefan Richter firewire: sbp2: fix memory leak in sbp2_cancel_orbs or at send error When an ORB was canceled (Command ORB i.e. SCSI request timed out, or Management ORB timed out), or there was a send error in the initial transaction, we missed to drop one of the ORB's references and thus leaked memory. Background: In total, we hold 3 references to each Operation Request Block: - 1 during sbp2_scsi_queuecommand() or sbp2_send_management_orb() respectively, - 1 for the duration of the write transaction to the ORB_Pointer or Management_Agent register of the target, - 1 for as long as the ORB stays within the lu->orb_list, until the ORB is unlinked from the list and the orb->callback was executed. The latter one of these 3 references is finished - normally by sbp2_status_write() when the target wrote status for a pending ORB, - or by sbp2_cancel_orbs() in case of an ORB time-out, - or by complete_transaction() in case of a send error. Of them, the latter two lacked the kref_put. Add the missing kref_put()s. Add comments to the gets and puts of references for transaction callbacks and ORB callbacks so that it is easier to see what is supposed to happen. Signed-off-by: Stefan Richter --- drivers/firewire/sbp2.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) Date: Thu, 5 Aug 2010 22:20:09 +0200 (CEST) From: Julia Lawall ieee1394: Adjust confusing if indentation Indent the branch of an if. Signed-off-by: Julia Lawall Signed-off-by: Stefan Richter --- drivers/ieee1394/ohci1394.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Mon, 2 Aug 2010 10:09:04 +0200 (CEST) From: Stefan Richter Merge firewire branches to be released post v2.6.35 Add forgotten #include in drivers/firewire/ohci.c. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 1 + 1 file changed, 1 insertion(+) Date: Sun, 1 Aug 2010 12:23:14 +0200 (CEST) From: Stefan Richter firewire: core: add forgotten dummy driver methods, remove unused ones There is an at least theoretic race condition in which .start_iso etc. could still be called between when the dummy driver is bound to the card and when the children devices are being shut down. Add dummy_start_iso and friends. On the other hand, .enable, .set_config_rom, .read_csr, write_csr do not need to be implemented by the dummy driver, as commented. Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 64 +++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 26 deletions(-) Date: Thu, 29 Jul 2010 18:19:22 +0200 From: Stefan Richter firewire: add isochronous multichannel reception This adds the DMA context programming and userspace ABI for multichannel reception, i.e. for listening on multiple channel numbers by means of a single DMA context. The use case is reception of more streams than there are IR DMA units offered by the link layer. This is already implemented by the older ohci1394 + ieee1394 + raw1394 stack. And as discussed recently on linux1394-devel, this feature is occasionally used in practice. The big drawbacks of this mode are that buffer layout and interrupt generation necessarily differ from single-channel reception: Headers and trailers are not stripped from packets, packets are not aligned with buffer chunks, interrupts are per buffer chunk, not per packet. These drawbacks also cause a rather hefty code footprint to support this rarely used OHCI-1394 feature. (367 lines added, among them 94 lines of added userspace ABI documentation.) This implementation enforces that a multichannel reception context may only listen to channels to which no single-channel context on the same link layer is presently listening to. OHCI-1394 would allow to overlay single-channel contexts by the multi-channel context, but this would be a departure from the present first-come-first-served policy of IR context creation. The implementation is heavily based on an earlier one by Jay Fenlason. Thanks Jay. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 93 ++++++++-- drivers/firewire/core-iso.c | 32 ++- drivers/firewire/core.h | 2 + drivers/firewire/ohci.c | 316 +++++++++++++++++++++++++++------- include/linux/firewire-cdev.h | 281 +++++++++++++++++++++--------- include/linux/firewire.h | 29 ++- 6 files changed, 560 insertions(+), 193 deletions(-) Date: Thu, 29 Jul 2010 09:31:56 +0200 (CEST) From: Stefan Richter firewire: core: small clarifications in core-cdev Make a note on the seemingly unused linux/sched.h. Rename an irritatingly named variable. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) Date: Wed, 28 Jul 2010 23:49:45 +0200 (CEST) From: Stefan Richter firewire: core: remove unused code ioctl_create_iso_context enforces ctx->header_size >= 4. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) Date: Wed, 28 Jul 2010 15:50:00 +0200 (CEST) From: Stefan Richter firewire: ohci: release channel in error path firewire-ohci keeps book of which isochronous channels are occupied by IR DMA contexts, so that there cannot be more than one context listening to a certain channel. If IR context creation failed due to an out-of-memory condition, this bookkeeping leaked a channel. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 1 + 1 file changed, 1 insertion(+) Date: Tue, 27 Jul 2010 13:20:33 +0200 (CEST) From: Stefan Richter firewire: ohci: use memory barriers to order descriptor updates When we append to a DMA program, we need to ensure that the order in which initialization of the new descriptors and update of the branch_address of the old tail descriptor, as seen by the PCI device, happen as intended. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 3 +++ 1 file changed, 3 insertions(+) Date: Fri, 23 Jul 2010 13:05:39 +0200 (CEST) From: Stefan Richter firewire: cdev: improve FW_CDEV_IOC_ALLOCATE In both the ieee1394 stack and the firewire stack, the core treats kernelspace drivers better than userspace drivers when it comes to CSR address range allocation: The former may request a register to be placed automatically at a free spot anywhere inside a specified address range. The latter may only request a register at a fixed offset. Hence, userspace drivers which do not require a fixed offset potentially need to implement a retry loop with incremented offset in each retry until the kernel does not fail allocation with EBUSY. This awkward procedure is not fundamentally necessary as the core already provides a superior allocation API to kernelspace drivers. Therefore change the ioctl() ABI by addition of a region_end member in the existing struct fw_cdev_allocate. Userspace and kernelspace APIs work the same way now. There is a small cost to pay by clients though: If client source code is required to compile with older kernel headers too, then any use of the new member fw_cdev_allocate.region_end needs to be enclosed by #ifdef/#endif directives. However, any client program that seriously wants to use address range allocations will require a kernel of cdev ABI version >= 4 at runtime and a linux/firewire-cdev.h header of >= 4 anyway. This is because v4 brings FW_CDEV_EVENT_REQUEST2. The only client program in which build-time compatibility with struct fw_cdev_allocate as found in older kernel headers makes sense is libraw1394. (libraw1394 uses the older broken FW_CDEV_EVENT_REQUEST to implement a makeshift, incorrect transaction responder that does at least work somewhat in many simple scenarios, relying on guesswork by libraw1394 and by libraw1394 based applications. Plus, address range allocation and transaction responder is only one of many features that libraw1394 needs to provide, and these other features need to work with kernel and kernel-headers as old as possible. Any new linux/firewire-cdev.h based client that implements a transaction responder should never attempt to do it like libraw1394; instead it should make a header and kernel of v4 or later a hard requirement.) While we are at it, update the struct fw_cdev_allocate documentation to better reflect the recent fw_cdev_event_request2 ABI addition. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 12 +++++++++--- include/linux/firewire-cdev.h | 29 ++++++++++++++++++++++++----- 2 files changed, 33 insertions(+), 8 deletions(-) Date: Fri, 23 Jul 2010 13:02:54 +0200 (CEST) From: Stefan Richter firewire: core: fix upper bound of possible CSR allocations region->end is defined as an upper bound of the requested address range, exclusive --- i.e. as an address outside of the range in which the requested CSR is to be placed. Hence 0x0001,0000,0000,0000 is the biggest valid region->end, not 0x0000,ffff,ffff,fffc like the current check asserted. For simplicity, the fix drops the region->end & 3 test because there is no actual problem with these bits set in region->end. The allocated address range will be quadlet aligned and of a size of multiple quadlets due to the checks for region->start & 3 and handler->length & 3 alone. Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Thu, 22 Jul 2010 11:58:05 +0200 (CEST) From: Stefan Richter tools/firewire: nosy-dump: increment program version Since version 0.3 from Kristian's repository, there should actually be no change in functionality except for the x86-64 fix. Nevertheless, make it distinct from the original nosy-dump --- just in case and also because of potential future changes. Signed-off-by: Stefan Richter --- tools/firewire/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Date: Thu, 22 Jul 2010 11:58:05 +0200 (CEST) From: Stefan Richter tools/firewire: nosy-dump: remove unused code Signed-off-by: Stefan Richter --- tools/firewire/nosy-dump.c | 113 +++++++++++++++++-------------------- 1 file changed, 53 insertions(+), 60 deletions(-) Date: Thu, 22 Jul 2010 11:58:05 +0200 (CEST) From: Stefan Richter tools/firewire: nosy-dump: use linux/firewire-constants.h Signed-off-by: Stefan Richter --- tools/firewire/decode-fcp.c | 6 ++++-- tools/firewire/nosy-dump.c | 7 ++++--- tools/firewire/nosy-dump.h | 29 +++-------------------------- 3 files changed, 11 insertions(+), 31 deletions(-) Date: Thu, 22 Jul 2010 11:58:05 +0200 (CEST) From: Stefan Richter tools/firewire: nosy-dump: break up a deeply nested function Signed-off-by: Stefan Richter --- tools/firewire/nosy-dump.c | 255 ++++++++++++++++++++----------------- 1 file changed, 137 insertions(+), 118 deletions(-) Date: Thu, 22 Jul 2010 11:58:05 +0200 (CEST) From: Stefan Richter tools/firewire: nosy-dump: make some symbols static or const Signed-off-by: Stefan Richter --- tools/firewire/nosy-dump.c | 56 +++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 27 deletions(-) Date: Thu, 22 Jul 2010 11:58:05 +0200 (CEST) From: Stefan Richter tools/firewire: nosy-dump: change to kernel coding style This changes only - whitespace - C99 initializers - comment style - order of #includes - if { } else { } bracing Signed-off-by: Stefan Richter --- tools/firewire/decode-fcp.c | 364 ++++---- tools/firewire/list.h | 24 tools/firewire/nosy-dump.c | 1641 ++++++++++++++++++------------------ tools/firewire/nosy-dump.h | 280 +++--- 4 files changed, 1128 insertions(+), 1181 deletions(-) Date: Thu, 22 Jul 2010 11:58:05 +0200 (CEST) From: Stefan Richter tools/firewire: nosy-dump: work around segfault in decode_fcp 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: Stefan Richter --- tools/firewire/nosy-dump.c | 5 +++++ 1 file changed, 5 insertions(+) Date: Thu, 22 Jul 2010 11:58:05 +0200 (CEST) From: Stefan Richter tools/firewire: nosy-dump: fix it on x86-64 Replace 'unsigned long' and the (unaffected) 'unsigned int' by uint32_t if they represent quadlets. Signed-off-by: Stefan Richter --- tools/firewire/decode-fcp.c | 12 +- tools/firewire/nosy-dump.c | 37 ++--- tools/firewire/nosy-dump.h | 272 ++++++++++++------------------------ 3 files changed, 112 insertions(+), 209 deletions(-) Date: Thu, 22 Jul 2010 11:58:05 +0200 (CEST) From: Stefan Richter tools/firewire: add userspace front-end of nosy 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: Stefan Richter Acked-by: Kristian Høgsberg [[ backport patch without MAINTAINERS hunk ]] --- drivers/firewire/Kconfig | 3 + tools/firewire/Makefile | 19 + tools/firewire/decode-fcp.c | 239 ++++++++ tools/firewire/list.h | 62 ++ tools/firewire/nosy-dump.c | 1037 ++++++++++++++++++++++++++++++++++++ tools/firewire/nosy-dump.h | 292 ++++++++++ 6 files changed, 1651 insertions(+), 1 deletion(-) Date: Thu, 22 Jul 2010 11:56:38 +0200 (CEST) From: Stefan Richter firewire: nosy: use generic printk macros 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: Stefan Richter --- drivers/firewire/nosy.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) Date: Thu, 22 Jul 2010 11:56:38 +0200 (CEST) From: Stefan Richter firewire: nosy: endianess fixes and annotations 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: Stefan Richter --- drivers/firewire/nosy-user.h | 6 +- drivers/firewire/nosy.c | 74 ++++++++++++----------------------- 2 files changed, 29 insertions(+), 51 deletions(-) Date: Thu, 22 Jul 2010 11:56:38 +0200 (CEST) From: Stefan Richter firewire: nosy: annotate __user pointers and __iomem pointers Signed-off-by: Stefan Richter --- drivers/firewire/nosy.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Date: Thu, 22 Jul 2010 11:56:38 +0200 (CEST) From: Stefan Richter firewire: nosy: fix device shutdown with active client 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: Stefan Richter --- drivers/firewire/nosy.c | 109 ++++++++++++++++++++++++++++++---------- 1 file changed, 81 insertions(+), 28 deletions(-) Date: Thu, 22 Jul 2010 11:56:38 +0200 (CEST) From: Stefan Richter firewire: nosy: handle errors in device probe and add a missing pci_disable_device() to device shutdown. Signed-off-by: Stefan Richter --- drivers/firewire/nosy.c | 40 +++++++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 7 deletions(-) Date: Thu, 22 Jul 2010 11:56:38 +0200 (CEST) From: Stefan Richter firewire: nosy: fix IRQ handler for card ejection Untested, I don't have a PCILynx CardBus card. Signed-off-by: Stefan Richter --- drivers/firewire/nosy.c | 4 ++++ 1 file changed, 4 insertions(+) Date: Thu, 22 Jul 2010 11:56:38 +0200 (CEST) From: Stefan Richter firewire: nosy: unroll some simple functions nosy_start/stop_snoop() and nosy_add/remove_client() are simple enough to be inlined into their callers. Signed-off-by: Stefan Richter --- drivers/firewire/nosy.c | 75 +++++++++++++++------------------------- 1 file changed, 29 insertions(+), 46 deletions(-) Date: Thu, 22 Jul 2010 11:56:38 +0200 (CEST) From: Stefan Richter firewire: nosy: use flagless variants of spinlock accessors 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: Stefan Richter --- drivers/firewire/nosy.c | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) Date: Thu, 22 Jul 2010 11:56:38 +0200 (CEST) From: Stefan Richter firewire: nosy: fix list corruption by NOSY_IOC_STOP nosy_stop_snoop() would blow up the second time it was called without nosy_start_snoop() in between. Signed-off-by: Stefan Richter --- drivers/firewire/nosy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Thu, 22 Jul 2010 11:56:38 +0200 (CEST) From: Stefan Richter firewire: nosy: convert to unlocked ioctl 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: Stefan Richter --- drivers/firewire/nosy.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) Date: Thu, 27 Jul 2010 10:28:30 +0200 (CEST) From: Stefan Richter firewire: nosy: misc cleanups Extend copyright note to 2007, c.f. Kristian's git log. Includes: - replace some by - add required indirectly included - 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: Stefan Richter --- drivers/firewire/nosy-user.h | 10 drivers/firewire/nosy.c | 318 +++++++++++++++++------------------ drivers/firewire/nosy.h | 27 +-- 3 files changed, 169 insertions(+), 186 deletions(-) Date: Thu, 27 Jul 2010 10:26:33 +0200 (CEST) From: Stefan Richter firewire: new driver: nosy - IEEE 1394 traffic sniffer 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 , 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: Stefan Richter Acked-by: Kristian Høgsberg --- drivers/firewire/Kconfig | 23 + drivers/firewire/Makefile | 1 + drivers/firewire/nosy-user.h | 25 + drivers/firewire/nosy.c | 695 +++++++++++++++++++++++++++++++++++ drivers/firewire/nosy.h | 238 ++++++++++++ 5 files changed, 982 insertions(+) Date: Sun, 18 Jul 2010 13:00:50 +0200 (CEST) From: Stefan Richter firewire: cdev: add PHY pinging This extends the FW_CDEV_IOC_SEND_PHY_PACKET ioctl() for /dev/fw* to be useful for ping time measurements. One application for it would be gap count optimization in userspace that is based on ping times rather than hop count. (The latter is implemented in firewire-core itself but is not applicable to beta PHYs that act as repeater.) Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 9 ++++++--- drivers/firewire/core.h | 5 +++++ drivers/firewire/ohci.c | 3 +++ include/linux/firewire-cdev.h | 5 ++++- 4 files changed, 18 insertions(+), 4 deletions(-) Date: Fri, 16 Jul 2010 22:25:51 +0200 (CEST) From: Stefan Richter firewire: cdev: add PHY packet reception Add an FW_CDEV_IOC_RECEIVE_PHY_PACKETS ioctl() and FW_CDEV_EVENT_PHY_PACKET_RECEIVED poll()/read() event for /dev/fw*. This can be used to get information from remote PHYs by remote access PHY packets. This is also the 2nd half of the functionality (the receive part) to support a userspace implementation of a VersaPHY transaction layer. Safety considerations: - PHY packets are generally broadcasts, hence some kind of elevated privileges should be required of a process to be able to listen in on PHY packets. This implementation assumes that a process that is allowed to open the /dev/fw* of a local node does have this privilege. There was an inconclusive discussion about introducing POSIX capabilities as a means to check for user privileges for these kinds of operations. Other limitations: - PHY packet reception may be switched on by ioctl() but cannot be switched off again. It would be trivial to provide an off switch, but this is not worth the code. The client should simply close() the fd then, or just ignore further events. - For sake of simplicity of API and kernel-side implementation, no filter per packet content is provided. Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 1 + drivers/firewire/core-cdev.c | 73 ++++++++++++++++++++++++++-- drivers/firewire/core-transaction.c | 5 ++ drivers/firewire/core.h | 2 + drivers/firewire/ohci.c | 3 - include/linux/firewire-cdev.h | 39 ++++++++++++--- include/linux/firewire.h | 3 + 7 files changed, 111 insertions(+), 15 deletions(-) Date: Fri, 16 Jul 2010 22:25:14 +0200 (CEST) From: Stefan Richter firewire: cdev: add PHY packet transmission Add an FW_CDEV_IOC_SEND_PHY_PACKET ioctl() for /dev/fw* which can be used to implement bus management related functionality in userspace. This is also half of the functionality (the transmit part) that is needed to support a userspace implementation of a VersaPHY transaction layer. Safety considerations: - PHY packets are generally broadcasts and may have interesting effects on PHYs and the bus, e.g. make asynchronous arbitration impossible due to too low gap count. Hence some kind of elevated privileges should be required of a process to be able to send PHY packets. This implementation assumes that a process that is allowed to open the /dev/fw* of a local node does have this privilege. There was an inconclusive discussion about introducing POSIX capabilities as a means to check for user privileges for these kinds of operations. - The kernel does not check integrity of the supplied packet data. That would be far too much code, considering the many kinds of PHY packets. A process which got the privilege to send these packets is trusted to do it correctly. Just like with the other "send packet" ioctls, a non-blocking API is chosen; i.e. the ioctl may return even before AT DMA started. After transmission, an event for poll()/read() is enqueued. Most users are going to need a blocking API, but a blocking userspace wrapper is easy to implement, and the second of the two existing libraw1394 calls raw1394_phy_packet_write() and raw1394_start_phy_packet_write() can be better supported that way. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 64 ++++++++++++++++++++++++++++++++++ include/linux/firewire-cdev.h | 44 +++++++++++++++++++++++ 2 files changed, 107 insertions(+), 1 deletion(-) Date: Fri, 16 Jul 2010 22:24:29 +0200 (CEST) From: Stefan Richter firewire: core: use C99 initializer in array of ioctl handlers to make the correspondence of ioctl numbers and handlers more obvious. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 42 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) Date: Sat, 17 Jul 2010 21:36:02 +0200 (CEST) From: Stefan Richter firewire: cdev: some clarifications to the API documentation Response events: - are generated on more occasions than their documentation claimed. CSR allocation: - An already occupied CSR can be determined from errno==EBUSY. Bus resets: - Note that FW_CDEV_IOC_INITIATE_BUS_RESET is nonblocking and that the client is not required to observe a grace period since kernels 2.6.36+ will enforce it now (commit 02d37bed). - The possible values of fw_cdev_initiate_bus_reset.type are listed in the kerneldoc comment already. - Clarify that an application that uses FW_CDEV_IOC_ADD_DESCRIPTOR and FW_CDEV_IOC_REMOVE_DESCRIPTOR does not have to issue a bus reset. Isochronous I/O contexts: - At most one can be created per open file descriptor. Signed-off-by: Stefan Richter --- include/linux/firewire-cdev.h | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) Date: Sun, 18 Jul 2010 12:44:01 +0200 (CEST) From: Stefan Richter firewire: normalize status values in packet callbacks core-transaction.c transmit_complete_callback() and close_transaction() expect packet callback status to be an ACK or RCODE, and ACKs get translated to RCODEs for transaction callbacks. An old comment on the packet callback API (been there from the initial submission of the stack) and the dummy_driver implementation of send_request/send_response deviated from this as they also included -ERRNO in the range of status values. Let's narrow status values down to ACK and RCODE to prevent surprises. RCODE_CANCELLED is chosen as the dummy_driver's RCODE as its meaning of "transaction timed out" comes closest to what happens when a transaction coincides with card removal. Signed-off-by: Stefan Richter --- Supersedes patch "correct comment on packet callback API" from July 16. drivers/firewire/core-card.c | 4 ++-- drivers/firewire/core-transaction.c | 5 ++++- include/linux/firewire.h | 8 ++++---- 3 files changed, 10 insertions(+), 7 deletions(-) Date: Mon, 12 Jul 2010 13:50:00 -0700 From: Joe Perches ieee1394: Remove unnecessary casts of private_data Signed-off-by: Joe Perches Signed-off-by: Stefan Richter --- drivers/ieee1394/dv1394.c | 4 ++-- drivers/ieee1394/raw1394.c | 4 ++-- drivers/ieee1394/video1394.c | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) Date: Thu, 8 Jul 2010 16:09:06 +0200 (CEST) From: Stefan Richter firewire: core: integrate software-forced bus resets with bus management Bus resets which are triggered - by the kernel drivers after updates of the local nodes' config ROM, - by userspace software via ioctl shall be deferred until after >=2 seconds after the last bus reset. If multiple modifications of the local nodes' config ROM happen in a row, only a single bus reset should happen after them. When the local node's link goes from inactive to active or vice versa, and at the two occasions of bus resets mentioned above --- and if the current gap count differs from 63 --- the bus reset should be preceded by a PHY configuration packet that reaffirms the gap count. Otherwise a bus manager would have to reset the bus again right after that. This is necessary to promote bus stability, e.g. leave grace periods for allocations and reallocations of isochronous channels and bandwidth, SBP-2 reconnections etc.; see IEEE 1394 clause 8.2.1. This change implements all of the above by moving bus reset initiation into a delayed work (except for bus resets which are triggered by the bus manager workqueue job and are performed there immediately). It comes with a necessary addition to the card driver methods that allows to get the current gap count from PHY registers. Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 68 +++++++++++++++++++++------- drivers/firewire/core-cdev.c | 3 + drivers/firewire/core-transaction.c | 18 ++++++- drivers/firewire/core.h | 6 ++ drivers/firewire/ohci.c | 53 ++++++++++++++++------ include/linux/firewire.h | 6 +- 6 files changed, 116 insertions(+), 38 deletions(-) Date: Wed, 7 Jul 2010 15:36:07 +0200 (CEST) From: Stefan Richter firewire: cdev: fix fw_cdev_event_bus_reset emission after local config ROM changes When a descriptor was added or removed to the local node's config ROM, userspace clients which had a local node's /dev/fw* open did not receive any fw_cdev_event_bus_reset for poll()/read() consumption. The cause was that the core-device.c facility which re-reads the config ROM of the bus reset initiator node missed to call the fw_device update function. The fw_units are destroyed and newly added, but their parent stays and needs to be updated. Reported-by: Jay Fenlason Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 1 + 1 file changed, 1 insertion(+) Date: Wed, 7 Jul 2010 14:13:14 +0200 (CEST) From: Stefan Richter firewire: core: ensure some userspace API constants match corresponding kernel API constants The FW_ISO_ constants of the in-kernel API of firewire-core and FW_CDEV_ISO_ constants of the userspace API of firewire-core have nothing to do with each other --- except that the core-cdev.c implementation relies on them having the same values. Hence put some compile-time assertions into core-cdev.c. It's lame but I prefer it over including the userspace API header into the kernelspace API header and defining kernelspace API constants from userspace API constants. Nor do I want to expose the kernelspace constants in one of the two firewire headers that are exported to userland since this only concerns the core-cdev.c implementation. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 11 +++++++++++ 1 file changed, 11 insertions(+) Date: Wed, 7 Jul 2010 13:26:18 +0200 (CEST) From: Stefan Richter firewire: core: fix fw_send_request kerneldoc comment The present inline documentation of the fw_send_request() in-kernel API refers to userland code that is not applicable to kernel drivers at all. Reported-by: Ben Gamari While we are at fixing the whole documentation of fw_send_request(), also improve the rest of firewire-core's kerneldoc comments: - Add a bit of text concerning fw_run_transaction()'s call parameters. - Append () to function names and tab-align parameter descriptions as suggested by the example in Documentation/kernel-doc-nano-HOWTO.txt. - Remove kerneldoc markers from comments on static functions. - Remove outdated parameter descriptions at build_tree(). Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 10 +- drivers/firewire/core-iso.c | 2 drivers/firewire/core-topology.c | 16 ++--- drivers/firewire/core-transaction.c | 90 +++++++++++++++------------- 4 files changed, 60 insertions(+), 58 deletions(-) Date: Wed, 7 Jul 2010 14:37:30 +0200 (CEST) From: Clemens Ladisch firewire: cdev: check write quadlet request length to avoid buffer overflow Check that the data length of a write quadlet request actually is large enough for a quadlet. Otherwise, fw_fill_request could access the four bytes after the end of the outbound_transaction_event structure. Signed-off-by: Clemens Ladisch Modification of Clemens' change: Consolidate the check into init_request() which is used by the affected ioctl_send_request() and ioctl_send_broadcast_request() and the unaffected ioctl_send_stream_packet(), to save a few lines of code. Note, since struct outbound_transaction_event *e is slab-allocated, such an out-of-bounds access won't hit unallocated memory but may result in a (virtually impossible to exploit) information disclosure. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 4 ++++ 1 file changed, 4 insertions(+) Date: Mon, 21 Jun 2010 23:24:35 +0200 (CEST) From: Stefan Richter firewire: cdev: fix fw_cdev_event_bus_reset.bm_node_id Fix an obscure ABI feature that is a bit of a hassle to implement. However, somebody put it into the ABI, so let's fill in a sensible value there. Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 12 +++++++++--- drivers/firewire/core-cdev.c | 2 +- drivers/firewire/core-topology.c | 1 + include/linux/firewire-cdev.h | 5 +++++ include/linux/firewire.h | 1 + 5 files changed, 17 insertions(+), 4 deletions(-) Date: Mon, 21 Jun 2010 23:23:52 +0200 (CEST) From: Stefan Richter firewire: core: no need to track irq flags in bm_work This is a workqueue job and always entered with IRQs enabled. Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) Date: Sun, 20 Jun 2010 22:54:22 +0200 (CEST) From: Stefan Richter firewire: cdev: extend fw_cdev_event_iso_interrupt documentation Add information regarding the 2.6.32 update to the xmit variant of fw_cdev_event_iso_interrupt. Signed-off-by: Stefan Richter --- include/linux/firewire-cdev.h | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) Date: Sun, 20 Jun 2010 22:53:55 +0200 (CEST) From: Stefan Richter firewire: cdev: fix ABI for FCP and address range mapping, add fw_cdev_event_request2 The problem: A target-like userspace driver, e.g. AV/C target or SBP-2/3 target, needs to be able to act as responder and requester. In the latter role, it needs to send requests to nods from which it received requests. This is currently impossible because fw_cdev_event_request lacks information about sender node ID. Reported-by: Jay Fenlason Libffado + libraw1394 + firewire-core is currently unable to drive two or more audio devices on the same bus. Reported-by: Arnold Krille This is because libffado requires destination node ID of FCP requests and sender node ID of FCP responses to match. It even prohibits libffado from working with a bus on which libraw1394 opens a /dev/fw* as default ioctl device that does not correspond with the audio device. This is because libraw1394 does not receive the sender node ID from the kernel. Moreover, fw_cdev_event_request makes it impossible to tell unicast and broadcast write requests apart. The fix: Add a replacement of struct fw_cdev_event_request request, boringly called struct fw_cdev_event_request2. The new event will be sent to a userspace client instead of the old one if the client claims compatibility with ABI version 4 or later. libraw1394 needs to be extended to make use of the new event, in order to properly support libffado and other FCP or address range mapping users who require correct sender node IDs. Further notes: While we are at it, change back the range of possible values of fw_cdev_event_request.tcode to 0x0...0xb like in ABI version <= 3. The preceding change "firewire: expose extended tcode of incoming lock requests to (userspace) drivers" expanded it to 0x0...0x17 which could catch sloppily coded clients by surprise. The extended range of codes is only used in the new fw_cdev_event_request2.tcode. Jay and I also suggested an alternative approach to fix the ABI for incoming requests: Add an FW_CDEV_IOC_GET_REQUEST_INFO ioctl which can be called after reception of an fw_cdev_event_request, before issuing of the closing FW_CDEV_IOC_SEND_RESPONSE ioctl. The new ioctl would reveal the vital information about a request that fw_cdev_event_request lacks. Jay showed an implementation of this approach. The former event approach adds 27 LOC of rather trivial code to core-cdev.c, the ioctl approach 34 LOC, some of which is nontrivial. The ioctl approach would certainly also add more LOC to userspace programs which require the expanded information on inbound requests. This approach is probably only on the lighter-weight side in case of clients that want to be compatible with kernels that lack the new capability, like libraw1394. However, the code to be added to such libraw1394-like clients in case of the event approach is a straight- forward additional switch () case in its event handler. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 45 ++++++++++++++++---- include/linux/firewire-cdev.h | 76 +++++++++++++++++++++++++++++++++- 2 files changed, 110 insertions(+), 11 deletions(-) Date: Tue, 18 May 2010 10:57:33 -0400 From: Jay Fenlason firewire: expose extended tcode of incoming lock requests to (userspace) drivers When a remote device does a LOCK_REQUEST, the core does not pass the extended tcode to userspace. This patch makes it use the juju-specific tcodes listed in firewire-constants.h for incoming requests. Signed-off-by: Jay Fenlason This matches how tcode in the API for outbound requests is treated. Affects kernelspace and userspace drivers alike, but at the moment there are no kernespace drivers that receive lock requests. Split out from a combo patch, slightly reordered, changelog reworded. Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Date: Sun, 20 Jun 2010 22:52:55 +0200 (CEST) From: Stefan Richter firewire: cdev: freeze FW_CDEV_VERSION due to libraw1394 bug libraw1394 v2.0.0...v2.0.5 takes FW_CDEV_VERSION from an externally installed header file and uses it to declare its own implementation level in FW_CDEV_IOC_GET_INFO. This is wrong; it should set the real version for which it was actually written. If we add features to the kernel ABI that require the kernel to check a client's implementation level, we can not trust the client version if it was set from FW_CDEV_VERSION. Hence freeze FW_CDEV_VERSION at the current value (no damage has been done yet), clearly document FW_CDEV_VERSION as a dummy version and what clients are expected to do with fw_cdev_get_info.version, and use a new defined constant (which is not placed into the exported header file) as kernel implementation level. Note, in order to check in client program source code which features are present in an externally installed linux/firewire-cdev.h, use preprocessor directives like #ifdef FW_CDEV_IOC_ALLOCATE_ISO_RESOURCE or #ifdef FW_CDEV_EVENT_ISO_RESOURCE_ALLOCATED instead of a check of FW_CDEV_VERSION. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 7 ++++++- include/linux/firewire-cdev.h | 22 ++++++++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) Date: Sun, 20 Jun 2010 22:52:27 +0200 (CEST) From: Stefan Richter firewire: cdev: count references of cards during inbound transactions If a request comes in to an address range managed by a userspace driver i.e. client, the card instance of request and response may differ from the card instance of the client device. Therefore we need to take a reference of the card until the response was sent. I thought about putting the reference counting into core-transaction.c, but the various high-level drivers besides cdev clients (firewire-net, firewire-sbp2, firedtv) use the card pointer in their fw_address_handler address_callback method only to look up devices of which they already hold the necessary references. So this seems to be a specific firewire-cdev issue which is better addressed locally. We do not need the reference - in case of FCP_REQUEST or FCP_RESPONSE requests because then the firewire-core will send the split transaction response for us already in the context of the request handler, - if it is the same card as the client device's because we hold a card reference indirectly via teh client->device reference. To keep things simple, we take the reference nevertheless. Jay Fenlason wrote: > there's no way for the core to tell cdev "this card is gone, > kill any inbound transactions on it", while cdev holds the transaction > open until userspace issues a SEND_RESPONSE ioctl, which may be a very, > very long time. But when it does, it calls fw_send_response(), which > will dereference the card... > > So how unhappy are we about userspace potentially holding a fw_card > open forever? While termination of inbound transcations at card removal could be implemented, it is IMO not worth the effort. Currently, the effect of holding a reference of a card that has been removed is to block the process that called the pci_remove of the card. This is - either a user process ran by root. Root can find and kill processes that have /dev/fw* open, if desired. - a kernel thread (which one?) in case of hot removal of a PCCard or ExpressCard. The latter case could be a problem indeed. firewire-core's card shutdown and card release should probably be improved not to block in shutdown, just to defer freeing of memory until release. This is not a new problem though; the same already always happens with the client->device->card without the need of inbound transactions or other special conditions involved, other than the client not closing the file. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 8 ++++++++ 1 file changed, 8 insertions(+) Date: Tue, 18 May 2010 14:02:45 -0400 From: Jay Fenlason firewire: cdev: fix responses to nodes at different card My box has two firewire cards in it: card0 and card1. My application opens /dev/fw0 (card 0) and allocates an address space. The core makes the address space available on both cards. Along comes the remote device, which sends a READ_QUADLET_REQUEST to card1. The request gets passed up to my application, which calls ioctl_send_response(). ioctl_send_response() then calls fw_send_response() with card0, because that's the card it's bound to. Card0's driver drops the response, because it isn't part of a transaction that it has outstanding. So in core-cdev: handle_request(), we need to stash the card of the inbound request in the struct inbound_transaction_resource and use that card to send the response to. The hard part will be refcounting the card correctly so it can't get deallocated while we hold a pointer to it. Here's a trivial patch, which does not do the card refcounting, but at least demonstrates what the problem is. Note that we can't depend on the fact that the core-cdev:client structure holds a card open, because in this case the card it holds open is not the card the request came in on. ..and there's no way for the core to tell cdev "this card is gone, kill any inbound transactions on it", while cdev holds the transaction open until userspace issues a SEND_RESPONSE ioctl, which may be a very, very long time. But when it does, it calls fw_send_response(), which will dereference the card... So how unhappy are we about userspace potentially holding a fw_card open forever? Signed-off-by: Jay Fenlason Reference counting to be addressed in a separate change. Signed-off-by: Stefan Richter (whitespace) --- drivers/firewire/core-cdev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) Date: Mon, 14 Jun 2010 11:46:25 +0200 From: Clemens Ladisch firewire: cdev: fix race in iso context creation Protect the client's iso context pointer against a race that can happen when more than one creation call is executed at the same time. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) Date: Sun, 20 Jun 2010 22:50:35 +0200 (CEST) From: Stefan Richter firewire: remove an unused function argument void (*fw_address_callback_t)(..., int speed, ...) is the speed that a remote node chose to transmit a request to us. In case of split transactions, firewire-core will transmit the response at that speed. Upper layer drivers on the other hand (firewire-net, -sbp2, firedtv, and userspace drivers) cannot do anything useful with that speed datum, except log it for debug purposes. But data that is merely potentially (not even actually) used for debug purposes does not belong into the API. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 3 +-- drivers/firewire/core-transaction.c | 14 +++++++------- drivers/firewire/net.c | 4 ++-- drivers/firewire/sbp2.c | 3 +-- drivers/media/dvb/firewire/firedtv-fw.c | 4 ++-- include/linux/firewire.h | 2 +- 6 files changed, 14 insertions(+), 16 deletions(-) Date: Tue, 8 Jun 2010 00:20:10 +0200 (CEST) From: Stefan Richter firewire: core: remove an unnecessary zero initialization All of the fields of the iso_interrupt_event instance are overwritten right after it was allocated. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Tue, 15 Jun 2010 01:22:45 +0200 (CEST) From: Stefan Richter firewire: core: remove unused variable which caused gcc 4.6 to warn about variable 'destination' set but not used. Since the hardware ensures that we receive only response packets with proper destination node ID (in a given bus generation), we have no use for destination here in the core as well as in upper layers. (This is different with request packets. There we pass destination node ID to upper layers because they may for example need to check whether this was an unicast or broadcast request.) Reported-and-Tested-By: Justin P. Mattock Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) Date: Tue, 15 Jun 2010 02:00:11 +0200 (CEST) From: Stefan Richter ieee1394: remove unused variables which caused gcc 4.6 to warn about variable 'XYZ' set but not used. sbp2.c, unit_characteristics: The underlying problem which was spotted here --- an incomplete implementation --- is already 50% fixed in drivers/firewire/sbp2.c which observes mgt_ORB_timeout but not yet ORB_size. raw1394.c, length_conflict; dv1394.c, ts_off: Impossible to tell why these variables are there. We can safely remove them though because we don't need a compiler warning to realize that we are dealing with (at least stylistically) flawed code here. dv1394.c, packet_time: This was used in debug macro that is only compiled in with DV1394_DEBUG_LEVEL >= 2 defined at compile-time. Just drop it since nobody debugs dv1394 anymore. Avoids noise in regular kernel builds. dv1394.c, ohci; eth1394.c, priv: These variables clearly can go away. Somebody wanted to use them but then didn't (or not anymore). Note, all of this code is considered to be at its end of life and is thus not really meant to receive janitorial updates anymore. But if we can easily remove noisy warnings from kernel builds, we should. Reported-by: Justin P. Mattock Signed-off-by: Stefan Richter --- drivers/ieee1394/dv1394.c | 14 ++------------ drivers/ieee1394/eth1394.c | 3 --- drivers/ieee1394/raw1394.c | 3 +-- drivers/ieee1394/sbp2.c | 11 ++++------- 4 files changed, 7 insertions(+), 24 deletions(-) Date: Sat, 12 Jun 2010 20:35:52 +0200 (CEST) From: Stefan Richter firewire: rename CSR access driver methods Rather than "read a Control and Status Registers (CSR) Architecture register" I prefer to say "read a Control and Status Register". Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 2 +- drivers/firewire/core-transaction.c | 10 ++++------ drivers/firewire/core.h | 4 ++-- drivers/firewire/ohci.c | 8 ++++---- 4 files changed, 11 insertions(+), 13 deletions(-) Date: Sat, 12 Jun 2010 20:35:21 +0200 (CEST) From: Stefan Richter firewire: core: combine some repeated code All of these CSRs have the same read/ write/ aynthing-else handling, except for CSR_PRIORITY_BUDGET which might not be implemented. The CSR_CYCLE_TIME read handler implementation accepted 4-byte-sized block write requests before this change but this is just silly; the register is only required to support quadlet read and write requests like the other r/w CSR core and Serial-Bus-dependent registers. Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 84 +++++----------------------- 1 file changed, 15 insertions(+), 69 deletions(-) Date: Sat, 12 Jun 2010 20:34:50 +0200 (CEST) From: Stefan Richter firewire: normalize STATE_CLEAR/SET CSR access interface Push the maintenance of STATE_CLEAR/SET.abdicate down into the card driver. This way, the read/write_csr_reg driver method works uniformly across all CSR offsets. Signed-off-by: Stefan Richter --- drivers/firewire/core-topology.c | 5 +-- drivers/firewire/core-transaction.c | 41 ++++++++-------------------- drivers/firewire/core.h | 2 drivers/firewire/ohci.c | 19 ++++++++++--- include/linux/firewire.h | 3 +- 5 files changed, 30 insertions(+), 40 deletions(-) Date: Sat, 12 Jun 2010 20:30:21 +0200 (CEST) From: Stefan Richter firewire: replace get_features card driver hook by feature variables in the fw_card struct. The hook appeared to be an unnecessary abstraction in the card driver interface. Cleaner would be to pass those feature flags as arguments to fw_card_initialize() or fw_card_add(), but the FairnessControl register is in the SCLK domain and may therefore not be accessible while Link Power Status is off, i.e. before the card->driver->enable call from fw_card_add(). Signed-off-by: Stefan Richter --- drivers/firewire/core-topology.c | 3 +-- drivers/firewire/core-transaction.c | 3 +-- drivers/firewire/core.h | 5 ----- drivers/firewire/ohci.c | 14 ++------------ include/linux/firewire.h | 3 +++ 5 files changed, 7 insertions(+), 21 deletions(-) Date: Sat, 12 Jun 2010 20:29:07 +0200 (CEST) From: Stefan Richter firewire: drop sizeof expressions from some request size arguments In case of fw_card_bm_work()'s lock request, the present sizeof expression is going to be wrong if somebody changes the fw_card's DMA scratch buffer's size in the future. In case of quadlet write requests, sizeof(u32) is just silly; it's 4. In case of SBP-2 ORB pointer write requests, 8 is arguably quicker to understand as the correct and only possible value than sizeof(some_datum). Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 5 ++--- drivers/firewire/sbp2.c | 10 ++++------ 2 files changed, 6 insertions(+), 9 deletions(-) Date: Sat, 12 Jun 2010 20:26:51 +0200 (CEST) From: Stefan Richter firewire: 'add CSR_... support' addendum Add a comment on which of the conflicting NODE_IDS specifications we implement. Reduce a comment on rather irrelevant register bits that can all be looked up in the spec (or from now on in the code history). Directly include the required indirectly included bug.h. Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 27 ++++++--------------------- drivers/firewire/ohci.c | 1 + 2 files changed, 7 insertions(+), 21 deletions(-) Date: Thu, 10 Jun 2010 08:41:51 +0200 From: Clemens Ladisch firewire: core: always enable cycle master packets As part of the bus manager responsibilities, make sure that the cycle master sends cycle start packets. This is needed when the old bus manager disabled the cycle master's cmstr bit and there are iso-capable nodes on the new bus. Signed-off-by: Clemens Ladisch --- drivers/firewire/core-card.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) Date: Thu, 10 Jun 2010 08:40:49 +0200 From: Clemens Ladisch firewire: allocate broadcast channel in hardware On OHCI 1.1 controllers, let the hardware allocate the broadcast channel automatically. This removes a theoretical race condition directly after a bus reset where it could be possible to read the channel allocation register with channel 31 still being unallocated. Signed-off-by: Clemens Ladisch --- drivers/firewire/core-card.c | 16 +++++++++++----- drivers/firewire/core-topology.c | 3 ++- drivers/firewire/core.h | 1 + drivers/firewire/ohci.c | 18 ++++++++++++------ 4 files changed, 26 insertions(+), 12 deletions(-) Date: Thu, 10 Jun 2010 08:37:15 +0200 From: Clemens Ladisch firewire: core: add CSR abdicate support Implement the abdicate bit, which is required for bus manager capable nodes and tested by the Base 1394 Test Suite. Finally, something to do at a command reset! :-) Signed-off-by: Clemens Ladisch --- drivers/firewire/core-card.c | 3 ++- drivers/firewire/core-topology.c | 2 ++ drivers/firewire/core-transaction.c | 13 +++++++++++-- drivers/firewire/core.h | 1 + include/linux/firewire.h | 2 ++ 5 files changed, 18 insertions(+), 3 deletions(-) Date: Thu, 10 Jun 2010 08:36:37 +0200 From: Clemens Ladisch firewire: add CSR cmstr support Implement the cmstr bit, which is required for cycle master capable nodes and tested for by the Base 1394 Test Suite. This bit allows the bus master to disable cycle start packets; there are bus master implementations that actually do this. Signed-off-by: Clemens Ladisch --- drivers/firewire/core-transaction.c | 12 ++++++++-- drivers/firewire/core.h | 2 ++ drivers/firewire/ohci.c | 35 ++++++++++++++++++++++++++++ drivers/firewire/ohci.h | 1 + 4 files changed, 48 insertions(+), 2 deletions(-) Date: Thu, 10 Jun 2010 08:35:37 +0200 From: Clemens Ladisch firewire: core: add CSR MAINT_UTILITY support Implement the MAIN_UTILITY register, which is utterly optional but useful as a safe target for diagnostic read/write/broadcast transactions. Signed-off-by: Clemens Ladisch --- drivers/firewire/core-transaction.c | 9 +++++++++ include/linux/firewire.h | 3 +++ 2 files changed, 12 insertions(+) Date: Thu, 10 Jun 2010 08:35:06 +0200 From: Clemens Ladisch firewire: add CSR PRIORITY_BUDGET support If supported by the OHCI controller, implement the PRIORITY_BUDGET register, which is required for nodes that can use asynchronous priority arbitration. To allow the core to determine what features the lowlevel device supports, add a new card driver callback. Signed-off-by: Clemens Ladisch --- drivers/firewire/core-transaction.c | 14 ++++++++++++++ drivers/firewire/core.h | 4 ++++ drivers/firewire/ohci.c | 27 +++++++++++++++++++++++++++ include/linux/firewire.h | 1 + 4 files changed, 46 insertions(+) Date: Thu, 10 Jun 2010 08:34:13 +0200 From: Clemens Ladisch firewire: add CSR BUSY_TIMEOUT support Implement the BUSY_TIMEOUT register, which is required for nodes that support retries. Signed-off-by: Clemens Ladisch --- drivers/firewire/core-transaction.c | 14 +++++++++++--- drivers/firewire/ohci.c | 14 +++++++++++++- 2 files changed, 24 insertions(+), 4 deletions(-) Date: Thu, 10 Jun 2010 08:33:07 +0200 From: Clemens Ladisch firewire: add CSR BUS_TIME support Implement the BUS_TIME register, which is required for cycle master capable nodes and tested for by the Base 1393 Test Suite. Even when there is not yet bus master initialization support, this register allows us to work together with other bus masters. Signed-off-by: Clemens Ladisch --- drivers/firewire/core-transaction.c | 14 ++ drivers/firewire/ohci.c | 168 ++++++++++++++++++---------- 2 files changed, 120 insertions(+), 62 deletions(-) Date: Thu, 10 Jun 2010 08:26:48 +0200 From: Clemens Ladisch firewire: add CSR CYCLE_TIME write support The specification requires that CYCLE_TIME is writable so that it can be initialized, so we better implement it. Signed-off-by: Clemens Ladisch --- drivers/firewire/core-transaction.c | 3 +++ drivers/firewire/ohci.c | 7 +++++++ 2 files changed, 10 insertions(+) Date: Thu, 10 Jun 2010 08:26:28 +0200 From: Clemens Ladisch firewire: core: add CSR SPLIT_TIMEOUT support Implement the SPLIT_TIMEOUT registers. Besides being required by the spec, this is desirable for some IIDC devices and necessary for many audio devices to be able to increase the timeout from userspace. Signed-off-by: Clemens Ladisch --- drivers/firewire/core-card.c | 4 + drivers/firewire/core-transaction.c | 76 ++++++++++++++++++++++++---- include/linux/firewire.h | 5 ++ 3 files changed, 74 insertions(+), 11 deletions(-) Date: Thu, 10 Jun 2010 08:25:46 +0200 From: Clemens Ladisch firewire: core: add CSR RESET_START support This implements the RESET_START register (as a dummy) to make the Base 1394 Test Suite happy. Signed-off-by: Clemens Ladisch --- drivers/firewire/core-transaction.c | 5 +++++ 1 file changed, 5 insertions(+) Date: Thu, 10 Jun 2010 08:25:19 +0200 From: Clemens Ladisch firewire: add CSR NODE_IDS support The NODE_IDS register, and especially its bus_id field, is quite useless because 1394.1 requires that the bus_id field always stays 0x3ff. However, the 1394 specification requires this register on all transaction capable nodes, and the Base 1394 Test Suite tests for it, so we better implement it. Signed-off-by: Clemens Ladisch --- drivers/firewire/core-transaction.c | 11 +++++++++++ drivers/firewire/core.h | 1 + drivers/firewire/ohci.c | 20 ++++++++++++++++++++ 3 files changed, 32 insertions(+) Date: Thu, 10 Jun 2010 08:24:35 +0200 From: Clemens Ladisch firewire: add read_csr_reg driver callback To prepare for the following additions of more OHCI-implemented CSR registers, replace the get_cycle_time driver callback with a generic CSR register callback. Signed-off-by: Clemens Ladisch --- drivers/firewire/core-cdev.c | 2 +- drivers/firewire/core-transaction.c | 3 ++- drivers/firewire/core.h | 2 +- drivers/firewire/ohci.c | 19 ++++++++++++++++--- 4 files changed, 20 insertions(+), 6 deletions(-) Date: Thu, 10 Jun 2010 08:24:03 +0200 From: Clemens Ladisch firewire: core: add CSR STATE_CLEAR/STATE_SET support The state registers are zero and read-only in this implementation, so they are not of much use. However, the specification requires that they are present for transaction capable nodes, and the Base 1394 Test Suite tests for them, so we better implement them. Signed-off-by: Clemens Ladisch --- drivers/firewire/core-transaction.c | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) Date: Thu, 10 Jun 2010 08:23:28 +0200 From: Clemens Ladisch firewire: core: retry on local errors in bus manager election When the candidate bus manager fails to do the lock request with which it tries to become bus manager, it assumes that the current IRM is not actually IRM capable and forces itself to become root. However, if that lock request failed because the local node itself was not able to send it, then we cannot blame the current IRM and should not steal its rootness. In this case, RCODE_SEND_ERROR is likely to indicate a temporary error condition such as exhausted tlabels or low memory, so we better try again later. Signed-off-by: Clemens Ladisch --- drivers/firewire/core-card.c | 10 ++++++++++ 1 file changed, 10 insertions(+) Date: Thu, 10 Jun 2010 08:22:07 +0200 From: Clemens Ladisch firewire: ohci: speed up PHY register accesses Most PHY chips, when idle, can complete a register access in the time needed for two or three PCI read transactions; bigger delays occur only when data is currently being moved over the link/PHY interface. So if we busy-wait a few times when waiting for the register access to finish, it is likely that we can finish without having to sleep. Signed-off-by: Clemens Ladisch --- drivers/firewire/ohci.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) Date: Wed, 19 May 2010 08:28:32 +0200 From: Clemens Ladisch firewire: check cdev response length Add a check that the data length in the SEND_RESPONSE ioctl is correct. Incidentally, this also fixes the previously wrong response length of software-handled lock requests. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 9 ++++-- drivers/firewire/core-transaction.c | 38 +++++++++++++++++++++++++++- drivers/firewire/core.h | 1 drivers/firewire/core-cdev.c | 9 +++++-- drivers/firewire/core-transaction.c | 38 +++++++++++++++++++++++++++- drivers/firewire/core.h | 1 + 3 files changed, 44 insertions(+), 4 deletions(-) Date: Thu, 27 May 2010 14:36:45 +0200 (CEST) From: Julia Lawall drivers/media: Eliminate a NULL pointer dereference In each case, the print involves dereferencing a value that is NULL or is near NULL. Signed-off-by: Julia Lawall Firewire-only backport patch: drivers/media/video/hdpvr/hdpvr-video.c | 2 +- drivers/media/video/usbvision/usbvision-video.c | 3 +-- omitted. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-1394.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Sat, 5 Jun 2010 11:46:49 +0200 (CEST) From: Stefan Richter firewire: ohci: do not enable interrupts without the handler On 26 Apr 2010, Clemens Ladisch wrote: > In theory, none of the interrupts should occur before the link is > enabled. In practice, I'd rather make sure to not set the master > interrupt enable bit until we have installed the interrupt handler. and proposed to move OHCI1394_masterIntEnable out of the present reg_write() into a new one before the HCControl.linkEnable reg_write(). Why not defer setting /all/ of the bits until right before linkEnable? Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) Date: Sun, 30 May 2010 19:43:52 +0200 (CEST) From: Stefan Richter firewire: core: check for 1394a compliant IRM, fix inaccessibility of Sony camcorder Per IEEE 1394 clause 8.4.2.3, a contender for the IRM role shall check whether the current IRM complies to 1394a-2000 or later. If not force a compliant node (e.g. itself) to become IRM. This was implemented in the older ieee1394 driver but not yet in firewire-core. An older Sony camcorder (Sony DCR-TRV25) which implements 1394-1995 IRM but neither 1394a-2000 IRM nor BM was now found to cause an interoperability bug: - Camcorder becomes root node when plugged in, hence gets IRM role. - firewire-core successfully contends for BM role, proceeds to perform gap count optimization and resets the bus. - Sony camcorder ignores presence of a BM (against the spec, this is a firmware bug), performs its idea of gap count optimization and resets the bus. - Preceding two steps are repeated endlessly, bus never settles, regular I/O is practically impossible. http://thread.gmane.org/gmane.linux.kernel.firewire.user/3913 This is an interoperability regression from the old to the new drivers. Fix it indirectly by adding the 1394a IRM check. The spec suggests three and a half methods to determine 1394a compliance of a remote IRM; we choose the method of testing the Config_ROM.Bus_Info.generation field. This is data that firewire-core should have readily available at this point, i.e. does not require extra I/O. Reported-by: Clemens Ladisch (missing 1394a check) Reported-by: H. S. (issue with Sony DCR-TRV25) Tested-by: H. S. Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) Date: Mon, 24 May 2010 21:31:23 +0200 (CEST) From: Stefan Richter ieee1394: schedule for removal All application domains that are supported by the old ieee1394 driver stack are supported by the newer firewire driver stack too. There is now good and extensive experience with the newer stack from deployment in Fedora since F7 as well as by enthusiast users of other distributions. The new drivers have consequently been recommended as the default ones since 2.6.33, in order to fix some severe usability problems of FireWire on Linux due to limitations of the old stack. It is now high time to announce when the obsolete drivers will be removed. Signed-off-by: Stefan Richter Acked-by: Jarod Wilson [[backport patch without Documentation/feature-removal-schedule.txt hunk]] --- drivers/ieee1394/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Date: Tue, 27 Apr 2010 09:07:00 +0200 From: Clemens Ladisch firewire: core: use separate timeout for each transaction Using a single timeout for all transaction that need to be flushed does not work if the submission of new transactions can defer the timeout indefinitely into the future. We need to have timeouts that do not change due to other transactions; the simplest way to do this is with a separate timer for each transaction. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter (+ one lockdep annotation) --- drivers/firewire/core-card.c | 11 ---- drivers/firewire/core-transaction.c | 70 +++++++++++++++------------- drivers/firewire/core.h | 1 - include/linux/firewire.h | 3 + 4 files changed, 39 insertions(+), 46 deletions(-) Date: Fri, 23 Apr 2010 19:27:25 -0400 From: Peter Hurley firewire: core: Fix tlabel exhaustion problem fw_core_handle_response() was not properly clearing tlabel_mask. This was resulting in premature tlabel exhaustion. Signed-off-by: Peter Hurley This fixes an omission in 2.6.31-rc1 commit 1e626fdc "firewire: core: use more outbound tlabels" which prevented to really use 64 instead of 32 transaction labels, as soon as split transactions occurred that had their AR-resp tasklet run after the AT-req tasklet. Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Mon, 19 Apr 2010 17:29:14 +0200 From: Clemens Ladisch firewire: core: make transaction label allocation more robust If one request is so long-lived that it does not get a response before the following 63 requests, its bit in tlabel_mask is still set when the next request tries to allocate a transaction label for that number. In this state, while the first request is not completed or timed out, no new requests can be submitted. To fix this, skip over any label still in use, and do not error out unless we have entirely run out of labels. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-transaction.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) Date: Mon, 12 Apr 2010 10:35:44 +0200 From: Clemens Ladisch firewire: ohci: wait for local CSR lock access to finish Add a loop to wait for the controller to finish a locally-initiated CSR lock operation. Google shows some occurrences of the "swap not done yet" message which might indicate that some OHCI controllers are not fast enough to do the lock/swap in the time needed for one PCI access. This also correctly handles the case where the lock operation did not finish, instead of silently returning an uninitialized value. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) Date: Mon, 12 Apr 2010 10:35:30 +0200 From: Clemens Ladisch firewire: ohci: prevent aliasing of locally handled register addresses We must compute the offset from the CSR register base with the full 48 address bits to prevent matching with addresses whose lower 32 bits happen to be equal with one of the specially handled registers. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) Date: Mon, 12 Apr 2010 10:35:18 +0200 From: Clemens Ladisch firewire: core: fw_iso_resource_manage: return -EBUSY when out of resources Returning -EIO for all errors would not allow clients to determine if the resource allocation process itself failed, or if the resources are not available. (The latter information is needed by CMP to synchronize restoring of overlayed connections after a bus reset.) Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-iso.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) Date: Mon, 12 Apr 2010 10:35:05 +0200 From: Clemens Ladisch firewire: core: fix retries calculation in iso manage_channel() If there is a permanent error condition when communicating with the IRM, after the sixth error, the retry variable will be decremented to -1. If, in this case, the bits in channels_mask are not yet exhausted, the next channel is retried 2^32 times. To fix this, check that retry is never decremented beyond zero. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-iso.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Date: Wed, 14 Apr 2010 22:30:18 +0200 (CEST) From: Stefan Richter firewire: core: clean up config ROM related defined constants Clemens Ladisch pointed out that - BIB_IMC is not named like the field is called in the standard, - readers of the code may get worried about the magic 0x0c0083c0, - a CSR_NODE_CAPABILITIES key is there in the header but not put to good use. So let's rename BIB_IMC, add a defined constant for Node_Capabilities and a comment which reassures people that somebody thought about it and they don't have to (or if they still do, tell them where they have to look for confirmation), and prune our incomplete and arbitrary set of defined constants of CSR key IDs. And there is a nother magic number, that of Bus_Information_Block.Bus_Name, to be defined and commented. Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 11 ++++++----- include/linux/firewire.h | 2 -- 2 files changed, 6 insertions(+), 7 deletions(-) Date: Thu, 15 Apr 2010 22:16:04 +0200 From: Stefan Richter firewire: cdev: fix cut+paste mistake in disclaimer This was supposed to be generic "authors or copyright holders"; I mistakenly picked up text from a wrong file. Reported-by: Daniel K. Signed-off-by: Stefan Richter --- include/linux/firewire-cdev.h | 2 +- include/linux/firewire-constants.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Date: Sun, 11 Apr 2010 11:52:12 +0200 From: Stefan Richter firewire: cdev: change license of exported header files to MIT license Among else, this allows projects like libdc1394 to carry copies of the ABI related header files without them or distributors having to worry about effects on the project's overall license terms. Switch to MIT license as suggested by Kristian. Also update the year in the copyright statement according to source history. Cc: Jay Fenlason Acked-by: Clemens Ladisch Signed-off-by: Stefan Richter Signed-off-by: Kristian Høgsberg --- include/linux/firewire-cdev.h | 33 +++++++++++++++++------------ include/linux/firewire-constants.h | 29 +++++++++++++++++++++++-- 2 files changed, 46 insertions(+), 16 deletions(-) Date: Sat, 10 Apr 2010 16:47:18 +0100 (CET) From: Stefan Richter ieee1394: mark char device files as not seekable The - raw1394 (/dev/raw1394), - video1394 (/dev/video1394/*), - dv1394 (/dev/dv1394/*) character device file ABIs do not make any use of lseek(), pread(), or pwrite(). Therefore use nonseekable_open() and, redundantly, set file_operations.llseek to no_llseek to remove any doubt whether the BKL- grabbing default_llseek handler is used. Although all this is legacy code which should be left in peace until it is eventually removed (as it is superseded by firewire-core's ABI), this change seems still worth doing to further minimize the presence of BKL usage in the kernel. Signed-off-by: Stefan Richter --- drivers/ieee1394/dv1394.c | 11 ++++++----- drivers/ieee1394/raw1394.c | 3 ++- drivers/ieee1394/video1394.c | 5 +++-- 3 files changed, 11 insertions(+), 8 deletions(-) Date: Sat, 10 Apr 2010 16:38:05 +0100 (CET) From: Stefan Richter firewire: cdev: mark char device files as not seekable The character device file ABI (i.e. /dev/fw* character device file interface) does not make any use of lseek(), pread(), pwrite() (or any kind of write() at all). Use nonseekable_open() and, redundantly, set file_operations.llseek to no_llseek to remove any doubt whether the BKL-grabbing default_llseek handler is used. (Also shuffle file_operations initialization according to the order of handler definitions.) Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Date: Fri, 2 Apr 2010 14:05:02 +0200 (CEST) From: Stefan Richter firewire: ohci: cleanups and fix for nonstandard build without debug facility 1) Clean up two function names: The ohci_ prefix is only used in names of fw_card_driver hooks. There were two unnecessary exceptions. 2) Replace empty macros by empty inline functions so that call parameter type checking is available in #ifndef'd builds. 3) CONFIG_FIREWIRE_OHCI_DEBUG is currently a hidden kconfig variable, hence is not going to be switched off by anybody. Still, it can be switched off but then compilation will fail in ohci_enable() at the expression param_debug & OHCI_PARAM_DEBUG_BUSRESETS. Add the necessary definitions in the nonstandard case. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) Date: Sat, 10 Apr 2010 16:04:56 +0200 (CEST) From: Stefan Richter firewire: ohci: wait for PHY register accesses to complete Rather than having the arbitrary msleep(2) pause, let read_phy_reg() loop until the link--phy access was finished. Factor write_phy_reg() out of ohci_update_phy_reg() and of read_paged_phy_reg() and let it loop too until the link--phy access was finished. Like in the older ohci1394 driver, a timeout of 100 milliseconds is chosen. Unlike the old driver, we sleep instead of busy-wait in each waiting loop iteration. Instead of a loop, the waiting could probably also be implemented interrupt driven, but why bother. It would require up and running interrupt handling before the link was fully configured and enabled. Also modify functions a bit: Error return and value return can be combined in read_phy_reg() since the domain of values is only u8. Likewise in read_paged_phy_reg(). Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 112 ++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 55 deletions(-) Date: Thu, 01 Apr 2010 16:43:59 +0200 From: Clemens Ladisch firewire: ohci: fix up configuration of TI chips On TI chips (OHCI-Lynx and later), enable link enhancements features that TI recommends to be used. None of these are required for proper operation, but they are safe and nice to have. In theory, these bits should have been set by default, but in practice, some BIOS/EEPROM writers apparently do not read the datasheet, or get spooked by names like "unfair". Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 19 ++++++++++++++++++- drivers/firewire/ohci.h | 8 ++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) Date: Sun, 04 Apr 2010 15:19:54 +0200 From: "Clemens Ladisch" firewire: ohci: enable 1394a enhancements The OHCI spec says that, if the programPhyEnable bit is set, the driver is responsible for configuring the IEEE1394a enhancements within the PHY and the link consistently. So do this. Also add a quirk to allow disabling these enhancements; this is needed for the TSB12LV22 where ack accelerations are buggy (erratum b). Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core.h | 4 ++ drivers/firewire/ohci.c | 83 +++++++++++++++++++++++++++++++++++++++- drivers/firewire/ohci.h | 2 3 files changed, 86 insertions(+), 3 deletions(-) Date: Thu, 01 Apr 2010 16:40:18 +0200 From: Clemens Ladisch firewire: ohci: do not clear PHY interrupt status inadvertently The interrupt status bits in PHY register 5 are cleared by writing a one bit. To avoid clearing them unadvertently, do not write them back when they were read as set, but only when they have been explicitly requested to be set. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core.h | 1 + drivers/firewire/ohci.c | 7 +++++++ 2 files changed, 8 insertions(+) Date: Sun, 04 Apr 2010 15:19:52 +0200 From: "Clemens Ladisch" firewire: ohci: add a function for reading PHY registers Move the register reading code from ohci_update_phy_reg() into a function which can be used separately. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) Date: Sat, 10 Apr 2010 12:23:09 +0200 (CEST) From: Stefan Richter firewire: cdev: comment fixlet Signed-off-by: Stefan Richter --- include/linux/firewire-cdev.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Date: Wed, 31 Mar 2010 16:26:52 +0200 From: "Clemens Ladisch" firewire: cdev: iso packet documentation Add the missing documentation for iso packets. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- include/linux/firewire-cdev.h | 37 +++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) Date: Wed, 07 Apr 2010 08:30:50 +0200 From: Stefan Richter firewire: cdev: fix information leak A userspace client got to see uninitialized stack-allocated memory if it specified an _IOC_READ type of ioctl and an argument size larger than expected by firewire-core's ioctl handlers (but not larger than the core's union ioctl_arg). Fix this by clearing the requested buffer size to zero, but only at _IOR ioctls. This way, there is almost no runtime penalty to legitimate ioctls. The only legitimate _IOR is FW_CDEV_IOC_GET_CYCLE_TIMER with 12 or 16 bytes to memset. [Another way to fix this would be strict checking of argument size (and possibly direction) vs. command number. However, we then need a lookup table, and we need to allow for slight size deviations in case of 32bit userland on 64bit kernel.] Reported-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) Date: Wed, 31 Mar 2010 16:26:46 +0200 From: "Clemens Ladisch" firewire: cdev: require quadlet-aligned headers for transmit packets The definition of struct fw_cdev_iso_packet seems to imply that the header_length must be quadlet-aligned, and in fact, specifying an unaligned header has never really worked when using multiple packet structures, because the position of the next control word is computed by rounding the header_length _down_, so the last one to three bytes of the header would overlap the next control word. To avoid this problem, check that the header length is properly aligned. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 2 ++ 1 file changed, 2 insertions(+) Date: Wed, 31 Mar 2010 16:26:39 +0200 From: "Clemens Ladisch" firewire: cdev: disallow receive packets without header In receive contexts, reject packets with header_length==0. This would be an instruction to queue zero packets which would not make sense. This prevents a division by zero in the OHCI driver. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Date: Fri, 19 Mar 2010 00:39:07 +0100 (CET) From: Stefan Richter firewire: core: align driver match with modalias The driver match strategy was: - Match vendor/model/specifier/version of the unit directory. - If that was a miss, match vendor from the root directory and model/specifier/version of the unit directory. This was inconsistent with how the modalias string was constructed until recently (take vendor/model from root directory and specifier/ version from unit directory). It was also inconsistent with how it is done since the parent commit: - Use vendor/model/specifier/version of the unit directory if possible, - fall back to one or more of vendor/model/specifier/version from the root directory depending on which ones are not present at the unit directory. Fix this inconsistency by sharing the ROM scanner function between modalias printer function and driver match function. Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 87 ++++++++++++++------------------- 1 file changed, 38 insertions(+), 49 deletions(-) Date: Fri, 19 Mar 2010 00:38:29 +0100 (CET) From: Stefan Richter firewire: core: fix Model_ID in modalias The modalias string of devices that represent units on a FireWire node did not show Module_ID entries within unit directories. This was because firewire-core searched only the root directory of the configuration ROM for a Model_ID entry. We now search first the root directory, then the unit directory. IOW honor a unit directory's Model_ID if present, otherwise fall back to the root directory's model ID (if present). Furthermore, apply the same change to Vendor_ID. This had the same issue but it was less apparent because most devices provide Vendor_ID only in the root directory. And finally, also use this strategy for the remaining two IDs in the modalias, Specifier_ID and Version. It does not actually make sense to look for them elsewhere than in the unit directory because they are mandatory there. However, a uniform search order simplifies the implementation and has no adverse affect in practice. Side notes: - The older counterpart of this, nodemgr.c of ieee1394, looked for Vendor_ID first in the root directory, then in the unit directory, and for Model_ID only in the unit directory. - There is a single mainline driver which requires Vendor_ID and Model_ID --- the firedtv driver. This one worked because FireDTVs provide Vendor_ID in the root directory and Model_ID identically in root directory and unit directory. - Apart from firedtv, there are currently no drivers known to me (including userspace drivers) that look at the Vendor_ID or Model_ID of the modalias. Reported-by: Maciej Żenczykowski Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 40 ++++++++++++--------------------- 1 file changed, 14 insertions(+), 26 deletions(-) Date: Wed, 17 Mar 2010 11:07:55 +0100 From: Clemens Ladisch firewire: ohci: add cycle timer quirk for the TI TSB12LV22 Among the many entries in the TSB12LV22 errata list (TI literature number SLLS312) is the following: PCI Slave reads of the Cycle Timer register may occasionally get an incorrect value. Software may be able to validate value by reading the register multiple times rapidly and evaluating for a reasonable difference. Signed-off-by: Clemens Ladisch (untested) Signed-off-by: Stefan Richter (added #define) --- drivers/firewire/ohci.c | 4 ++++ 1 file changed, 4 insertions(+) Date: Mon, 15 Mar 2010 13:20:32 +0100 From: Clemens Ladisch firewire: core: fw_iso_resource_manage: fix error handling If the bandwidth allocation fails, the error must be returned in *channel regardless of whether the channel allocation succeeded. Checking for c >= 0 is not correct if no channel allocation was requested, in which case this part of the code is reached with c == -EINVAL. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-iso.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) Date: Tue, 21 Jul 2009 18:45:50 +0200 From: Henrik Kurelid firedtv: correct version number and current/next in CA_PMT The version number in the CA_PMT message sent to the hardware was alwaysed set to zero. This could cause problems if the PMT would change during decryption of a channel since the new CA_PMT would have the same version number as the old. The version number is now copied from the original PMT. Signed-off-by: Henrik Kurelid Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-avc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Sun, 21 Feb 2010 17:59:14 +0100 (CET) From: Stefan Richter firewire: ohci: extend initialization log message by the number of available isochronous DMA contexts and active quirks which is occasionally useful information. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) Date: Sun, 21 Feb 2010 17:58:52 +0100 (CET) From: Stefan Richter firewire: ohci: fix IR/IT context mask mixup This bug was present in firewire-ohci since day one: The number of available isochronous receive DMA contexts was mixed up with that of available isochronous transmit DMA contexts. This is harmless on a few chips which offer the same number of contexts in both directions, but most chips nowadays implement only the standard minimum of 4 IR contexts, but 8 IT contexts. If a user attempted to run a lot of IR contexts at once, results with more than four were therefore unpredictable. I suppose the controller would simply refuse to start DMA of any unimplemented context. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) Date: Sun, 21 Feb 2010 17:58:29 +0100 (CET) From: Stefan Richter firewire: ohci: add module parameter to activate quirk fixes This way, we can advise users of precompiled kernel packages to test existing quirk fixes on chips which have not been listed yet, without them having to build a kernel from source. Note, to use this feature on a machine with more than one controller, steps like these are necessary: # lspci | grep 1394 # ls /sys/bus/pci/drivers/firewire_ohci/ # echo -n "0000:03:02.0" > /sys/bus/pci/drivers/firewire_ohci/unbind # echo 2 > /sys/module/firewire_ohci/parameters/quirks # echo -n "0000:03:02.0" > /sys/bus/pci/drivers/firewire_ohci/bind # echo 0 > /sys/module/firewire_ohci/parameters/quirks The parameter can also be used to switch off quirk flags that were hardwired into firewire-ohci's quirks table. Simply specify a non-zero quirks value but without any known flags, e.g. 0x100. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 11 +++++++++++ 1 file changed, 11 insertions(+) Date: Sun, 21 Feb 2010 17:58:01 +0100 (CET) From: Stefan Richter firewire: ohci: use an ID table for quirks detection We don't have a lot of quirks to take into account (especially since dual-buffer IR is out of the picture), but still, a table-based approach is more organized than a series of if () clauses. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 46 ++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 18 deletions(-) Date: Sun, 21 Feb 2010 17:57:32 +0100 (CET) From: Stefan Richter firewire: ohci: reorder struct fw_ohci for better cache efficiency The config_rom struct members are only accessed during relatively infrequent self-ID-complete interrupts and only if the local config ROM was changed, while the ar_, at_, ir_, it_ members are used very frequently during I/O. Hence move the config_rom members further down. More importantly, make the huge self_id_buffer member the last one; this is only accessed in self-ID-complete interrupts. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) Date: Sun, 21 Feb 2010 17:57:05 +0100 (CET) From: Stefan Richter firewire: ohci: remove unused dualbuffer IR code This code was no longer used since 2.6.33, "firewire: ohci: always use packet-per-buffer mode for isochronous reception" commit 090699c0. If anybody needs this code in the future for special purposes, it can be brought back in. But it must not be re-enabled by default; drivers (kernelspace or userspace drivers) should only get this mode if they explicitly request it. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 184 ---------------------------------------- include/linux/pci_ids.h | 1 - 2 files changed, 1 insertion(+), 184 deletions(-) Date: Sun, 21 Feb 2010 17:56:42 +0100 (CET) From: Stefan Richter firewire: core: combine a bit of repeated code Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) Date: Sun, 21 Feb 2010 17:56:21 +0100 (CET) From: Stefan Richter firewire: core: change type of a data buffer from array of char to union of structs. I already used a union to size the buffer which holds ioctl arguments; more consequent is to define it as an instance of this union in the first place. Also rename several local variables from "request" to "a"(rgument) since the term request can be mistaken to mean a transaction subaction, e.g. an instance of struct fw_request. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 325 ++++++++++++++++------------------- 1 file changed, 152 insertions(+), 173 deletions(-) Date: Sun, 21 Feb 2010 12:48:57 +0100 (CET) From: Stefan Richter firewire: cdev: increment ABI version number so that clients can detect whether the FW_CDEV_IOC_GET_CYCLE_TIMER ioctl is reliable (on all tested controllers, especially the widely used VIA controllers, also NEC controllers, see commits b677532b and 1c1517ef). Also add a comment on the 2.6.32 iso xmit enhancement and on dual-buffer IR having been disabled in 2.6.33. Signed-off-by: Stefan Richter --- include/linux/firewire-cdev.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) Date: Sat, 20 Feb 2010 12:13:49 +0100 (CET) From: Stefan Richter firewire: cdev: add more flexible cycle timer ioctl The system time from CLOCK_REALTIME is not monotonic, hence problematic for the main user of the FW_CDEV_IOC_GET_CYCLE_TIMER ioctl. This issue exists in its successor ABI, i.e. raw1394, too. http://subversion.ffado.org/ticket/242 We now offer an alternative ioctl which lets the caller choose between CLOCK_REALTIME, CLOCK_MONOTONIC, and CLOCK_MONOTONIC_RAW as source of the local time, very similar to the clock_gettime libc function. The format of the local time return value matches that of clock_gettime (seconds and nanoseconds, instead of a single microseconds value from the existing ioctl). Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 38 +++++++++++++++++++++++++++++----- include/linux/firewire-cdev.h | 31 ++++++++++++++++++++++++---- 2 files changed, 59 insertions(+), 10 deletions(-) Date: Fri, 19 Feb 2010 21:00:31 +0100 (CET) From: Stefan Richter firewire: core: rename an internal function according to what it really does. Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) Date: Fri, 19 Feb 2010 21:00:02 +0100 (CET) From: Stefan Richter firewire: core: fix an information leak If a device exposes a sparsely populated configuration ROM, firewire-core's sysfs interface and character device file interface showed random data in the gaps between config ROM blocks. Fix this by zero-initialization of the config ROM reader's scratch buffer. Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 1 + 1 file changed, 1 insertion(+) Date: Thu, 18 Feb 2010 01:54:00 +0100 (CET) From: Stefan Richter firewire: core: increase stack size of config ROM reader The stack size of 16 was artificially chosen and may be too small in extreme cases. A device won't be accessible then. Since it doesn't really matter to the slab allocator whether we ask for 1088 bytes or 2048 bytes of scratch memory, just allocate 2048 bytes for the sum of temporary config ROM image and stack, and we will never ever overflow the stack (because there simply can't be more stack items than ROM entries). Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) Date: Thu, 18 Feb 2010 01:52:45 +0100 (CET) From: Stefan Richter firewire: core: don't fail device creation in case of too large config ROM blocks It never happened yet, but better safe than sorry: If a device's config ROM contains a block which overlaps the boundary at 0xfffff00007ff, just ignore that one block instead of refusing to add the device representation. That way, upper layers (kernelspace or userspace drivers) might still be able to use the device to some degree. That's better than total inaccessibility of the device. Worse, the core would have logged only a generic "giving up on config rom" message which could only be debugged by feeding a firewire-ohci debug logging session through a config ROM interpreter, IOW would likely remain undiagnosed. Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) Date: Thu, 18 Feb 2010 01:50:31 +0100 (CET) From: Stefan Richter firewire: core: fix "giving up on config rom" with Panasonic AG-DV2500 The Panasonic AG-DV2500 tape deck contains an invalid entry in its configuration ROM root directory: A leaf pointer with the undefined key ID 0 and an offset that points way out of the standard config ROM area. This caused firewire-core to dismiss the device with the generic log message "giving up on config rom for node id...", after which it was of course impossible to access the tape deck with dvgrab or any other program. https://bugzilla.redhat.com/show_bug.cgi?id=449252#c29 The fix is to simply ignore this invalid ROM entry and proceed to read the valid rest of the ROM. There is a catch though: When the kernel later iterates over the ROM, it would be nasty having to check again for such too large ROM offsets. Therefore we manipulate the defective or unsupported ROM entry to become a harmless immediate entry that won't have any side effects later (an entry with the value 0x00000000). Reported-by: George Chriss Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) Date: Sun, 14 Feb 2010 18:49:18 +0100 (CET) From: Stefan Richter firewire: remove incomplete Bus_Time CSR support The current implementation of Bus_Time read access was buggy since it did not ensure that Bus_Time.second_count_hi and second_count_lo came from the same 128 seconds period. Reported-by: Håkan Johansson Instead of a fix, remove Bus_Time register support altogether. The spec requires all cycle master capable nodes to implement this (all Linux nodes are cycle master capable) while it also says that it "may" be initialized by the bus manager or by the IRM standing in for a bus manager. (Neither Linux' firewire-core nor ieee1394 nodemgr implement this.) Since we cannot rely on Bus_Time having been initialized by a bus manager, it is better to return an error instead of a nonsensical value on a read request to Bus_Time. Alternatively, we could fix the Bus_Time read integrity bug _and_ implement (a) cycle master's write support of the register as well as (b) bus manager's Bus_Time initialization service, i.e. preservation of the Bus_Time when the cycle master node of a bus changes. However, that would be quite some code for a feature that is unreliable to begin with and very likely unused in practice. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 2 +- drivers/firewire/core-transaction.c | 17 ++++++----------- drivers/firewire/core.h | 2 +- drivers/firewire/ohci.c | 25 +++++++------------------ 4 files changed, 15 insertions(+), 31 deletions(-) Date: Sun, 14 Feb 2010 18:47:47 +0100 (CET) From: Stefan Richter firewire: get_cycle_timer optimization and cleanup ohci: Break out of the retry loop if too many attempts were necessary. This may theoretically happen if the chip is fatally defective or if the get_cycle_timer ioctl was performed after a CardBus controller was ejected. Also micro-optimize the loop by re-using the last two register reads in the next iteration, remove a questionable inline keyword, and shuffle a comment around. core: ioctl_get_cycle_timer() is always called with interrupts on, therefore local_irq_save() can be replaced by local_irq_disable(). Disabled local IRQs imply disabled preemption, hence preempt_disable() can be removed. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 16 ++++------ drivers/firewire/ohci.c | 57 ++++++++++++++++++----------------- 2 files changed, 36 insertions(+), 37 deletions(-) Date: Sun, 14 Feb 2010 18:47:07 +0100 (CET) From: Stefan Richter firewire: ohci: enable cycle timer fix on ALi and NEC controllers Discussed in "read_cycle_timer backwards for sub-cycle 0000, 0001", http://thread.gmane.org/gmane.linux.kernel.firewire.devel/13704 Known bad controllers: ALi M5271, listed by lspci as M5253 [10b9:5253] NEC OrangeLink [1033:00cd] (rev 03) NEC uPD72874 [1033:00f2] (rev 01) VIA VT6306 [1106:3044] (rev 46) VIA VT6308P, listed by lspci as rev c0 Reported-by: Pieter Palmers Reported-by: Håkan Johansson Reported-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) Date: Wed, 20 Jan 2010 09:58:02 +0100 From: Clemens Ladisch firewire: ohci: work around cycle timer bugs on VIA controllers VIA controllers sometimes return an inconsistent value when reading the isochronous cycle timer register. To work around this, read the register multiple times and add consistency checks. Signed-off-by: Clemens Ladisch Reported-by: Pieter Palmers Reported-by: Håkan Johansson Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 52 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 3 deletions(-) Date: Mon, 08 Feb 2010 08:30:03 +0100 From: Clemens Ladisch firewire: ohci: retransmit isochronous transmit packets on cycle loss In isochronous transmit DMA descriptors, link the skip address pointer back to the descriptor itself. When a cycle is lost, the controller will send the packet in the next cycle, instead of terminating the entire DMA program. There are two reasons for this: * This behaviour is compatible with the old IEEE1394 stack. Old applications would not expect the DMA program to stop in this case. * Since the OHCI driver does not report any uncompleted packets, the context would stop silently; clients would not have any chance to detect and handle this error without a watchdog timer. Signed-off-by: Clemens Ladisch Pieter Palmers notes: "The reason I added this retry behavior to the old stack is because some cards now and then fail to send a packet (e.g. the o2micro card in my dell laptop). I couldn't figure out why exactly this happens, my best guess is that the card cannot fetch the payload data on time. This happens much more frequently when sending large packets, which leads me to suspect that there are some contention issues with the DMA that fills the transmit FIFO. In the old stack it was a pretty critical issue as it resulted in a freeze of the userspace application. The omission of a packet doesn't necessarily have to be an issue. E.g. in IEC61883 streams the DBC field can be used to detect discontinuities in the stream. So as long as the other side doesn't bail when no [packet] is present in a cycle, there is not really a problem. I'm not convinced though that retrying is the proper solution, but it is simple and effective for what it had to do. And I think there are no reasons not to do it this way. Userspace can still detect this by checking the cycle the descriptor was sent in." Signed-off-by: Stefan Richter (changelog, comment) --- drivers/firewire/ohci.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) Date: Mon, 18 Jan 2010 22:36:49 +0100 (CET) From: Stefan Richter firewire: net: fix panic in fwnet_write_complete In the transmit path of firewire-net (IPv4 over 1394), the following race condition may occur: - The networking soft IRQ inserts a datagram into the 1394 async request transmit DMA. - The 1394 async transmit completion tasklet runs to finish cleaning up (unlink datagram from list of pending ones, release skb and outbound 1394 transaction object) --- before the networking soft IRQ had a chance to proceed and add the datagram to the list of pending datagrams. This caused a panic in the 1394 async transmit completion tasklet when it dereferenced unitialized list heads: http://bugzilla.kernel.org/show_bug.cgi?id=15077 The fix is to add checks in the tx soft IRQ and in the tasklet to determine which of these two is the last referrer to the transaction object. Then handle the cleanup of the object by the last referrer rather than assuming that the tasklet is always the last one. There is another similar race: Between said tasklet and fwnet_close, i.e. at ifdown. However, that race is much less likely to occur in practice and shall be fixed in a separate update. Reported-by: Илья Басин Signed-off-by: Stefan Richter --- drivers/firewire/net.c | 53 ++++++++++++++++++++++++++++++----------- 1 file changed, 39 insertions(+), 14 deletions(-) Date: Tue, 26 Jan 2010 21:39:07 +0100 (CET) From: Stefan Richter firewire: ohci: fix crashes with TSB43AB23 on 64bit systems Unsurprisingly, Texas Instruments TSB43AB23 exhibits the same behaviour as TSB43AB22/A in dual buffer IR DMA mode: If descriptors are located at physical addresses above the 31 bit address range (2 GB), the controller will overwrite random memory. With luck, this merely prevents video reception. With only a little less luck, the machine crashes. We use the same workaround here as with TSB43AB22/A: Switch off the dual buffer capability flag and use packet-per-buffer IR DMA instead. Another possible workaround would be to limit the coherent DMA mask to 31 bits. In Linux 2.6.33, this change serves effectively only as documentation since dual buffer mode is not used for any controller anymore. But somebody might want to re-enable it in the future to make use of features of dual buffer DMA that are not available in packet-per-buffer mode. In Linux 2.6.32 and older, this update is vital for anyone with this controller, more than 2 GB RAM, a 64 bit kernel, and FireWire video or audio applications. We have at least four reports: http://bugzilla.kernel.org/show_bug.cgi?id=13808 http://marc.info/?l=linux1394-user&m=126154279004083 https://bugzilla.redhat.com/show_bug.cgi?id=552142 http://marc.info/?l=linux1394-user&m=126432246128386 Reported-by: Paul Johnson Reported-by: Ronneil Camara Reported-by: G Zornetzer Reported-by: Mark Thompson Cc: stable@kernel.org Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Date: Sun, 24 Jan 2010 16:45:03 +0100 (CET) From: Stefan Richter firewire: core: fix use-after-free regression in FCP handler Commit db5d247a "firewire: fix use of multiple AV/C devices, allow multiple FCP listeners" introduced a regression into 2.6.33-rc3: The core freed payloads of incoming requests to FCP_Request or FCP_Response before a userspace driver accessed them. We need to copy such payloads for each registered userspace client and free the copies according to the lifetime rules of non-FCP client request resources. (This could possibly be optimized by reference counts instead of copies.) The presently only kernelspace driver which listens for FCP requests, firedtv, was not affected because it already copies FCP frames into an own buffer before returning to firewire-core's FCP handler dispatcher. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 50 +++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 14 deletions(-) Date: Sun, 24 Jan 2010 14:48:00 +0100 (CET) From: Stefan Richter firewire: cdev: add_descriptor documentation fix struct fw_cdev_add_descriptor.length is in quadlets, not in bytes. Also remove any doubts about the endianess of descriptor data. Signed-off-by: Stefan Richter --- include/linux/firewire-cdev.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Date: Sun, 24 Jan 2010 14:47:02 +0100 (CET) From: Stefan Richter firewire: core: add_descriptor size check Presently, firewire-core only checks whether descriptors that are to be added by userspace drivers to the local node's config ROM do not exceed a size of 256 quadlets. However, the sum of the bare minimum ROM plus all descriptors (from firewire-core, from firewire-net, from userspace) must not exceed 256 quadlets. Otherwise, the bounds of a statically allocated buffer will be overwritten. If the kernel survives that, firewire-core will subsequently be unable to parse the local node's config ROM. (Note, userspace drivers can add descriptors only through device files of local nodes. These are usually only accessible by root, unlike device files of remote nodes which may be accessible to lesser privileged users.) Therefore add a test which takes the actual present and required ROM size into account for all descriptors of kernelspace and userspace drivers. Cc: stable@kernel.org Signed-off-by: Stefan Richter --- drivers/firewire/core-card.c | 41 ++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 13 deletions(-) Date: Sun, 10 Jan 2010 13:14:26 +0100 From: =?UTF-8?B?TsOpbWV0aCBNw6FydG9u?= firewire: make PCI device id constant The id_table field of the struct pci_driver is constant in so it is worth to make pci_table also constant. Found with Coccinelle. Signed-off-by: Márton Németh Cc: Julia Lawall Cc: cocci@diku.dk Signed-off-by: Stefan Richter stefanr@s5r6.in-berlin.de> (changelog) --- drivers/firewire/ohci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Sat, 26 Dec 2009 01:47:12 +0100 (CET) From: Stefan Richter firedtv: add missing NULL pointer check If there is ever going to be a FireDTV or FloppyDTV firmware which does not provide a minimal ASCII textual descriptor for Model_Id --- or if the descriptor is provided indirectly in a descriptor directory --- the ieee1394 variant of the device probe of firedtv would dereference a NULL pointer. The firewire variant of firedtv's device probe is not affected. The fix makes sure that such an unexpected firmware is safely recognized by fdtv_alloc as an unknown firmware. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-1394.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) Date: Sat, 26 Dec 2009 01:44:10 +0100 (CET) From: Stefan Richter firewire: qualify config ROM cache pointers as const pointers Several config ROM related functions only peek at the ROM cache; mark their arguments as const pointers. Ditto fw_device.config_rom and fw_unit.directory, as the memory behind them is meant to be write-once. Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 21 +++++++++++---------- drivers/firewire/sbp2.c | 5 +++-- include/linux/firewire.h | 12 ++++++------ 3 files changed, 20 insertions(+), 18 deletions(-) Date: Sat, 26 Dec 2009 01:43:21 +0100 (CET) From: Stefan Richter firewire: core: fw_csr_string addendum Witespace and comment changes, and a different way to say i + 1 < end. Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 26 ++++++++++++++++---------- include/linux/firewire.h | 1 - 2 files changed, 16 insertions(+), 11 deletions(-) Date: Thu, 24 Dec 2009 11:59:57 +0100 From: Clemens Ladisch firewire: add fw_csr_string() helper function The core (sysfs attributes), the firedtv driver, and possible future drivers all read strings from some configuration ROM directory. Factor out the generic code from show_text_leaf() into a new helper function, modified slightly to handle arbitrary buffer sizes. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter --- drivers/firewire/core-device.c | 110 +++++++++++++++++------- drivers/media/dvb/firewire/firedtv-fw.c | 39 +-------- include/linux/firewire.h | 2 + 3 files changed, 84 insertions(+), 67 deletions(-) Date: Sat, 26 Dec 2009 01:36:53 +0100 (CET) From: Stefan Richter firewire, ieee1394: update Kconfig help Update the Kconfig help texts of both stacks to encourage a general move from the older to the newer drivers. However, do not label ieee1394 as "Obsolete" yet, as the newer drivers have not been deployed as default stack in the majority of Linux distributions yet, and those who start doing so now may still want to install the old drivers as fallback for unforeseen issues. Since Linux 2.6.32, FireWire audio devices can be driven by the newer firewire driver stack too, hence remove an outdated comment about audio devices. Also remove comments about library versions since the 2nd generation of libraw1394 and libdc1394 is now in common use; details on library versions can be read at the wiki link from the help texts. Signed-off-by: Stefan Richter --- drivers/Kconfig | 2 drivers/firewire/Kconfig | 44 +++++++++-------------------- drivers/ieee1394/Kconfig | 59 ++++++++++++++++++++++++++++----------- 3 files changed, 56 insertions(+), 49 deletions(-) Date: Sat, 26 Dec 2009 01:35:14 +0100 (CET) From: Stefan Richter firewire: ohci: always use packet-per-buffer mode for isochronous reception This is a minimal change meant for the short term: Never set the ohci->use_dualbuffer flag to true. There are two reasons to do so: - Packet-per-buffer mode and dual-buffer mode do not behave the same under certain circumstances, notably if several packets are covered by a single fw_cdev_iso_packet descriptor. http://marc.info/?l=linux1394-devel&m=124965653718313 Therefore the driver stack should not silently choose one or the other mode but should leave the choice to the high-level driver (regardless if kernel driver or userspace driver). Or simply always only offer packet-per-buffer mode, since a considerable number of controllers, even current ones, does not offer dual-buffer support. - Even under circumstances where packet-per-buffer mode and dual-buffer mode behave exactly the same --- notably when used through libraw1394, libdc1394, as well as the current two kernel drivers which use isochronous reception (firewire-net and firedtv) --- we are still faced with the problem that several OHCI 1.1 controllers have bugs in dual-buffer mode. Although it looks like we have identified most of those buggy controllers by now, we cannot be quite sure about that. So, use packet-per-buffer by default from now on. This change should be followed up by a more complete solution: Either extend the in-kernel API and the userspace ABI by a choice between the two IR modes or remove all dual-buffer related code from firewire-ohci. Signed-off-by: Stefan Richter --- drivers/firewire/ohci.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) Date: Sat, 26 Dec 2009 01:34:29 +0100 (CET) From: Stefan Richter firewire: cdev: fix another memory leak in an error path If copy_from_user in an FW_CDEV_IOC_SEND_RESPONSE ioctl failed, the fw_request pointed to by the inbound_transaction_resource is no longer referenced and needs to be freed. Signed-off-by: Stefan Richter --- drivers/firewire/core-cdev.c | 1 + 1 file changed, 1 insertion(+) Date: Thu, 24 Dec 2009 12:05:58 +0100 From: Clemens Ladisch firewire: fix use of multiple AV/C devices, allow multiple FCP listeners Control of more than one AV/C device at once --- e.g. camcorders, tape decks, audio devices, TV tuners --- failed or worked only unreliably, depending on driver implementation. This affected kernelspace and userspace drivers alike and was caused by firewire-core's inability to accept multiple registrations of FCP listeners. The fix allows multiple address handlers to be registered for the FCP command and response registers. When a request for these registers is received, all handlers are invoked, and the Firewire response is generated by the core and not by any handler. The cdev API does not change, i.e., userspace is still expected to send a response for FCP requests; this response is silently ignored. Signed-off-by: Clemens Ladisch Signed-off-by: Stefan Richter (changelog, rebased, whitespace) --- drivers/firewire/core-cdev.c | 26 +++-- drivers/firewire/core-transaction.c | 118 ++++++++++++++++++++---- drivers/media/dvb/firewire/firedtv-fw.c | 12 -- include/linux/firewire-cdev.h | 3 + include/linux/firewire.h | 4 5 files changed, 119 insertions(+), 44 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-iso.c | 4 ++-- 1 file changed, 2 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: 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: Sat, 31 Oct 2009 16:44:19 +0100 (CET) From: Stefan Richter Not runtime-tested! --- drivers/firewire/Kconfig | 1 - drivers/firewire/net.c | 15 ++++++--------- 2 files changed, 6 insertions(+), 10 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 | 13 + drivers/firewire/Makefile | 6 drivers/firewire/fw-ipv4.c | 1819 ------------------------------------- drivers/firewire/net.c | 1819 +++++++++++++++++++++++++++++++++++++ drivers/ieee1394/Kconfig | 2 5 files changed, 1836 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 | 2644 ---------------------------- drivers/firewire/fw-sbp2.c | 1660 ------------------ drivers/firewire/fw-topology.c | 572 ------ drivers/firewire/fw-transaction.c | 978 ---------- drivers/firewire/ohci.c | 2644 ++++++++++++++++++++++++++++ drivers/firewire/sbp2.c | 1659 ++++++++++++++++++ 17 files changed, 9407 insertions(+), 9408 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: 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) Commit ebbb16bffa646f853899ef3fdc0ac7abab888703 upstream. 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) Commit af2719415a5ceae06f2a6d33e78b555e64697fc8 upstream. 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/fw-sbp2.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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, Mar 26, 2009 22:36:52 +0100 (CET) From: Beat Michel Liechti DVB: firedtv: FireDTV S2 problems with tuning solved Signed-off-by: Beat Michel Liechti Tuning was broken on FireDTV S2 (and presumably FloppyDTV S2) because a wrong opcode was sent. The box only gave "not implemented" responses. Changing the opcode to _TUNE_QPSK2 fixes this for good. Cc: stable@kernel.org Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-avc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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: Thu, 5 Mar 2009 19:13:43 +0100 (CET) From: Stefan Richter 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: 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: Thu, 26 Feb 2009 10:32:31 -0800 From: Linus Torvalds Make ieee1394_init a fs-initcall It needs to happen before any firewire driver actually registers itself, and that was previously handled by having the Makefile list the core ieee1394 files before the drivers. But now there are firewire drivers in drivers/media, and the Makefile games aren't enough. So just make ieee1394_init happen earlier in the init sequence, the way all other bus layers already do. Reported-and-tested-by: Ingo Molnar Cc: Stefan Richter Cc: Henrik Kurelid Cc: Mauro Carvalho Chehab Cc: Ben Backx Signed-off-by: Linus Torvalds --- drivers/ieee1394/ieee1394_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Tue, 24 Feb 2009 15:52:49 +0100 (CET) From: Beat Michel Liechti firedtv: dvb_frontend_info for FireDTV S2, fix "frequency limits undefined" error I found that the function fdtv_frontend_init in the file firedtv-fe.c was missing a case for FIREDTV_DVB_S2 which resulted in "frequency limits undefined" errors in syslog. Signed-off-by: Beat Michel Liechti Change by Stefan R: combine it with case case FIREDTV_DVB_S as originally suggested by Beat Michel. This enables FE_CAN_FEC_AUTO also for FireDTV-S2 devices which is possible as long as only DVB-S channels are used. FE_CAN_FEC_AUTO would be wrong for DVB-S2 channels, but those cannot be used yet since the driver is not yet converted to S2API. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-fe.c | 1 + 1 file changed, 1 insertion(+) Date: Mon, 23 Feb 2009 14:21:10 +0100 (CET) From: Stefan Richter firedtv: reinstate debug logging option Henrik Kurelid tells me that FCP debug logging (which I removed during cleanups) is still useful when working on driver issues together with end users. So bring it back in an updated form with only 60% of the original code footprint. Logging can be enabled with # echo -1 > /sys/module/firedtv/parameters/debug 1 instead of -1 enables only FCP header logging, 2 instead of -1 enables only hexdumps of the entire FCP frames. 0 switches logging off again. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-avc.c | 79 +++++++++++++++++++++++ 1 file changed, 79 insertions(+) Date: Fri, 20 Feb 2009 20:54:27 +0100 (CET) From: Stefan Richter firedtv: build fix for INPUT=m and DVB_FIREDTV=y Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Thu, 19 Feb 2009 20:40:39 +0100 From: Stefan Richter firedtv: use msecs_to_jiffies Pointed out by Mauro Carvalho Chehab. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-avc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) Date: Mon, 16 Feb 2009 23:42:31 +0100 (CET) From: Stefan Richter ieee1394: remove superfluous assertions hpsb_read, hpsb_write, hpsb_lock are sleeping functions which nobody is in danger to use in atomic context. Besides, in_interrupt does not cover all types of atomic context. Signed-off-by: Stefan Richter --- drivers/ieee1394/ieee1394_transactions.c | 6 ------ 1 file changed, 6 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: Sun Feb 15 20:50:46 CET 2009 From: Stefan Richter firedtv: some more housekeeping Fix an old checkpatch warning and a new compiler warning. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-ci.c | 2 +- drivers/media/dvb/firewire/firedtv-dvb.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) Date: Sun Feb 15 15:33:17 CET 2009 From: Stefan Richter firedtv: rename a file once more At the moment, about a third of avc.c is specific to FireDTVs rather than generic AV/C code. Rename it to firedtv-avc.c. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/Makefile | 2 drivers/media/dvb/firewire/avc.c | 1235 ----------------------- drivers/media/dvb/firewire/firedtv-avc.c | 1235 +++++++++++++++++++++++ drivers/media/dvb/firewire/firedtv.h | 64 4 files changed, 1268 insertions(+), 1268 deletions(-) Date: Sun Feb 15 15:33:17 CET 2009 From: Stefan Richter firedtv: dvb demux: more compact channels backing store Replace struct firedtv_channel { bool active; int pid; } channel[16]; by unsigned long channel_active; u16 channel_pid[16];. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-dvb.c | 52 ++++++++++------------- drivers/media/dvb/firewire/firedtv.h | 10 ++-- 2 files changed, 27 insertions(+), 35 deletions(-) Date: Sun Feb 15 15:33:17 CET 2009 From: Stefan Richter firedtv: dvb demux: some simplifications c->active was unnecessarily cleared twice. Also, by marking the channel inactive before the for loop, the loop becomes identical with fdtv_channel_collect(). Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-dvb.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) Date: Sun Feb 15 15:33:17 CET 2009 From: Stefan Richter firedtv: dvb demux: remove a bogus loop This loop is unnecessary because - only active channel[].pid's will be sent to the device, - when a channel is activated, its pid is set to dvbdmxfeed->pid. Perhaps the original code was there because it was initially not fully covered by the fdtv->demux_mutex. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-dvb.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) Date: Sun Feb 15 15:33:17 CET 2009 From: Stefan Richter firedtv: dvb demux: fix mutex protection fdtv_start_feed() accessed the channel list unsafely. Fully serialize it with itself and fdtv_stop_feed(). Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-dvb.c | 80 +++++++++-------------- 1 file changed, 32 insertions(+), 48 deletions(-) Date: Sun Feb 15 15:33:17 CET 2009 From: Stefan Richter firedtv: dvb demux: fix missing braces Original code was: ... case DMX_TS_PES_OTHER: //Dirty fix to keep firesat->channel pid-list up to date for(k=0;k<16;k++){ if(firesat->channel[k].active == 0) firesat->channel[k].pid = dvbdmxfeed->pid; break; } channel = firesat_channel_allocate(firesat); break; default: ... Looks bogus in several respects. For now let's just add braces to the if because that seems to be what the author meant. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-dvb.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) Date: Sun Feb 15 15:33:17 CET 2009 From: Stefan Richter firedtv: allow build without input subsystem !CONFIG_INPUT is very unlikely on systems on which firedtv is of interest. But we can easily support it. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/Kconfig | 5 ++++- drivers/media/dvb/firewire/Makefile | 3 ++- drivers/media/dvb/firewire/firedtv.h | 7 +++++++ 3 files changed, 13 insertions(+), 2 deletions(-) Date: Sun Feb 15 15:33:17 CET 2009 From: Stefan Richter firedtv: replace EXTRA_CFLAGS by ccflags The former are deprecated. The latter can depend on Kconfig variables. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Date: Sun Feb 15 15:33:17 CET 2009 From: Stefan Richter firedtv: concentrate ieee1394 dependencies Move the entire interface with drivers/ieee1394 to firedtv-1394.c. Move 1394-independent module initialization code to firedtv-dvb.c. This prepares interfacing with drivers/firewire. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/Kconfig | 7 + drivers/media/dvb/firewire/Makefile | 10 - drivers/media/dvb/firewire/avc.c | 82 +++---- drivers/media/dvb/firewire/firedtv-1394.c | 263 ++++++++-------------- drivers/media/dvb/firewire/firedtv-ci.c | 11 - drivers/media/dvb/firewire/firedtv-dvb.c | 162 ++++++++++++-- drivers/media/dvb/firewire/firedtv-fe.c | 10 - drivers/media/dvb/firewire/firedtv.h | 60 +++-- 8 files changed, 332 insertions(+), 273 deletions(-) Date: Sun Feb 15 15:33:17 CET 2009 From: Stefan Richter firedtv: amend Kconfig menu prompt Signed-off-by: Stefan Richter --- drivers/media/dvb/Kconfig | 2 ++ drivers/media/dvb/firewire/Kconfig | 14 +++++++------- 2 files changed, 9 insertions(+), 7 deletions(-) Date: Sun Feb 15 15:33:17 CET 2009 From: Stefan Richter firedtv: remove kernel version compatibility macro Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-dvb.c | 7 ++++--- drivers/media/dvb/firewire/firedtv.h | 8 -------- 2 files changed, 4 insertions(+), 11 deletions(-) Date: Sun Feb 15 15:33:17 CET 2009 From: Stefan Richter firedtv: combine header files avc.h and firedtv-*.h are small and currently not shared with other drivers, hence concatenate them all into firedtv.h. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/avc.c | 2 - drivers/media/dvb/firewire/avc.h | 52 ---------------------- drivers/media/dvb/firewire/firedtv-1394.c | 3 - drivers/media/dvb/firewire/firedtv-ci.c | 2 - drivers/media/dvb/firewire/firedtv-ci.h | 9 ---- drivers/media/dvb/firewire/firedtv-dvb.c | 2 - drivers/media/dvb/firewire/firedtv-fe.c | 1 - drivers/media/dvb/firewire/firedtv-rc.c | 1 - drivers/media/dvb/firewire/firedtv-rc.h | 11 ----- drivers/media/dvb/firewire/firedtv.h | 33 ++++++++++++++ 10 files changed, 33 insertions(+), 83 deletions(-) Date: Sun Feb 15 15:33:17 CET 2009 From: Stefan Richter firedtv: misc style touch-ups Standardize on lower-case hexadecimal constants. Adjust whitespace. Omit unnecessary pointer type casts and an unnecessary list head initialization. Use dev_printk. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/avc.c | 32 +++++----- drivers/media/dvb/firewire/firedtv-1394.c | 35 +++--------- drivers/media/dvb/firewire/firedtv-ci.c | 29 +++++----- drivers/media/dvb/firewire/firedtv-dvb.c | 65 ++++++++++------------ drivers/media/dvb/firewire/firedtv-fe.c | 27 +++++---- 5 files changed, 85 insertions(+), 103 deletions(-) Date: Wed Feb 11 21:21:04 CET 2009 From: Stefan Richter firedtv: avc, ci: remove unused constants Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/avc.c | 14 ++-- drivers/media/dvb/firewire/firedtv-ci.c | 17 +++-- drivers/media/dvb/firewire/firedtv.h | 81 ------------------------ 3 files changed, 19 insertions(+), 93 deletions(-) Date: Wed Feb 11 21:21:04 CET 2009 From: Stefan Richter firedtv: avc: remove bitfields from read descriptor response operands Don't use bitfields in struct types of on-the-wire data. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/avc.c | 48 +++++++++-- drivers/media/dvb/firewire/avc.h | 106 ------------------------ drivers/media/dvb/firewire/firedtv-ci.c | 46 +++++----- drivers/media/dvb/firewire/firedtv-fe.c | 26 +++--- drivers/media/dvb/firewire/firedtv.h | 29 +++++++ 5 files changed, 107 insertions(+), 148 deletions(-) Date: Wed Feb 11 21:21:04 CET 2009 From: Stefan Richter firedtv: avc: remove bitfields from DSD command operands Don't use bitfields in struct types of on-the-wire data. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/avc.c | 109 +++++++++++++++---------------- drivers/media/dvb/firewire/avc.h | 74 --------------------- 2 files changed, 52 insertions(+), 131 deletions(-) Date: Wed Feb 11 21:21:04 CET 2009 From: Stefan Richter firedtv: avc: header file cleanup Remove unused constants and declarations. Move privately used constants into .c files. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/avc.c | 6 +- drivers/media/dvb/firewire/avc.h | 67 ------------------------ drivers/media/dvb/firewire/firedtv-fe.c | 2 + 3 files changed, 6 insertions(+), 69 deletions(-) Date: Wed Feb 11 21:21:04 CET 2009 From: Stefan Richter firedtv: avc: remove bitfields from FCP frame types Don't use bitfields in struct types of on-the-wire data. Also move many privately used constants from avc.h to avc.c and remove some unused constants. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/avc.c | 210 ++++++++++++++---------- drivers/media/dvb/firewire/avc.h | 134 --------------- drivers/media/dvb/firewire/firedtv-fe.c | 2 + 3 files changed, 123 insertions(+), 223 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: 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: Tue, 3 Feb 2009 17:54:31 +0100 (CET) From: Stefan Richter ieee1394: dv1394: move deprecation message from module init to file open On many Linux installations, the dv1394 driver will be auto-loaded whenever an AV/C device (e.g. camcorder or audio device) is plugged in. An irritating message would then appear in the kernel log. Defer this message to until a dv1394 character device file is actually used by a program. Also include the program name in the message and update the message slightly. Signed-off-by: Stefan Richter --- drivers/ieee1394/dv1394.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Date: Sun, 1 Feb 2009 01:29:35 -0800 (PST) From: Petr Vandrovec firewire: core: Remove card from list of cards when enable fails Signed-off-by: Petr Vandrovec After a controller initialization failure, addition of another card got stuck due to card_list corruption. Signed-off-by: Stefan Richter --- drivers/firewire/fw-card.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) Date: Thu, 29 Jan 2009 00:13:20 +0100 (CET) From: Stefan Richter ieee1394: sbp2: add workarounds for 2nd and 3rd generation iPods as per https://bugs.launchpad.net/bugs/294391. These got one sample of each iPod generation going. However there still occurred I/O stalls with the 3rd generation iPod which remain undiagnosed at the time of this writing. Acked-by: Jarod Wilson Signed-off-by: Stefan Richter --- drivers/ieee1394/sbp2.c | 10 ++++++++++ 1 file changed, 10 insertions(+) Date: Thu, 29 Jan 2009 00:11:59 +0100 (CET) From: Stefan Richter firewire: sbp2: add workarounds for 2nd and 3rd generation iPods According to https://bugs.launchpad.net/bugs/294391 - 3rd generation iPods need the "fix capacity" workaround after all (apparently they crash after the last sector was accessed), - 2nd generation iPods need the "128 kB maximum request size" workaround. Alas both iPod generations feature the same model ID in the config ROM, hence we can only define a shared quirks list entry for them. Luckily the fix capacity workaround did not show a negative effect in Jarod's tests with 2nd gen. iPod. A side note: Apple computers in target mode (or at least an x86 Mac mini) don't have firmware_version and model_id, hence none of the iPod quirks list entries is active for them. Tested-by: Jarod Wilson Acked-by: Jarod Wilson Signed-off-by: Stefan Richter --- drivers/firewire/fw-sbp2.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) Date: Wed, 28 Jan 2009 01:03:34 +0100 (CET) From: Stefan Richter firewire: sbp2: fix DMA mapping leak on the failure path Reported-by: FUJITA Tomonori who also provided a first version of the fix. Signed-off-by: Stefan Richter --- drivers/firewire/fw-sbp2.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) Date: Sat, 24 Jan 2009 20:35:38 +0100 (CET) From: Stefan Richter firewire: core: optimize card shutdown This fixes a regression by "firewire: keep highlevel drivers attached during brief connection loss": There were 2 seconds unnecessary waiting added to the shutdown procedure of each controller. We use card->link as status flag to signal the device handler that there is no use to wait for a come-back. Signed-off-by: Stefan Richter --- drivers/firewire/fw-card.c | 2 +- drivers/firewire/fw-device.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 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: Sat, 24 Jan 2009 19:41:46 +0100 (CET) From: Stefan Richter ieee1394: sbp2: don't assume zero model_id or firmware_revision if there is none This makes sbp2 behave more like firewire-sbp2 which reports 0xff000000 as immediate value if there are no unit directory entries for model_id or firmware_revision. It does not reduce matches with the currently existing quirks table; the only zero entry there is for a device which actually does have a zero model_id. It only changes how model_id and firmware_revision are logged if they are missing. Other functionally unrelated changes: The model_id member of quirks list entries is renamed to model; the value (but not the effect) of SBP2_ROM_VALUE_WILDCARD is changed. Now this part of the source is identical with firewire-sbp2 for easier maintenance. Signed-off-by: Stefan Richter --- drivers/ieee1394/sbp2.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) Date: Sat, 24 Jan 2009 19:41:46 +0100 (CET) From: Stefan Richter ieee1394: sbp2: fix payload limit at S1600 and S3200 1394-2008 clause 16.3.4.1 (1394b-2002 clause 16.3.1.1) defines tighter limits than 1394-2008 clause 6.2.2.3 (1394a-2000 clause 6.2.2.3). Our previously too large limit doesn't matter though if the controller reports its max_receive correctly. Signed-off-by: Stefan Richter --- drivers/ieee1394/sbp2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Sat, 24 Jan 2009 19:41:46 +0100 (CET) From: Stefan Richter firewire: sbp2: define some magic numbers as macros Signed-off-by: Stefan Richter --- drivers/firewire/fw-sbp2.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) Date: Sat, 24 Jan 2009 19:41:46 +0100 (CET) From: Stefan Richter firewire: sbp2: fix payload limit at S1600 and S3200 1394-2008 clause 16.3.4.1 (1394b-2002 clause 16.3.1.1) defines tighter limits than 1394-2008 clause 6.2.2.3 (1394a-2000 clause 6.2.2.3). Our previously too large limit doesn't matter though if the controller reports its max_receive correctly. Signed-off-by: Stefan Richter --- drivers/firewire/fw-sbp2.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) Date: Tue, 20 Jan 2009 19:10:58 +0100 (CET) From: Stefan Richter firewire: ohci: increase AT req. retries, fix ack_busy_X from Panasonic camcorders and others Camcorders have a tendency to fail read requests to their config ROM and write request to their FCP command register with ack_busy_X. This has become a problem with newer kernels and especially Panasonic camcorders, causing AV/C in dvgrab and kino to fail. Dvgrab for example frequently logs "send oops"; kino reports loss of AV/C control. I suspect that lower CPU scheduling latencies in newer kernels made this issue more prominent now. According to https://sourceforge.net/tracker/?func=detail&atid=114103&aid=2492640&group_id=14103 this can be fixed by configuring the FireWire controller for more hardware retries for request transmission; these retries are evidently more successful than libavc1394's own retry loop (typically 3 tries on top of hardware retries). Presumably the same issue has been reported at https://bugzilla.redhat.com/show_bug.cgi?id=449252 and https://bugzilla.redhat.com/show_bug.cgi?id=477279 . In a quick test with a JVC camcorder (which didn't malfunction like the reported camcorders), this change decreased the number of ack_busy_X from 16 in three runs of dvgrab to 4 in three runs of the same capture duration. Signed-off-by: Stefan Richter --- drivers/firewire/fw-ohci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Tue, 20 Jan 2009 19:09:58 +0100 (CET) From: Stefan Richter ieee1394: ohci1394: increase AT req. retries, fix ack_busy_X from Panasonic camcorders and others Camcorders have a tendency to fail read requests to their config ROM and write request to their FCP command register with ack_busy_X. This has become a problem with newer kernels and especially Panasonic camcorders, causing AV/C in dvgrab and kino to fail. Dvgrab for example frequently logs "send oops"; kino reports loss of AV/C control. I suspect that lower CPU scheduling latencies in newer kernels made this issue more prominent now. According to https://sourceforge.net/tracker/?func=detail&atid=114103&aid=2492640&group_id=14103 this can be fixed by configuring the FireWire controller for more hardware retries for request transmission; these retries are evidently more successful than libavc1394's own retry loop (typically 3 tries on top of hardware retries). Presumably the same issue has been reported at https://bugzilla.redhat.com/show_bug.cgi?id=449252 and https://bugzilla.redhat.com/show_bug.cgi?id=477279 . Tested-by: Mathias Beilstein Signed-off-by: Stefan Richter --- drivers/ieee1394/ohci1394.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Mon, 19 Jan 2009 19:20:31 +0100 (CET) From: Stefan Richter ieee1394: sbp2: update a help string Signed-off-by: Stefan Richter --- drivers/ieee1394/sbp2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Date: Mon, 19 Jan 2009 19:19:55 +0100 (CET) From: Stefan Richter ieee1394: support for speeds greater than S800 The hard-wired configuration of the top speed (until now S800) was unnecessary, remove it. If the local link layer controller supports S1600 or S3200, we now assume this speed for all present 1394b PHYs (except if they are behind 1394a repeaters) until nodemgr figured out the actual speed while fetching the config ROM. Signed-off-by: Stefan Richter --- drivers/ieee1394/ieee1394.h | 4 +--- drivers/ieee1394/ieee1394_core.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 11 deletions(-) Date: Sun, 18 Jan 2009 16:30:00 +0100 (CET) From: Stefan Richter firedtv: avc: fix offset in avc_tuner_get_ts The parentheses were wrong. It didn't matter though because this code only writes a 0 into an area which is already initialized to 0. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/avc.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) Date: Sun, 18 Jan 2009 16:30:00 +0100 (CET) From: Stefan Richter firedtv: avc: reduce stack usage, remove two typedefs It is safe to share a memory buffer for command frame and response frame because the response data come in after the command frame was last used. Even less stack would be required if only the actual required frame size instead of the entire FCP register size was allocated. Also, rename the defined types AVCCmdFrm and AVCRspFrm to struct avc_command_frame and struct avc_response_frame. TODO: Remove the bitfields in these types. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/avc.c | 1064 +++++++++++++++---------------- drivers/media/dvb/firewire/avc.h | 24 - 2 files changed, 532 insertions(+), 556 deletions(-) Date: Sun, 18 Jan 2009 16:30:00 +0100 (CET) From: Stefan Richter firedtv: cmp: move code to avc Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/Makefile | 1 - drivers/media/dvb/firewire/avc.c | 147 +++++++++++++++++++ drivers/media/dvb/firewire/avc.h | 3 + drivers/media/dvb/firewire/cmp.c | 171 ---------------------- drivers/media/dvb/firewire/cmp.h | 9 - drivers/media/dvb/firewire/firedtv-1394.c | 1 - drivers/media/dvb/firewire/firedtv-fe.c | 1 - 7 files changed, 150 insertions(+), 183 deletions(-) Date: Sun, 18 Jan 2009 16:30:00 +0100 (CET) From: Stefan Richter firedtv: iso: move code to firedtv-1394 Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/Makefile | 1 - drivers/media/dvb/firewire/firedtv-1394.c | 96 ++++++++++++++++++- drivers/media/dvb/firewire/firedtv-iso.c | 110 ---------------------- drivers/media/dvb/firewire/firedtv.h | 5 - 4 files changed, 93 insertions(+), 119 deletions(-) Date: Sun, 18 Jan 2009 16:30:00 +0100 (CET) From: Stefan Richter firedtv: iso: remove unnecessary struct type definitions Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-iso.c | 17 +++++++----- drivers/media/dvb/firewire/firedtv.h | 34 ----------------------- 2 files changed, 10 insertions(+), 41 deletions(-) Date: Sun, 18 Jan 2009 16:30:00 +0100 (CET) From: Stefan Richter firedtv: iso: style changes and fixlets Add cleanup after failure in setup_iso_channel. Replace printk() by dv_err(). Decrease indentation level in rawiso_activity_cb(). Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/firedtv-iso.c | 136 +++++++++++------------ 1 file changed, 66 insertions(+), 70 deletions(-) Date: Sat, 17 Jan 2009 14:47:34 +0100 From: Rambaldi firedtv: rename variables and functions from firesat to firedtv Signed-off-by: Rambaldi Additional changes by Stefan Richter: Renamed struct firedtv *firedtv to struct firedtv *fdtv and firedtv_foo_bar() to fdtv_foo_bar() for brevity. Signed-off-by: Stefan Richter --- drivers/media/dvb/firewire/avc.c | 188 +++++++++++----------- drivers/media/dvb/firewire/avc.h | 34 ++-- drivers/media/dvb/firewire/cmp.c | 40 ++-- drivers/media/dvb/firewire/cmp.h | 6 drivers/media/dvb/firewire/firedtv-1394.c | 190 +++++++++++----------- drivers/media/dvb/firewire/firedtv-ci.c | 106 ++++++------ drivers/media/dvb/firewire/firedtv-ci.h | 6 drivers/media/dvb/firewire/firedtv-dvb.c | 142 ++++++++-------- drivers/media/dvb/firewire/firedtv-fe.c | 124 +++++++------- drivers/media/dvb/firewire/firedtv-iso.c | 40 ++-- drivers/media/dvb/firewire/firedtv-rc.c | 18 +- drivers/media/dvb/firewire/firedtv-rc.h | 8 drivers/media/dvb/firewire/firedtv.h | 32 ++-- 13 files changed, 467 insertions(+), 467 deletions(-) Date: Sat, 17 Jan 2009 13:07:44 +0100 From: Rambaldi firedtv: rename files from firesat to firedtv Signed-off-by: Rambaldi Additional changes by Stefan Richter: Name the directory "firewire" instead of "firedtv". Standardize on "-" instead of "_" in file names, because that's what drivers/firewire/ and drivers/media/dvb/dvb-usb/ use too. Build fix. Signed-off-by: Stefan Richter --- drivers/media/dvb/Kconfig | 2 drivers/media/dvb/Makefile | 2 drivers/media/dvb/firesat/Kconfig | 12 - drivers/media/dvb/firesat/Makefile | 13 - drivers/media/dvb/firesat/avc_api.c | 1051 ---------------------- drivers/media/dvb/firesat/avc_api.h | 432 --------- drivers/media/dvb/firesat/cmp.c | 171 ---- drivers/media/dvb/firesat/cmp.h | 9 - drivers/media/dvb/firesat/firesat-ci.c | 261 ----- drivers/media/dvb/firesat/firesat-ci.h | 9 - drivers/media/dvb/firesat/firesat-rc.c | 191 ---- drivers/media/dvb/firesat/firesat-rc.h | 11 - drivers/media/dvb/firesat/firesat.h | 227 ----- drivers/media/dvb/firesat/firesat_1394.c | 291 ------ drivers/media/dvb/firesat/firesat_dvb.c | 276 ------ drivers/media/dvb/firesat/firesat_fe.c | 245 ----- drivers/media/dvb/firesat/firesat_iso.c | 111 -- drivers/media/dvb/firewire/Kconfig | 12 + drivers/media/dvb/firewire/Makefile | 13 + drivers/media/dvb/firewire/avc.c | 1051 ++++++++++++++++++++++ drivers/media/dvb/firewire/avc.h | 432 +++++++++ drivers/media/dvb/firewire/cmp.c | 171 ++++ drivers/media/dvb/firewire/cmp.h | 9 + drivers/media/dvb/firewire/firedtv-1394.c | 291 ++++++ drivers/media/dvb/firewire/firedtv-ci.c | 261 +++++ drivers/media/dvb/firewire/firedtv-ci.h | 9 + drivers/media/dvb/firewire/firedtv-dvb.c | 276 ++++++ drivers/media/dvb/firewire/firedtv-fe.c | 245 +++++ drivers/media/dvb/firewire/firedtv-iso.c | 111 ++ drivers/media/dvb/firewire/firedtv-rc.c | 191 ++++ drivers/media/dvb/firewire/firedtv-rc.h | 11 + drivers/media/dvb/firewire/firedtv.h | 227 +++++ 32 files changed, 3312 insertions(+), 3312 deletions(-) create mode 100644 drivers/media/dvb/firewire/Kconfig create mode 100644 drivers/media/dvb/firewire/Makefile create mode 100644 drivers/media/dvb/firewire/avc.c create mode 100644 drivers/media/dvb/firewire/avc.h create mode 100644 drivers/media/dvb/firewire/cmp.c create mode 100644 drivers/media/dvb/firewire/cmp.h create mode 100644 drivers/media/dvb/firewire/firedtv-ci.c create mode 100644 drivers/media/dvb/firewire/firedtv-ci.h create mode 100644 drivers/media/dvb/firewire/firedtv-rc.c create mode 100644 drivers/media/dvb/firewire/firedtv-rc.h create mode 100644 drivers/media/dvb/firewire/firedtv.h create mode 100644 drivers/media/dvb/firewire/firedtv-1394.c create mode 100644 drivers/media/dvb/firewire/firedtv-dvb.c create mode 100644 drivers/media/dvb/firewire/firedtv-fe.c create mode 100644 drivers/media/dvb/firewire/firedtv-iso.c delete mode 100644 drivers/media/dvb/firesat/Kconfig delete mode 100644 drivers/media/dvb/firesat/Makefile delete mode 100644 drivers/media/dvb/firesat/avc_api.c delete mode 100644 drivers/media/dvb/firesat/avc_api.h delete mode 100644 drivers/media/dvb/firesat/cmp.c delete mode 100644 drivers/media/dvb/firesat/cmp.h delete mode 100644 drivers/media/dvb/firesat/firesat-ci.c delete mode 100644 drivers/media/dvb/firesat/firesat-ci.h delete mode 100644 drivers/media/dvb/firesat/firesat-rc.c delete mode 100644 drivers/media/dvb/firesat/firesat-rc.h delete mode 100644 drivers/media/dvb/firesat/firesat.h delete mode 100644 drivers/media/dvb/firesat/firesat_1394.c delete mode 100644 drivers/media/dvb/firesat/firesat_dvb.c delete mode 100644 drivers/media/dvb/firesat/firesat_fe.c delete mode 100644 drivers/media/dvb/firesat/firesat_iso.c 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: Sat, 17 Jan 2009 22:45:54 +0100 (CET) From: Stefan Richter firewire: keep highlevel drivers attached during brief connection loss There are situations when nodes vanish from the bus and come back quickly thereafter: - When certain bus-powered hubs are plugged in, - when certain devices are plugged into 6-port hubs, - when certain disk enclosures are switched from self-power to bus power or vice versa and break the daisy chain during the transition, - when the user plugs a cable out and quickly plugs it back in, e.g. to reorder a daisy chain (works on Mac OS X if done quickly enough), - when certain hubs temporarily malfunction during high bus traffic. Until now, firewire-core reported affected nodes as lost to the highlevel drivers (firewire-sbp2 and userspace drivers). We now delay the destruction of device representations until after at least two seconds after the last bus reset. If a "new" device is detected in this period whose bus information block and root directory header match that of a device which is pending for deletion, we resurrect that device and send update calls to highlevel drivers. Signed-off-by: Stefan Richter --- drivers/firewire/fw-device.c | 121 +++++++++++++++++++++++++++++------ drivers/firewire/fw-device.h | 1 + 2 files changed, 100 insertions(+), 22 deletions(-) Date: Wed, 14 Jan 2009 23:01:35 +0100 (CET) From: Stefan Richter firedtv: add missing dependency on CONFIG_INPUT Fix build error \ Reported-by: Randy Dunlap Perhaps we should make the remote control part of firedtv modular so that the driver can be built without input support. But it's not very likely that anybody would have use for such a constellation. Signed-off-by: Stefan Richter --- I need to fold it into "DVB: add firesat driver" before I submit the driver for mainline merge. drivers/media/dvb/firesat/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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: Fri, 09 Jan 2009 16:20:31 -0800 From: David Moore firewire: cdev: Workaround bug in idr_remove_all() There is a memory clearing problem in idr_remove_all(). Specifically, idr_remove_all() should be clearing some idr data structures before returning them to the idr free list but it's not. Because the idr kmem_cache is persistent, that's why different instantiations of the firewire client would interact with each other. Here's a workaround while I work on a patch to idr.c: Purposefully clear new memory allocated by the idr API to workaround a bug in idr_remove_all. Signed-off-by: David Moore Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Fri, 9 Jan 2009 20:49:37 +0100 (CET) From: Stefan Richter firewire: core: fix sleep in atomic context due to driver core change Due to commit 2831fe6f9cc4e16c103504ee09a47a084297c0f3, "driver core: create a private portion of struct device", device_initialize() can no longer be called from atomic contexts. We now defer it until after config ROM probing. This requires changes to the bus manager code because this may use a device before it was probed. Reported-by: Jay Fenlason Signed-off-by: Stefan Richter --- drivers/firewire/fw-card.c | 13 +++++++------ drivers/firewire/fw-device.c | 23 +++++++++++++---------- 2 files changed, 20 insertions(+), 16 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:43:23 +0100 (CET) From: Stefan Richter firewire: ohci: change "context_stop: still active" log message The present message is mostly just noise. We only need to be notified if the "active" flag does not go off before the retry loop terminates. Signed-off-by: Stefan Richter --- drivers/firewire/fw-ohci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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: 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: 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: Thu, 25 Dec 2008 15:34:25 +0100 (CET) From: Julia Lawall firedtv: Use DEFINE_SPINLOCK SPIN_LOCK_UNLOCKED is deprecated. The following makes the change suggested in Documentation/spinlocks.txt Signed-off-by: Julia Lawall Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/firesat_1394.c | 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: Mon, 15 Dec 2008 08:17:12 +0100 From: Henrik Kurelid firedtv: fix registration - adapter number could only be zero There was a bug causing the initialization to fail if adapter number was greater than zero. The adapter was however registered which caused the driver to oops the second time initialization was tried. Signed-off-by: Henrik Kurelid Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/firesat_dvb.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: Sat, 13 Dec 2008 15:21:29 -0800 From: Harvey Harrison ieee1934: dv1394: interrupt enabling/disabling broken on big-endian After annotating the frame structs, this was left: drivers/ieee1394/dv1394.c:2113:23: warning: invalid assignment: |= drivers/ieee1394/dv1394.c:2113:23: left side has type restricted __le32 drivers/ieee1394/dv1394.c:2113:23: right side has type int drivers/ieee1394/dv1394.c:2121:24: warning: invalid assignment: &= drivers/ieee1394/dv1394.c:2121:24: left side has type restricted __le32 drivers/ieee1394/dv1394.c:2121:24: right side has type int drivers/ieee1394/dv1394.c:2123:24: warning: invalid assignment: |= drivers/ieee1394/dv1394.c:2123:24: left side has type restricted __le32 drivers/ieee1394/dv1394.c:2123:24: right side has type int Which looks like a real bug on a big-endian arch as it would set/clear the wrong bit. Signed-off-by: Harvey Harrison Bill Fink writes: I finally got a chance to test the patch on my kernel, and live DV viewing using xine still worked fine. Although I admit to being mystified how it works both before and after the patch, since the cpu_to_le32() calls that were added should result in byte swapping on PPC that wasn't being done before. I guess that either the code paths involved aren't actually being triggered by my xine DV viewing, or there's some fortuitous palindromic setting of bits. Tested-by: Bill Fink Signed-off-by: Stefan Richter --- drivers/ieee1394/dv1394.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Date: Sat, 13 Dec 2008 15:20:39 -0800 From: Harvey Harrison ieee1394: dv1394: annotate frame input/output structs as little endian No Functional changes. Signed-off-by: Harvey Harrison Signed-off-by: Stefan Richter --- drivers/ieee1394/dv1394-private.h | 44 +++++++++++++++--------------- drivers/ieee1394/dv1394.c | 4 +- 2 files changed, 24 insertions(+), 24 deletions(-) Date: Sat, 13 Dec 2008 15:03:06 -0800 From: Harvey Harrison ieee1394: eth1394: trivial sparse annotations Mostly annotations of ether_type as a be16. Signed-off-by: Harvey Harrison Signed-off-by: Stefan Richter --- drivers/ieee1394/eth1394.c | 26 +++++++++++++------------- drivers/ieee1394/eth1394.h | 16 ++++++++-------- 2 files changed, 21 insertions(+), 21 deletions(-) Date: Sat, 13 Dec 2008 15:02:34 -0800 From: Harvey Harrison ieee1394: mark bus_info_data as a __be32 array Two access functions get_max_rom and set_hw_config_rom are changed to take __be32 as well. Only bus_info_data was ever passed in so this is OK. All other uses of bus_info_data treated it as a be32 value already. Signed-off-by: Harvey Harrison Signed-off-by: Stefan Richter --- drivers/ieee1394/csr1212.h | 2 +- drivers/ieee1394/hosts.h | 2 +- drivers/ieee1394/ohci1394.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) Date: Sat, 13 Dec 2008 15:02:21 -0800 From: Harvey Harrison ieee1394: replace CSR_SET_BUS_INFO_GENERATION macro Signed-off-by: Harvey Harrison Signed-off-by: Stefan Richter --- drivers/ieee1394/csr.h | 10 +++++----- drivers/ieee1394/hosts.c | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) Date: Sat, 13 Dec 2008 15:01:50 -0800 From: Harvey Harrison ieee1394: pcilynx: trivial endian annotation bus_info_block was treated as a be32 everywhere, annotate as such. Removes plenty of sparse warnings. Signed-off-by: Harvey Harrison Signed-off-by: Stefan Richter --- drivers/ieee1394/pcilynx.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Sat, 13 Dec 2008 23:12:06 +0100 (CET) From: Stefan Richter ieee1394: ignore nonzero Bus_Info_Block.max_rom, fetch config ROM in quadlets It is already known that buggy firmwares exist which report a bogus link_spd in their config ROM bus info block. We now got the first report of a bogus max_rom too (Freecom FireWire Hard Drive 1TB, http://bugzilla.kernel.org/show_bug.cgi?id=12206). I suspect other OSs only use quadlet reads to fetch the config ROM, otherwise the firmware authors would have noticed their mistake. Hence limit ieee1394's config ROM fetching routine to quadlets as the safe minimum regardless of what the bus info block says. This will potentially slow the bus reset handling by nodemgr somewhat down. But most existing devices support only quadlet reads anyway, hence there will often be no actual difference to before this change. Signed-off-by: Stefan Richter --- drivers/ieee1394/csr1212.c | 45 ++++++++++++------------------------- drivers/ieee1394/csr1212.h | 7 +----- drivers/ieee1394/nodemgr.c | 20 +++------------- 3 files changed, 19 insertions(+), 53 deletions(-) Date: Fri, 5 Dec 2008 10:00:16 +0100 From: Henrik Kurelid firedtv: use length_field() of PMT as length Parsed and used the length_field() of the PMT message instead of using the length field of the message struct, which does not seem to be filled correctly by e.g. MythTV. Signed-off-by: Henrik Kurelid Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/firesat-ci.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) Date: Thu, 4 Dec 2008 22:40:52 +0100 From: Henrik Kurelid firedtv: fix returned struct for ca_info The SystemId of the ca_info message was filled with garbage. It now returns what the card returns. Signed-off-by: Henrik Kurelid Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/avc_api.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Date: Sun, 2 Nov 2008 13:45:00 +0100 (CET) From: Stefan Richter firedtv: increase FCP frame length for DVB-S2 tune QSPK The last three bytes didn't go out to the wire. Effect of the fix not yet tested. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/avc_api.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) Date: Sun, 2 Nov 2008 13:45:00 +0100 (CET) From: Stefan Richter firedtv: replace mdelay by msleep These functions can sleep (and in fact sleep for the duration of a whole FCP transaction). Hence msleep is more appropriate here. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/avc_api.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Date: Sun, 2 Nov 2008 13:45:00 +0100 (CET) From: Stefan Richter firedtv: trivial reorganization in avc_api Reduce nesting level by factoring code out of avc_tuner_dsd() into helper functions. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/avc_api.c | 519 ++++++++++++++-------------- 1 file changed, 257 insertions(+), 262 deletions(-) Date: Sun, 2 Nov 2008 13:45:00 +0100 (CET) From: Stefan Richter firedtv: trivial cleanups in avc_api Use dev_err(), no CamelCase function names, adjust comment style, put #if 0 around unused code and add FIXME comments, standardize on lower-case hexadecimal constants, use ALIGN() for some frame length calculations, make a local function static... The code which writes FCP command frames and reads FCP response frames is not yet brought into canonical kernel coding style because this involves changes of typedefs (on-the-wire bitfields). Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/avc_api.c | 206 ++++++++++++----------- drivers/media/dvb/firesat/avc_api.h | 31 +-- drivers/media/dvb/firesat/firesat-ci.c | 8 drivers/media/dvb/firesat/firesat_1394.c | 6 drivers/media/dvb/firesat/firesat_dvb.c | 13 + drivers/media/dvb/firesat/firesat_fe.c | 46 ++--- 6 files changed, 146 insertions(+), 164 deletions(-) Date: Sun, 2 Nov 2008 13:45:00 +0100 (CET) From: Stefan Richter firedtv: don't retry oPCR updates endlessly In the theoretical case that the target node wasn't handling the lock transactions as expected or there was continued interference by other initiating nodes, these functions wouldn't return for ages. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/cmp.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) Date: Sun, 2 Nov 2008 13:45:00 +0100 (CET) From: Stefan Richter firedtv: remove bitfield typedefs from cmp, fix for big endian CPUs Use macros/ inline functions/ standard byte order accessors to read and write oPCR register values (big endian bitfields, on-the-wire data). The new code may not be the ultimate optimum, but it doesn't occur in a hot path. This fixes the CMP code for big endian CPUs. So far I tested it only on a little endian CPU though. For now, include instead of because drivers/ieee1394/*.h also include the former. I will fix this in drivers/ieee1394 and firedtv later. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/cmp.c | 70 +++++++++++++++++--------------- 1 file changed, 38 insertions(+), 32 deletions(-) Date: Sun, 2 Nov 2008 13:45:00 +0100 (CET) From: Stefan Richter firedtv: trivial cleanups in cmp Reduce nesting level by means of early exit and goto. Remove obsolete includes, use dev_err(), no CamelCase function names... Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/cmp.c | 199 ++++++++++------------- drivers/media/dvb/firesat/cmp.h | 6 - drivers/media/dvb/firesat/firesat_1394.c | 4 drivers/media/dvb/firesat/firesat_fe.c | 6 4 files changed, 93 insertions(+), 122 deletions(-) Date: Sun, 2 Nov 2008 13:45:00 +0100 (CET) From: Stefan Richter firedtv: trivial cleanups in firesat-ci Whitespace, variable names, comment style... Also, use dvb_generic_open() and dvb_generic_release() directly as our hooks in struct file_operations because firedtv's wrappers merely called these generic functions. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/firesat-ci.c | 162 ++++++++++--------------- 1 file changed, 66 insertions(+), 96 deletions(-) Date: Sun, 2 Nov 2008 13:45:00 +0100 (CET) From: Stefan Richter firedtv: remove CA debug code This looks like it is not necessary to have available for endusers who cannot patch kernels for bug reporting and tests of fixes. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/firesat-ci.c | 67 ------------------------- 1 file changed, 67 deletions(-) Date: Sun, 2 Nov 2008 13:45:00 +0100 (CET) From: Stefan Richter firedtv: remove AV/C debug code This looks like it is not necessary to have available for endusers who cannot patch kernels for bug reporting and tests of fixes. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/avc_api.c | 171 +--------------------------- 1 file changed, 6 insertions(+), 165 deletions(-) Date: Sun, 2 Nov 2008 13:45:00 +0100 (CET) From: Stefan Richter firedtv: remove various debug code Most of this was already commented out. And that which wasn't is not relevant in normal use. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/cmp.c | 11 +---------- drivers/media/dvb/firesat/firesat_1394.c | 4 ---- drivers/media/dvb/firesat/firesat_dvb.c | 4 ---- drivers/media/dvb/firesat/firesat_iso.c | 8 +------- 4 files changed, 2 insertions(+), 25 deletions(-) Date: Mon, 29 Sep 2008 19:22:48 +0200 (CEST) From: Stefan Richter firedtv: register input device as child of a FireWire device Instead of one virtual input device which exists for the whole lifetime of the driver and receives events from all connected FireDTVs, register one input device for each firedtv device. These input devices will show up as children of the respective firedtv devices in the sysfs hierarchy. However, the implementation falls short because of a bug in userspace: Udev's path_id script gets stuck with 100% CPU utilization, maybe because of an assumption about the maximum ieee1394 device hierarchy depth. To avoid this bug, we use the fw-host device instead of the proper unit_directory device as parent of the input device. There is hope that the port to the new firewire stack won't be inhibited by this userspace bug because there are no fw-host devices there. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/avc_api.c | 4 +- drivers/media/dvb/firesat/firesat-rc.c | 42 ++++++++++++++++------- drivers/media/dvb/firesat/firesat-rc.h | 9 +++-- drivers/media/dvb/firesat/firesat.h | 5 ++- drivers/media/dvb/firesat/firesat_1394.c | 26 ++++++-------- 5 files changed, 52 insertions(+), 34 deletions(-) Date: Mon, 29 Sep 2008 19:21:52 +0200 (CEST) From: Stefan Richter firedtv: fix string comparison and a few sparse warnings Sparse found a bug: while ((kv_buf + kv_len - 1) == '\0') should have been while (kv_buf[kv_len - 1] == '\0') We fix it by a better implementation without a temporary copy. Also fix sparse warnings of 0 instead of NULL and signedness mismatches. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/avc_api.c | 14 +++++++------- drivers/media/dvb/firesat/avc_api.h | 6 +++--- drivers/media/dvb/firesat/firesat_1394.c | 23 +++++++---------------- drivers/media/dvb/firesat/firesat_dvb.c | 2 +- 4 files changed, 18 insertions(+), 27 deletions(-) Date: Mon, 29 Sep 2008 19:21:20 +0200 (CEST) From: Stefan Richter firedtv: remove unused struct members and redefine an int as a bool. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/firesat.h | 7 +------ drivers/media/dvb/firesat/firesat_dvb.c | 20 ++++++++------------ 2 files changed, 9 insertions(+), 18 deletions(-) Date: Mon, 29 Sep 2008 19:20:36 +0200 (CEST) From: Stefan Richter firedtv: fix initialization of dvb_frontend.ops There was a NULL pointer reference if no dvb_frontend_info was found. Also, don't directly assign struct typed values to struct typed variables. Instead write out assignments to individual strcut members. This reduces module size by about 1 kB. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/firesat.h | 34 ++--- drivers/media/dvb/firesat/firesat_dvb.c | 3 - drivers/media/dvb/firesat/firesat_fe.c | 167 +++++++++++------------- 3 files changed, 91 insertions(+), 113 deletions(-) Date: Mon, 29 Sep 2008 19:19:41 +0200 (CEST) From: Stefan Richter firedtv: remove unused dual subunit code from initialization No FireDTVs with more than one subunit exists, hence simplify the initialization for the special case of one subunit. The driver was able to check for more than one subunit but was broken for more than two subunits. While we are at it, add several missing cleanups after failure, and include a few dynamically allocated structures diretly into struct firesat instead of allocating them separately. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/avc_api.c | 36 ---- drivers/media/dvb/firesat/avc_api.h | 1 - drivers/media/dvb/firesat/firesat-ci.c | 15 +- drivers/media/dvb/firesat/firesat-ci.h | 2 drivers/media/dvb/firesat/firesat.h | 18 +- drivers/media/dvb/firesat/firesat_1394.c | 214 ++++++++--------------- drivers/media/dvb/firesat/firesat_dvb.c | 166 ++++++++---------- drivers/media/dvb/firesat/firesat_fe.c | 22 +- 8 files changed, 171 insertions(+), 303 deletions(-) Date: Mon, 29 Sep 2008 19:19:08 +0200 (CEST) From: Stefan Richter firedtv: add vendor_id and version to driver match table Now that nodemgr was enhanced to match against the root directory's vendor ID if there isn't one in the unit directory, use this to prevent firedtv to be bound to wrong devices by accident. Also add the AV/C software version ID to the match flags for completeness; specifier ID and software only make sense as a pair. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/firesat_1394.c | 52 +++++++++++++++-------- 1 file changed, 33 insertions(+), 19 deletions(-) Date: Mon, 29 Sep 2008 19:18:30 +0200 (CEST) From: Stefan Richter firedtv: use hpsb_node_read(), _write(), _lock() because they are simpler and treat the node generation more correctly. While we are at it, clean up and simplify surrounding code. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/avc_api.c | 133 +++++++---------------- drivers/media/dvb/firesat/cmp.c | 7 - drivers/media/dvb/firesat/firesat.h | 10 +- drivers/media/dvb/firesat/firesat_1394.c | 24 +--- drivers/media/dvb/firesat/firesat_iso.c | 3 + 5 files changed, 58 insertions(+), 119 deletions(-) Date: Wed, 27 Aug 2008 01:24:25 +0200 (CEST) From: Stefan Richter ieee1394: inherit ud vendor_id from node vendor_id While Module_Vendor_ID in the configuration ROM's root directory is mandatory, there often aren't vendor IDs in unit directories. This affects the new firedtv driver which is meant to be auto-loaded and matched only for vendor-specific devices. We now always copy ne->vendor_id into ud->vendor_id before we scan a unit directory (and fill in a possibly present vendor ID from there). This way, the root directory's vendor ID is used as fallback in the "uevent" environment for modprobe'ing per module alias when a node was plugged in, and in the driver match routine when protocol drivers are bound to unit directories. It will however not be used as sysfs attribute of a unit directory device. Signed-off-by: Stefan Richter --- drivers/ieee1394/nodemgr.c | 3 +++ 1 file changed, 3 insertions(+) Date: Wed, 27 Aug 2008 13:40:02 +0200 From: Stefan Richter ieee1394: add hpsb_node_read() and hpsb_node_lock() These will be used by the firedtv driver. Like hpsb_node_write() they are much better APIs for high-level drivers than hpsb_write() and its siblings --- easier to use correctly and also terser. Unlike hspb_node_write(), the two new functions will only be used by one call site. Hence make them static inline instead of exported symbols. Signed-off-by: Stefan Richter --- drivers/ieee1394/nodemgr.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) Date: Wed, 27 Aug 2008 01:18:32 +0200 (CEST) From: Stefan Richter ieee1394: use correct barrier types between accesses of nodeid and generation A compiler barrier (explicit on the read side, implicit on the write side) is not quite enough for what has to be accomplished here. Use hardware memory barriers on systems which need them. (Of course a full fix of generation handling would require much more than this. The ieee1394 core's bus generation counter had to be tied to the controller's bus generation counter; cf. Kristian's stack. It's just that I have other current business with the code around these barrier()s, so why not do at least this small fix.) Signed-off-by: Stefan Richter --- drivers/ieee1394/nodemgr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) Date: Tue, 26 Aug 2008 00:17:30 +0200 (CEST) From: Stefan Richter firedtv: fix remote control input and update the scancode-to-keycode mapping to a current model. Per default, various media key keycodes are emitted which closely match what is printed on the remote. Userland can modify the mapping by means of evdev ioctls. (Not tested.) The old scancode-to-keycode mapping is left in the driver but cannot be modified by ioctls. This preserves status quo for old remotes. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/avc_api.c | 31 ++--- drivers/media/dvb/firesat/firesat-rc.c | 137 ++++++++++++++++++----- drivers/media/dvb/firesat/firesat-rc.h | 6 - drivers/media/dvb/firesat/firesat_1394.c | 25 ++-- 4 files changed, 139 insertions(+), 60 deletions(-) Date: Tue, 26 Aug 2008 00:11:28 +0200 (CEST) From: Stefan Richter firedtv: replace tasklet by workqueue job Non-atomic context is a lot nicer to work with. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/avc_api.c | 57 +++++------------------ drivers/media/dvb/firesat/avc_api.h | 1 + drivers/media/dvb/firesat/firesat.h | 4 +- drivers/media/dvb/firesat/firesat_1394.c | 4 +- 4 files changed, 18 insertions(+), 48 deletions(-) Date: Sun, 24 Aug 2008 23:30:00 +0200 (CEST) From: Stefan Richter firedtv: move some code back to ieee1394 core Partially reverts "ieee1394: remove unused code" of Linux 2.6.25. Signed-off-by: Stefan Richter --- drivers/ieee1394/ieee1394_core.c | 1 + drivers/ieee1394/ieee1394_transactions.c | 29 +++++++++++ drivers/ieee1394/ieee1394_transactions.h | 2 + drivers/media/dvb/firesat/cmp.c | 61 +---------------------- 4 files changed, 35 insertions(+), 58 deletions(-) Date: Sun, 24 Aug 2008 23:29:30 +0200 (CEST) From: Stefan Richter firedtv: replace semaphore by mutex firesat->avc_sem and ->demux_sem have been used exactly like a mutex. The only exception is the schedule_remotecontrol tasklet which did a down_trylock in atomic context. This is not possible with mutex_trylock; however the whole remote control related code is non-functional anyway at the moment. This should be fixed eventually, probably by turning the tasklet into a worqueue job. Convert everything else from semaphore to mutex. Also rewrite a few of the affected functions to unlock the mutex at a single exit point, instead of in several branches. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/avc_api.c | 11 ++++- drivers/media/dvb/firesat/cmp.c | 27 +++++++----- drivers/media/dvb/firesat/firesat.h | 11 ++--- drivers/media/dvb/firesat/firesat_1394.c | 5 +- drivers/media/dvb/firesat/firesat_dvb.c | 54 ++++++++++------------- 5 files changed, 55 insertions(+), 53 deletions(-) Date: Sun, 24 Aug 2008 23:28:45 +0200 (CEST) From: Stefan Richter firedtv: some header cleanups Unify #ifndef/#define/#endif guards against multiple inclusion. Drop extern keyword from function declarations. Remove #include's into header files where struct declarations suffice. Remove unused ohci1394 interface and related unused ieee1394 interfaces. Add a few missing #include's and remove a few apparently obsolete ones. Sort them alphabetically. Signed-off-by: Stefan Richter --- drivers/ieee1394/dma.h | 1 + drivers/ieee1394/iso.h | 1 + drivers/media/dvb/firesat/avc_api.c | 13 +++- drivers/media/dvb/firesat/avc_api.h | 69 ++++++++++--------- drivers/media/dvb/firesat/cmp.c | 15 +++- drivers/media/dvb/firesat/cmp.h | 14 ++-- drivers/media/dvb/firesat/firesat-ci.c | 11 ++- drivers/media/dvb/firesat/firesat-ci.h | 8 +- drivers/media/dvb/firesat/firesat-rc.c | 5 - drivers/media/dvb/firesat/firesat-rc.h | 13 ++- drivers/media/dvb/firesat/firesat.h | 48 ++++++++----- drivers/media/dvb/firesat/firesat_1394.c | 84 +++++++---------------- drivers/media/dvb/firesat/firesat_dvb.c | 21 ++---- drivers/media/dvb/firesat/firesat_fe.c | 21 +----- drivers/media/dvb/firesat/firesat_iso.c | 10 +++ 15 files changed, 160 insertions(+), 174 deletions(-) Date: Sun, 24 Aug 2008 23:27:45 +0200 (CEST) From: Stefan Richter firedtv: nicer registration message and some initialization fixes Print the correct name in dvb_register_adapter(). While we are at it, replace two switch cascades by one for loop, remove a superfluous member of struct firesat and of two unused arguments of AVCIdentifySubunit(), and fix bogus kfree's in firesat_dvbdev_init(). Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/avc_api.c | 5 +- drivers/media/dvb/firesat/avc_api.h | 2 drivers/media/dvb/firesat/firesat.h | 11 ++-- drivers/media/dvb/firesat/firesat_1394.c | 30 +++++----- drivers/media/dvb/firesat/firesat_dvb.c | 68 +++++------------------ drivers/media/dvb/firesat/firesat_fe.c | 8 +-- 6 files changed, 40 insertions(+), 84 deletions(-) Date: Tue, 26 Aug 2008 14:24:17 +0200 (CEST) From: Stefan Richter firesat: rename to firedtv Suggested by Andreas Monitzer. Besides DVB-S/-S2 receivers, the driver also supports DVB-C and DVB-T receivers, hence the previous project name is too narrow now. Not yet done: Rename source directory, files, types, variables... Signed-off-by: Stefan Richter --- drivers/media/dvb/Makefile | 2 +- drivers/media/dvb/firesat/Kconfig | 13 +++++++------ drivers/media/dvb/firesat/Makefile | 4 ++-- drivers/media/dvb/firesat/avc_api.c | 2 +- drivers/media/dvb/firesat/cmp.c | 2 +- drivers/media/dvb/firesat/firesat-ci.c | 2 +- drivers/media/dvb/firesat/firesat-rc.c | 2 +- drivers/media/dvb/firesat/firesat.h | 2 +- drivers/media/dvb/firesat/firesat_1394.c | 16 ++++++++-------- drivers/media/dvb/firesat/firesat_dvb.c | 2 +- drivers/media/dvb/firesat/firesat_fe.c | 8 ++++---- 11 files changed, 28 insertions(+), 27 deletions(-) Date: Sun, 24 Aug 2008 23:26:23 +0200 (CEST) From: Stefan Richter firesat: add missing copyright notes Reported by Andreas Monitzer and Christian Dolzer. Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/avc_api.c | 6 ++-- drivers/media/dvb/firesat/avc_api.h | 39 +++++++++-------------- drivers/media/dvb/firesat/cmp.c | 4 +- drivers/media/dvb/firesat/firesat-ci.c | 3 +- drivers/media/dvb/firesat/firesat-rc.c | 11 ++++++ drivers/media/dvb/firesat/firesat.h | 4 +- drivers/media/dvb/firesat/firesat_1394.c | 6 ++-- drivers/media/dvb/firesat/firesat_dvb.c | 4 +- drivers/media/dvb/firesat/firesat_fe.c | 4 +- drivers/media/dvb/firesat/firesat_iso.c | 2 10 files changed, 44 insertions(+), 39 deletions(-) Date: Sun, 24 Aug 2008 15:20:07 +0200 From: Henrik Kurelid firesat: avc resend - Add resending of AVC message to the card if no answer is received - Replace the homebrewed event_wait function with a standard wait queue - Clean up of log/error messages - Increase debug level of avc communication Signed-off-by: Henrik Kurelid Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/avc_api.c | 171 ++++++++++++----------- drivers/media/dvb/firesat/firesat.h | 1 + drivers/media/dvb/firesat/firesat_1394.c | 1 + 3 files changed, 94 insertions(+), 79 deletions(-) Date: Fri, 1 Aug 2008 10:00:45 +0200 (CEST) From: Henrik Kurelid firesat: update isochronous interface, add CI support I have finally managed to get the CI support for the card working. The implementation is a bare minimum to get encrypted channels to work in kaffeine. It works fine with my T/CI card. Now and then I get an AVC timeout and have to retune a channel in order to get it to work. Once the CAM seemed to hang so I needed to remove and insert it again. I.e. there are a number of glitches. The latest version contains the following changes: - Implemented the new hpsb iso interface so that data can be received from the card - Reduced some timers for demux setup which caused scanning to timeout - Added possibility to unload driver - Added support for getting C/N ratio - Added two debug parameters to the driver; ca_debug and avc_comm_debug. - Added CI support that works for me in kaffeine - Started working on CI MMI support. It now supports: o Enter menu o Receiving MMI objects - Added support for 64-bit platforms - Corrected DVB-C modulations problems Signed-off-by: Henrik Kurelid Signed-off-by: Stefan Richter (rebased, whitespace) --- drivers/media/dvb/firesat/Makefile | 1 + drivers/media/dvb/firesat/avc_api.c | 768 +++++++++++++++++++---- drivers/media/dvb/firesat/avc_api.h | 296 ++++++--- drivers/media/dvb/firesat/cmp.c | 44 + drivers/media/dvb/firesat/firesat-ci.c | 342 +++++++++- drivers/media/dvb/firesat/firesat.h | 174 +++++ drivers/media/dvb/firesat/firesat_1394.c | 123 ---- drivers/media/dvb/firesat/firesat_dvb.c | 49 + drivers/media/dvb/firesat/firesat_fe.c | 80 +- drivers/media/dvb/firesat/firesat_iso.c | 106 +++ 10 files changed, 1488 insertions(+), 495 deletions(-) Date: Sat, 09 Aug 2008 14:35:55 +0200 From: Ben Backx firesat: add DVB-S support for DVB-S2 devices ...so S2 owners now can at least watch DVB-S channels in linux. Signed-off-by: Ben Backx Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/avc_api.c | 6 ++++++ 1 file changed, 6 insertions(+) Date: Sun, 22 Jun 2008 16:00:53 +0200 From: Ben Backx firesat: fix DVB-S2 device recognition This only makes sure that a DVB-S2 device is really recognized as a S2, nothing else is added yet. It's using the string containing the model that is stored in the configuration ROM, the older version was using some hardware revision dependent part of the ROM. Signed-off-by: Ben Backx Signed-off-by: Stefan Richter --- drivers/media/dvb/firesat/avc_api.c | 17 +------------- drivers/media/dvb/firesat/firesat.h | 3 +- drivers/media/dvb/firesat/firesat_1394.c | 28 +++++++++++++++++++++++ 3 files changed, 31 insertions(+), 17 deletions(-) Date: Thu, 6 Mar 2008 21:30:23 -0800 From: Greg Kroah-Hartman DVB: add firesat driver Original code written by Christian Dolzer Cleaned up by Greg. Major cleanup and reorg by Manu Abraham Additions also by Ben Backx Cc: Christian Dolzer Cc: Andreas Monitzer Cc: Manu Abraham Cc: Fabio De Lorenzo Cc: Robert Berger Signed-off-by: Ben Backx Signed-off-by: Greg Kroah-Hartman Signed-off-by: Stefan Richter (tweaked dvb/Makefile) --- drivers/media/dvb/Kconfig | 2 + drivers/media/dvb/Makefile | 2 + drivers/media/dvb/firesat/Kconfig | 11 + drivers/media/dvb/firesat/Makefile | 12 + drivers/media/dvb/firesat/avc_api.c | 848 +++++++++++++++++++++++ drivers/media/dvb/firesat/avc_api.h | 381 ++++++++++ drivers/media/dvb/firesat/cmp.c | 230 ++++++ drivers/media/dvb/firesat/cmp.h | 9 + drivers/media/dvb/firesat/firesat-ci.c | 95 +++ drivers/media/dvb/firesat/firesat-ci.h | 9 + drivers/media/dvb/firesat/firesat-rc.c | 84 ++ drivers/media/dvb/firesat/firesat-rc.h | 9 + drivers/media/dvb/firesat/firesat.h | 85 ++ drivers/media/dvb/firesat/firesat_1394.c | 468 +++++++++++++ drivers/media/dvb/firesat/firesat_dvb.c | 350 +++++++++ drivers/media/dvb/firesat/firesat_fe.c | 263 +++++++ 16 files changed, 2858 insertions(+) Date: Sat, 13 Dec 2008 01:43:59 +0100 (CET) From: Stefan Richter ieee1394: add quirk fix for Freecom HDD According to http://bugzilla.kernel.org/show_bug.cgi?id=12206, Freecom FireWire Hard Drive 1TB reports max_rom=2 but returns garbage if block read requests are used to read the config ROM. Force max_rom=0 to limit them to quadlet read requests. Reported-by: Christian Mueller Signed-off-by: Stefan Richter --- drivers/ieee1394/nodemgr.c | 6 ++++++ 1 file changed, 6 insertions(+) Date: Fri, 12 Dec 2008 21:57:50 -0800 From: Harvey Harrison ieee1394: consolidate uses of IEEE1934_BUSID_MAGIC Move the definition out of nodemgr.h and use it in csr.c/pcilynx.c Signed-off-by: Harvey Harrison Signed-off-by: Stefan Richter --- drivers/ieee1394/csr.c | 4 ++-- drivers/ieee1394/ieee1394.h | 3 +++ drivers/ieee1394/nodemgr.h | 3 --- drivers/ieee1394/pcilynx.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) Date: Wed, 10 Dec 2008 00:20:38 +0100 (CET) From: Stefan Richter firewire: fw-ohci: fix IOMMU resource exhaustion There is a DMA map/ unmap imbalance whenever a block write request packet is sent and then dequeued with ohci_cancel_packet. The latter may happen frequently if the AR resp tasklet is executed before the AT req tasklet for the same transaction. Add the missing dma_unmap_single. This fixes https://bugzilla.redhat.com/show_bug.cgi?id=475156 Reported-by: Emmanuel Kowalski Tested-by: Emmanuel Kowalski Signed-off-by: Stefan Richter --- drivers/firewire/fw-ohci.c | 11 +++++++---- drivers/firewire/fw-transaction.c | 3 +++ drivers/firewire/fw-transaction.h | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-) Date: Tue, 09 Dec 2008 22:40:20 +1100 From: Nigel Cunningham ieee1394: node manager causes up to ~3.25s delay in freezing tasks The firewire nodemanager function "nodemgr_host_thread" contains a loop that calls try_to_freeze near the top of the loop, but then delays for up to 3.25 seconds (plus time to do work) before getting back to the top of the loop. When starting a cycle post-boot, this doesn't seem to bite, but it is causing a noticeable delay at boot time, when freezing processes prior to starting to read the image. The following patch adds invocation of try_to_freeze to the subloops that are used in the body of this function. With these additions, the time to freeze when starting to resume at boot time is virtually zero. I'm no expert on firewire, and so don't know that we shouldn't check the return value and jump back to the top of the loop or such like after being frozen, but I submit it for your consideration. Signed-off-by: Nigel Cunningham The delay until nodemgr freezes was up to 0.25s (plus time for node probes) in Linux 2.6.27 and older and up to 3.25s (plus ~) since Linux 2.6.28-rc1, hence much more noticeable. try_to_freeze() without any jump is correct. The surrounding code in the respective loops will catch whether another bus reset happens during the freeze and handle it. Signed-off-by: Stefan Richter --- drivers/ieee1394/nodemgr.c | 2 ++ 1 file changed, 2 insertions(+) Date: Sat, 6 Dec 2008 17:35:59 +0100 (CET) From: Stefan Richter ieee1394: ohci1394: flush MMIO writes before delay in initialization and replace busy-wait by msleep. Signed-off-by: Stefan Richter --- drivers/ieee1394/ohci1394.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) Date: Sat, 6 Dec 2008 17:35:20 +0100 (CET) From: Stefan Richter ieee1394: ohci1394: pass error codes from request_irq through Signed-off-by: Stefan Richter --- drivers/ieee1394/ohci1394.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) Date: Sat, 6 Dec 2008 15:36:47 +0100 From: Frans Pop ieee1394: ohci1394: don't leave interrupts enabled during suspend/resume On my HP 2510p I get the following in dmesg during near the end of most resumes from suspend to RAM: irq 19: nobody cared (try booting with the "irqpoll" option) Pid: 0, comm: swapper Not tainted 2.6.28-rc7 #67 Call Trace: [] ? ohci_irq_handler+0x60/0x7e9 [ohci1394] [] __report_bad_irq+0x38/0x87 [] note_interrupt+0x10e/0x174 [] handle_fasteoi_irq+0xa7/0xd1 [] do_IRQ+0x73/0xe4 [] ret_from_intr+0x0/0xa [] ? acpi_idle_enter_bm+0x26b/0x2b2 [processor] [] ? acpi_idle_enter_bm+0x261/0x2b2 [processor] [] ? notifier_call_chain+0x33/0x5b [] ? cpuidle_idle_call+0x8c/0xc4 [] ? cpu_idle+0x4a/0x9a [] ? rest_init+0x5c/0x5e handlers: [] (ohci_irq_handler+0x0/0x7e9 [ohci1394]) Disabling IRQ #19 There also seems to be an interrupt storm during suspend/resume when this happens: 19: 99968 33 IO-APIC-fasteoi ohci1394 This patch gets rid of both issues and makes the resume as a whole significantly faster. Signed-off-by: Frans Pop As was pointed out in http://lkml.org/lkml/2008/12/6/127, this does not fix the cause of the interrupt storm. However, since the source of the interrupts could not be determined yet, we make the system at least more usable with this change. Signed-off-by: Stefan Richter --- drivers/ieee1394/ohci1394.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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: Sat, 29 Nov 2008 19:00:56 +0100 (CET) From: Stefan Richter firewire: reorder struct fw_card for better cache efficiency topology_map is by far the largest member in struct fw_card. Move it to the very end of the struct so that card pointer dereferences have better chances to hit the CPU cache. This requires to increase the topology_map backing store to the size specified in IEEE 1394, i.e. 256 rather than 255 quadlets. Otherwise the topology_map response handler may access invalid memory. Signed-off-by: Stefan Richter --- drivers/firewire/fw-transaction.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) Date: Sat, 29 Nov 2008 18:56:47 +0100 (CET) From: Stefan Richter firewire: fix resetting of bus manager retry counter An earlier change, maybe long ago, removed the copying of self_id_count into card->self_id_count. Since then each bus reset cleared card->bm_retries even when it shouldn't. Signed-off-by: Stefan Richter --- drivers/firewire/fw-topology.c | 14 ++++++-------- drivers/firewire/fw-transaction.h | 1 - 2 files changed, 6 insertions(+), 9 deletions(-) Date: Sat, 29 Nov 2008 17:44:57 +0100 (CET) From: Jay Fenlason firewire: improve refcounting of fw_card Take a reference to the card whenever fw_card_bm_work() is scheduled on that card and release it when the work is done. This allows us to remove the cancel_delayed_work_sync() in fw_core_remove_card(). Signed-off-by: Jay Fenlason Signed-off-by: Stefan Richter (patch update) --- drivers/firewire/fw-card.c | 18 +++++++++++++++--- drivers/firewire/fw-device.c | 6 +++--- drivers/firewire/fw-topology.c | 2 +- drivers/firewire/fw-transaction.h | 2 ++ 4 files changed, 21 insertions(+), 7 deletions(-) Date: Wed, 22 Oct 2008 15:59:42 -0400 From: Jay Fenlason firewire: typo in comment Signed-off-by: Jay Fenlason Signed-off-by: Stefan Richter --- drivers/firewire/fw-card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Sat, 29 Nov 2008 14:55:47 +0100 (CET) From: Stefan Richter ieee1394: sbp2: fix race condition in state change An intermediate transition from _RUNNING to _IN_SHUTDOWN could have been missed by the former code. Signed-off-by: Stefan Richter --- drivers/ieee1394/sbp2.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) Date: Wed, 26 Nov 2008 01:35:21 +0100 (CET) From: Stefan Richter ieee1394: mark all hpsb_address_ops instances as const These are never modified. Signed-off-by: Stefan Richter --- drivers/ieee1394/csr.c | 8 ++++---- drivers/ieee1394/eth1394.c | 2 +- drivers/ieee1394/highlevel.c | 7 ++++--- drivers/ieee1394/highlevel.h | 7 ++++--- drivers/ieee1394/raw1394.c | 2 +- drivers/ieee1394/sbp2.c | 4 ++-- 6 files changed, 16 insertions(+), 14 deletions(-) Date: Wed, 26 Nov 2008 01:34:55 +0100 (CET) From: Stefan Richter ieee1394: replace a GFP_ATOMIC by GFP_KERNEL allocation All callers of hpsb_register_addrspace() can sleep. Signed-off-by: Stefan Richter --- drivers/ieee1394/highlevel.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Wed, 26 Nov 2008 01:34:25 +0100 (CET) From: Stefan Richter ieee1394: fix list corruption at module removal If there is more than one FireWire controller present, dummy_zero_addr and dummy_max_addr were added multiple times to different lists, thus corrupting the lists. Fix this by allocating them dynamically per host instead of just once globally. (Perhaps a better address space allocation algorithm could rid us of the two dummy address spaces.) Fixes http://bugzilla.kernel.org/show_bug.cgi?id=10129 . Signed-off-by: Stefan Richter --- drivers/ieee1394/highlevel.c | 25 ++++++++++++------------- drivers/ieee1394/hosts.h | 4 ++++ 2 files changed, 16 insertions(+), 13 deletions(-) Date: Mon, 24 Nov 2008 20:40:00 +0100 (CET) From: Stefan Richter firewire: fix small memory leak at module removal Signed-off-by: Stefan Richter --- drivers/firewire/fw-device.c | 2 +- drivers/firewire/fw-device.h | 2 ++ drivers/firewire/fw-transaction.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) Date: Sat, 22 Nov 2008 12:38:58 +0100 (CET) From: Stefan Richter firewire: fw-sbp2: another iPod mini quirk entry Add another model ID of a broken firmware to prevent early I/O errors by acesses at the end of the disk. Reported at linux1394-user, http://marc.info/?t=122670842900002 Signed-off-by: Stefan Richter --- drivers/firewire/fw-sbp2.c | 5 +++++ 1 file changed, 5 insertions(+) Date: Sat, 22 Nov 2008 12:38:24 +0100 (CET) From: Stefan Richter ieee1394: sbp2: another iPod mini quirk entry Add another model ID of a broken firmware to prevent early I/O errors by acesses at the end of the disk. Reported at linux1394-user, http://marc.info/?t=122670842900002 Signed-off-by: Stefan Richter --- drivers/ieee1394/sbp2.c | 5 +++++ 1 file changed, 5 insertions(+) Date: Thu, 30 Oct 2008 01:49:20 +0100 From: Kay Sievers ieee1394: struct device - replace bus_id with dev_name(), dev_set_name() Acked-by: Greg Kroah-Hartman Signed-off-by: Kay Sievers Signed-off-by: Stefan Richter --- drivers/ieee1394/hosts.c | 4 ++-- drivers/ieee1394/nodemgr.c | 14 +++++--------- 2 files changed, 7 insertions(+), 11 deletions(-) Date: Thu, 30 Oct 2008 01:41:56 +0100 From: Kay Sievers firewire: struct device - replace bus_id with dev_name(), dev_set_name() Acked-by: Greg Kroah-Hartman Signed-off-by: Kay Sievers Signed-off-by: Stefan Richter --- drivers/firewire/fw-device.c | 14 ++++++-------- drivers/firewire/fw-ohci.c | 2 +- drivers/firewire/fw-sbp2.c | 2 +- 3 files changed, 8 insertions(+), 10 deletions(-) Date: Sun, 26 Oct 2008 11:04:20 +0100 (CET) From: Stefan Richter firewire: fw-sbp2: remove unnecessary locking What was I thinking when I added sbp2_set_generation()? Its locking did nothing (except for implicitly providing the necessary barrier between node IDs update and generation update). Signed-off-by: Stefan Richter --- drivers/firewire/fw-sbp2.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) Date: Sun, 26 Oct 2008 12:02:03 +0100 (CET) From: Stefan Richter ieee1394: dv1394: fix possible deadlock in multithreaded clients Fix a possible though highly unlikely deadlock: Thread A: Thread B: - acquire mmap_sem - dv1394_ioctl/read/write() - dv1394_mmap() - acquire video->mtx - acquire video->mtx - copy_to/from_user(), possible page fault: acquire mmap_sem The simplest fix is to use mutex_trylock() instead of mutex_lock() in dv1394_mmap(). This changes the behavior under contention in a way which is visible to userspace clients. However, my guess is that no clients exist which use mmap vs. ioctl/read/write on the dv1394 character device file interface in concurrent threads. Reported-by: Johannes Weiner Signed-off-by: Stefan Richter --- drivers/ieee1394/dv1394.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) Date: Sun, 26 Oct 2008 12:03:37 +0100 (CET) From: Stefan Richter ieee1394: raw1394: fix possible deadlock in multithreaded clients Regression in 2.6.28-rc1: When I added the new state_mutex which prevents corruption of raw1394's internal state when accessed by multithreaded client applications, the following possible though highly unlikely deadlock slipped in: Thread A: Thread B: - acquire mmap_sem - raw1394_write() or raw1394_ioctl() - raw1394_mmap() - acquire state_mutex - acquire state_mutex - copy_to/from_user(), possible page fault: acquire mmap_sem The simplest fix is to use mutex_trylock() instead of mutex_lock() in raw1394_mmap(). This changes the behavior under contention in a way which is visible to userspace clients. However, since multithreaded access was entirely buggy before state_mutex was added and libraw1394's documentation advised application programmers to use a handle only in a single thread, this change in behaviour should not be an issue in practice at all. Since we have to use mutex_trylock() in raw1394_mmap() regardless whether /dev/raw1394 was opened with O_NONBLOCK or not, we now use mutex_trylock() unconditionally everywhere for state_mutex, just to have consistent behavior. Reported-by: Johannes Weiner Signed-off-by: Stefan Richter --- drivers/ieee1394/raw1394.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) Date: Fri, 24 Oct 2008 15:26:20 -0400 From: Jay Fenlason firewire: fw-sbp2: fix races 1: There is a small race between queue_delayed_work() and its corresponding kref_get(). Do the kref_get first, and _put it again if the queue_delayed_work() failed, so there is no chance of the kref going to zero while the work is scheduled. 2: An SBP2_LOGOUT_REQUEST could be sent out with a login_id full of garbage. Initialize it to an invalid value so we can tell if we ever got a valid login_id. 3: The node ID and generation may have changed but the new values may not yet have been recorded in lu and tgt when the final logout is attempted. Use the latest values from the device in sbp2_release_target(). Signed-off-by: Jay Fenlason Signed-off-by: Stefan Richter --- drivers/firewire/fw-sbp2.c | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) Date: Wed, 22 Oct 2008 00:28:36 +0200 (CEST) From: Stefan Richter firewire: fw-sbp2: delay first login to avoid retries This optimizes firewire-sbp2's device probe for the case that the local node and the SBP-2 node were discovered at the same time. In this case, fw-core's bus management work and fw-sbp2's login and SCSI probe work are scheduled in parallel (in the globally shared workqueue and in fw-sbp2's workqueue, respectively). The bus reset from fw-core may then disturb and extremely delay the login and SCSI probe because the latter fails with several command timeouts and retries and has to be retried from scratch. We avoid this particular situation of sbp2_login() and fw_card_bm_work() running in parallel by delaying the first sbp2_login() a little bit. This is meant to be a short-term fix for https://bugzilla.redhat.com/show_bug.cgi?id=466679. In the long run, the SCSI probe, i.e. fw-sbp2's call of __scsi_add_device(), should be parallelized with sbp2_reconnect(). Problem reported and fix tested and confirmed by Alex Kanavin. Signed-off-by: Stefan Richter --- drivers/firewire/fw-sbp2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Sun, 26 Oct 2008 09:50:31 +0100 (CET) From: Stefan Richter firewire: fw-ohci: initialization failure path fixes Fix leaks when pci_probe fails. Simplify error log strings. Signed-off-by: Stefan Richter --- drivers/firewire/fw-ohci.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) Date: Wed, 22 Oct 2008 15:59:42 -0400 From: Jay Fenlason firewire: fw-ohci: don't leak dma memory on module removal The transmit and receive context dma memory was not being freed on module removal. Neither was the config rom memory. Fix that. The ab->next assignment is pure paranoia. Signed-off-by: Jay Fenlason Signed-off-by: Stefan Richter --- drivers/firewire/fw-ohci.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) Date: Thu, 16 Oct 2008 18:00:15 -0400 From: Jay Fenlason firewire: fix struct fw_node memory leak With the bus_resets patch applied, it is easy to see this memory leak by repeatedly resetting the firewire bus while running slabtop in another window. Just watch kmalloc-32 grow and grow... Signed-off-by: Jay Fenlason Signed-off-by: Stefan Richter --- drivers/firewire/fw-topology.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) Date: Thu, 16 Oct 2008 15:51:59 -0400 From: Jay Fenlason firewire: Survive more than 256 bus resets The "color" is used during the topology building after a bus reset, hovever in "struct fw_node"s it is stored in a u8, but in struct fw_card it is stored in an int. When the value wraps in one struct, but not the other, disaster strikes. Signed-off-by: Jay Fenlason Fixes http://bugzilla.kernel.org/show_bug.cgi?id=10922. Signed-off-by: Stefan Richter --- drivers/firewire/fw-transaction.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Wed, 15 Oct 2008 00:10:53 +0200 (CEST) From: Stefan Richter firewire: fw-sbp2: extend failure check after SCSI probe https://bugzilla.redhat.com/show_bug.cgi?id=466679 indicates that the SCSI stack's probe may fail (with the sdev offlined) even if no 1394 bus generation update happened. It's cheap to check for offline status, hence add this check to initiate a logout/ login/ SCSI probe retry. Signed-off-by: Stefan Richter --- drivers/firewire/fw-sbp2.c | 3 ++- 1 file changed, 2 insertions(+), 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: Wed, 1 Oct 2008 18:13:20 -0400 From: Jay Fenlason firewire: Add more documentation to firewire-cdev.h Signed-off-by: Jay Fenlason Signed-off-by: Stefan Richter --- include/linux/firewire-cdev.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) Date: Fri, 12 Sep 2008 18:20:16 +0200 (CEST) From: Stefan Richter firewire: fix ioctl() return code Reported by Jay Fenlason: ioctl() did not return as intended - the size of data read into ioctl_send_request, - the number of datagrams enqueued by ioctl_queue_iso. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Fri, 12 Sep 2008 18:09:55 +0200 (CEST) From: Stefan Richter firewire: fix setting tag and sy in iso transmission Reported by Jay Fenlason: The iso packet control accessors in fw-cdev.c had bogus masks. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Date: Thu, 11 Sep 2008 19:22:53 +0200 (CEST) From: Stefan Richter ieee1394: dv1394, video1394: remove unnecessary expressions init->channel and v.buffer are unsigned and tests for < 0 therefore always false. gcc knows this and eliminates the code, but anyway... Reported by Roel Kluin. Signed-off-by: Stefan Richter --- drivers/ieee1394/dv1394.c | 2 +- drivers/ieee1394/video1394.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) Date: Tue, 19 Aug 2008 21:30:17 +0200 (CEST) From: Stefan Richter ieee1394: survive a few seconds connection loss There are situations when nodes vanish from the bus and come back in quickly thereafter: - When certain bus-powered hubs are plugged in, - when certain disk enclosures are switched from self-power to bus power or vice versa and break the daisy chain during the transition, - when the user plugs a cable out and quickly plugs it back in, e.g. to reorder a daisy chain (works on Mac OS X if done quickly enough), - when certain hubs temporarily malfunction during high bus traffic. The ieee1394 driver's nodemgr already contained a function to set vanished nodes aside into "limbo"; i.e. they wouldn't actually be deleted right away. (In fact, only unloading the driver or writing into an obscure sysfs attribute would delete them eventually.) If nodes reappeared later, they would be resurrected out of limbo. Moving nodes into and out of limbo was accompanied with calling the .suspend() and .resume() driver methods of the drivers which were bound to a respective node's unit directories. Not only is this somewhat strange due to the intended use of these driver methods for power management, also the sbp2 driver in particular does not implement .suspend() and .resume(). Hence sbp2 would be disconnected from devices in situations as listed above. We now: - leave drivers bound when nodes go into limbo, - call the drivers' .update() when nodes come out of limbo, - automatically delete in-limbo nodes 3 seconds after the last bus reset and bus rescan. - Because of the automatic removal, the now obsolete bus attribute /sys/bus/ieee1394/destroy_node is removed. This especially lets sbp2 survive brief disconnections. You can for example yank a disk's cable and plug it back in while reading the respective disk with dd, but dd will happily continue as if nothing happened. Signed-off-by: Stefan Richter --- drivers/ieee1394/nodemgr.c | 147 +++++++++++++------------------------ drivers/ieee1394/nodemgr.h | 2 2 files changed, 51 insertions(+), 98 deletions(-) Date: Tue, 19 Aug 2008 21:29:23 +0200 (CEST) From: Stefan Richter ieee1394: nodemgr clean up class iterators Remove useless pointer type casts. Remove unnecessary hi->host indirection where only host is used. Remove an unnecessary WARN_ON. Change a few names. Signed-off-by: Stefan Richter --- drivers/ieee1394/nodemgr.c | 172 +++++++++++++++++-------------------- 1 file changed, 81 insertions(+), 91 deletions(-) Date: Sat, 16 Aug 2008 21:52:28 +0200 (CEST) From: Stefan Richter firewire: Kconfig help update Signed-off-by: Stefan Richter --- drivers/firewire/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Date: Sat, 16 Aug 2008 00:15:16 +0200 (CEST) From: Stefan Richter ieee1394: raw1394: make write() thread-safe Application programs should use a libraw1394 handle only in a single thread. The raw1394 driver was apparently relying on this, because it did nothing to protect its fi->state variable from corruption due to concurrent accesses. We now serialize the fi->state accesses. This affects the write() path. We re-use the state_mutex which was introduced to protect fi->iso_state accesses in the ioctl() path. These paths and accesses are independent of each other, hence separate mutexes could be used. But I don't see much benefit in that. Signed-off-by: Stefan Richter --- drivers/ieee1394/raw1394.c | 4 ++++ 1 file changed, 4 insertions(+) Date: Sat, 16 Aug 2008 17:52:04 +0200 (CEST) From: Stefan Richter ieee1394: raw1394: narrow down the state_mutex protected region Refactor the ioctl dispatcher in order to move a fraction of it out of the section which is serialized by fi->state_mutex. This is not so much about performance but more about self-documentation: The mutex_lock()/ mutex_unlock() calls are now closer to the data accesses which the mutex protects, i.e. to the iso_state switch. Signed-off-by: Stefan Richter --- drivers/ieee1394/raw1394.c | 211 +++++++++++++++++++------------------ 1 file changed, 110 insertions(+), 101 deletions(-) Date: Sat, 16 Aug 2008 00:11:48 +0200 (CEST) From: Stefan Richter ieee1394: raw1394: replace BKL by local mutex, make ioctl() and mmap() thread-safe This removes the last usage of the Big Kernel Lock from the ieee1394 stack, i.e. from raw1394's (unlocked_)ioctl and compat_ioctl. The ioctl()s don't need to take the BKL, but they need to be serialized per struct file *. In particular, accesses to ->iso_state need to be serial. We simply use a blocking mutex for this purpose because libraw1394 does not use O_NONBLOCK. In practice, there is no lock contention anyway because most if not all libraw1394 clients use a libraw1394 handle only in a single thread. mmap() also accesses ->iso_state. Until now this was unprotected against concurrent changes by ioctls. Fix this bug while we are at it. Signed-off-by: Stefan Richter --- drivers/ieee1394/raw1394-private.h | 1 + drivers/ieee1394/raw1394.c | 23 +++++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) Date: Sat, 9 Aug 2008 20:22:17 +0200 (CEST) From: Stefan Richter firewire: fw-sbp2: fix another small generation access bug queuecommand() looked at the remote and local node IDs before it read the bus generation. The corresponding race with sbp2_reconnect updating these data was probably impossible to happen though because the current code blocks the SCSI layer during reconnection. However, better safe than sorry, especially if someone later improves the code to not block the SCSI layer. Signed-off-by: Stefan Richter --- drivers/firewire/fw-sbp2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) Date: Thu, 14 Aug 2008 21:47:21 +0200 (CEST) From: Stefan Richter firewire: fw-sbp2: enforce s/g segment size limit 1. We don't need to round the SBP-2 segment size limit down to a multiple of 4 kB (0xffff -> 0xf000). It is only necessary to ensure quadlet alignment (0xffff -> 0xfffc). 2. Use dma_set_max_seg_size() to tell the DMA mapping infrastructure and the block IO layer about the restriction. This way we can remove the size checks and segment splitting in the queuecommand path. This assumes that no other code in the firewire stack uses dma_map_sg() with conflicting requirements. It furthermore assumes that the controller device's platform actually allows us to set the segment size to our liking. Assert the latter with a BUG_ON(). 3. Also use blk_queue_max_segment_size() to tell the block IO layer about it. It cannot know it because our scsi_add_host() does not point to the FireWire controller's device. Thanks to Grant Grundler and FUJITA Tomonori for advice. Signed-off-by: Stefan Richter --- drivers/firewire/fw-sbp2.c | 63 ++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 36 deletions(-) Date: Thu, 14 Aug 2008 09:28:14 +0200 (CEST) From: Stefan Richter ieee1394: sbp2: enforce s/g segment size limit 1. We don't need to round the SBP-2 segment size limit down to a multiple of 4 kB (0xffff -> 0xf000). It is only necessary to ensure quadlet alignment (0xffff -> 0xfffc). 2. Use dma_set_max_seg_size() to tell the DMA mapping infrastructure and the block IO layer about the restriction. This way we can remove the size checks and segment splitting in the queuecommand path. This assumes that no other code in the ieee1394 stack uses dma_map_sg() with conflicting requirements. It furthermore assumes that the controller device's platform actually allows us to set the segment size to our liking. Assert the latter with a BUG_ON(). 3. Also use blk_queue_max_segment_size() to tell the block IO layer about it. It cannot know it because our scsi_add_host() does not point to the FireWire controller's device. We can also uniformly use dma_map_sg() for the single segment case just like for the multi segment case, to further simplify the code. Also clean up how the page table is converted to big endian. Thanks to Grant Grundler and FUJITA Tomonori for advice. Signed-off-by: Stefan Richter --- drivers/ieee1394/sbp2.c | 98 +++++++++++----------------------------- drivers/ieee1394/sbp2.h | 33 ++++--------- 2 files changed, 39 insertions(+), 92 deletions(-) Date: Sat, 9 Aug 2008 20:16:24 +0200 (CEST) From: Stefan Richter ieee1394: sbp2: check for DMA mapping failures Signed-off-by: Stefan Richter --- drivers/ieee1394/sbp2.c | 94 +++++++++++++++++++++++++--------------- 1 file changed, 59 insertions(+), 35 deletions(-) Date: Sat, 9 Aug 2008 20:13:00 +0200 (CEST) From: Stefan Richter ieee1394: sbp2: stricter dma_sync Two dma_sync_single_for_cpu() were called in the wrong place. Luckily they were merely for DMA_TO_DEVICE, hence nobody noticed. Also reorder the matching dma_sync_single_for_device() a little bit so that they reside in the same functions as their counterparts. This also avoids syncing the s/g table for requests which don't use it. Signed-off-by: Stefan Richter --- drivers/ieee1394/sbp2.c | 50 +++++++++++++--------------------------- 1 file changed, 16 insertions(+), 34 deletions(-) Date: Mon, 24 Mar 2008 20:56:40 +0100 (CET) From: Stefan Richter firewire: unnecessary BM delay after generation rollover Noticed by Jarod Wilson: The bus manager work was unnecessarily delayed each time the bus generation counter rolled over. Signed-off-by: Stefan Richter Signed-off-by: Jarod Wilson --- drivers/firewire/fw-card.c | 2 +- drivers/firewire/fw-topology.c | 2 +- drivers/firewire/fw-transaction.h | 9 +++++++++ 3 files changed, 11 insertions(+), 2 deletions(-) Date: Wed, 19 Mar 2008 22:02:40 +0100 (CET) From: Stefan Richter firewire: insist on successive self ID complete events The whole topology code only works if the old and new topologies which are compared come from immediately successive self ID complete events. If there happened bus resets without self ID complete events in the meantime, or self ID complete events with invalid selfIDs, the topology comparison could identify nodes wrongly, or more likely just corrupt kernel memory or panic right away. We now discard all nodes of the old topology and treat all current nodes as new ones if the current self ID generation is not the previous one plus 1. Signed-off-by: Stefan Richter Signed-off-by: Jarod Wilson --- drivers/firewire/fw-topology.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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(-) Date: Sun, 20 Jul 2008 14:20:53 +0200 From: Jay Fenlason firewire: fw_send_request_sync() Share code between fw_send_request + wait_for_completion callers. Signed-off-by: Jay Fenlason Addendum: Removes an unnecessary struct and an ununsed retry loop. Calls it fw_run_transaction() instead of fw_send_request_sync(). Signed-off-by: Stefan Richter Acked-by: Kristian Høgsberg --- drivers/firewire/fw-card.c | 56 +++++++---------------------- drivers/firewire/fw-device.c | 37 +++----------------- drivers/firewire/fw-sbp2.c | 46 +++++++------------------ drivers/firewire/fw-transaction.c | 48 ++++++++++++++++++++++++-- drivers/firewire/fw-transaction.h | 9 +++-- 5 files changed, 82 insertions(+), 114 deletions(-) Date: Sat, 2 Aug 2008 17:13:09 +0200 (CEST) From: Julia Lawall ieee1394: Use DIV_ROUND_UP Signed-off-by: Julia Lawall Signed-off-by: Stefan Richter --- drivers/ieee1394/csr1212.c | 2 +- drivers/ieee1394/eth1394.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) Date: Tue, 29 Jul 2008 23:46:25 -0700 From: David Moore firewire: Preserve response data alignment bug when it is harmless Recently, a bug having to do with the alignment of transaction response data was fixed. However, some apps such as libdc1394 relied on the presence of that bug in order to function correctly. In order to stay compatible with old versions of those apps, this patch preserves the bug in cases where it is harmless to normal operation (such as the single quadlet read) due to a simple duplication of data. This guarantees maximum compatability for those users who are using the old app with the fixed kernel. Signed-off-by: David Moore Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) Date: Fri, 25 Jul 2008 16:24:19 +0200 (CEST) From: Stefan Richter firewire: state userland requirements in Kconfig help Signed-off-by: Stefan Richter --- drivers/firewire/Kconfig | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) Date: Tue, 22 Jul 2008 21:35:47 +0200 (CEST) From: Stefan Richter firewire: avoid memleak after phy config transmit failure Use only statically allocated data for PHY config packet transmission. With the previous incarnation, some data wouldn't be freed if the packet transmit callback was never called. A theoretical drawback now is that, in PCs with more than one card, card A may complete() for a waiter on card B. But this is highly unlikely and its impact not serious. Bus manager B may reset bus B before the PHY config went out, but the next phy config on B should be fine. However, with a timeout of 100ms, this situation is close to impossible. Signed-off-by: Stefan Richter --- drivers/firewire/fw-transaction.c | 56 +++++++++++------------------- 1 file changed, 20 insertions(+), 36 deletions(-) Date: Tue, 22 Jul 2008 18:41:10 +0200 (CEST) From: Stefan Richter firewire: fw-ohci: TSB43AB22/A dualbuffer workaround Isochronous reception in dualbuffer mode is reportedly broken with TI TSB43AB22A on x86-64. Descriptor addresses above 2G have been determined as the trigger: https://bugzilla.redhat.com/show_bug.cgi?id=435550 Two fixes are possible: - pci_set_consistent_dma_mask(pdev, DMA_31BIT_MASK); at least when IR descriptors are allocated, or - simply don't use dualbuffer. This fix implements the latter workaround. But we keep using dualbuffer on x86-32 which won't give us highmen (and thus physical addresses outside the 31bit range) in coherent DMA memory allocations. Right now we could for example also whitelist PPC32, but DMA mapping implementation details are expected to change there. Signed-off-by: Stefan Richter Signed-off-by: Jarod Wilson --- drivers/firewire/fw-ohci.c | 37 ++++++++++++++++++++++++------------- include/linux/pci_ids.h | 1 + 2 files changed, 25 insertions(+), 13 deletions(-) Date: Sat, 19 Jul 2008 15:35:41 +0800 From: JiSheng Zhang firewire: queue the right number of data There will be 4 padding bytes in struct fw_cdev_event_response on some platforms The member:__u32 data will point to these padding bytes. While queue the response and data in complete_transaction in fw-cdev.c, it will queue like this: |response(excluding padding bytes)|4 padding bytes|4 padding bytes|data. It queue 4 extra bytes. That is to say it use "&response + sizeof(response)" while other place of kernel and userspace library use "&response + offsetof (typeof(response), data)". So it will lost the last 4 bytes of data. This patch can fix it while not changing the struct definition. Signed-off-by: JiSheng Zhang This fixes responses to outbound block read requests on 64bit architectures. Tested on i686, x86-64, and x86-64 with i686 userland, using firecontrol and gscanbus. Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) Date: Sat, 12 Jul 2008 14:51:18 +0200 (CEST) From: Stefan Richter firewire: warn on unfinished transactions during card removal After card->done and card->work are completed, any remaining pending request would be a bug. We cannot safely complete a transaction at that point anymore. IOW card users must not drop their last fw_card reference (usually indirect references through fw_device references) before their last outbound transaction through that card was finished. Signed-off-by: Stefan Richter --- drivers/firewire/fw-card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Sat, 12 Jul 2008 14:50:42 +0200 (CEST) From: Stefan Richter firewire: small fw_fill_request cleanup - better name for a function argument - removal of a local variable which became unnecessary after "fully initialize fw_transaction before marking it pending" Signed-off-by: Stefan Richter --- drivers/firewire/fw-transaction.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) Date: Sat, 12 Jul 2008 14:50:06 +0200 (CEST) From: Stefan Richter firewire: fully initialize fw_transaction before marking it pending In theory, card->flush_timer could already access a transaction between fw_send_request()'s spin_unlock_irqrestore and the rest of what happens in fw_send_request(). This would happen if the process which sends the request is preempted and put to sleep right after spin_unlock_irqrestore for longer than 100ms. Therefore we fill in everything in struct fw_transaction at which the flush_timer might look at before we lift the lock. To do: Ensure that the timer does not pick up the transaction before the time of the AT request event plus split transaction timeout. Signed-off-by: Stefan Richter --- drivers/firewire/fw-transaction.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) Date: Sat, 12 Jul 2008 14:49:19 +0200 (CEST) From: Stefan Richter firewire: fix race of bus reset with request transmission Reported by Jay Fenlason: A bus reset tasklet may call fw_flush_transactions and touch transactions (call their callback which will free them) while the context which submitted the transaction is still inserting it into the transmission queue. A simple solution to this problem is to _not_ "flush" the transactions because of a bus reset (complete the transcations as 'cancelled'). They will now simply time out (completed as 'cancelled' by the split-timeout timer). Jay Fenlason thought of this fix too but I was quicker to type it out. :-) Background: Contexts which access an instance of struct fw_transaction are: 1. the submitter, until it inserted the packet which is embedded in the transaction into the AT req DMA, 2. the AsReqTrContext tasklet when the request packet was acked by the responder node or transmission to the responder failed, 3. the AsRspRcvContext tasklet when it found a request which matched an incoming response, 4. the card->flush_timer when it picks up timed-out transactions to cancel them, 5. the bus reset tasklet when it cancels transactions (this access is eliminated by this patch), 6. a process which shuts down an fw_card (unregisters it from fw-core when the controller is unbound from fw-ohci) --- although in this case there shouldn't really be any transactions anymore because we wait until all card users finished their business with the card. All of these contexts run concurrently (except for the 6th, presumably). The 1st is safe against the 2nd and 3rd because of the way how a request packet is carefully submitted to the hardware. A race between 2nd and 3rd has been fixed a while ago (bug 9617). The 4th is almost safe against 1st, 2nd, 3rd; there are issues with it if huge scheduling latencies occur, to be fixed separately. The 5th looks safe against 2nd, 3rd, and 4th but is unsafe against 1st. Maybe this could be fixed with an explicit state variable in struct fw_transaction. But this would require fw_transaction to be rewritten as only dynamically allocatable object with reference counting --- not a good solution if we also can simply kill this 5th accessing context (replace it by the 4th). Signed-off-by: Stefan Richter --- drivers/firewire/fw-topology.c | 2 -- 1 file changed, 2 deletions(-) Date: Sun, 25 May 2008 11:06:55 +0200 (CEST) From: Stefan Richter firewire: don't respond to broadcast write requests Contrary to a comment in the source, request->ack of a broadcast write request can be ACK_PENDING. Hence the existing check is insufficient. Debug dmesg before: AR spd 0 tl 00, ffc0 -> ffff, ack_pending , QW req, fffff0000234 = ffffffff AT spd 0 tl 00, ffff -> ffc0, ack_complete, W resp And the requesting node (linux1394) reports an unsolicited response. Debug dmesg after: AR spd 0 tl 00, ffc0 -> ffff, ack_pending , QW req, fffff0000234 = ffffffff Signed-off-by: Stefan Richter --- drivers/firewire/fw-transaction.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) Date: Sat, 24 May 2008 16:50:22 +0200 (CEST) From: Stefan Richter firewire: clean up fw_card reference counting This is a functionally equivalent replacement of the current reference counting of struct fw_card instances. It only converts it to common idioms as suggested by Kristian Høgsberg: - struct kref replaces atomic_t as the counter. - wait_for_completion is used to wait for all card users to complete. BTW, it may make sense to count card->flush_timer and card->work as card users too. Signed-off-by: Stefan Richter --- drivers/firewire/fw-card.c | 30 ++++++++++++++++++++---------- drivers/firewire/fw-device.c | 5 ++--- drivers/firewire/fw-transaction.h | 20 ++++++++++++++++++-- 3 files changed, 40 insertions(+), 15 deletions(-) Date: Sat, 24 May 2008 16:48:05 +0200 (CEST) From: Stefan Richter firewire: clean up some includes Signed-off-by: Stefan Richter --- drivers/firewire/fw-transaction.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) Date: Sat, 24 May 2008 16:46:10 +0200 (CEST) From: Stefan Richter firewire: remove unused struct members Signed-off-by: Stefan Richter --- drivers/firewire/fw-card.c | 1 - drivers/firewire/fw-device.h | 1 - drivers/firewire/fw-ohci.c | 1 - drivers/firewire/fw-transaction.h | 2 -- 4 files changed, 5 deletions(-) Date: Sat, 24 May 2008 16:41:09 +0200 (CEST) From: Stefan Richter firewire: implement broadcast_channel CSR for 1394a compliance See IEEE 1394a clause 8.3.2.3.11. Signed-off-by: Stefan Richter --- drivers/firewire/fw-card.c | 1 + drivers/firewire/fw-transaction.c | 20 +++++++++++++++++--- drivers/firewire/fw-transaction.h | 4 ++++ 3 files changed, 22 insertions(+), 3 deletions(-) Date: Thu, 3 Jul 2008 18:52:28 +0200 From: Philippe De Muyter ieee1394: dump mmapped iso buffers in core files Currently, core files do not contain the mmapped memory of the video1394 or dv1394 devices, which contain the actual video input, making it impossible to analyse the cause of abnormal program termination for image analysis or (de)compression software. Fix that. Signed-off-by: Philippe De Muyter Also affects users of the rawiso ioctl API of raw1394. Signed-off-by: Stefan Richter --- drivers/ieee1394/dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Date: Fri, 23 May 2008 11:57:41 +0100 From: Alan Cox ieee1394: raw1394: Push the BKL down into the driver ioctls Actually in this case wrap the function for now. Signed-off-by: Alan Cox Added raw1394_compat_ioctl hunk. Signed-off-by: Stefan Richter --- drivers/ieee1394/raw1394.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) Date: Mon, 19 May 2008 22:07:28 +0200 (CEST) From: Stefan Richter ieee1394: video1394: reorder module init, prepare BKL removal This prepares video1394 for removal of the BKL (big kernel lock): It allows video1394_open() to be called while video1394_init_module() is still in progress. Signed-off-by: Stefan Richter --- drivers/ieee1394/highlevel.c | 4 +--- drivers/ieee1394/highlevel.h | 13 ++++++++++++- drivers/ieee1394/video1394.c | 2 ++ 3 files changed, 15 insertions(+), 4 deletions(-) Date: Fri, 2 May 2008 20:14:52 +0200 (CEST) From: Stefan Richter ieee1394: reduce log noise about config ROM CRC errors This avoids redundant messages about a special and usually harmless firmware flaw. Signed-off-by: Stefan Richter --- drivers/ieee1394/csr1212.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) Date: Sun, 11 May 2008 00:37:14 +0200 (CEST) From: Stefan Richter ieee1394: sbp2: spin disks down on suspend and shutdown This instructs sd_mod to send START STOP UNIT on suspend and resume, and on driver unbinding or unloading (including when the system is shut down). We don't do this though if multiple initiators may log in to the target. Signed-off-by: Stefan Richter --- drivers/ieee1394/sbp2.c | 2 ++ 1 file changed, 2 insertions(+) Date: Sun, 11 May 2008 00:36:47 +0200 (CEST) From: Stefan Richter firewire: fw-sbp2: spin disks down on suspend and shutdown This instructs sd_mod to send START STOP UNIT on suspend and resume, and on driver unbinding or unloading (including when the system is shut down). We don't do this though if multiple initiators may log in to the target. Signed-off-by: Stefan Richter Tested-by: Tino Keitel --- drivers/firewire/fw-sbp2.c | 3 +++ 1 file changed, 3 insertions(+) Date: Sun, 11 May 2008 00:35:55 +0200 (CEST) From: Stefan Richter ieee1394: sbp2: fix spindown for PL-3507 and TSB42AA9 firmwares Reported by Tino Keitel: PL-3507 with firmware from Prolific does not spin down the disk on START STOP UNIT with power condition = 0 and start = 0. It does however work with power condition = 2 or 3. Also found while investigating this: DViCO Momobay CX-1 and FX-3A (TI TSB42AA9/A based) become unresponsive after START STOP UNIT with power condition = 0 and start = 0. They stay responsive if power condition is set when stopping the motor. Signed-off-by: Stefan Richter --- drivers/ieee1394/sbp2.c | 20 ++++++++++++++++++-- drivers/ieee1394/sbp2.h | 1 + 2 files changed, 19 insertions(+), 2 deletions(-) Date: Sun, 11 May 2008 00:35:04 +0200 (CEST) From: Stefan Richter firewire: fw-sbp2: fix spindown for PL-3507 and TSB42AA9 firmwares Reported by Tino Keitel: PL-3507 with firmware from Prolific does not spin down the disk on START STOP UNIT with power condition = 0 and start = 0. It does however work with power condition = 2 or 3. Also found while investigating this: DViCO Momobay CX-1 and FX-3A (TI TSB42AA9/A based) become unresponsive after START STOP UNIT with power condition = 0 and start = 0. They stay responsive if power condition is set when stopping the motor. Signed-off-by: Stefan Richter Tested-by: Tino Keitel --- drivers/firewire/fw-sbp2.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) Date: Sun, 11 May 2008 00:34:07 +0200 (CEST) From: Stefan Richter scsi: sd: optionally set power condition in START STOP UNIT Adds a new scsi_device flag, start_stop_pwr_cond: If enabled, the sd driver will not send plain START STOP UNIT commands but ones with the power condition field set to 3 (standby) or 1 (active) respectively. Some FireWire disk firmwares do not stop the motor if power condition is zero. Or worse, they become unresponsive after a START STOP UNIT with power condition = 0 and start = 0. http://lkml.org/lkml/2008/4/29/704 This patch only adds the necessary code to sd_mod but doesn't activate it. Follow-up patches to the FireWire drivers will add detection of affected devices and enable the code for them. I did not add power condition values to scsi_error.c::scsi_eh_try_stu() for now. The three firmwares which suffer from above mentioned problems do not need START STOP UNIT in the error handler, and they are not adversely affected by START STOP UNIT with power condition = 0 and start = 1 (like scsi_eh_try_stu() sends it if scsi_device.allow_restart is enabled). Signed-off-by: Stefan Richter Tested-by: Tino Keitel --- drivers/scsi/sd.c | 5 +++++ include/scsi/scsi_device.h | 1 + 2 files changed, 6 insertions(+) Date: Sat, 16 Aug 2008 13:39:26 +0200 (CEST) From: Stefan Richter ieee1394: sbp2: let nodemgr retry node updates during bus reset series sbp2 was too quick to report .update() to the ieee1394 core as failed. (Logged as "Failed to reconnect to sbp2 device!".) The core would then unbind sbp2 from the device. This is not justified if the .update() failed because another bus reset happened. We check this and tell the ieee1394 that .update() succeeded, and the core will call sbp2's .update() for the new bus reset as well. This improves reconnection/re-login especially on buses with several disks as they may issue bus resets in close succession when they come online. Tested by Damien Benoist. Signed-off-by: Stefan Richter --- drivers/ieee1394/sbp2.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) Date: Sat, 16 Aug 2008 13:38:11 +0200 (CEST) From: Stefan Richter ieee1394: don't drop nodes during bus reset series nodemgr_node_probe checked for generation increments too late and therefore prematurely reported nodes as "suspended". Fixes http://bugzilla.kernel.org/show_bug.cgi?id=11349. Reported and tested by Damien Benoist. Signed-off-by: Stefan Richter --- drivers/ieee1394/nodemgr.c | 40 +++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 19 deletions(-) Date: Sat, 16 Aug 2008 13:36:47 +0200 (CEST) From: Stefan Richter ieee1394: regression in 2.6.25: updates should happen before probes Regression since commit 73cf60232ef16e1f8a64defa97214a1722db1e6c, "ieee1394: use class iteration api": The two loops for (1.) driver updates and (2.) driver probes were replaced by a single loop with bogus needs_probe checks. Hence updates and probes were now intermixed, and especially sbp2 updates (reconnects) held up longer than necessary. While we fix it, change the needs_probe flag to bool type for clarity. Tested by Damien Benoist. Signed-off-by: Stefan Richter --- drivers/ieee1394/nodemgr.c | 28 +++++++++++++++------------- drivers/ieee1394/nodemgr.h | 2 +- 2 files changed, 16 insertions(+), 14 deletions(-)