Commit Graph

174 Commits

Author SHA1 Message Date
Stefan Richter ae57988f68 firewire: fw-core: make two variables static
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-08-02 20:34:17 +02:00
Stefan Richter 4eaff7d630 firewire: fw-ohci: dma_free_coherent needs IRQs enabled
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-08-02 20:34:17 +02:00
Stefan Richter 25659f7183 firewire: fw-sbp2: set correct maximum payload (fixes CardBus adapters)
As far as I know, all CardBus FireWire 400 adapters have a maximum
payload of 1024 bytes which is less than the speed-dependent limit of
2048 bytes.  Fw-sbp2 has to take the host adapter's limit into account.

This apparently fixes Juju's incompatibility with my CardBus cards, a
NEC based card and a VIA based card.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Acked-by: Kristian Høgsberg <krh@redhat.com>
2007-08-02 20:34:16 +02:00
Linus Torvalds e6f194d8f6 Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (60 commits)
  [SCSI] libsas: make ATA functions selectable by a config option
  [SCSI] bsg: unexport sg v3 helper functions
  [SCSI] bsg: fix bsg_unregister_queue
  [SCSI] bsg: make class backlinks
  [SCSI] 3w-9xxx: add support for 9690SA
  [SCSI] bsg: fix bsg_register_queue error path
  [SCSI] ESP: Increase ESP_BUS_TIMEOUT to 275.
  [SCSI] libsas: fix scr_read/write users and update the libata documentation
  [SCSI] mpt fusion: update Kconfig help
  [SCSI] scsi_transport_sas: add destructor for bsg
  [SCSI] iscsi_tcp: buggered kmalloc()
  [SCSI] qla2xxx: Update version number to 8.02.00-k2.
  [SCSI] qla2xxx: Add ISP25XX support.
  [SCSI] qla2xxx: Use pci_try_set_mwi().
  [SCSI] qla2xxx: Use PCI-X/PCI-Express read control interfaces.
  [SCSI] qla2xxx: Re-factor isp_operations to static structures.
  [SCSI] qla2xxx: Validate mid-layer 'underflow' during check-condition handling.
  [SCSI] qla2xxx: Correct setting of 'current' and 'supported' speeds during FDMI registration.
  [SCSI] qla2xxx: Generalize iIDMA support.
  [SCSI] qla2xxx: Generalize FW-Interface-2 support.
  ...
2007-07-22 11:36:49 -07:00
Kristian Høgsberg b02b6bc465 [SCSI] Make scsi_host_template::proc_name const char * instead of char *.
Signed-off-by: Kristian Høgsberg <krh@redhat.com>

collapsed with fw-sbp2 patch "Drop cast to non-const char * in host
template initialization." from Kristian Høgsberg

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-07-19 12:06:26 -05:00
Stefan Richter 412edf654a firewire: fw-sbp2: convert to new SCSI data buffer accessors
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-07-18 23:53:28 +02:00
Stefan Richter 9c9bdf4d50 firewire: fix memory leak of fw_request instances
Found and debugged by Jay Fenlason <fenlason@redhat.com>.
The bug was especially noticeable with direct I/O over fw-sbp2.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
2007-07-18 23:53:28 +02:00
Stefan Richter 5d59a6f1ba firewire: remove bogus check in fw_core_handle_request
This check is bogus:
  - Maximum asynchronous payload size for S800...S3200 is 4096.
  - The p->payload_length is totally uninteresting.  Only the
    request->length of the subsequently allocated and initialized
    struct fw_request is of significance.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
2007-07-18 23:53:27 +02:00
Stefan Richter b980f5a224 firewire: fw-ohci: fix "scheduling while atomic"
context_stop is called by bus_reset_tasklet, among else.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-07-18 23:53:27 +02:00
Stefan Richter 362e901c65 firewire: fw-ohci: flush MMIO write before msleep
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-07-18 23:53:27 +02:00
Stefan Richter 7aa484815f firewire: fw-sbp2: fix DMA mapping of management ORBs
The CPU must not touch the buffer after it was DMA-mapped.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
2007-07-10 00:07:49 +02:00
Stefan Richter 8526392ae8 firewire: fw-sbp2: fix DMA mapping of command ORBs
The CPU must not touch the buffer after it was DMA-mapped.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
2007-07-10 00:07:48 +02:00
Stefan Richter b4be016ad8 firewire: fw-sbp2: fix DMA mapping of S/G tables
- The CPU must not touch the buffer after it was DMA-mapped.
  - The size argument of dma_unmap_single(...page_table...) was bogus.
  - Move a comment closer to the code to which it refers to.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
