Archived
14
0
Fork 0
Commit graph

281 commits

Author SHA1 Message Date
Daniel Drake
3c21cfc4ba video1394: small optimizations to frame retrieval codepath
Add some GCC branch prediction optimizations to unlikely error/safety
conditions in the ioctl handling code commonly called during an application's
capture loop.

Signed-off-by: Daniel Drake <ddrake@brontes3d.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-12-07 21:31:04 +01:00
Stefan Richter
c1c9c7cd9f ieee1394: handle sysfs errors
Handle driver core errors with as much care as appropriate.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-12-07 21:29:57 +01:00
Stefan Richter
1ed891c6d4 ieee1394: coding style in hosts.c
Some 80-columns pedantry, and touch up of a // comment.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-12-07 21:29:35 +01:00
Stefan Richter
5c37dcbe13 ieee1394: lock smaller region by host_num_alloc mutex
We need the mutex only around the iteration over existing hosts.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-12-07 21:29:21 +01:00
Stefan Richter
b63d4fe95f ieee1394: usecs_to_jiffies takes unsigned int argument
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-12-07 21:29:08 +01:00
Stefan Richter
da256c5537 ieee1394: ohci1394: suspend/resume cosmetics
Reorder the definitions of ohci1394_pci_suspend and _resume.  Remove
redundant comments.  Beautify return statements.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-12-07 21:28:40 +01:00
Bernhard Kaindl
f011bf085c ohci1394: steps to implement suspend/resume
I did a quick shot on what I described and the appended patch
does the first thing needed for working suspend/resume
in ohci1394 which is HW de- and re-initialisation.

It works with suspend2disk on my Ricoh R5C552 IEEE 1394 Controller
with the 2.6.17 kernel to the extent that if I call dvgrab --interactive
after suspend2disk without unloading ohci1394, it does not lock up
dvgrab with 100% CPU but properly connects to the camera, given
that I first unplug and plug the camera after coming back from
suspend.

I guess that could be fixed by forcing a bus reset in the resume
function.

I cannot test suspend to RAM here at the moment and should
follow the guidelines in Documentation/power/pci.txt also,
so this is rather a quick report than a finished patch and
there are some rough edges:

However, with this patch, I have to unload at least some in-kernel
users of ohci1394 like dv1394 or video1394 before suspending.

Not doing that caused an Oops and a bad tasklet error, probably from
not handling ISO tasklets during suspend/resume properly.

Maybe these can be temporarily cleared or unregistered and
re-registered for suspend/resume with help from the other
layers or from the highlevel 1394 core, but I do not really
know what these do.

But this patch provides a useful base to start from and is
already of much help for people which do not need dv1394
and video1394 or can unload them at least during suspend.

I cannot test function with sbp2 at the moment, but raw1394
seems to work fine.

Signed-off-by: Bernhard Kaindl <bk@fsfe.org>

Update 1: merge with previous two ohci1394 suspend/resume patches
Update 2: version for application on top of Linux 2.6.19-rc4

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-12-07 21:28:13 +01:00
Stefan Richter
f9edc4f5c1 ieee1394: raw1394: add comments on lock usage
Add a who-is-who about some locks and list heads in raw1394's struct
definitions.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-12-07 21:28:06 +01:00
Stefan Richter
23077f1d72 ieee1394: sbp2: slightly reorder sbp2scsi_abort
Put the target's fetch agent into reset state before the underlying ORB
DMA is unmapped and the ->done handler is called.  It is highly unlikely
but the target could access that ORB right before sbp2 sends the reset
request.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-12-07 21:27:30 +01:00
Stefan Richter
0e930f437e ieee1394: remove unused struct member from highlevel API
struct hpsb_highlevel's struct module *owner is neither used by the IEEE
1394 core nor set by any of the in-tree drivers or the two out-of-tree
highlevel drivers I know about (dfg1394, mem1394) --- nor is this member
documented.  An unscheduled removal seems acceptable.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-12-07 21:20:30 +01:00
Nigel Cunningham
7dfb71030f [PATCH] Add include/linux/freezer.h and move definitions from sched.h
Move process freezing functions from include/linux/sched.h to freezer.h, so
that modifications to the freezer or the kernel configuration don't require
recompiling just about everything.

[akpm@osdl.org: fix ueagle driver]
Signed-off-by: Nigel Cunningham <nigel@suspend2.net>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-07 08:39:27 -08:00
Christoph Lameter
e18b890bb0 [PATCH] slab: remove kmem_cache_t
Replace all uses of kmem_cache_t with struct kmem_cache.

The patch was generated using the following script:

	#!/bin/sh
	#
	# Replace one string by another in all the kernel sources.
	#

	set -e

	for file in `find * -name "*.c" -o -name "*.h"|xargs grep -l $1`; do
		quilt add $file
		sed -e "1,\$s/$1/$2/g" $file >/tmp/$$
		mv /tmp/$$ $file
		quilt refresh
	done

The script was run like this

	sh replace kmem_cache_t "struct kmem_cache"

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-07 08:39:25 -08:00
Christoph Lameter
e94b176609 [PATCH] slab: remove SLAB_KERNEL
SLAB_KERNEL is an alias of GFP_KERNEL.

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-07 08:39:24 -08:00
Christoph Lameter
54e6ecb239 [PATCH] slab: remove SLAB_ATOMIC
SLAB_ATOMIC is an alias of GFP_ATOMIC

Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-07 08:39:24 -08:00
David Howells
c4028958b6 WorkStruct: make allyesconfig
Fix up for make allyesconfig.

