Commit Graph

626 Commits

Author SHA1 Message Date
Mark Haverkamp 9203344cb8 [SCSI] aacraid: initialization timeout
Received from Mark Salyzyn from Adaptec.

In the rare instances where the adapter, or the motherboard, is
misbehaving; driver initialization or shutdown becomes problematic. By
introducing a 3 minute timeout on the first interrupt driven command
during initialization, or the issuance of the adapter shutdown command
during driver unload, we can resolve the lockup problems induced by
common (but rare) hardware misbehaviors.

The timeout during initialization, should it occur, is accompanied by a
message presented to the console and the logs indicating that the user
should inspect and resolve problems with interrupt routing.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-26 17:46:59 -05:00
Mark Haverkamp 08efb7b611 [SCSI] aacraid: error return checking
This patch adds some additional error return checking and error return
value propagation during initialization. Also, the deprecation of
pci_module_init with pci_register_driver along with the change in return
values.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-26 17:46:18 -05:00
Mark Haverkamp 131256cf20 [SCSI] aacraid: handle AIF hotplug events (update)
Received from Mark Salyzyn from Adaptec.

Hotplug sniffs the AIFs (events) from the adapter and if a container
change resulting in the device going offline (container zero), online
(container zero completed) or changing capacity (morph) it will take
actions by calling the appropriate API.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-26 17:42:50 -05:00
Mark Haverkamp 2f130980d1 [SCSI] aacraid: aacraid: AIF preallocation (update)
Recevied from Mark Salyzyn from Adaptec.

Aif pre-allocation is used to pull the kmalloc outside of the locks.

Applies to the scsi-misc-2.6 git tree.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-26 17:41:49 -05:00
Mark Haverkamp 7a8cf29d69 [SCSI] aacraid: Greater than 2TB capacity support
Received from Mark Salyzyn from Adaptec.

There are a few adapters that are capable of creating devices with this large
of a capacity, but now that we have the large fib support in, the management
applications will be capable of generating them.  The problem is, once they are
created, the driver will not be able to access the devices correctly without
this patch.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-26 17:41:13 -05:00
Bagalkote, Sreenivas c4a3e0a529 [SCSI] MegaRAID SAS RAID: new driver
Signed-off-by: Sreenivas Bagalkote <Sreenivas.Bagalkote@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-26 17:32:44 -05:00
Christoph Hellwig fe8b2304e5 [SCSI] sas: fix remote phy removal
Brown paperbag bug:  sas_rphy_delete was ordered completely
wrong.  Fix it up to be the same order as sas_phy_delete or
fc_rport_terminate and fix rphy objects that leaked after module
removal.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-25 17:19:35 -05:00
Andrew Vasquez 44550322cb [SCSI] qla2xxx: fix remote port timeout with qla2xxx driver
This patch fixes a hole in the rport unblock handling when processing
fabric events via the ADISC/PLOGI device state machine.  Original code
would not properly 'unblock' the port upon the port reloging into the
fabric.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-25 12:11:35 -05:00
James Bottomley 6f3a20242d [SCSI] allow REPORT LUN scanning even for LUN 0 PQ of 3
Currently we just ignore the device, which means there are a few
arrays out there that we don't find.

This patch updates the scsi_report_lun_scan() to take a target instead
of a device so it can be called on a return of
SCSI_SCAN_TARGET_PRESENT, which is what a PQ 3 device returns.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-25 12:01:48 -05:00
adam radford 49bfd8db4a [SCSI] 3ware 9000: Add support for 9550SX controllers
Signed-off-by: Adam Radford <linuxraid@amcc.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-25 09:36:26 -05:00
Jeff Garzik 98ed72deeb Merge /spare/repo/linux-2.6/ 2005-09-24 00:26:49 -04:00
Jeff Garzik c1d9728ecc Merge /spare/repo/linux-2.6/ 2005-09-24 00:25:02 -04:00
Linus Torvalds 87e807b6c4 Merge branch 'upstream' from master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev 2005-09-23 16:44:52 -07:00
Jeff Garzik 536f809802 Merge /spare/repo/linux-2.6/ 2005-09-23 19:03:21 -04:00
Benjamin Herrenschmidt 0cdc82ee1a [PATCH] mesh scsi: fix error handling
The PowerMac mesh SCSI driver had some missing error handling which would
trigger warnings due to lack of handling of return value from
scsi_add_host.  This fixes it.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: James Bottomley <James.Bottomley@SteelEye.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-22 22:17:36 -07:00
Andy Currid e86ee6682b [PATCH] Add NVIDIA device ID in sata_nv
Signed-off-by: Andy Currid <acurrid@nvidia.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-09-21 22:52:19 -04:00
Andrew Morton 68ce1eb540 [SCSI] lpfc build fix
gcc-2.95.x doesn't do anonymous unions.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-21 16:25:46 -05:00
Linus Torvalds 9600c11ba3 Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-for-linus-2.6 2005-09-20 08:50:49 -07:00
James Bottomley 3ed7a4704b [SCSI] Fix thread termination for the SCSI error handle
From: 	Alan Stern <stern@rowland.harvard.edu>

This patch (as561) fixes the error handler's thread-exit code.  The
kthread_stop call won't wake the thread from a down_interruptible, so
the patch gets rid of the semaphore and simply does

        set_current_state(TASK_INTERRUPTIBLE);

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

Modified to simplify the termination loop and correct the sleep condition.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-19 09:50:04 -05:00
James Bottomley 939647ee30 [SCSI] fix oops on usb storage device disconnect
We fix the oops by enforcing the host state model.  There have also
been two extra states added: SHOST_CANCEL_RECOVERY and
SHOST_DEL_RECOVERY so we can take the model through host removal while
the recovery thread is active.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-19 09:24:52 -05:00
Alan Stern a64358db12 [SCSI] SCSI scanning and removal fixes
This patch (as545) fixes the list traversals in __scsi_remove_target and
scsi_forget_host.  In each case the existing code list_for_each_entry_safe
in an _unsafe_ manner, because the list was not protected from outside
modification while the iteration was running.