2007-07-10 00:07:48 +02:00
Stefan Richter 332ef3310b firewire: fw-sbp2: add a boundary check
Add rudimentary check for the case that the page table overflows due to
merging of s/g elements by the IOMMU.  This would have lead to
overwriting of arbitrary memory.

After this change I expect that an offending command will be
unsuccessfully retried until the scsi_device is taken offline by SCSI
core.  It's a border case and not worth to implement a recovery
strategy.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Acked-by: Kristian Høgsberg <krh@redhat.com>
2007-07-10 00:07:47 +02:00
Stefan Richter 9fb2dd12c0 firewire: fw-sbp2: correctly align page tables
This is required per SBP-2 clause 5.2.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Acked-by: Kristian Høgsberg <krh@redhat.com>
2007-07-10 00:07:47 +02:00
Stefan Richter e7cdf237b2 firewire: fw-sbp2: memset wants string.h
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Acked-by: Kristian Høgsberg <krh@redhat.com>
2007-07-10 00:07:47 +02:00
Stefan Richter ffd0db26dd firewire: fw-sbp2: use correct speed in sbp2_agent_reset
noticed by Jay Fenlason

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Acked-by: Kristian Høgsberg <krh@redhat.com>
2007-07-10 00:07:46 +02:00
Jay Fenlason 6f061487f7 firewire: fw-sbp2: correctly dereference by container_of
Replace a cast with a container_of().  As long as nobody reorders the
structure elements, they do the same thing, but container_of() is more
readable.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (added complete_command_orb)
Acked-by: Kristian Høgsberg <krh@redhat.com>
2007-07-10 00:07:46 +02:00
Stefan Richter 5cd54c94b0 firewire: fw-sbp2: implement nonexclusive login
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
2007-07-10 00:07:45 +02:00
Stefan Richter 79352e9f94 firewire: fw-sbp2: let SCSI shutdown commands through before logout
This affects of course only the "soft shutdown" case, e.g. "modprobe -r
firewire-sbp2", while it doesn't matter for hot unplug.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
2007-07-10 00:07:44 +02:00
Stefan Richter cf47c7a26c firewire: fw-sbp2: implement max sectors limit for some old bridges
This currently only affects one bridge in the hardwired blacklist.
I don't own one of those, hence haven't tested it.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-07-10 00:07:44 +02:00
Stefan Richter dae1a3aa8e firewire: simplify a struct type
cleanup after "firewire: support S100B...S400B and link slower than PHY"

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
2007-07-10 00:07:44 +02:00
Stefan Richter f139749001 firewire: support S100B...S400B and link slower than PHY
Use a speed probe to determine the speed over 1394b buses and of nodes
which report a link speed less than their PHY speed.

Log the effective maximum speed of newly created nodes in dmesg.

Also, read the config ROM (except bus info block) at the maximum speed
rather than S100.  This isn't a real optimization though because we
still only use quadlet read requests for the entire ROM.

The patch also adds support for S1600 and S3200, although such hardware
does not exist yet.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
2007-07-10 00:07:43 +02:00
Stefan Richter 24d40125f1 firewire: optimize gap count with 1394b leaf nodes
Table-based gap count optimization cannot be used if 1394b repeater PHYs
are present.  But it does work with 1394b leaf nodes.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
2007-07-10 00:07:43 +02:00
Stefan Richter 25d83f583b firewire: remove unused macro
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-07-10 00:07:42 +02:00
Stefan Richter 8a8cea2734 firewire: missing newline in printk
Also remove some errno printouts which will be shown by infrastructure
code anyway.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-07-10 00:07:42 +02:00
Stefan Richter b8f106570f firewire: fw-sbp2: remove unused struct member
cleanup after support of single-buffer requests was dropped

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
2007-07-10 00:07:42 +02:00
Stefan Richter fe77d4f283 firewire: add Kconfig help on building both stacks
Alas that won't work so good, because nobody reads help texts.

