firefly-linux-kernel-4.4.55.git
17 years agofirewire: Add a comment to describe why we split the sg list.
Kristian Høgsberg, Stefan Richter [Wed, 9 May 2007 23:23:10 +0000 (19:23 -0400)]
firewire: Add a comment to describe why we split the sg list.

Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Return SCSI_MLQUEUE_HOST_BUSY for out of memory cases in queuecommand.
Kristian Høgsberg [Wed, 9 May 2007 23:23:09 +0000 (19:23 -0400)]
firewire: Return SCSI_MLQUEUE_HOST_BUSY for out of memory cases in queuecommand.

Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Handle the last few DMA mapping error cases.
Kristian Høgsberg [Wed, 9 May 2007 23:23:08 +0000 (19:23 -0400)]
firewire: Handle the last few DMA mapping error cases.

This should be the last missing checks.

Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Allocate scsi_host up front and allocate the sbp2_device as hostdata.
Kristian Høgsberg [Wed, 9 May 2007 23:23:07 +0000 (19:23 -0400)]
firewire: Allocate scsi_host up front and allocate the sbp2_device as hostdata.

Avoids an extra allocation and simplifies lifetime rules for the scsi_host.

Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Provide module aliase for backwards compatibility.
Olaf Hering [Sat, 5 May 2007 21:17:13 +0000 (23:17 +0200)]
firewire: Provide module aliase for backwards compatibility.