The new scsi_forget_host routine takes the moderately controversial step
of iterating over devices for removal rather than iterating over targets.
This makes more sense to me because the current scheme treats targets as
second-class citizens, created and removed on demand, rather than as
objects corresponding to actual hardware.  (Also I couldn't figure out any
safe way to iterate over the target list, since it's not so easy to tell
when a target has already been removed.)

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-18 15:22:06 -05:00
Alan Stern b95be99d52 [SCSI] fix oops in scsi_release_buffers()
I found one other thing that needs to be fixed.  The call to
scsi_release_buffers in scsi_unprep_request causes an oops, because the
sgtable has already been freed in scsi_io_completion.  The following patch
is needed.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-17 15:24:53 -05:00
Adam Kropelin 27b2f6792f [PATCH] qla2xxx: Use dword accessors for PCI_ROM_ADDRESS
PCI_ROM_ADDRESS is a 32 bit register and as such should be accessed using
pci_bus_{read,write}_config_dword().  A recent audit of drivers/ turned up
several cases of byte- and word-sized accesses.  The harmful ones were fixed
by Linus directly.  This patches up one of the remaining
harmless-but-still-wrong cases caught in the dragnet.

Signed-off-by: Adam Kropelin <akropel1@rochester.rr.com>
Cc: Andrew Vasquez <andrew.vasquez@qlogic.com>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-17 11:50:03 -07:00
Jeff Garzik 7fb6ec287a [libata] fix PIO completion race
Make sure we that completion is the final action we take; prior to this
change, another CPU may have changed ap->pio_task_state before we tested
it a final time.

Spotted by, and original patch by Albert Lee @ IBM.

Also includes a minor optimization:  eliminate a ton of unnecessary
queue_work() calls, simply by jumping to the beginning of the FSM
function ata_pio_task().
2005-09-16 06:01:48 -04:00
Alan Cox 17b14451fd [PATCH] PATCH: remove function for non-PCI as requested
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-09-16 02:39:01 -04:00
Alan Cox 7a83e90b32 [PATCH] PATCH: silly in piix driver
Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-09-16 02:37:47 -04:00
Alan Stern 541950027f [SCSI] fix use after potential free in scsi_remove_device
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-15 22:03:54 -04:00
James Bottomley b568355733 [SCSI] atp870u: fix memory addressing bug
From: Alan Cox <alan@redhat.com>

The virt_to_bus() wasn't correctly taken out of this driver.  It needs
to be able to track both physical and virtual addresses for its prd table.
Update the driver to do this with separate tracking entries.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-15 08:59:36 -05:00
James Bottomley 59897dad98 [SCSI] fix sym scsi boot hang
On Wed, 2005-09-14 at 18:06 +1000, Anton Blanchard wrote:
> And in particular it looks like the scsi_unprep_request in
> scsi_queue_insert is causing it. The following patch fixes the boot
> problems on the vscsi machine:

OK, my fault.  Your fix is almost correct .. I was going to do this
eventually, honest, because there's no need to unprep and reprep a
command that comes in through scsi_queue_insert().

However, I decided to leave it in to exercise the scsi_unprep_request()
path just to make sure it was working.  What's happening, I think, is
that we also use this path for retries.  Since we kill and reget the
command each time, the retries decrement is never seen, so we're
retrying forever.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-14 16:59:03 -04:00
Randy.Dunlap d39a942c3f [SCSI] scsi: 2 drivers need MODULE_LICENSE()
Modules need a license to prevent kernel tainting.

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-14 16:58:26 -04:00
Timothy Thelin 186d330e68 [SCSI] scsi: sd, sr, st, and scsi_lib all fail to copy cmd_len to new cmd
This fixes an issue in scsi command initialization from a request
where sd, sr, st, and scsi_lib all fail to copy the request's
cmd_len to the scsi command's cmd_len field.

Signed-off-by: Timothy Thelin <timothy.thelin@wdc.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-14 16:54:12 -04:00
Jeff Garzik dbaa9a9d2b Merge /spare/repo/linux-2.6/ 2005-09-14 08:57:30 -04:00
Uwe Koziolek 668e4bc722 [PATCH] sata_sis: uninitialized variable
There is an uninitialized variable issue in sata_sis.c
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-09-14 08:22:44 -04:00
Arnaud Patard 39eb936c7e [PATCH] sata_sis: Fix typo in sata port2 initialisation
This patch fixes a nasty typo I introduced in my previous patch (commit
f2c853bca5). The right offset of the
second port in pure sata mode is 64 and not 0x64.
Thanks to Martin Schuster for pointing this to me

Signed-off-by: Arnaud Patard <apatard@mandriva.com>
 ---
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-09-14 08:21:34 -04:00
Tejun Heo 923f122573 [PATCH] sil24: initialization fix
sil24 0.20 didn't use to perform (what seems to be) port multiplier
initialization and controller reset 0.10 driver does.  This makes some
sil24 controllers malfunction.  This patch adds PM initialization and
controller resetting to initilization and bumps version to 0.21.
Please refer to the following thread for more information.

http://marc.theaimsgroup.com/?l=linux-ide&m=112582819830324&w=2
http://marc.theaimsgroup.com/?l=linux-ide&m=112636045531060&w=2

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-09-14 08:19:27 -04:00
Jeff Garzik 905ec87e93 Merge /spare/repo/linux-2.6/ 2005-09-14 08:19:08 -04:00
Jeff Garzik 165415f700 Merge /spare/repo/linux-2.6/ 2005-09-14 08:12:20 -04:00
James Bottomley a89f29f6ea [SCSI] aic7xxx: move to dma_get_required_mask() and correct 39 bit assumptions
This patch moves aic7xxx over to the dma_get_required_mask() API and
dumps its open coded memory check.

It also appears from this bug:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=167049

That 39 bit addressing doesn't work on older cards.  I surmise that the
AHC_LARGE_SCBS flag is the one that marks cards capable of using 39 bit
addressing, so I also folded that check into the code.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-13 14:24:48 -05:00
Dave C Boutcher 154fb614df [SCSI] ibmvscsi compatibility fix
Linda Xie ever so gently pointed out that she had a patch
to preserve compatibility with older SLES targets, and I told
her we didn't need to push it to mainline.

This patch explicitly checks the version of the IBMVSCSI target
and ensures that large scatterlists are not sent to older
targets.

