aboutsummaryrefslogtreecommitdiff
path: root/drivers/firewire
AgeCommit message (Collapse)Author
2007-11-07firewire: fw-sbp2: fix refcountingStefan Richter
Since patch "fw-sbp2: use an own workqueue (fix system responsiveness)" increased parallelism between fw-sbp2 and fw-core, it was possible that fw-sbp2 didn't release the SCSI device when the FireWire device was disconnected. This happened if sbp2_update() ran during sbp2_login(), because a bus reset occurred during sbp2_login(). The sbp2_login() work would [try to] reschedule itself because it failed due to the bus reset, and it would _not_ drop its reference on the target. However, sbp2_update() would schedule sbp2_login() too before sbp2_login() rescheduled itself and hence sbp2_update() would take an additional reference. And then we would have one reference too many. The fix is to _always_ drop the reference when leaving the sbp2_login() work. If the sbp2_login() work reschedules itself, it takes a reference, but only if it wasn't already rescheduled by sbp2_update(). Ditto in the sbp2_reconnect() work. The resulting code is actually simpler than before: We _always_ take a reference when successfully scheduling work. And we _always_ drop a reference when leaving a workqueue job. No exceptions. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-10-31firewire: Fix pci resume to not pass in a __be32 config rom.Kristian Høgsberg
The ohci_enable() function shared between pci_probe and pci_resume takes a host endian config rom, but ohci->config_rom is __be32. This sets up the config rom in the wrong endian on little endian machine, specifically, BusOptions will be initialized to a 0 max receive size. This patch changes the way we reuse the config rom so that we avoid this problem. Signed-off-by: Kristian Hoegsberg <krh@redhat.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-10-22firewire: fw-ohci: shut up a superfluous compiler warningStefan Richter
New warning since commit ab88ca488b8af66c3defa165874e81e695319a19, "firewire: fw-ohci: missing dma_unmap_single": drivers/firewire/fw-ohci.c: In function 'at_context_transmit': drivers/firewire/fw-ohci.c:609: warning: 'payload_bus' may be used uninitialized in this function Access to payload_bus is conditional on packet->payload_length > 0, and that won't change while in at_context_queue_packet. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-10-22firewire: fw-ohci: log a note about unsupported featuresStefan Richter
because there seems to be more time needed to implement this. Also, change related error return values to more appropriate ones. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-10-20fix typo "insted" -> "instead"Uwe Kleine-König
Signed-off-by: Uwe Kleine-König <ukleinek@informatik.uni-freiburg.de> Signed-off-by: Adrian Bunk <bunk@kernel.org>
2007-10-17firewire: fw-cdev: reorder wakeup vs. spinlockJay Fenlason
Signed-off-by: Jay Fenlason <fenlason@redhat.com> Prompted by https://bugzilla.redhat.com/show_bug.cgi?id=323411 Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-10-17firewire: in-code doc updates.Yann Dirson
Signed-off-by: Yann Dirson <ydirson@altern.org> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (update)
2007-10-17firewire: a header cleanupStefan Richter
fw_node() is not used (and not useful) outside fw-topology.c. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-10-17firewire: adopt read cycle timer ABI from raw1394Stefan Richter
This duplicates the read cycle timer feature of raw1394 (added in Linux 2.6.21) in firewire-core's userspace ABI. The argument to the ioctl is reordered though to ensure 32/64 bit compatibility. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Kristian Høgsberg <krh@redhat.com>
2007-10-17firewire: fw-ohci: check for misconfigured bus (phyID == 63)Stefan Richter
Check NodeID.nodeNumber as per OHCI 1.1 clause 7.2.3.2. See also IEEE 1394a table 5B-1. Also, demote the "node ID not valid" message from error to notification as it is not an error condition. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-10-17firewire: fw-ohci: missing dma_unmap_singleStefan Richter
at_context_queue_packet() didn't clean up in an early exit path. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Kristian Høgsberg <krh@redhat.com>
2007-10-17firewire: fw-ohci: log posted write errorsStefan Richter
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-10-17firewire: fw-ohci: reorder includesStefan Richter
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-10-17firewire: fw-ohci: fix includesStefan Richter
Add used includes, remove unused includes. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-10-17firewire: fw-ohci: enforce read order for selfID generationStefan Richter
It seems unlikely, but access to self_id_cpu[0] could at least in theory be deferred until after the loop over self_id_cpu[1..n] or even after the subsequent reg_read. Enforce the desired order by a read barrier. Also prevent the reg_read from being reordered relative to the for loop. This isn't necessary if the loop's conditional printk counts as an implicit barrier, but better make it explicit. (self_id_cpu[] is a coherent DMA buffer.) Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-10-17firewire: fw-sbp2: use an own workqueue (fix system responsiveness)Stefan Richter
Firewire-sbp2 did very uncooperative things in the kernel's shared workqueue: Sleeping until reception of management status from the target for up to 2 seconds, and performing SCSI inquiry and all of the setup of SCSI command set drivers via scsi_add_device. If there were transient or permanent error conditions, this caused long blockage of the kernel's events process, noticeable e.g. by blocked keyboard input. We now allocate a workqueue process exclusive to fw-sbp2. As a side effect, this also increases parallelism of fw-sbp2's login and reconnect work versus fw-core's device discovery and device update work which is performed in the shared workqueue. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Kristian Høgsberg <krh@redhat.com>
2007-10-17firewire: fw-sbp2: expose module parameter for workaroundsStefan Richter
On rare occasions, the ability to set one of the workaround flags at runtime may save the day. People who experience I/O errors with firewire-sbp2 while the old sbp2 driver worked for them should try workarounds=1 and report to the devel mailinglist whether that improves things. Firewire-sbp2 defaults to the SCSI stack's maximum transfer size per command, while sbp2 limits them to 128 kBytes. Flag 1 accomplishes just that. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-10-17firewire: fw-sbp2: add support for multiple logical units per targetStefan Richter
Fixes "New firewire stack only recognizing half of a chain of drives", https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=242254 Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-10-17firewire: fw-sbp2: always enable IRQs before calling command ORB callbackStefan Richter
On IOMMU-less noncoherent architectures, orb->callback will memcpy the whole SCSI command buffer for READ-like SCSI commands. It is therefore friendlier to enable IRQs before the call, like before patch "Add ref-counting for sbp2 orbs". Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Acked-by: Kristian Høgsberg <krh@redhat.com>
2007-10-17firewire: fw-core: local variable shadows a global oneStefan Richter
Sparse warned about it although it was apparently harmless: drivers/firewire/fw-cdev.c:624:23: warning: symbol 'interrupt' shadows an earlier one include/asm/hw_irq.h:29:13: originally declared here Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-10-17firewire: optimize fw_core_add_address_handlerStefan Richter
Potentially avoids unnecessary loop runs. Guarantee quadlet-aligned starts of address regions. Document the return values. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-10-14fw-cdev __user annotationsAl Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-10-12Driver core: change add_uevent_var to use a structKay Sievers
This changes the uevent buffer functions to use a struct instead of a long list of parameters. It does no longer require the caller to do the proper buffer termination and size accounting, which is currently wrong in some places. It fixes a known bug where parts of the uevent environment are overwritten because of wrong index calculations. Many thanks to Mathieu Desnoyers for finding bugs and improving the error handling. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2007-10-07firewire: point to migration documentStefan Richter
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-09-07firewire: fw-ohci: ignore failure of pci_set_power_state (fix suspend ↵Stefan Richter
regression) Fixes (papers over) "Sleep problems with kernels >= 2.6.21 on powerpc", http://lkml.org/lkml/2007/8/25/155. The issue is that the FireWire controller's pci_dev.current_state of iBook G3 and presumably older PowerBooks is still in PCI_UNKNOWN instead of PCI_D0 when the firewire driver's .suspend method is called. Like it was suggested earlier in http://lkml.org/lkml/2006/10/24/13, we do not fail .suspend anymore if pci_set_power_state failed. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-08-25firewire: Add ref-counting for sbp2 orbs (fix command abortion)Kristian Høgsberg
This handles the case where we get the status write before getting the complete_transaction callback ("status write for unknown orb"). In this case, we just assume that the initial orb pointer transaction succeeded and finish the orb. To prevent the transaction callback from touching freed memory, we ref-count the orb structures. Signed-off-by: Kristian Høgsberg <krh@redhat.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-08-25firewire: fix unloading of fw-ohci while devices are attachedStefan Richter
Fix panic in run_timer_softirq right after "modprobe -r firewire-ohci" if a FireWire disk was attached and firewire-sbp2 loaded. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-08-02firewire: fw-core: make two variables staticStefan Richter
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-08-02firewire: fw-ohci: dma_free_coherent needs IRQs enabledStefan Richter
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-08-02firewire: fw-sbp2: set correct maximum payload (fixes CardBus adapters)Stefan Richter
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-07-22Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6Linus Torvalds
* 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-19[SCSI] Make scsi_host_template::proc_name const char * instead of char *.Kristian Høgsberg
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-18firewire: fw-sbp2: convert to new SCSI data buffer accessorsStefan Richter
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-07-18firewire: fix memory leak of fw_request instancesStefan Richter
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-18firewire: remove bogus check in fw_core_handle_requestStefan Richter
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-18firewire: fw-ohci: fix "scheduling while atomic"Stefan Richter
context_stop is called by bus_reset_tasklet, among else. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-07-18firewire: fw-ohci: flush MMIO write before msleepStefan Richter
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2007-07-10firewire: fw-sbp2: fix DMA mapping of management ORBsStefan Richter
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-10firewire: fw-sbp2: fix DMA mapping of command ORBsStefan Richter
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-10firewire: fw-sbp2: fix DMA mapping of S/G tablesStefan Richter
- 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-10firewire: fw-sbp2: add a boundary checkStefan Richter
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-10firewire: fw-sbp2: correctly align page tablesStefan Richter
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-10firewire: fw-sbp2: memset wants string.hStefan Richter
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Acked-by: Kristian Høgsberg <krh@redhat.com>
2007-07-10firewire: fw-sbp2: use correct speed in sbp2_agent_resetStefan Richter
noticed by Jay Fenlason Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Acked-by: Kristian Høgsberg <krh@redhat.com>
2007-07-10firewire: fw-sbp2: correctly dereference by container_ofJay Fenlason
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-10firewire: fw-sbp2: implement nonexclusive loginStefan Richter
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Kristian Høgsberg <krh@redhat.com>
2007-07-10firewire: fw-sbp2: let SCSI shutdown commands through before logoutStefan Richter
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-10firewire: fw-sbp2: implement max sectors limit for some old bridgesStefan Richter
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-10firewire: simplify a struct typeStefan Richter
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-10firewire: support S100B...S400B and link slower than PHYStefan Richter
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>