This patch loads fw-sbp2 if sbp2 is still in the config file. So one can
go back and forth between releases without worry about the root
filesystem drivers.

Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Existing mkinitrd scripts still have to be adapted, unless they grok
module aliases.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Add to fw-core-y instead of assigning fw-core-objs in Makefile.
Kristian Høgsberg [Tue, 8 May 2007 00:33:38 +0000 (20:33 -0400)]
firewire: Add to fw-core-y instead of assigning fw-core-objs in Makefile.

Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Break out shared IEEE1394 constant to separate header file.
Kristian Høgsberg [Tue, 8 May 2007 00:33:37 +0000 (20:33 -0400)]
firewire: Break out shared IEEE1394 constant to separate header file.

Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Use linux/*.h instead of asm/*.h header files.
Kristian Høgsberg [Tue, 8 May 2007 00:33:36 +0000 (20:33 -0400)]
firewire: Use linux/*.h instead of asm/*.h header files.

Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Uppercase most macro names.
Kristian Høgsberg [Tue, 8 May 2007 00:33:35 +0000 (20:33 -0400)]
firewire: Uppercase most macro names.

Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Coding style cleanup: no spaces after function names.
Kristian Høgsberg [Tue, 8 May 2007 00:33:34 +0000 (20:33 -0400)]
firewire: Coding style cleanup: no spaces after function names.

Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Convert card_rwsem to a regular mutex.
Kristian Høgsberg [Tue, 8 May 2007 00:33:33 +0000 (20:33 -0400)]
firewire: Convert card_rwsem to a regular mutex.

Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Clean up comment style.
Kristian Høgsberg [Tue, 8 May 2007 00:33:32 +0000 (20:33 -0400)]
firewire: Clean up comment style.

Drop filenames from file preamble, drop editor annotations and
use standard indent style for block comments.

Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (fixed typo)
17 years agofirewire: Use lib/ implementation of CRC ITU-T.
Kristian Høgsberg [Tue, 8 May 2007 00:33:31 +0000 (20:33 -0400)]
firewire: Use lib/ implementation of CRC ITU-T.

With the CRC ITU-T implementation available in lib/ we can use that instead.

This also fixes a bug in the topology map crc computation.

Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (fixed Kconfig)
17 years agoCRC ITU-T V.41
Ivo van Doorn [Mon, 12 Jun 2006 14:17:04 +0000 (16:17 +0200)]
CRC ITU-T V.41

This will add the CRC calculation according
to the CRC ITU-T V.41 to the kernel lib/ folder.

This code has been derived from the rt2x00 driver,
currently found only in the wireless-dev tree, but
this library is generic and could be used by more
drivers who currently use their own implementation.

Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Also useful for the new firewire stack.

Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Rename fw-device-cdev.c to fw-cdev.c and move header to include/linux.
Kristian Høgsberg [Mon, 30 Apr 2007 19:03:15 +0000 (15:03 -0400)]
firewire: Rename fw-device-cdev.c to fw-cdev.c and move header to include/linux.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Future proof the iso ioctls by adding a handle for the iso context.
Kristian Høgsberg [Mon, 30 Apr 2007 19:03:14 +0000 (15:03 -0400)]
firewire: Future proof the iso ioctls by adding a handle for the iso context.

Currently create context always returns 0 and the other iso
ioctls will expect user space to pass that in for subsequent ioctls.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Add read/write and size annotations to IOC numbers.
Kristian Høgsberg [Mon, 30 Apr 2007 19:03:13 +0000 (15:03 -0400)]
firewire: Add read/write and size annotations to IOC numbers.

Also, with this change, refactor ioctl dispatch code to do the
copying from and to user space as indicated by the IOC annotations.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: don't use extern on public symbols
Randy Dunlap [Thu, 26 Apr 2007 05:43:16 +0000 (22:43 -0700)]
firewire: don't use extern on public symbols

Make firewire entry points not 'extern':

drivers/firewire/fw-device.c:160:25: warning: function 'fw_device_get' with external linkage has definition
drivers/firewire/fw-device.c:167:13: warning: function 'fw_device_put' with external linkage has definition

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: fw-device printk fix
Andrew Morton [Thu, 26 Apr 2007 07:16:04 +0000 (00:16 -0700)]
firewire: fw-device printk fix

You don't know what type is used to implement u64.

Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Don't use subsystem rwsem, it's going away.
Kristian Høgsberg [Tue, 17 Apr 2007 15:51:57 +0000 (11:51 -0400)]
firewire: Don't use subsystem rwsem, it's going away.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Do an agent reset on error recovery.
Kristian Høgsberg [Wed, 11 Apr 2007 22:44:33 +0000 (18:44 -0400)]
firewire: Do an agent reset on error recovery.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
(Reverted part which moved it from eh_abort_handler to eh_host_reset_handler)

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Only free ORBs that completed the initial transaction.
Kristian Høgsberg [Tue, 10 Apr 2007 22:11:20 +0000 (18:11 -0400)]
firewire: Only free ORBs that completed the initial transaction.

In some situations we can receive the ORB status write before we
have received the ORB pointer write response.  When this happens,
we assume that the fw_transaction is finished and free the ORB
struct containing the fw_transaction.

This fix make the status write logic only accept status writes
for ORBs where the initial ORB pointer write transaction finished.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Forward SAM status codes to the scsi stack.
Kristian Høgsberg [Tue, 10 Apr 2007 22:11:18 +0000 (18:11 -0400)]
firewire: Forward SAM status codes to the scsi stack.

Or the SAM status codes from the device sense data into the
command error code.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Check for CONTEXT_RUN not CONTEXT_ACTIVE when starting AT DMA context.
Kristian Høgsberg [Tue, 10 Apr 2007 22:11:17 +0000 (18:11 -0400)]
firewire: Check for CONTEXT_RUN not CONTEXT_ACTIVE when starting AT DMA context.

Doh, bad typo...

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Byteswap iso header so all headers are presented as be32.
Kristian Høgsberg [Tue, 10 Apr 2007 22:11:16 +0000 (18:11 -0400)]
firewire: Byteswap iso header so all headers are presented as be32.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Fix start on cycle 0 for IT, implement start on cycle for IR.
Kristian Høgsberg [Wed, 28 Mar 2007 18:26:10 +0000 (14:26 -0400)]
firewire: Fix start on cycle 0 for IT, implement start on cycle for IR.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Fix the range check for the queue_iso payload pointer.
Kristian Høgsberg [Wed, 28 Mar 2007 18:46:23 +0000 (20:46 +0200)]
firewire: Fix the range check for the queue_iso payload pointer.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (renamed a variable)
17 years agofirewire: Increase the number of config rom retries and the retry delay.
Kristian Høgsberg [Tue, 27 Mar 2007 05:43:43 +0000 (01:43 -0400)]
firewire: Increase the number of config rom retries and the retry delay.

Some devices have a really long power-on cycle, and we fail to
successfully probe these if they're plugged in and then turned on.

There's really no down-side to bumping the number of retries and the
retry delay, and most devices will get picked up within the first couple
of retries anyway.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Don't set card->irm_node before we have a new valid topology.
Kristian Høgsberg [Tue, 27 Mar 2007 14:42:39 +0000 (09:42 -0500)]
firewire: Don't set card->irm_node before we have a new valid topology.

In case the topology build fails, we want to retain the old topology
info until another reset finishes and results in a valid new tree.  If
we clear card->irm_node to NULL and the topology build fails, we end up
dereferencing a NULL pointer in a few places.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Generalize resource tracking for cdev implementation.
Kristian Høgsberg [Tue, 27 Mar 2007 05:43:41 +0000 (01:43 -0400)]
firewire: Generalize resource tracking for cdev implementation.

Generalize the way we keep track of the various resources and
assign a unique handle to each resource.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Add ioctls to add and remove config rom descriptors.
Kristian Høgsberg [Wed, 28 Mar 2007 19:26:42 +0000 (21:26 +0200)]
firewire: Add ioctls to add and remove config rom descriptors.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (fixed whitespace)
17 years agofirewire: Streamline userspace interface structs.
Kristian Høgsberg [Tue, 27 Mar 2007 05:43:39 +0000 (01:43 -0400)]
firewire: Streamline userspace interface structs.

Make event struct layout common part include the closure and add a
union for all event types; provide a mechanism for setting the
bus reset event closure.

Shuffle struct fw_cdev_queue_iso fields around to be 64-bit safe.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Remember to set the driver_data pointer when queueing a packet.
Kristian Høgsberg [Mon, 26 Mar 2007 23:18:19 +0000 (19:18 -0400)]
firewire: Remember to set the driver_data pointer when queueing a packet.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Use device->groups for adding device attributes.
Kristian Høgsberg [Tue, 27 Mar 2007 23:35:13 +0000 (19:35 -0400)]
firewire: Use device->groups for adding device attributes.

We dynamically create an attribute group for the key present on the
device in hand and point device->group to it.  This way the device
core adds the sysfs attributes for us as the device is added.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Add phy register defines.
Marc Butler [Fri, 23 Mar 2007 16:24:02 +0000 (10:24 -0600)]
firewire: Add phy register defines.

Signed-off-by: Marc Butler <marc@adaptivecode.com>
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (added whitespace)
17 years agofirewire: Export GUID as sysfs attribute.
Kristian Høgsberg [Wed, 21 Mar 2007 00:58:35 +0000 (20:58 -0400)]
firewire: Export GUID as sysfs attribute.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Add sysfs attributes for config rom directory values.
Kristian Høgsberg [Wed, 21 Mar 2007 14:55:19 +0000 (10:55 -0400)]
firewire: Add sysfs attributes for config rom directory values.

We export the entire config rom, so this is technically redundant,
but should make udev rules and HAL integration easier.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Make use of struct device_type.
Kristian Høgsberg [Wed, 21 Mar 2007 00:58:33 +0000 (20:58 -0400)]
firewire: Make use of struct device_type.

The device_type struct is useful for setting attributes for a device
and overriding .release and .uevent for a group of devices.  This patch
uses it this way to clean up the sysfs code a bit.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: ROM cache is CPU-endian
Stefan Richter [Tue, 20 Mar 2007 18:44:26 +0000 (19:44 +0100)]
firewire: ROM cache is CPU-endian

Puts a stray endian annotation down.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: fix compiler warnings on 64bit
Stefan Richter [Tue, 20 Mar 2007 18:42:15 +0000 (19:42 +0100)]
firewire: fix compiler warnings on 64bit

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
17 years agofirewire: add includes for sem and rw_sem
Stefan Richter [Mon, 19 Mar 2007 15:37:16 +0000 (11:37 -0400)]
firewire: add includes for sem and rw_sem

as a precaution.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Grab dev->sem when doing the update callback.
Kristian Høgsberg [Mon, 19 Mar 2007 15:37:16 +0000 (11:37 -0400)]
firewire: Grab dev->sem when doing the update callback.

This serializes the update callback with the probe and remove callback from
the driver core and prevents remove from being called while update is
running for the same device.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: rename CONFIG_FW to CONFIG_FIREWIRE
Stefan Richter [Sun, 18 Mar 2007 00:39:28 +0000 (01:39 +0100)]
firewire: rename CONFIG_FW to CONFIG_FIREWIRE

to avoid confusion with CONFIG_FW_LOADER.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Acked-by: Kristian Høgsberg <krh@redhat.com>
17 years agofirewire: Add ref-counting for sbp2_device and hold a ref while we have work scheduled.
Kristian Høgsberg [Wed, 14 Mar 2007 21:34:58 +0000 (17:34 -0400)]
firewire: Add ref-counting for sbp2_device and hold a ref while we have work scheduled.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Free pending transactions on cdev release.
Kristian Høgsberg [Wed, 14 Mar 2007 21:34:57 +0000 (17:34 -0400)]
firewire: Free pending transactions on cdev release.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Zero out sd->scsi_host if we fail to register with the SCSI stack.
Kristian Høgsberg [Wed, 14 Mar 2007 21:34:56 +0000 (17:34 -0400)]
firewire: Zero out sd->scsi_host if we fail to register with the SCSI stack.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Implement deallocation of address ranges.
Kristian Høgsberg [Wed, 14 Mar 2007 21:34:55 +0000 (17:34 -0400)]
firewire: Implement deallocation of address ranges.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Move sync and tag parameters to start_iso ioctl.
Kristian Høgsberg [Wed, 14 Mar 2007 21:34:54 +0000 (17:34 -0400)]
firewire: Move sync and tag parameters to start_iso ioctl.

Setting these at create_context time or start_iso time doesn't matter
much, but raw1394 sets them at start_iso time so that will be easier to
emulate this way.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Fix dualbuffer iso receive mode and drop buffer fill mode.
Kristian Høgsberg [Wed, 14 Mar 2007 21:34:53 +0000 (17:34 -0400)]
firewire: Fix dualbuffer iso receive mode and drop buffer fill mode.

The dualbuffer DMA setup did not account for the iso trailer word
and thus didn't  work correctly.  With this fixed we can drop the
dual buffer fallback mode.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Implement CSR cycle time and bus time registers.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:56 +0000 (12:12 -0500)]
firewire: Implement CSR cycle time and bus time registers.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Implement topology map and fix a couple of loopback bugs.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:55 +0000 (12:12 -0500)]
firewire: Implement topology map and fix a couple of loopback bugs.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Export juju specific rcodes to user space.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:54 +0000 (12:12 -0500)]
firewire: Export juju specific rcodes to user space.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Add generation field to send_request ioctl struct.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:53 +0000 (12:12 -0500)]
firewire: Add generation field to send_request ioctl struct.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Add card index field to get_info cdev ioctl struct.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:52 +0000 (12:12 -0500)]
firewire: Add card index field to get_info cdev ioctl struct.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Fix order of arguments for iso context creation.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:51 +0000 (12:12 -0500)]
firewire: Fix order of arguments for iso context creation.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Track pending transactions and cancel them on cdev release.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:50 +0000 (12:12 -0500)]
firewire: Track pending transactions and cancel them on cdev release.

Without this, pending transactions will dereference freed memory
if they complete after the device file has been closed.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Move async transmit to use the general context code.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:49 +0000 (12:12 -0500)]
firewire: Move async transmit to use the general context code.

The old async transmit context handling was starting and stopping
DMA for every packet transmission.  This could cause silently failing
packet transmission, if the DMA was reprogrammed too close to being
stopped.

The general context code keeps DMA running at all times and fixes this
problem.  It's also a nice cleanup.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Use only a wait queue and terminate poll and read on device removal.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:48 +0000 (12:12 -0500)]
firewire: Use only a wait queue and terminate poll and read on device removal.

Drop the event list semaphore and only use the wait queue and the list
to synchronize queue access.  Break out of a poll or read whenever
the device is disconnected.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Don't time out command orbs, leave that to the scsi stack.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:47 +0000 (12:12 -0500)]
firewire: Don't time out command orbs, leave that to the scsi stack.

The mod_timer based timing out of orb was a little to agressive and
would time out legit, but long-lived scsi cmds.  Besides, the scsi
stack keeps track of this already.  Since we're only timing out
management orbs, go back to wait_for_completion_timeout.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Add rom_index attribute for unit sysfs directories.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:46 +0000 (12:12 -0500)]
firewire: Add rom_index attribute for unit sysfs directories.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Quiet down fw-sbp2 logging a bit, remove stale FIXME.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:45 +0000 (12:12 -0500)]
firewire: Quiet down fw-sbp2 logging a bit, remove stale FIXME.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Switch cdev code over to use register_chrdev and keep a list of devices.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:44 +0000 (12:12 -0500)]
firewire: Switch cdev code over to use register_chrdev and keep a list of devices.

The old mechanism kept a struct cdev for each fw device, but fops->release
would reference this struct after the device got freed in some cases.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Generalize get_config_rom to get_info.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:43 +0000 (12:12 -0500)]
firewire: Generalize get_config_rom to get_info.

Repurpose the get_config_rom ioctl to a general get_info ioctl.
This ioctl is now used for version negotiation, and optionally
returns the config rom, and the current bus info.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Implement ioctl to initiate bus reset.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:42 +0000 (12:12 -0500)]
firewire: Implement ioctl to initiate bus reset.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Add a bus reset event type for fw-device-cdev.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:41 +0000 (12:12 -0500)]
firewire: Add a bus reset event type for fw-device-cdev.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Only use INIT_DELAYED_WORK for first initialization.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:40 +0000 (12:12 -0500)]
firewire: Only use INIT_DELAYED_WORK for first initialization.

Use PREPARE_DELAYED_WORK to just change the function pointer.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Iterate through units in a keventd callback for update callbacks.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:39 +0000 (12:12 -0500)]
firewire: Iterate through units in a keventd callback for update callbacks.

We can't take the klist lock for the child device list in interrupt
context.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Clear all interrupt bits before shutting down.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:38 +0000 (12:12 -0500)]
firewire: Clear all interrupt bits before shutting down.

Some flaky controllers doesn't honor the masterIntEnable bits
and can generate bus reset events even if that bit is cleared.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Drop the unused fw_card device.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:37 +0000 (12:12 -0500)]
firewire: Drop the unused fw_card device.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Let an fw_descriptor specify a leading immediate key/value pair.
Kristian Høgsberg [Wed, 7 Mar 2007 17:12:36 +0000 (12:12 -0500)]
firewire: Let an fw_descriptor specify a leading immediate key/value pair.

This lets us break out "Juju" as the model name in the config rom.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Scheduled removal of SA_xxx interrupt flags fixups 3
Thomas Gleixner [Tue, 6 Mar 2007 02:19:51 +0000 (18:19 -0800)]
firewire: Scheduled removal of SA_xxx interrupt flags fixups 3

The obsolete SA_xxx interrupt flags have been used despite the scheduled
removal.  Fixup the remaining users in -mm.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: adjust whitespace
Stefan Richter [Sun, 4 Mar 2007 13:45:18 +0000 (14:45 +0100)]
firewire: adjust whitespace

Remove space before tab and trailing whitespace.
Unify indentation of goto target labels.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Implement sync and tag matching for isochronous receive.
Kristian Høgsberg [Fri, 16 Feb 2007 22:34:51 +0000 (17:34 -0500)]
firewire: Implement sync and tag matching for isochronous receive.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Configure channel and speed at context creation time.
Kristian Høgsberg [Fri, 16 Feb 2007 22:34:50 +0000 (17:34 -0500)]
firewire: Configure channel and speed at context creation time.

We need the channel number as we queue up iso packets for transmission
so we can fill out the header correctly.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Store OHCI version and make sure we have at least 1.1 before doing dualbuffer.
Kristian Høgsberg [Fri, 16 Feb 2007 22:34:49 +0000 (17:34 -0500)]
firewire: Store OHCI version and make sure we have at least 1.1 before doing dualbuffer.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Get zeroed out pages for mapping to user space.
Kristian Høgsberg [Fri, 16 Feb 2007 22:34:48 +0000 (17:34 -0500)]
firewire: Get zeroed out pages for mapping to user space.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Don't touch DMA descriptors after appending.
Kristian Høgsberg [Fri, 16 Feb 2007 22:34:47 +0000 (17:34 -0500)]
firewire: Don't touch DMA descriptors after appending.

When a DMA descriptor is appended to the context we sync it for
DMA and the device might potentially read it immediately.  So,
we can't set the IRQ bits in the descriptor after appending.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Use a buffer fill descriptor for receive when header size is 0.
Kristian Høgsberg [Fri, 16 Feb 2007 22:34:46 +0000 (17:34 -0500)]
firewire: Use a buffer fill descriptor for receive when header size is 0.

When the DMA is setup to not strip any headers, we need to use
the buffer fill descriptor instead of the dual buffer, since the
dual buffer descriptor must strip a non-zero number of header quadlets.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Set correct buffer lengths for dualbuffer DMA descriptor.
Kristian Høgsberg [Fri, 16 Feb 2007 22:34:45 +0000 (17:34 -0500)]
firewire: Set correct buffer lengths for dualbuffer DMA descriptor.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Acummulate received iso headers and send them back to user space.
Kristian Høgsberg [Fri, 16 Feb 2007 22:34:44 +0000 (17:34 -0500)]
firewire: Acummulate received iso headers and send them back to user space.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Log OHCI chipset version in PCI probe.
Kristian Høgsberg [Fri, 16 Feb 2007 22:34:43 +0000 (17:34 -0500)]
firewire: Log OHCI chipset version in PCI probe.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Implement functionality to stop isochronous DMA contexts.
Kristian Høgsberg [Fri, 16 Feb 2007 22:34:42 +0000 (17:34 -0500)]
firewire: Implement functionality to stop isochronous DMA contexts.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Rename 'send_iso' to 'start_iso'.
Kristian Høgsberg [Fri, 16 Feb 2007 22:34:41 +0000 (17:34 -0500)]
firewire: Rename 'send_iso' to 'start_iso'.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Implement basic isochronous receive functionality.
Kristian Høgsberg [Fri, 16 Feb 2007 22:34:40 +0000 (17:34 -0500)]
firewire: Implement basic isochronous receive functionality.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Generalize the iso transmit descriptor buffer logic.
Kristian Høgsberg [Fri, 16 Feb 2007 22:34:39 +0000 (17:34 -0500)]
firewire: Generalize the iso transmit descriptor buffer logic.

The descriptor circular buffer logic used for iso transmission is
useful for async transmit too, so pull the sharable logic out in
a few standalone functions.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Split the iso buffer out from fw_iso_context and avoid vmalloc.
Kristian Høgsberg [Fri, 16 Feb 2007 22:34:38 +0000 (17:34 -0500)]
firewire: Split the iso buffer out from fw_iso_context and avoid vmalloc.

This patch splits out the iso buffer so we can initialize it at mmap
time with the size provided in the mmap call.  Furthermore, allocate
the backing pages using alloc_page to avoid setting up kernel side
virtual memory mappings for the pages.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Use correct payload pointer when demarshalling incoming requests.
Kristian Høgsberg [Fri, 16 Feb 2007 22:34:37 +0000 (17:34 -0500)]
firewire: Use correct payload pointer when demarshalling incoming requests.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Read the *Clear versions of the iso interrupt register.
Kristian Høgsberg [Fri, 16 Feb 2007 22:34:36 +0000 (17:34 -0500)]
firewire: Read the *Clear versions of the iso interrupt register.

The *Clear registers returns the masked value when read which is
what we want.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Fix another typo from the bitfield conversion.
Kristian Høgsberg [Fri, 16 Feb 2007 22:34:35 +0000 (17:34 -0500)]
firewire: Fix another typo from the bitfield conversion.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Use dma_mapping_error() for checking for DMA mapping errors.
Kristian Høgsberg [Tue, 6 Feb 2007 19:49:40 +0000 (14:49 -0500)]
firewire: Use dma_mapping_error() for checking for DMA mapping errors.

Pointed out by Pete Zaitcev.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Credit the old sbp2.c driver for being a good starting point.
Kristian Høgsberg [Tue, 6 Feb 2007 19:49:39 +0000 (14:49 -0500)]
firewire: Credit the old sbp2.c driver for being a good starting point.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Use atomic_t's for serial numbers.
Kristian Høgsberg [Tue, 6 Feb 2007 19:49:38 +0000 (14:49 -0500)]
firewire: Use atomic_t's for serial numbers.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Use atomic_inc_return.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Spell out fw as firewire in sysfs.
Kristian Høgsberg [Tue, 6 Feb 2007 19:49:37 +0000 (14:49 -0500)]
firewire: Spell out fw as firewire in sysfs.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Complete SCSI commands with DID_BUS_BUSY when a bus reset happens.
Kristian Høgsberg [Tue, 6 Feb 2007 19:49:36 +0000 (14:49 -0500)]
firewire: Complete SCSI commands with DID_BUS_BUSY when a bus reset happens.

This lets the SCSI stack retry the command when a SCSI command is
interrupted by a FireWire bus reset.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Schedule topology work before calling driver update functions.
Kristian Høgsberg [Tue, 6 Feb 2007 19:49:35 +0000 (14:49 -0500)]
firewire: Schedule topology work before calling driver update functions.

This prevents superfluous bus traffic as fw-sbp2 logs in only to
get kicked off the device by another bus reset as the driver core
does bus management.  Scheduling it this way lets the driver core
finish bus management before higher level drivers get the update
callback.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Introduce a retry mechanism for reconnects and logins.
Kristian Høgsberg [Tue, 6 Feb 2007 19:49:34 +0000 (14:49 -0500)]
firewire: Introduce a retry mechanism for reconnects and logins.

Sometimes we reconnect too soon, sometimes too late.  Adding a retry
mechanism make the reconnect step much more robust.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: fw-sbp2: Do ORB timeout right.
Kristian Høgsberg [Tue, 6 Feb 2007 19:49:33 +0000 (14:49 -0500)]
firewire: fw-sbp2: Do ORB timeout right.

When a management ORB times out, either because the fw_transaction
times out or when we don't get the status write, we need to properly
cancel the entire operation.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Implement proper transaction cancelation.
Kristian Høgsberg [Tue, 6 Feb 2007 19:49:32 +0000 (14:49 -0500)]
firewire: Implement proper transaction cancelation.

Drivers such as fw-sbp2 had no way to properly cancel in-progress
transactions, which could leave a pending transaction or an unset
packet in the low-level queues after kfree'ing the containing
structure. fw_cancel_transaction() lets drivers cancel a submitted
transaction.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Reduce some redundant register definitions.
Kristian Høgsberg [Tue, 6 Feb 2007 19:49:31 +0000 (14:49 -0500)]
firewire: Reduce some redundant register definitions.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
17 years agofirewire: Rework async receive DMA.
Kristian Høgsberg [Tue, 6 Feb 2007 19:49:30 +0000 (14:49 -0500)]
firewire: Rework async receive DMA.

The old DMA program for receiving async packets stops DMA while
processing received packets and only expects one packet per
interrupt.  Stopping DMA can silently drop packets and we need to
handle multiple received packets per interrupt.

This new version keeps DMA running at all times and just append new
pages as buffers fill up, and supports multiple packets per interrupt.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>