Signed-off-by: Linda Xie <lxie@us.ibm.com>
Signed-off-by: Dave Boutcher <boutcher@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-13 10:15:10 -05:00
James Bottomley 1c5363153d [SCSI] blacklist REPORT LUNS usage on transtec arrays
They report being SCSI-3 but seem to give back rubbish to a
REPORT_LUNS command.  Force them to be sequentially scanned.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-13 09:52:19 -05:00
Linus Torvalds 35d91f75c2 Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-for-linus-2.6 2005-09-12 20:02:18 -07:00
Mike Christie 6f16b5359c [SCSI] set error value when failing commands in prep_fn
set DID_NO_CONNECT for the BLKPREP_KILL case and correct a few
BLKPREP_DEFER cases that weren't checking for the need to plug the
queue.

Signed-Off-By: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-10 21:02:25 -05:00
James Bottomley 146f7262ee [SCSI] Alter the scsi_add_device() API to conform to what users expect
The original API returned either an ERR_PTR() or a refcounted sdev.
Unfortunately, if it's successful, you need to do a scsi_device_put() on
the sdev otherwise the refcounting is wrong.

Everyone seems to expect that scsi_add_device() should be callable
without doing the ref put, so alter the API so it is (we still have
__scsi_add_device with the original behaviour).

The only actual caller that needs altering is the one in firewire ...
not because it gets this right, but because it acts on the error if one
is returned.

Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-10 14:43:25 -05:00
viro@ZenIV.linux.org.uk fe08ac3178 [PATCH] __user annotations (scsi/ch)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-10 10:16:27 -07:00
Adrian Bunk 338cec3253 [PATCH] merge some from Rusty's trivial patches
This patch contains the most trivial from Rusty's trivial patches:
- spelling fixes
- remove duplicate includes

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-10 10:06:30 -07:00
Jesper Juhl f9101210e7 [PATCH] vfree and kfree cleanup in drivers/
This patch does a full cleanup of 'NULL checks before vfree', and a partial
cleanup of calls to kfree for all of drivers/ - the kfree bit is partial in
that I only did the files that also had vfree calls in them.  The patch
also gets rid of some redundant (void *) casts of pointers being passed to
[vk]free, and a some tiny whitespace corrections also crept in.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-10 10:06:30 -07:00
Alan Stern b70d37bf61 [SCSI] Fix module removal/device add race
This patch (as546) fixes an oops-causing failure to check the return code
from scsi_device_get.  The call can return an error if the LLD is being
unloaded from memory.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-10 11:21:02 -05:00
Andrew Vasquez f631b4be76 [SCSI] lpfc: use wwn_to_u64() transport helper
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Acked-by: Smart, James <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-10 11:11:48 -05:00
Andrew Vasquez f8b02a85eb [SCSI] qla2xxx: use wwn_to_u64() transport helper
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-10 11:10:57 -05:00
James Bottomley 37be6eeb49 [SCSI] SAS transport class: fixup prototype of sas_host_setup
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-09 18:43:56 -05:00
adam radford d327d08232 [SCSI] 3ware 9000: handle use_sg != 0 for emulated commands
The attached patch updates the driver for the 3ware 9000 series to do
the following:

- Correctly handle single sgl's with use_sg = 1.

This is needed with the latest scsi-block-2.6 merge otherwise the 3w-9xxx
driver will not work.  I tested the patch James sent a few weeks back to fix
this, and it had a bug where the request_buffer was accessed in
twa_scsiop_execute_scsi_complete() when it was invalid.  This is a corrected
variation of that patch.

Signed-off-by: Adam Radford <linuxraid@amcc.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-09 18:11:16 -05:00
Christoph Hellwig c7ebbbce36 [SCSI] SAS transport class
The SAS transport class contains common code to deal with SAS HBAs, an
aproximated representation of SAS topologies in the driver model,
and various sysfs attributes to expose these topologies and managment
interfaces to userspace.

In addition to the basic SCSI core objects this transport class introduces
two additional intermediate objects:  The SAS PHY as represented by struct
sas_phy defines an "outgoing" PHY on a SAS HBA or Expander, and the SAS
remote PHY represented by struct sas_rphy defines an "incoming" PHY on a
SAS Expander or end device.  Note that this is purely a software concept, the
underlying hardware for a PHY and a remote PHY is the exactly the same.

There is no concept of a SAS port in this code, users can see what PHYs
form a wide port based on the port_identifier attribute, which is the same
for all PHYs in a port.

This submission doesn't handle hot-plug addition or removal of SAS devices
and thus doesn't do scanning in a workqueue yet, that will be added in
phase2 after this submission.  In a third phase I will add additional
managment infrastructure.

I think this submission is ready for 2.6.14, but additional comments are
of course very welcome.

I'd like to thanks James Smart a lot for his very useful input on the
design.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-09 16:43:37 -05:00
Douglas Gilbert 1c8e71d720 [SCSI] sg: do not set VM_IO flag on mmap-ed pages
Further to the problem discussed in this post:
http://marc.theaimsgroup.com/?l=linux-scsi&m=112540053711489&w=2

It seems that the sg driver does not need to set the VM_IO flag
on pages that it memory maps to the user space since they are
not from the IO space. Ahmed Teirelbar <ahmed.teirelbar@adic.com>
wants the facility and has tested this patch as I have without
adverse effects.

The oops protection is still important. Some users really did
try and use dio transfers from the sg driver to memory mapped
IO space (on a video capture card if my memory serves) during the
lk 2.4 series. I'm not sure how successful it was but that will
now be politely refused in lk 2.6.13+ .

Changelog:
   - set the page flags for sg's reserved buffer mmap-ed
     to the user space to VM_RESERVED (rather than
     VM_RESERVED | VM_IO )

Signed-off-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-09 16:37:05 -05:00
James Bottomley 788ce43aa1 [SCSI] SCSI core: fix leakage of scsi_cmnd's
Actually, just one problem and one cosmetic fix:

1) We need to dequeue for the loop and kill case (it seems easiest
simply to dequeue in the scsi_kill_request() routine)
2) There's no real need to drop the queue lock.  __scsi_done() is lock
agnostic, so since there's no requirement, let's just leave it in to
avoid any locking issues.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-09 16:30:59 -05:00
viro@ZenIV.linux.org.uk b95adac775 [PATCH] trivial iomem annotations in qla2xxx/qla_dbg.c
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-09 14:05:54 -07:00
Ingo Molnar a9f6a0dd54 [PATCH] more SPIN_LOCK_UNLOCKED -> DEFINE_SPINLOCK conversions
This converts the final 20 DEFINE_SPINLOCK holdouts.  (another 580 places
are already using DEFINE_SPINLOCK).  Build tested on x86.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-09 14:03:48 -07:00
Ingo Molnar 8d06afab73 [PATCH] timer initialization cleanup: DEFINE_TIMER
Clean up timer initialization by introducing DEFINE_TIMER a'la
DEFINE_SPINLOCK.  Build and boot-tested on x86.  A similar patch has been
been in the -RT tree for some time.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-09 14:03:48 -07:00
James Bottomley e91442b635 [SCSI] SCSI core: fix leakage of scsi_cmnd's
From: 	Alan Stern <stern@rowland.harvard.edu>