Signed-Off-By: David Howells <dhowells@redhat.com>
2006-11-22 14:57:56 +00:00
David S. Miller
c20e3945c7 [ETH1394]: Fix unaligned accesses.
Several u64 objects are derefernced in situations where the
pointer is not guarenteed to be aligned correctly.  Use
get_unaligned() as needed.

Thanks to Will Simoneau for lots of testing and debugging
help.

Signed-off-by: David S. Miller <davem@davemloft.net>
Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-10-30 15:24:38 -08:00
Stefan Richter
346f5c7ee7 ieee1394: ohci1394: revert fail on error in suspend
Some errors during preparation for suspended state can be skipped with a
warning instead of a failure of the whole suspend transition, notably an
error in pci_set_power_state.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-10-29 20:02:23 +01:00
Linus Torvalds
7ff3e52cf2 Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6:
  ieee1394: nodemgr: fix startup of knodemgrd
2006-10-08 12:28:41 -07:00
Stefan Richter
b7a7179dca ieee1394: nodemgr: fix startup of knodemgrd
Revert a thinko in commit d2f119fe31:
When knodemgrd starts, it needs to sleep until host->generation was
incremented above its initial value of 0.  My wrong logic caused it to
start sending requests when the bus wasn't completely ready.  Seen as
"AT dma reset ctx=0, aborting transmission" messages in 2.6.19-rc1.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-10-08 12:10:26 +02:00
David Howells
7d12e780e0 IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.

The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around.  On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).

Where appropriate, an arch may override the generic storage facility and do
something different with the variable.  On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.

Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions.  Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller.  A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.

I've build this code with allyesconfig for x86_64 and i386.  I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.

This will affect all archs.  Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:

	struct pt_regs *old_regs = set_irq_regs(regs);

And put the old one back at the end:

	set_irq_regs(old_regs);

Don't pass regs through to generic_handle_irq() or __do_IRQ().

In timer_interrupt(), this sort of change will be necessary:

	-	update_process_times(user_mode(regs));
	-	profile_tick(CPU_PROFILING, regs);
	+	update_process_times(user_mode(get_irq_regs()));
	+	profile_tick(CPU_PROFILING);

I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().