I thought about adding some crude multiple choice selection (build the
old stack, build the new stack, build both stacks).  It's possible, but
it would introduce awkward dummy config variables.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-06-29 17:32:07 +02:00
Stefan Richter 0a9972baa7 firewire: fix async reception on big endian machines
descriptor.data_address is little endian

Tested-by: Olaf Hering <olh@suse.de>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
2007-06-29 17:32:07 +02:00
Kristian Høgsberg 24315c5e6f firewire: Only set client->iso_context if allocation was successful.
This patch fixes an OOPS on cdev release for an fd where iso context
creation failed.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-06-21 00:09:41 +02:00
Stefan Richter a515958d6f firewire: fix hang after card ejection
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
2007-06-16 12:43:20 +02:00
Kristian Høgsberg 1ca31ae7cf firewire: Change struct fw_cdev_iso_packet to not use bitfields.
The struct is part of the userspace interface and can not use
bitfields.  This patch replaces the bitfields with a __u32 'control'
word and provides access macros to set the bits.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-05-31 21:40:15 +02:00
Kristian Høgsberg 2aef469a35 firewire: Implement suspend/resume PCI driver hooks.
It's a low-impact design, that just makes suspend/resume look like
a bus reset to the upper level drivers, but it should be sufficient.

Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-05-31 21:40:14 +02:00
Stefan Richter 14e2198646 firewire: fw-sbp2: implement sysfs ieee1394_id
The attribute /sys/bus/scsi/devices/*:*:*:*/ieee1394_id, as generated by
the old sbp2 driver, is typically used to create persistently named
links in /dev/disk/by-id.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
2007-05-31 21:40:13 +02:00
Jeff Garzik 350958f984 firewire: fix return code
Fix this warning on x86-64

drivers/firewire/fw-cdev.c:798: warning: initialization from incompatible pointer type

by making the return code of ioctl_send_request() the same as all the
other ioctl_xxx() return codes.

Signed-off-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-05-27 23:21:01 +02:00
Stefan Richter 9a60731d00 firewire: prefix modules with firewire- instead of fw-
Of course everybody immediately associates "fw-" with FireWire, not
firmware or firewall or whatever.  But "firewire-" has a nice ring to
it too.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Acked-by: Kristian Hoegsberg <krh@bitplanet.net>
2007-05-27 23:21:01 +02:00
Kristian Høgsberg ec839e43fb firewire: Add missing byteswapping for receive DMA programs.
Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-05-27 23:21:00 +02:00
Al Viro faa2fb4e67 missing mm.h in fw-ohci
need it for page_private(), not all targets have it pulled indirectly

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-05-15 18:56:37 -07:00
Kristian Høgsberg d79406dd14 firewire: Convert OHCI driver to use standard goto unwinding for error handling.
Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-05-10 18:24:14 +02:00
Kristian Høgsberg 2d826cc5c7 firewire: Always use parens with sizeof.
Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-05-10 18:24:14 +02:00
Kristian Høgsberg 213d7bbd76 firewire: Drop single buffer request support.
The SCSI layer only passes sg requests down, so drop the
use_sg == 0, request_bufflen != 0 case.

Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-05-10 18:24:14 +02:00
Kristian Høgsberg, Stefan Richter 36abb3b18e 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>
2007-05-10 18:24:14 +02:00
Kristian Høgsberg e1b68c4dcf 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>
2007-05-10 18:24:14 +02:00
Kristian Høgsberg 95ffc5e314 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>
2007-05-10 18:24:14 +02:00
Kristian Høgsberg ad85274fb7 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>
2007-05-10 18:24:14 +02:00
Olaf Hering 1e4c7b0dab 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>
2007-05-10 18:24:14 +02:00
Kristian Høgsberg 58e313b362 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>
2007-05-10 18:24:13 +02:00
Kristian Høgsberg 4c5a443e80 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>
2007-05-10 18:24:13 +02:00
Kristian Høgsberg a77754a75d firewire: Uppercase most macro names.
Signed-off-by: Kristian Hoegsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-05-10 18:24:13 +02:00
Kristian Høgsberg a98e271987 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>
2007-05-10 18:24:13 +02:00