This patch (as559b) adds a new routine, scsi_unprep_request, which
gets called every place a request is requeued.  (That includes
scsi_queue_insert as well as scsi_requeue_command.)  It also changes
scsi_kill_requests to make it call __scsi_done with result equal to
DID_NO_CONNECT << 16.  (I'm not sure if it's necessary to call
scsi_init_cmd_errh here; maybe you can check on that.)  Finally, the
patch changes the return value from scsi_end_request, to avoid
returning a stale pointer in the case where the request was requeued.
Fortunately the return value is used in only place, and the change
actually simplified it.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>

Rejections fixed up and
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-09 10:44:16 -05:00
Neil Brown 286f3e13a1 [SCSI] fix possible deadlock in scsi_lib.c
If a filesystem, while writing out data, decides that it is good
to issue a cache flush on a SCSI drive (or other 'sd' device), it will
call blkdev_issue_flush which calls ->issue_flush_fn which is
scsi_issue_flush_fn.
This calls sd_issue_flush which calls sd_sync_cache, which calls
scsi_execute_request.
This will (as sshdr != NULL) call
    kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_KERNEL)

If memory is tight, the presence of GFP_KERNEL may cause write
requests to be sent to some filesystem to free up memory, however if
that filesystem is waiting for the issue_flush_fn to complete, you
could get a deadlock.

I wonder if it might be more appropriate to use GFP_NOIO as in the
following patch.

I wonder if it might be even more appropriate to cope better with a
kmalloc failure, especially as in this use, sd_sync_cache only will
use the sense information to print out a more informative error
message.

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-09 10:29:22 -05:00
Alan Stern 903f4fed85 [SCSI] fix callers of scsi_remove_device() who already hold the scan muted
This patch (as544) adds a private entry point to scsi_remove_device, for
use when callers already own the scan_mutex.  The appropriate callers are
modified to use the new entry point.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-09 10:28:17 -05:00
Alan Stern e517d3133f [SCSI] add missing scan mutex to scsi_scan_target()
This patch (as543) adds a private entry point to scsi_scan_target, for use
when the caller already owns the scan_mutex, and updates the kerneldoc for
that routine (which was badly out-of-date).  It converts scsi_scan_channel
to use the new entry point.  Lastly, it modifies scsi_get_host_dev to make
it acquire the scan_mutex, necessary since the routine adds a new
scsi_device even if it doesn't do any actual scanning.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-09 10:24:31 -05:00
Jeff Garzik 8add788574 [libata] minor fixes
* sata_mv: remove pci_intx(), now that the same function is in PCI core
* sata_sis: fix variable initialization bug, trim trailing whitespace
2005-09-08 23:07:29 -04:00
Brett M Russ a04ce0ffca [PATCH] PCI/libata INTx cleanup
Simple cleanup to eliminate X copies of the pci_enable_intx() function
in libata.  Moved ahci.c's pci_intx() to pci.c and use it throughout
libata and msi.c.

Signed-off-by: Brett Russ <russb@emc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-09-08 15:07:08 -07:00
Hannes Reinecke 6a690df5c8 [PATCH] scan all enabled ports on ata_piix
ICH6 spec defines the PORT_ bits as:

PORT_ENABLED (R/W):

  0 = Disabled.  The port is in the off state and cannot detect any
  devices.

  1 = Enabled.  The port can transition between the on, partial, and
  slumber states and can detect devices.

PORT_PRESENT  (R/O)

  The status of this bit may change at any time.  This bit is cleared
  when the port is disabled via PORT_ENABLED.  This bit is not cleared upon
  surprise removal of a device.

So from a textual view it is not necessary that PORT_PRESENT _must_ be set,
especially if a device detection has to be done anyway.  And, in fact, this
is the view that ACER has been taken with its new Laptops (e.g.  Travelmate
4150).

And the definition of PORT_ENABLED / PORT_PRESENT is mixed up, btw.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Jens Axboe <axboe@suse.de>
Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-09-08 05:57:23 -04:00
Jeff Garzik 1d6ae775d7 Merge /spare/repo/linux-2.6/ 2005-09-08 05:43:49 -04:00
Jeff Garzik 142e27fc8a Merge /spare/repo/linux-2.6/ 2005-09-08 05:41:28 -04:00
Jeff Garzik c324b44c34 Merge /spare/repo/linux-2.6/ 2005-09-08 05:39:55 -04:00
Jeff Garzik 5a2cec83a9 Merge /spare/repo/linux-2.6/ 2005-09-08 05:37:58 -04:00
Arnaud Patard f2c853bca5 [PATCH] sata_sis: Add support for SiS182 chipset
This patch adds support for the SiS182 sata chipset. This is a
minimalistic version of the patch from
http://bugme.osdl.org/show_bug.cgi?id=4192. Basically, it add the PCI
IDs and handles the change of the 2nd port adress register.

Signed-Off-By: Arnaud Patard <apatard@mandriva.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-09-07 20:35:36 -04:00
Linus Torvalds 0481990b75 Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-for-linus-2.6 2005-09-07 17:31:27 -07:00
Linus Torvalds 0dd7f883a9 Merge branch 'upstream' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/misc-2.6 2005-09-07 17:28:25 -07:00
Linus Torvalds cc896f0871 Merge branch 'upstream' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev 2005-09-07 17:27:39 -07:00
viro@ZenIV.linux.org.uk 147a67f010 [PATCH] bogus #if (ncr53c406)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-07 17:17:34 -07:00
viro@ZenIV.linux.org.uk 185a7a1cd7 [PATCH] -Wundef fixes (ncr5380)
NDEBUG and NDEBUG_ABORT are almost always used as integers in NCR5380; added
define to 0 if they are not defined, switched lone ifdef NDEBUG into if.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-07 17:17:33 -07:00
Pekka Enberg 82ca76b6b1 [PATCH] drivers: convert kcalloc to kzalloc
This patch converts kcalloc(1, ...) calls to use the new kzalloc() function.

Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-07 16:57:46 -07:00
Jeff Garzik ca20aa6954 [libata sata_mv] fix build
This function will go away when pci_intx() finally makes it
into the core PCI layer.
2005-09-07 02:05:59 -04:00
Brett Russ 20f733e7d7 [PATCH] libata: Marvell SATA support (PIO mode)
This is my libata compatible low level driver for the Marvell SATA
family.  Currently it successfully runs in PIO mode on a 6081 chip.
EDMA support is in the works and should be done shortly.  Review,
testing (especially on other flavors of Marvell), comments welcome.