Some notes on the interrupt handling in the drivers:

 (*) input_dev() is now gone entirely.  The regs pointer is no longer stored in
     the input_dev struct.

 (*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking.  It does
     something different depending on whether it's been supplied with a regs
     pointer or not.

 (*) Various IRQ handler function pointers have been moved to type
     irq_handler_t.

Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 15:10:12 +01:00
Matt LaPlante
095096038d Fix several typos in drivers/
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-10-03 22:31:37 +02:00
Linus Torvalds
0cd43f83d3 Merge branch 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6
* 'upstream-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6: (48 commits)
  ieee1394: raw1394: arm functions slept in atomic context
  ieee1394: sbp2: enable auto spin-up for all SBP-2 devices
  MAINTAINERS: updates to IEEE 1394 subsystem maintainership
  ieee1394: ohci1394: check for errors in suspend or resume
  set power state of firewire host during suspend
  ieee1394: ohci1394: more obvious endianess handling
  ieee1394: ohci1394: fix endianess bug in debug message
  ieee1394: sbp2: don't prefer MODE SENSE 10
  ieee1394: nodemgr: grab class.subsys.rwsem in nodemgr_resume_ne
  ieee1394: nodemgr: fix rwsem recursion
  ieee1394: sbp2: more help in Kconfig
  ieee1394: sbp2: prevent rare deadlock in shutdown
  ieee1394: sbp2: update includes
  ieee1394: sbp2: better handling of transport errors
  ieee1394: sbp2: recheck node generation in sbp2_update
  ieee1394: sbp2: safer agent reset in error handlers
  ieee1394: sbp2: handle "sbp2util_node_write_no_wait failed"
  CONFIG_PM=n slim: drivers/ieee1394/ohci1394.c
  ieee1394: safer definition of empty macros
  video1394: add poll file operation support
  ...
2006-09-30 09:38:19 -07:00
Jean Delvare
a0d9c63d36 i2c-algo-bit: Discard the mdelay data struct member
i2c-algo-bit: Discard the mdelay data struct member

The i2c_algo_bit_data structure has an mdelay member, which is not
used by the algorithm code (the code has always been ifdef'd out.)
Let's discard it to save some code and memory.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Cc: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-09-26 15:38:51 -07:00
Stefan Richter
3253b669ee ieee1394: raw1394: arm functions slept in atomic context
Sleeping functions like copy_to_user were accessed inside spinlocks in
raw1394's arm_register, arm_unregister, arm_get_buf, arm_set_buf.
http://bugzilla.kernel.org/show_bug.cgi?id=7120

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Tested-by: David Trent <DTrent@piacton.com>
(cherry picked from e575953ec17c3f5c1e738847d2d16c241bb99783 commit)
2006-09-23 15:13:55 +02:00
Stefan Richter
c394f1eafe ieee1394: sbp2: enable auto spin-up for all SBP-2 devices
This is a follow-up to patch "ieee1394: sbp2: enable auto spin-up for
Maxtor disks".  When I 'ejected' an OXUF922 based HDD from a Mac OS X
box, it was spun down by the Mac and did not spin up by itself when
attached to a Linux box right after that.  The first SCSI command that
required the bridge to access the drive ended in
sda:<6>sd 18:0:0:0: Device not ready: <6>: Current: sense key: Not Ready
    Additional sense: Logical unit not ready, initializing cmd. required

Therefore the flag which instructs scsi_mod to send START STOP UNIT with
START=1 ("make medium ready") after such a condition is now enabled
unconditionally for all FireWire storage devices.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:53:01 +02:00
Stefan Richter
ea6104c224 ieee1394: ohci1394: check for errors in suspend or resume
Some of the suspend and resume litany may fail.
Tell the PCI core about it.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:41:45 +02:00
Pavel Machek
f0645e7720 set power state of firewire host during suspend
Put firewire host controller in PCI Dx state for system suspend.
(I was not able to measure any power savings, but it sounds like right
thing to do, anyway.)

Signed-off-by: Pavel Machek <pavel@suse.cz>

Update by stefanr:  Shuffle with existing PPC_PMAC code.  Set power
state in the resume hook too.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:39:06 +02:00
Stefan Richter
9531f13ae5 ieee1394: ohci1394: more obvious endianess handling
Rename ohci1394's packet_swab to header_le32_to_cpu to better reflect
what it actually does.  Also, define a constant array as 'const' and
check the array index properly.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:39:01 +02:00
Stefan Richter
cf82703dc6 ieee1394: ohci1394: fix endianess bug in debug message
The transaction labels were misprinted int the debug printk "Packet
received from node..." due two byte-swapping once too often.  Affected
were big endian machines, except UniNorth based ones.  Fix tested by
Wolfgang Pfeiffer.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:38:57 +02:00
Stefan Richter
98e238cd42 ieee1394: sbp2: don't prefer MODE SENSE 10
In the old days, sbp2 used to coerce all MODE SENSE commands into the
10 bytes version.  When all command set conversions were removed from
sbp2 several months ago, sdev->use_10_for_ms = 1 was added.  Meaning,
higher SCSI layers preferred the 10 bytes version but would try the 6
bytes version if the former failed.

Recently, a problem with the 10 bytes version was discovered.  An Initio
INIC-1530 firmware accepted the 10 bytes version but replied with bogus
data, showing the HDD incorrectly as write-protected.  Since RBC
actually mandates MODE SENSE (6), I checked which version was sent by
Windows XP and Mac OS X 10.3 to an SBP-2 target hosted by Linux --- it
was the 6 bytes version.  (Exception: OS X sent the 10 bytes version to
an MMC target.  RBC and SBC got MODE SENSE (6).)

Therefore, drop the use_10_for_ms flag from sbp2.  Now the upper layers
will try MODE SENSE (6) before MODE SENSE (10) on all SBP-2 devices.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:38:52 +02:00
Stefan Richter
a1842be898 ieee1394: nodemgr: grab class.subsys.rwsem in nodemgr_resume_ne
nodemgr_resume_ne was iterating over nodemgr_ud_class.children without
protection by nodemgr_ud_class.subsys.rwsem.

FIXME:
Shouldn't we rather use class->sem there, not class->subsys.rwsem?

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:38:43 +02:00
Stefan Richter
9b51601086 ieee1394: nodemgr: fix rwsem recursion
nodemgr_update_pdrv grabbed an rw semaphore (as reader) which was
already taken by its caller's caller, nodemgr_probe_ne (as reader too).
Reported by Miles Lane, call path pointed out by Arjan van de Ven.

FIXME:
Shouldn't we rather use class->sem there, not class->subsys.rwsem?

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:38:14 +02:00
Stefan Richter
b809289df0 ieee1394: sbp2: more help in Kconfig
Add some pointers to SCSI to the configuration menu item of sbp2.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:34:50 +02:00
Stefan Richter
2cccbb555c ieee1394: sbp2: prevent rare deadlock in shutdown
Scsi_remove_device() may go into uninterruptible sleep if blocked.
Therefore sbp2_remove() unblocks the Scsi_Host before the device is
requested to be removed.  But there could be another 1394 bus reset
after that which would block the host again.  The 1394 subsystem won't
call sbp2_update() concurrently to sbp2_remove(), which is why there is
no chance for sbp2_remove() to be unblocked by sbp2_update().

The fix is to tell sbp2's bus reset handler when a device is to be shut
down so that it skips scsi_block_requests() on that host.  As before,
any new commands after a reset without reconnect will be failed quickly
by sbp2scsi_queuecommand().

In the long term, means to go without scsi_block_requests() should be
found.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:34:44 +02:00
Stefan Richter
902abed158 ieee1394: sbp2: update includes
Remove unused includes.  Add missing includes, i.e. explicitly include
all used headers.  Sort includes alphabetically.  Replace one call to
signal_pending(current) to avoid to include headers just for this line.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:34:41 +02:00
Stefan Richter
abbca103a0 ieee1394: sbp2: better handling of transport errors
If the target signals a transport failure via status block, complete the
request with DID_BUSY to indicate to the SCSI subsystem that the command
may succeed when retried.

Also log diagnostic information if the status block shows a transport
related problem.  It may point to hardware faults.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:34:37 +02:00
Stefan Richter
4fc383c09d ieee1394: sbp2: recheck node generation in sbp2_update
While sbp2_update() is doing its duties after a bus reset, another reset
could happen.  Don't accept new requests until the next undisturbed
sbp2_update() or until sbp2_remove().

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:34:33 +02:00
Stefan Richter
1f427e8055 ieee1394: sbp2: safer agent reset in error handlers
The scsi_host_template's eh_abort_handler and eh_device_reset_handler
are allowed to sleep.  Use this to run sbp2_agent_reset in the more
reliable mode which returns _after_ its write transaction was finished.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:34:30 +02:00
Stefan Richter
09ee67abe9 ieee1394: sbp2: handle "sbp2util_node_write_no_wait failed"
Fix for http://bugzilla.kernel.org/show_bug.cgi?id=6948

Because sbp2 writes to the target's fetch agent's registers from within
atomic context, it cannot sleep to guaranteedly get a free transaction
label.  This may repeatedly lead to "sbp2util_node_write_no_wait failed"
and consequently to SCSI command abortion after timeout.  A likely cause
is that many queue_command softirqs may occur before khpsbpkt (the
ieee1394 driver's thread which cleans up after finished transactions) is
woken up to recycle tlabels.

Sbp2 now schedules a workqueue job whenever sbp2_link_orb_command fails
in sbp2util_node_write_no_wait.  The job will reliably get a transaction
label because it can sleep.

We use the kernel-wide shared workqueue because it is unlikely that the
job itself actually needs to sleep.  In the improbable case that it has
to sleep, it doesn't need to sleep long since the standard transaction
timeout is 100ms.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:34:14 +02:00
Alexey Dobriyan
2a87418284 CONFIG_PM=n slim: drivers/ieee1394/ohci1394.c
Remove some code which is unneeded if CONFIG_PM=n.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:33:19 +02:00
Stefan Richter
611aa19fd6 ieee1394: safer definition of empty macros
A deactivated macro, defined as "#define foo(bar)", will result in
silent corruption if somebody forgets a semicolon after a call to foo.
Replace it by "#define foo(bar) do {} while (0)" which will reveal any
respective syntax errors.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:31:20 +02:00
David Moore
4b60912e52 video1394: add poll file operation support
This patch adds support for the poll file operation to the video1394
driver.

Signed-off-by: David Moore <dcm@acm.org>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:31:13 +02:00
Adrian Bunk
a1b3206b36 the scheduled removal of drivers/ieee1394/sbp2.c:force_inquiry_hack
This patch contains the scheduled removal of the force_inquiry_hack
module parameter.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:31:08 +02:00
Andi Kleen
8df4083c52 Initialize ieee1394 early when built in
This makes debugging with firescope easier.

Signed-off-by: Andi Kleen <ak@suse.de> (original patch)

Update:
 - no need for #ifdef MODULE
 - add comment in ieee1394_core, more verbose comment in ohci1394

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (update)
2006-09-17 19:29:34 +02:00
Stefan Richter
e8398bb737 ieee1394: sbp2: convert sbp2util_down_timeout to waitqueue
The waitqueue API is used to replace a custom wait mechanism.  Only one
global waitqueue (instead of per-device waitqueues or completions) is
added because there is usually just one waiter.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:29:31 +02:00
Stefan Richter
6065772d54 ieee1394: sbp2: more checks of status block
- Add checks for the (very unlikely) cases that the target writes too
   little or too much status data or writes unsolicited status.
 - Indicate that these and similar conditions are unlikely().
 - Check the 'resp' and 'sbp_status' fields for possible failure status.
 - Slightly optimize access macros for the status block bitfields.
 - Unify a few related log messages.

TODO:  Check if 'src'==1, then withhold the respective ORB from reuse
until status for any subsequent ORB was received.  This is an old bug
whose fix requires more complex command queue handling.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:29:24 +02:00
Stefan Richter
3e98eab46d ieee1394: sbp2: safer initialization of status fifo
Sbp2's copy of the status fifo was cleared when management ORBs or new
command ORBs were prepared.  The latter had potential for a race
condition if the block layer's soft IRQ and the 1394 LLD's interrupt
handler ran on different CPUs.  It would also yield wrong status if a
command was completed with non-zero completion status before other
commands that had zero completion status, and no new command was
enqueued in the meantime.

Now, the status buffer is cleared right before it is written.  Thus it
ends up in the following simpler and safer access pattern:
 - sbp2_alloc_device: allocates and implicitly clears once,
 - sbp2_handle_status_write: clears, writes, and reads,
 - sbp2_query_logins, sbp2_login_device, sbp2_reconnect_device: read.
The latter three do not race with sbp2_handle_status_write because of
how the protocol works.

As a tiny optimization, the first two quadlets of the status never need
to be cleared.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:29:22 +02:00
Stefan Richter
d4018d7fa6 ieee1394: sbp2: optimize DMA direction of command ORBs
Only the driver writes ORBs, the device just reads them.  Therefore
PCI_DMA_BIDIRECTIONAL can be replaced by PCI_DMA_TODEVICE which may be
cheaper on some architectures.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:29:11 +02:00
Stefan Richter
28212767e5 ieee1394: sbp2: discard return value of sbp2_link_orb_command
Since sbp2 is at the moment unable to do anything with the return value
of sbp2_link_orb_command, just discard it.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:29:01 +02:00
Stefan Richter
cc07818912 ieee1394: sbp2: safer last_orb and next_ORB handling
The sbp2 initiator has two ways to tell a target's fetch agent about new
command ORBs:
 - Write the ORB's address to the ORB_POINTER register.  This must not
   be done while the fetch agent is active.
 - Put the ORB's address into the previously submitted ORB's next_ORB
   field and write to the DOORBELL register.  This may be done while the
   fetch agent is active or suspended.  It must not be done while the
   fetch agent is in reset state.
Sbp2 has a last_orb pointer which indicates in what way a new command
should be announced.  That pointer is concurrently accessed at various
occasions.  Furthermore, initiator and target are accessing the next_ORB
field of ORBs concurrently and asynchronously.

This patch does:
 - Protect all initiator accesses to last_orb by sbp2_command_orb_lock.
 - Add pci_dma_sync_single_for_device before a previously submitted
   ORB's next_ORB field is overwritten.
 - Insert a memory barrier between when next_ORB_lo and next_ORB_hi are
   overwritten.  Next_ORB_hi must not be updated before next_ORB_lo.
 - Remove the rather unspecific and now superfluous qualifier "volatile"
   from the next_ORB fields.
 - Add comments on how last_orb is connected with what is known about
   the target's fetch agent's state.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:19:25 +02:00
Stefan Richter
9154df538f ieee1394: remove #include <asm/semaphore.h>
These includes in ieee1394_core and eth1394 are obsolete.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:18:50 +02:00
Stefan Richter
9951903e61 ieee1394: shrink tlabel pools, remove tpool semaphores
This patch reduces the size of struct hpsb_host and also removes
semaphores from ieee1394_transactions.c.  On i386, struct hpsb_host
shrinks from 10656 bytes to 6688 bytes.  This is accomplished by
 - using a single wait_queue for hpsb_get_tlabel instead of many
   instances of semaphores,
 - using a single lock to serialize access to all tlabel pools (the
   protected code regions are small, i.e. lock contention very low),
 - omitting the sysfs attribute tlabels_allocations.

Drawback:  In the rare case that a process needs to sleep because all
transaction labels for the node are temporarily exhausted, it is also
woken up if a tlabel for a different node became free, checks for an
available tlabel, and is put to sleep again.  The check is not costly
and the situation occurs extremely rarely.  (Tlabels are typically
only exhausted if there was no context switch to the khpsbpkt thread
which recycles tlables.)  Therefore the benefit of reduced tpool size
outweighs this drawback.

The sysfs attributes tlabels_free and tlabels_mask are not compiled
anymore unless CONFIG_IEEE1394_VERBOSEDEBUG is set.

The by far biggest member of struct hpsb_host, the struct csr_control
csr (5272 bytes on i386), is now placed at the end of struct hpsb_host.

Note, hpsb_get_tlabel calls the macro wait_event_interruptible with a
condition argument which has a side effect (allocation of a tlabel and
manipulation of the packet).  This side effect happens only if the
condition is true.  The patch relies on wait_event_interruptible not
evaluating the condition again after it became true.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 19:17:13 +02:00
Stefan Richter
9b4f2e9576 ieee1394: merge from Linus
Conflicts: drivers/ieee1394/hosts.c
Patch "lockdep: annotate ieee1394 skb-queue-head locking" was meddling
with patch "ieee1394: fix kerneldoc of hpsb_alloc_host".

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
2006-09-17 18:19:31 +02:00
Danny Tholen
7334bb4ae9 [PATCH] 1394: fix for recently added firewire patch that breaks things on ppc
Recently a patch was added for preliminary suspend/resume handling on
!PPC_PMAC.  However, this broke both suspend and firewire on powerpc
because it saves the pci state after the device has already been disabled.

This moves the save state to before the pmac specific code.

Signed-off-by: Danny Tholen <obiwan@mailmij.org>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Ben Collins <bcollins@ubuntu.com>
Cc: Jody McIntyre <scjody@modernduck.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-08-27 11:01:28 -07:00
Stefan Richter
e31f59ce59 [PATCH] ieee1394: sbp2: enable auto spin-up for Maxtor disks
At least Maxtor OneTouch III require a "start stop unit" command after auto
spin-down before the next access can proceed.  This patch activates the
responsible code in scsi_mod for all Maxtor SBP-2 disks.
https://bugzilla.novell.com/show_bug.cgi?id=183011

Maybe that should be done for all SBP-2 disks, but better be cautious.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Jody McIntyre <scjody@modernduck.com>
Cc: Ben Collins <bcollins@ubuntu.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-08-06 08:57:48 -07:00
Ingo Molnar
d378834840 [PATCH] lockdep: annotate ieee1394 skb-queue-head locking
ieee1394 reuses the skb infrastructure of the networking code, and uses two
skb-head queues: ->pending_packet_queue and hpsbpkt_queue.  The latter is used
in the usual fashion: processed from a kernel thread.  The other one,
->pending_packet_queue is also processed from hardirq context (f.e.  in
hpsb_bus_reset()), which is not what the networking code usually does (which
completes from softirq or process context).  This locking assymetry can be
totally correct if done carefully, but it can also be dangerous if networking
helper functions are reused, which could assume traditional networking use.

It would probably be more robust to push this completion into a workqueue -
but technically the code can be 100% correct, and lockdep has to be taught
about it.  The solution is to split the ->pending_packet_queue skb-head->lock
class from the networking lock-class by using a private lock-validator key.

Has no effect on non-lockdep kernels.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Jody McIntyre <scjody@modernduck.com>
Cc: Ben Collins <bcollins@debian.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-03 15:27:08 -07:00
Stefan Richter
3c6c65f5ed [PATCH] ieee1394: fix kerneldoc of hpsb_alloc_host
There was stuff between the comment and the function.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03 12:02:37 -04:00
Stefan Richter
cab8d154e2 [PATCH] ieee1394: nodemgr: convert nodemgr_serialize semaphore to mutex
Another trivial sem2mutex conversion.

Side note:  nodemgr_serialize's purpose, when introduced in linux1394's
revision 529 in July 2002, was to protect several data structures which
are now largely handled by or together with Linux' driver core and are
now protected by the LDM's own mechanisms.  It may very well be possible
to remove this mutex now.  But fully parallelized node scanning is on
our long-term TODO list anyway; the mutex will certainly go away then.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03 12:02:36 -04:00
Stefan Richter
d2f119fe31 [PATCH] ieee1394: nodemgr: switch to kthread api, replace reset semaphore
Convert nodemgr's host thread from kernel_thread to kthread and its
sleep/restart mechanism from a counting semaphore to a schedule()/
wake_up_process() scheme.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03 12:02:35 -04:00
Stefan Richter
3a632fe232 [PATCH] ieee1394: nodemgr: make module parameter ignore_drivers writable
Nodemgr's ignore_drivers variable is exposed as a module load parameter
(therefore also as a sysfs attribute below /sys/module) and additionally
as an attribute below /sys/bus/ieee1394.  Since the latter is writable,
make the former writable too.

Note, the bus's attribute ignore_drivers is only relevant to newly added
units, not to present or suspended or resuming units.  Those have their
own attribute ignore_driver.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03 12:02:35 -04:00
Stefan Richter
40fd89cc54 [PATCH] ieee1394: nodemgr: do not spawn kernel_thread for sysfs rescan
nodemgr.c::fw_set_rescan() is used to re-run the driver core over
nodemgr's representation of unit directories in order to initiate
protocol driver probes.  It is initiated via write access to one of
nodemgr's sysfs attributes.  The purpose is to attach drivers to
units after switching a unit's ignore_driver attribute from 1 to 0.

It is not really necessary to fork a kernel_thread for this job.  The
call to kernel_thread() can be eliminated to avoid the deprecated API
and to simplify the code a bit.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03 12:02:34 -04:00
Stefan Richter
1ee0dc51fb [PATCH] ieee1394: nodemgr: remove unnecessary includes
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03 12:02:33 -04:00
Stefan Richter
45289bf6ac [PATCH] ieee1394: raw1394: remove redundant counting semaphore
An already existing wait queue replaces raw1394's complete_sem which was
maintained in parallel to the wait queue.  The role of the semaphore's
counter is taken over by a direct check of what was really counted:  The
presence of items in the list of completed requests.

Notes:

 - raw1394_release() sleeps uninterruptibly until all requests were
   completed.  This is the same behaviour as before the patch.

 - The macros wait_event and wait_event_interruptible are called with a
   condition argument which has a side effect, i.e. manipulation of the
   requests list.  This side effect happens only if the condition is
   true.  The patch relies on the fact that wait_event[_interruptible]
   does not evaluate the condition again after it became true.

 - The diffstat looks unfavorable with respect to added lines of code.
   However 19 of them are comments, and some are due to separation of
   existing code blocks into two small helper functions.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03 12:02:33 -04:00
Stefan Richter
438bd525e5 [PATCH] ieee1394: dv1394: sem2mutex conversion
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> (not runtime-tested)
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03 12:02:32 -04:00
Stefan Richter
d8831d5554 [PATCH] ieee1394: clean up declarations of hpsb_*_config_rom
hpsb_update_config_rom() is defined in csr.c, not hosts.c.
hpsb_get_config_rom() does not exist.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03 12:02:31 -04:00
Stefan Richter
d83e7d8e7e [PATCH] ieee1394: remove unused macros HPSB_PANIC and HPSB_TRACE
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03 12:02:31 -04:00
Stefan Richter
66faadfac3 [PATCH] ieee1394: remove redundant code from ieee1394_hotplug.h
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03 12:02:30 -04:00
Stefan Richter
de4394f13c [PATCH] ieee1394: update #include directives in midlayer header files
Remove unnecessary includes, add missing includes.
Use forward type declarations for some structs.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03 12:02:29 -04:00
Stefan Richter
e1d118f16d [PATCH] ieee1394: coding style and comment fixes in midlayer header files
Adjust tabulators, line wraps, empty lines, and comment style.
Update comments in ieee1394_transactions.h and highlevel.h.
Fix typo in comment in csr.h.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03 12:02:28 -04:00
Stefan Richter
2b01b80b94 [PATCH] ieee1394: replace __inline__ by inline
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03 12:02:28 -04:00
Stefan Richter
433a87d528 [PATCH] ieee1394: skip dummy loop in build_speed_map
The last loop in ieee1394 core's speed calculation is not required
unless ieee1394.h::IEEE1394_SPEED_MAX is changed from its current value
of 3.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03 12:02:27 -04:00
Stefan Richter
f0cbefe63c [PATCH] ieee1394: fix calculation of csr->expire
This variant of calculate_expire() is more correct and easier to read.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03 12:01:59 -04:00
Stefan Richter
31a379e106 [PATCH] ieee1394: sbp2: enable auto spin-up for Maxtor disks
At least Maxtor OneTouch III require a "start stop unit" command after
auto spin-down before the next access can proceed.  This patch activates
the responsible code in scsi_mod for all Maxtor SBP-2 disks.
https://bugzilla.novell.com/show_bug.cgi?id=183011

Maybe that should be done for all SBP-2 disks, but better be cautious.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03 12:01:58 -04:00
Stefan Richter
d7530a1e76 [PATCH] ieee1394: fix cosmetic problem in speed probe
If ieee1394.h::IEEE1394_SPEED_MAX is bigger than the actual speed of an
1394b host adapter and the speed to another 1394b node was probed, a
bigger speed than actually used was kept in host->speed[n].  The only
resulting problem so far was sbp2 displaying bogus values in the syslog,
e.g. S3200 for actual S800 connections if IEEE1394_SPEED_MAX was S3200.
But other high-level drivers which access this field could get into more
trouble.  (Eth1394 is the only other in-tree driver which does so.  It
seems it is not affected.)

Nodemgr now clips this value according to the host adapter's link speed.

A pointer expression in nodemgr_check_speed is also changed for clarity.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-07-03 00:03:59 -04:00
Thomas Gleixner
272ee69c65 [PATCH] irq-flags: firewire: Use the new IRQF_ constants
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Jody McIntyre <scjody@modernduck.com>
Cc: Ben Collins <bcollins@debian.org>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-02 13:58:50 -07:00
Jörn Engel
6ab3d5624e Remove obsolete #include <linux/config.h>
Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-06-30 19:25:36 +02:00
Greg Kroah-Hartman
2427ddd8fa [PATCH] 64bit Resource: convert a few remaining drivers to use resource_size_t where needed
Based on a patch series originally from Vivek Goyal <vgoyal@in.ibm.com>

Cc: Vivek Goyal <vgoyal@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-27 09:24:00 -07:00
Greg Kroah-Hartman
e29419fffc [PATCH] 64bit resource: fix up printks for resources in misc drivers
This is needed if we wish to change the size of the resource structures.

Based on an original patch from Vivek Goyal <vgoyal@in.ibm.com>

Cc: Vivek Goyal <vgoyal@in.ibm.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2006-06-27 09:23:59 -07:00
Linus Torvalds
da206c9e68 Merge git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial
* git://git.kernel.org/pub/scm/linux/kernel/git/bunk/trivial:
  typo fixes
  Clean up 'inline is not at beginning' warnings for usb storage
  Storage class should be first
  i386: Trivial typo fixes
  ixj: make ixj_set_tone_off() static
  spelling fixes
  fix paniced->panicked typos
  Spelling fixes for Documentation/atomic_ops.txt
  move acknowledgment for Mark Adler to CREDITS
  remove the bouncing email address of David Campbell
2006-06-26 13:33:14 -07:00
Akinobu Mita
179e09172a [PATCH] drivers: use list_move()
This patch converts the combination of list_del(A) and list_add(A, B) to
list_move(A, B) under drivers/.

Acked-by: Corey Minyard <minyard@mvista.com>
Cc: Ben Collins <bcollins@debian.org>
Acked-by: Roland Dreier <rolandd@cisco.com>
Cc: Alasdair Kergon <dm-devel@redhat.com>
Cc: Gerd Knorr <kraxel@bytesex.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frank Pavlic <fpavlic@de.ibm.com>
Acked-by: Matthew Wilcox <matthew@wil.cx>
Cc: Andrew Vasquez <linux-driver@qlogic.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Greg Kroah-Hartman <greg@kroah.com>
Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-26 09:58:18 -07:00
Andreas Mohr
d6e05edc59 spelling fixes
acquired (aquired)
contiguous (contigious)
successful (succesful, succesfull)
surprise (suprise)
whether (weather)
some other misspellings

Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-06-26 18:35:02 +02:00
Stefan Richter
09a9a45dc6 [PATCH] ieee1394: nodemgr: do not peek into struct semaphore
Also revert patch "frv: ieee1394 is borken on frv", as it no longer is.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: David Howells <dhowells@redhat.com>
Cc: Jody McIntyre <scjody@modernduck.com>
Cc: Ben Collins <bcollins@ubuntu.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-25 10:00:54 -07:00
Al Viro
a73df4dfdb [PATCH] frv: ieee1394 is borken on frv
The ieee1394 assumes it may make direct use of ->count in the semaphore
structure.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
Cc: Stefan Richter <stefanr@s5r6.in-berlin.de>
Cc: Ben Collins <bcollins@ubuntu.com>
Cc: Jody McIntyre <scjody@modernduck.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-06-23 07:42:55 -07:00
Linus Torvalds
34641a58a2 Merge git://git.kernel.org/pub/scm/linux/kernel/git/bcollins/linux1394-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/bcollins/linux1394-2.6: (28 commits)
  eth1394: replace __constant_htons by htons
  ieee1394: adjust code formatting in highlevel.c
  ieee1394: hl_irqs_lock is taken in hardware interrupt context
  ieee1394_core: switch to kthread API
  ieee1394: sbp2: Kconfig fix
  ieee1394: add preprocessor constant for invalid csr address
  sbp2: fix deregistration of status fifo address space
  [PATCH] eth1394: endian fixes
  Fix broken suspend/resume in ohci1394
  sbp2: use __attribute__((packed)) for on-the-wire structures
  sbp2: provide helptext for CONFIG_IEEE1394_SBP2_PHYS_DMA and mark it experimental
  Update feature removal of obsolete raw1394 ISO requests.
  sbp2: fix S800 transfers if phys_dma is off
  sbp2: remove ohci1394 specific constant
  ohci1394: make phys_dma parameter read-only
  ohci1394: set address range properties
  ieee1394: extend lowlevel API for address range properties
  sbp2: log number of supported concurrent logins
  sbp2: remove manipulation of inquiry response
  ieee1394: save RAM by using a single tlabel for broadcast transactions
  ...
2006-06-20 20:01:16 -07:00
David S. Miller
c6387a48cf [SPARC]: Kill __irq_itoa().
This ugly hack was long overdue to die.

It was a way to print out Sparc interrupts in a more freindly format,
since IRQ numbers were arbitrary opaque 32-bit integers which vectored
into PIL levels.  These 32-bit integers were not necessarily in the
0-->NR_IRQS range, but the PILs they vectored to were.

The idea now is that we will increase NR_IRQS a little bit and use a
virtual<-->real IRQ number mapping scheme similar to PowerPC.

That makes this IRQ printing hack irrelevant, and furthermore only a
handful of drivers actually used __irq_itoa() making it even less
useful.

Signed-off-by: David S. Miller <davem@davemloft.net>
2006-06-20 01:21:29 -07:00
Ben Collins
7136b8073f eth1394: replace __constant_htons by htons
...and __constant_ntohs, __constant_ntohl, __constant_cpu_to_be32 too
where possible.  Htons and friends are resolved to constants in these
places anyway.  Also fix an endianess glitch in a log message, spotted
by Alexey Dobriyan.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-06-12 18:16:25 -04:00
Ben Collins
2c4b69bd7b ieee1394: adjust code formatting in highlevel.c
Replace spaces by tabulators, wrap lines at 80 columns, delete some
blank lines and superfluous braces.  Collapse some if()-within-if()
constructs.  Replace a literal CSR address by its preprocessor constant.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-06-12 18:16:16 -04:00
Ben Collins
445151932e ieee1394: hl_irqs_lock is taken in hardware interrupt context
ohci1394 and pcilynx call highlevel_host_reset from their hardware
interrupt handler (via hpsb_selfid_complete).  Therefore all readers and
writers of hl_irqs_lock have to disable interrupts.  Reported by Jiri
Slaby and J. A. Magallon.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-06-12 18:16:01 -04:00
Ben Collins
f654240f33 ieee1394_core: switch to kthread API
This gets also rid of the MODPOST warning "drivers/ieee1394/ieee1394.o -
Section mismatch: reference to .exit.text: from .smp_locks after '' (at
offset 0x18)".

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jody McIntyre <scjody@modernduck.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-06-12 18:15:50 -04:00
Ben Collins
dd082c6705 ieee1394: sbp2: Kconfig fix
We only support x86 and ppc, due to the use of bus_to_virt() and friends.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-06-12 18:15:40 -04:00
Ben Collins
6737231ead ieee1394: add preprocessor constant for invalid csr address
Replace occurrences of the magic value ~(u64)0 for invalid
CSR address spaces by a named constant for better readability.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-06-12 18:15:31 -04:00
Ben Collins
e269d27679 sbp2: fix deregistration of status fifo address space
The proper designator of an invalid CSR address is ~(u64)0, not (u64)0.
Use the correct value in initialization and deregistration.
Also, scsi_id->sbp2_lun does not need to be initialized twice.
(scsi_id was kzalloc'd.)

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-06-12 18:15:20 -04:00
Ben Collins
02f4213fc4 [PATCH] eth1394: endian fixes
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-06-12 18:15:11 -04:00
Ben Collins
b21efb59c5 Fix broken suspend/resume in ohci1394
I've been experimenting to track down the cause of suspend/resume problems
on my Compaq Presario X1050 laptop:

http://bugzilla.kernel.org/show_bug.cgi?id=6075

Essentially the ACPI Embedded Controller and keyboard controller would
get into a bizarre, confused state after resume.

I found that unloading the ohci1394 module before suspend and reloading it
after resume made the problem go away.  Diffing the dmesg output from
resume, with and without the module loaded, I found that with the module
loaded I was missing these:

PM: Writing back config space on device 0000:02:00.0 at offset 1. (Was 2100080, writing 2100007)
PM: Writing back config space on device 0000:02:00.0 at offset 3. (Was 0, writing 8008)
PM: Writing back config space on device 0000:02:00.0 at offset 4. (Was 0, writing 90200000)
PM: Writing back config space on device 0000:02:00.0 at offset 5. (Was 1, writing 2401)
PM: Writing back config space on device 0000:02:00.0 at offset f. (Was 20000100, writing 2000010a)

The default PCI driver performs the pci_restore_state when no driver is
loaded for the device.  When the ohci1394 driver is loaded, it is supposed
to do this, however it appears not to do so.

I created the patch below and tested it, and it appears to resolve the
suspend problems I was having with the module loaded.  I only added in the
pci_save_state and pci_restore_state - however, though I know little of
this hardware, surely the driver should really be doing more than this when
suspending and resuming?  Currently it does almost nothing, what if there
are commands in progress, etc?

Signed-off-by: Robert Hancock <hancockr@shaw.ca>
Cc: Jody McIntyre <scjody@modernduck.com>
Cc: Ben Collins <bcollins@debian.org>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-06-12 18:15:03 -04:00
Ben Collins
05db5055b1 sbp2: use __attribute__((packed)) for on-the-wire structures
It seems to have worked without the attribute during all the years
just because sizes of all struct members are multiples of 32 bits.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-06-12 18:14:47 -04:00
Ben Collins
bccbccdbf8 sbp2: provide helptext for CONFIG_IEEE1394_SBP2_PHYS_DMA and mark it experimental
It appears I will not get it fixed overnight.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-06-12 18:14:36 -04:00
Ben Collins
fd23ade80e sbp2: fix S800 transfers if phys_dma is off
If sbp2 is forced to move data via ARM handler, the maximum packet size
allowed for S800 transfers exceeds ohci1394's buffer size on platforms
where PAGE_SIZE is 4096.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-06-12 18:14:14 -04:00
Ben Collins
40ae6c5e88 sbp2: remove ohci1394 specific constant
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-06-12 18:13:49 -04:00
Ben Collins
fa9b73997c ohci1394: make phys_dma parameter read-only
Being able to switch physical DMA on and off at run time would be a nice
feature but a PITA to support by highlevel drivers and userspace apps.
Therefore allow it only to be set when the driver is being loaded.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-06-12 18:13:42 -04:00
Ben Collins
4611ed3803 ohci1394: set address range properties
This patch supplies the API extension introduced by patch
"ieee1394: extend lowlevel API for address range properties"
with proper addresses.

Like in patch ''ohci1394, sbp2: fix "scsi_add_device failed"
with PL-3507 based devices'', 1 TeraByte is chosen as physical
upper bound.  This leaves a window for the middle address range.
This choice is only relevant for adapters which actually have a
programmable pysical upper bound register.  (Only ALi and
Fujitsu adapters are known for this.  Most adapters have a fixed
bound at 4 GB.)  The middle address range is suitable for posted
writes.

AFAIK, PCILynx does not support physical DMA nor posted writes,
therefore no equivalent change in the pcilynx driver is necessary.
There is also a driver for GP2Lynx, although not in mainline Linux.
I assume this hardware does not support these OHCI features either.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: Ben Collins <bcollins@ubuntu.com>
2006-06-12 18:13:32 -04:00