Signed-off-by: Brett Russ <russb@emc.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-09-07 01:56:09 -04:00
Brett Russ 7da7931283 [PATCH] libata: fix pio_mask values (take 2)
ata_get_mode_mask() uses bits 3 and 4 in the pio_mask to represent PIO
modes 3 and 4.  The value read from the drive, which reports support
for PIO3 and PIO4 in bits 0 and 1, is shifted left by 3 bits and OR'd
with 0x7 (which then corresponds to PIO 2-0 in libata).  Thus, the
drivers below need adjustments to comply with the way pio_mask is
used.  I changed the masks from the commented values to all support
PIO4-0, since the spec mandates that PIO0-2 are supported and there's
no reason not to support PIO3 IMO.

Signed-off-by: Brett Russ <russb@emc.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-09-07 01:54:54 -04:00
Jeff Garzik 344babaa9d [kernel-doc] fix various DocBook build problems/warnings
Most serious is fixing include/sound/pcm.h, which breaks the DocBook
build.

The other stuff is just filling in things that cause warnings.
2005-09-07 01:15:17 -04:00
James Bottomley 17fa53da12 Merge by hand (conflicts in sd.c) 2005-09-06 17:52:54 -05:00
James Bottomley 3173d8c342 [SCSI] quieten messages on scsi_execute commands
scsi_io_completion() can be a bit noisy about certain conditions.
Previously this wasn't a problem for internally generated commands,
since they never hit it.  However, since we do all SCSI commands via
bios, now they do.  user CD testers like magicdev are now getting not
ready messages every time they touch the CD to see if there's anything
in it.

Fix this by making all scsi_execute commands REQ_QUIET and making
scsi_finish_io() not say anything for REQ_QUIET.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-06 17:37:57 -05:00
Christoph Hellwig fe1b2d544d [SCSI] unexport scsi_add_timer/scsi_delete_timer
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-06 17:26:37 -05:00
Christoph Hellwig c5478def7a [SCSI] switch EH thread startup to the kthread API
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-06 17:26:06 -05:00
Christoph Hellwig 32993523dc [SCSI] fix SCSI_IOCTL_PROBE_HOST
This returns always false with new-style drivers right now.  Make it
return always true instead, as a host must be present if we are able
to call the ioctl (without a host attached there would be no device
node to call on..)

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-06 17:25:16 -05:00
Anton Blanchard 4869040512 [SCSI] Universal Xport no attach blacklist
On Fri, Dec 13, 2002 at 12:24:39AM +1100, Anton Blanchard wrote:

> We tested 2.5.51 on a ppc64 box, qlogic 2312 and a fastt700 array. I
> had CONFIG_SCSI_REPORT_LUNS and unfortunately it thought the management
> LUN was a disk:
>
>   Vendor: IBM       Model: Universal Xport   Rev: 0520
>   Type:   Direct-Access                      ANSI SCSI revision: 03
>
> ...
>
> SCSI device sdaj: drive cache: write through
> SCSI device sdaj: 40960 512-byte hdwr sectors (21 MB)
>  sdaj: unknown partition table
> Attached scsi disk sdaj at scsi2, channel 0, id 0, lun 31
>
> ...
>
> end_request: I/O error, dev sdaj, sector 0

Three years later...

It looks like SGI use the same FC vendor and they already have a
workaround for this issue. The following patch adds the IBM version of
it.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-06 17:23:43 -05:00
Alan Stern 4451e47262 [SCSI] sd: pause in sd_spinup_disk for slow USB devices
This patch adds a delay tailored for USB flash devices that are slow to
initialize their firmware.  The symptom is a repeated Unit Attention with
ASC=0x28 (Not Ready to Ready transition).  The patch will wait for up to 5
seconds for such devices to become ready.  Normal devices won't send the
repeated Unit Attention sense key and hence won't trigger the patch.

This fixes a problem with James Roberts-Thomson's USB device, and I've
seen several reports of other devices exhibiting the same symptoms --
presumably they will be helped as well.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-06 17:21:53 -05:00
Alan Stern e47373ec1c [SCSI] return success after retries in scsi_eh_tur
The problem lies in the way the error handler uses TEST UNIT READY to
tell whether error recovery has succeeded.  The scsi_eh_tur function
gives up after one round of retrying; after that it decides that more
error recovery is needed.

However TUR is liable to report sense data indicating a retry is needed
when in fact error recovery has succeeded.  A typical example might be
SK=2, ASC=4, ASCQ=1 (Logical unit in process of becoming ready).  The mere
fact that we were able to get a sensible reply to the TUR should indicate
that the device is working well enough to stop error recovery.

I ran across a case back in January where this happened.  A CD-ROM drive
timed out the INQUIRY command, and a device reset fixed the blockage.
But then the drive kept responding with 2/4/1 -- because it was spinning
up I suppose -- until the error handler gave up and placed it offline.
If the initial INQUIRY had received the 2/4/1 instead, everything would
have worked okay.  It doesn't seem reasonable for things to fail just
because the error handler had started running.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-06 17:19:23 -05:00
James Bottomley 4dddbc26c3 [SCSI] ibmvscsi: handle large scatter/gather lists
The maximum size of a scatter-gather list that the current IBM VSCSI
Client can handle is 10.  This patch adds large scatter-gather support
to the client so that it is capable of handling up to SG_ALL(255)
number of requests in the scatter-gather list.

Signed-off-by: Linda Xie <lxie@us.ibm.com>
Acked by: Dave C Boutcher <sleddog@us.ibm.com>

Rejections fixed up and
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-06 17:11:54 -05:00
Linus Torvalds 94f8c66e5e Merge branch 'upstream' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev 2005-09-05 05:50:36 -07:00
Jeff Garzik d0bd99299b /spare/repo/libata-dev branch 'iomap-try3' 2005-09-05 05:20:33 -04:00
Pavel Machek ca078bae81 [PATCH] swsusp: switch pm_message_t to struct
This adds type-checking to pm_message_t, so that people can't confuse it
with int or u32.  It also allows us to fix "disk yoyo" during suspend (disk
spinning down/up/down).

[We've tried that before; since that cpufreq problems were fixed and I've
tried make allyes config and fixed resulting damage.]

Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Alexander Nyberg <alexn@telia.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-05 00:06:16 -07:00
Ralf Baechle 875d43e72b [PATCH] mips: clean up 32/64-bit configuration
Start cleaning 32-bit vs. 64-bit configuration.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-09-05 00:06:06 -07:00
Andrew Vasquez 1aab60c25e [SCSI] qla2xxx: Update version number to 8.01.00-k.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-04 19:54:06 -05:00
Andrew Vasquez f6ef3b1872 [SCSI] qla2xxx: Stop firmware execution at unintialization time.
On ISP24xx parts, stop execution of firmware during ISP
tear-down.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-04 19:53:57 -05:00
Andrew Vasquez fe74c71f6b [SCSI] qla2xxx: Replace schedule_timeout().
From: Nishanth Aravamudan <nacc@us.ibm.com>

Replace schedule_timeout() with
msleep()/msleep_interruptible() as appropriate, to guarantee the task
delays as expected.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Signed-off-by: Domen Puncer <domen@coderock.org>
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-04 19:53:52 -05:00
Andrew Vasquez 86cd6baa82 [SCSI] qla2xxx: Remove bad call to fc_remove_host() during probe failure.
fc_remove_host() should only be called after a scsi_host has
been successfully added via scsi_add_host() -- any failures
while qla2xxx probing would result in an incorrect call to
fc_remove_host() during cleanup.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-04 19:53:50 -05:00
Andrew Vasquez afb046e2be [SCSI] qla2xxx: Add host attributes.
Export additional host information via the shost_attrs member in
the scsi_host template.  Attributes include: driver version,
firmware version, ISP serial number, ISP type, ISP product ID,
HBA model name, HBA model description, PCI interconnect
information, and HBA port state.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-04 19:53:42 -05:00
Andrew Vasquez ce7e4af7f5 [SCSI] qla2xxx: Add change_queue_depth/type() API support.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-04 19:53:40 -05:00
Andrew Vasquez 131736d34e [SCSI] qla2xxx: Remove redundant call to pci_unmap_sg().
In a corner-case failure where the request-q does not
contain enough entries for a given request, pci_unmap_sg()
would be called twice.  Remove direct call and let the
failure-path logic handle the unmapping.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-04 19:53:28 -05:00
Andrew Vasquez c32c4cb9fb [SCSI] qla2xxx: Remove RISC pause/release barriers during flash manipulation.
Remove unnecessary RISC pause/release barriers during
ISP24xx flash manipulation.  The ISP24xx can arbitrate flash
access requests during RISC executions.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-04 19:53:23 -05:00
Andrew Vasquez 06c22bd13f [SCSI] qla2xxx: Correct LED scheme definition.
Original implementation used an overloaded bit in the EFI
parameters.  The correct bit is BIT_4 of the special_options
section of NVRAM.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-04 19:53:12 -05:00
Andrew Vasquez c00c72ae01 [SCSI] qla2xxx: Simplify redundant target/device reset logic.
Remove redundant qla2x00_target_reset() function in favour of
the equivalent qla2x00_device_reset().  Update callers of
old function.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-04 19:53:10 -05:00
Andrew Vasquez f7d289f62e [SCSI] qla2xxx: Correct domain/area exclusion logic.
In an FL topology, limit port recognition to those devices
not within the same area and domain of the ISP.  The
firmware will recogonize such devices during local-loop
discovery.

Some devices may respond to a PLOGI before they have
completed their fabric login or they may not be a public
device. In this case they will report:

        domain == 00
        area == 00
        alpa == <XX>

which is valid. Exclude such devices from local loop
discovery.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-04 19:53:08 -05:00
Andrew Vasquez cca5335caf [SCSI] qla2xxx: Add FDMI support.
Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-04 19:53:07 -05:00
Andrew Vasquez ad3e0edace [SCSI] qla2xxx: Export class-of-service (COS) information.
Export COS information for the fc_host and fc_remote_port
objects added by the driver.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-04 19:53:04 -05:00
Andrew Vasquez 7524f9b9e7 [SCSI] qla2xxx: Use dma_get_required_mask() in determining the 'ideal' DMA mask.
In order to efficiently utilise the ISP's IOCB
request-queue, use the dma_get_required_mask() function to
determine the use of command-type 2 or 3 IOCBs when queueing
SCSI commands.  This applies to ISP2[123]xx chips only, as
the ISP24xx uses command-type 7 IOCBs which use 64bit DSDs.

Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-04 19:53:02 -05:00
Christoph Hellwig 1ff927306e [SCSI] aic7xxx: remove aiclib.c
#include of C files and macro tricks to rename symbols are evil and just
cause trouble.  Let's doublicate the two functions as they're going to
go away soon enough anyway.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-04 19:46:07 -05:00
Mark Haverkamp 77d71d222e [SCSI] aacraid: bad BUG_ON fix
This was noticed by Doug Bazamic and the fix found by Mark Salyzyn at
Adaptec.

There was an error in the BUG_ON() statement that validated the
calculated fib size which can cause the driver to panic.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-04 19:46:06 -05:00
Douglas Gilbert deb92b7ee9 [SCSI] sg direct io/mmap oops, st sync
This patch adopts the same solution as proposed by Kai M. in
a post titled: "[PATCH] SCSI tape signed/unsigned fix".
The fix is in a function that the sg driver borrowed from
the st driver so its maintenance is a little easier if
the functions remain the same after the fix.

   - change nr_pages type from unsigned to signed so errors
     from get_user_pages() call are properly handled

Signed-off-by: Douglas Gilbert <dougg@torque.net>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-04 19:46:03 -05:00
James Bottomley 07542b8323 This patch fixes in st.c the bug in the signed/unsigned int comparison
reported by Doug Gilbert and fixed by him in sg.c (see [PATCH] sg direct
io/mmap oops). Doug fixed the comparison in sg.c. This fix for st.c does not
touch the comparison but makes both arguments signed to remove the
problem. The new code is adapted from linux/fs/bio.c.

Signed-off-by: Kai Makisara <kai.makisara@kolumbus.fi>

Rejections fixed up and

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-09-04 19:45:59 -05:00
James Bottomley 61a7afa2c4 [SCSI] embryonic RAID class
The idea behind a RAID class is to provide a uniform interface to all
RAID subsystems (both hardware and software) in the kernel.

To do that, I've made this class a transport class that's entirely
subsystem independent (although the matching routines have to match per
subsystem, as you'll see looking at the code).  I put it in the scsi
subdirectory purely because I needed somewhere to play with it, but it's
not a scsi specific module.

I used a fusion raid card as the test bed for this; with that kind of
card, this is the type of class output you get:

jejb@titanic> ls -l /sys/class/raid_devices/20\:0\:0\:0/
total 0
lrwxrwxrwx  1 root root     0 Aug 16 17:21 component-0 -> ../../../devices/pci0000:80/0000:80:04.0/host20/target20:1:0/20:1:0:0/
lrwxrwxrwx  1 root root     0 Aug 16 17:21 component-1 -> ../../../devices/pci0000:80/0000:80:04.0/host20/target20:1:1/20:1:1:0/
lrwxrwxrwx  1 root root     0 Aug 16 17:21 device -> ../../../devices/pci0000:80/0000:80:04.0/host20/target20:0:0/20:0:0:0/
-r--r--r--  1 root root 16384 Aug 16 17:21 level
-r--r--r--  1 root root 16384 Aug 16 17:21 resync
-r--r--r--  1 root root 16384 Aug 16 17:21 state

So it's really simple: for a SCSI device representing a hardware raid,
it shows the raid level, the array state, the resync % complete (if the
state is resyncing) and the underlying components of the RAID (these are
exposed in fusion on the virtual channel 1).

As you can see, this type of information can be exported by almost
anything, including software raid.

The more difficult trick, of course, is going to be getting it to
perform configuration type actions with writable attributes.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-30 22:48:51 -05:00
Jeff Garzik 6f10623304 [libata] fix ATAPI-enable typo
Dumb typo spotted by Mark Lord.
2005-08-30 21:52:18 -04:00
Jeff Garzik 374b187357 [libata] update several drivers to use pci_iomap()/pci_iounmap() 2005-08-30 05:42:52 -04:00
Jeff Garzik ea6ba10bbb [libata] __iomem annotations for various drivers 2005-08-30 05:18:18 -04:00
Jeff Garzik e005f01de3 [libata ahci] minor remove/unplug path cleanup
Don't bother calling a hook, to call our own module, to call a helper
than simply calls ionumap().

If you unroll all that convolution, you get a simple kfree()+iounmap()
pair of calls.
2005-08-30 04:18:28 -04:00
Jeff Garzik 2fcf522509 /spare/repo/libata-dev branch 'master' 2005-08-30 03:48:57 -04:00
Jeff Garzik 4dd9e909e3 /spare/repo/libata-dev branch 'master' 2005-08-30 03:38:51 -04:00
Jeff Garzik 1623c81eec [libata] allow ATAPI to be enabled with new atapi_enabled module option
ATAPI is getting close to being ready.  To increase exposure, we enable
the code in the upstream kernel, but default it to off (present
behavior).  Users must pass atapi_enabled=1 as a module option (if
module) or on the kernel command line (if built in) to turn on
discovery of their ATAPI devices.
2005-08-30 03:37:42 -04:00
Linus Torvalds a8e4f435d9 Merge refs/heads/upstream from master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev 2005-08-29 22:04:58 -07:00
Stephen Rothwell fb120da678 [PATCH] Make MODULE_DEVICE_TABLE work for vio devices
Make MODULE_DEVICE_TABLE work for vio devices.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-08-30 13:31:56 +10:00
Stephen Rothwell 71d276d751 [PATCH] Create vio_bus_ops
Create vio_bus_ops so that we just pass a structure to vio_bus_init
instead of three separate function pointers.

Rearrange vio.h to avoid forward references. vio.h only needs
struct device_node from prom.h so remove the include and just
declare it.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
2005-08-30 13:23:47 +10:00
Jeff Garzik 76b2bf9b4d Merge libata branch 'chs-support' to latest upstream kernel. 2005-08-29 19:24:43 -04:00
Jeff Garzik 739cdbf1d8 Merge /spare/repo/linux-2.6/ 2005-08-29 19:10:39 -04:00
Jeff Garzik 502c7f1dd5 Merge /spare/repo/linux-2.6/ 2005-08-29 19:06:29 -04:00
Jeff Garzik da61396d24 Merge upstream kernel into libata 'passthru' branch 2005-08-29 19:01:43 -04:00
Jeff Garzik 2fca877b68 /spare/repo/libata-dev branch 'v2.6.13' 2005-08-29 16:12:36 -04:00
Jeff Garzik 70d374ea99 Merge /spare/repo/linux-2.6/ 2005-08-29 15:59:42 -04:00
Jeff Garzik aa7e16d6b8 [libata sata_nv] NVIDIA ok'd license change from OSL+GPL to GPL 2005-08-29 15:12:56 -04:00
Linus Torvalds 5be1d85c20 Merge refs/heads/upstream from master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev 2005-08-29 10:03:46 -07:00
Jeff Garzik 2cba582a49 [libata sata_promise] Do not attempt to use SATA phy on PATA controllers 2005-08-29 05:12:30 -04:00
Jeff Garzik af36d7f0df [libata] license change, other bits
- changes license of all code from OSL+GPL to plain ole GPL
  - except for NVIDIA, who hasn't yet responded about sata_nv
  - copyright holders were already contacted privately

- adds info in each driver about where hardware/protocol docs may be
  obtained

- where I have made major contributions, updated copyright dates
2005-08-28 20:18:39 -04:00
James Bottomley ba482ef4b1 Merge by hand (conflicts in sr.c) 2005-08-28 11:40:00 -05:00
James Bottomley e514385be2 [SCSI] fix sense buffer length handling problem
The new bio code was incorrectly converted from stack allocated to
kmalloc'd buffer handling.  There are two places where it incorrectly
uses sizeof(*sense) to get the size of the sense buffer.  This
actually produces one, so no sense data was ever getting back, causing
failure in things like disk spin up.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-28 11:34:12 -05:00
James Bottomley c9d297c543 [SCSI] fix 3ware raid emulated commands
The 3ware emulated commands all expect they are executing in the
use_sg == 0 case, which isn't true either in the block layer rework or
an SG_IO ioctl.

Fix this by adding the correct kmapping of the first element in the sg
list.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-28 11:34:11 -05:00
Christoph Hellwig f189c5cb8d [SCSI] comment cleanup for spi_execute
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-28 11:34:10 -05:00
akpm@osdl.org 1ccb48bb16 [SCSI] fix C syntax problem in scsi_lib.c
Older gcc's require variable definitions at the beginning of a block.

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-28 11:34:09 -05:00
James Bottomley 84743bbcf9 [SCSI] convert ch to use scsi_execute_req
I also tinkered with it's sense recognition routines to make them take
scsi_sense_hdr structures instead of raw sense data.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-28 11:34:08 -05:00
James Bottomley 820732b501 [SCSI] convert sr to scsi_execute_req
This follows almost the identical model to sd, except that there's one
ioctl which returns raw sense data, so it had to use scsi_execute()
instead.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-28 11:34:07 -05:00
James Bottomley ea73a9f239 [SCSI] convert sd to scsi_execute_req (and update the scsi_execute_req API)
This one removes struct scsi_request entirely from sd.  In the process,
I noticed we have no callers of scsi_wait_req who don't immediately
normalise the sense, so I updated the API to make it take a struct
scsi_sense_hdr instead of simply a big sense buffer.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-28 11:33:52 -05:00
James Bottomley 33aa687db9 [SCSI] convert SPI transport class to scsi_execute
This one's slightly more difficult.  The transport class uses
REQ_FAILFAST, so another interface (scsi_execute) had to be invented to
take the extra flag.  Also, the sense functions are shifted around to
allow spi_execute to place data directly into a struct scsi_sense_hdr.
With this change, there's probably a lot of unnecessary sense buffer
allocation going on which we can fix later.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-28 11:31:14 -05:00
James Bottomley 1cf72699c1 [SCSI] convert the remaining mid-layer pieces to scsi_execute_req
After this, we just have some drivers, all the ULDs and the SPI
transport class using scsi_wait_req().

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-28 11:27:01 -05:00
James Bottomley 7a93aef7fb Merge HEAD from ../scsi-misc-2.6-tmp 2005-08-28 11:18:35 -05:00
Pete Zaitcev 51490c89f9 [SCSI] sr.c: Fix getting wrong size
Here's the problem. Try to do this on 2.6.12:
- Kill udev and HAL
- Insert a CD-ROM into a SCSI or USB CD-ROM drive
- Run dd if=/dev/scd0
- cat /sys/block/sr0/size
- Eject the CD, insert a different one
- Run dd if=/dev/scd0
This is likely to do "access beyond the end of device", if you let it
- cat /sys/block/sr0/size
This shows the size of a previous CD, even though dd was supposed
to revalidate the device.
- Run dd if=/dev/scd0
The second run of dd works correctly!

The bug was introduced in 2.5.31, when Al fixes the recursive opens
in partitioning. Before, the code worked like this:
- Block layer called cdrom_open directly
- cdrom_open called sr_open
- sr_open called check_disk_change
- check_disk_change called sr_media_change
- sr_media_change did cd->needs_disk_change=1
- before returning sr_open tested cd->needs_disk_change
  and called get_sector_size.

In 2.6.12, the check_disk_change is called from cdrom_open only. Thus:
- Block layer calls sr_bd_open
- sr_bd_open calls cdrom_open
- cdrom_open calls sr_open
- sr_open tests cd->needs_disk_change, which wasn't set yet; returns
- cdrom_open calls check_disk_change
- check_disk_change calls sr_media_change
- sr_media_change does cd->needs_disk_change=1, but nobody cares

Acked by: Alexander Viro <aviro@redhat.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-28 11:14:12 -05:00
Dave C Boutcher 8224bfa84d [SCSI] ibmvscsi timeout fix
This patch fixes a long term borkenness in
ibmvscsi where we were using the wrong timeout
field from the scsi command (and using the
wrong units.)  Now broken by the fact that the
scsi_cmnd timeout field is gone entirely.
This only worked before because all the SCSI
targets assumed that 0 was default.

Signed-off-by: Dave Boutcher <boutcher@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-28 11:14:11 -05:00
Adrian Bunk de540a53f2 [SCSI] drivers/scsi/constants.c should include scsi_dbg.h
C files should include the files with the prototypes for their global
functions.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-28 11:14:10 -05:00
Dave C Boutcher be042f240a [SCSI] ibmvscsi eh locking
With the removal of the spinlocking around eh calls, we need to add a
little more locking back in, otherwise we do some naked list
manipulation.

Signed-off-by: Dave Boutcher <boutcher@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-28 11:14:08 -05:00
Mark Haverkamp 3b2946cc96 [SCSI] aacraid: Fix aacraid probe breakage (updated)
This patch fixes the bad assumption of the aacraid driver with use_sg.
I used the 3w-xxxx driver fix as a guide for this.

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-28 11:14:07 -05:00
James Bottomley 392160335c [SCSI] use scatter lists for all block pc requests and simplify hw handlers
Original From: Mike Christie <michaelc@cs.wisc.edu>

Add scsi_execute_req() as a replacement for scsi_wait_req()

Fixed up various pieces (added REQ_SPECIAL and caught req use after
free)

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-28 10:46:40 -05:00
James Bottomley 8e6401187e update scsi_wait_req to new format for blk_rq_map_kern()
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-28 10:46:39 -05:00
James Bottomley e537a36d52 [SCSI] use scatter lists for all block pc requests and simplify hw handlers
Here's the proof of concept for this one.  It converts scsi_wait_req to
do correct REQ_BLOCK_PC submission (and works nicely in my setup).

The final goal should be to eliminate struct scsi_request, but that
can't be done until the character submission paths of sg and st are also
modified.

There's some loss of functionality to this: retries are no longer
controllable (except by setting REQ_FASTFAIL) and the wait_req API needs
to be altered, but it looks very nice.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-08-28 10:45:34 -05:00