Commit graph

122 commits

Author SHA1 Message Date
Jeff Garzik 68b3aa7c98 [SCSI] allow sleeping in ->eh_bus_reset_handler()
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-17 12:05:10 -05:00
Jeff Garzik 94d0e7b805 [SCSI] allow sleeping in ->eh_device_reset_handler()
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-17 12:05:03 -05:00
Jeff Garzik 8fa728a268 [SCSI] allow sleeping in ->eh_abort_handler()
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-17 12:04:55 -05:00
Jeff Garzik 3471c28803 [SCSI] Remove no-op implementations of SCSI EH hooks
Drivers need not implement a hook that returns FAILED, and does nothing
else, since the SCSI midlayer code will do that for us.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-17 12:04:45 -05:00
Jeff Garzik e3df715501 [SCSI] Remove unnecessary locking around completion function calls
The SCSI ->done() hook should not be called from inside a spinlock.

Drivers that do this are mostly cut-n-paste from 2.2.x-era.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-17 12:04:37 -05:00
James Bottomley 12021fff2b [SCSI] aic7xxx: fix the BIOS limits setting routines
Following the go around over the SONY DVD that needs artificial limits,
this should be the correct code for all cases (minus the debugging
prints).

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-13 21:37:27 -05:00
Christoph Hellwig d6cbbad729 [SCSI] aic7xxx: clean up eisa support
- the eisa layer only probes when it's actually safe, no need for
   a driver option
 - store the id table directly in linux format instead of convering
   at runtime

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-11 18:45:06 -05:00
Christoph Hellwig 8eb3794257 [SCSI] aic7xxx: remove some dead wood
especially the now dead scsi_cmnd overlay

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-11 18:44:12 -05:00
Christoph Hellwig 3d65692aed [SCSI] aic7xxx: remove ahc_find_softc
there's absolutely no reason not to trust the driver private data

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-11 18:43:48 -05:00
Christoph Hellwig e431223eca [SCSI] aic7xxx: do not check for duplicate pci ids
pci layer handles this just fine for us

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-11 18:38:41 -05:00
Christoph Hellwig 765c4d45b8 [SCSI] aic7xxx/aic79xx: remove useless byte order macro cruft
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-11 18:38:21 -05:00
Mark Haverkamp 0bb14afe10 [SCSI] 2.6 aacraid: updated sysfs files
This patch adds some files into the /sys/class/scsi_host/hostN
directories for aacraid adapters:

model
vendor
hba_kernel_version
hba_monitor_version
hba_bios_version
serial_number

Signed-off-by: Mark Haverkamp <markh@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-03 12:44:12 -05:00
James Bottomley 9a8bc9b84b [SCSI] update spi transport class so that u320 Domain Validation works
There are several extra things that have to be considered when running
Domain Validation on a u320 target (notably how you fall back).

Hopefully this should help us when someone adds this transport class to
aic79xx.

I've tested this on the lsi1030, so I know it works correctly up to
u320.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-03 12:39:53 -05:00
James Bottomley 597487b9ba [SCSI] fix aic7xxx coupled parameter problem
For setting coupled parameters, we need to be comparing against the goal
settings, not the current ones.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-03 12:38:39 -05:00
brking@us.ibm.com 521314c122 [SCSI] sg: Command completion after remove oops
A problem exists todayin the sg driver that if an SG_IO request is
outstanding to a device when it is removed from the system. The
system may oops if that command completes later in time.

1. sg_remove gets called
2. sg_remove calls sg_finish_req_req on all pending requests
   This removes the Sg_request's from the headrp list in the Sg_fd
3. The sleeping SG_IO ioctl is woken. It does nothing and returns.
4. The caller closes the fd, which invokes sg_release
5. sg_release calls sg_remove_sfp. It finds no outstanding commands
   since the headrp list is empty, so it calls __sg_remove_sfp,
   which frees the sfp.
6. Now when sg_cmd_done gets called, sg uses upper_private_data in
   the Scsi_Request, which should point to the srp, which has been
   freed, so it points to freed memory.
7. sg then dereferences the srp pointer to get the sfp, and we oops.

The fix is to NULL out the upper_private_data field in this path,
which sg_cmd_done already checks for, which will prevent the oops
from occurring.

cpu 0x1: Vector: 300 (Data Access) at [c00000000fff7aa0]
    pc: d0000000002bbea8: .sg_cmd_done+0x70/0x394 [sg]
    lr: d000000000073304: .scsi_finish_command+0x10c/0x130 [scsi_mod]
    sp: c00000000fff7d20
   msr: 8000000000009032
   dar: 2f70726f63202f78
 dsisr: 40000000
  current = 0xc0000000024589b0
  paca    = 0xc0000000003da800
    pid   = 7, comm = events/1
[c00000000fff7dc0] d000000000073304 .scsi_finish_command+0x10c/0x130 [scsi_mod]
[c00000000fff7e50] d00000000007317c .scsi_softirq+0x140/0x168 [scsi_mod]
[c00000000fff7ef0] c0000000000634dc .__do_softirq+0xa0/0x17c
[c00000000fff7f90] c000000000018430 .call_do_softirq+0x14/0x24
[c00000000ed472e0] c0000000000142e0 .do_softirq+0x74/0x9c
[c00000000ed47370] c000000000013c9c .do_IRQ+0xe8/0x100
[c00000000ed473f0] c00000000000ae34 HardwareInterrupt_entry+0x8/0x54

c00000000003df28 .smp_call_function+0
x100/0x1d0
[c00000000ed47780] c0000000000ba99c .invalidate_bh_lrus+0x30/0x70
[c00000000ed47810] c0000000000b91a0 .invalidate_bdev+0x18/0x3c
[c00000000ed478a0] c0000000000da7b8 .__invalidate_device+0x70/0x94
[c00000000ed47930] c0000000001d40bc .invalidate_partition+0x4c/0x7c
[c00000000ed479c0] c00000000010a944 .del_gendisk+0x48/0x15c
[c00000000ed47a50] d00000000003d55c .sd_remove+0x34/0xe4 [sd_mod]
[c00000000ed47ae0] c0000000001c5d30 .device_release_driver+0x90/0xb4
[c00000000ed47b70] c0000000001c6130 .bus_remove_device+0xb0/0x12c
[c00000000ed47c00] c0000000001c4378 .device_del+0x120/0x198
[c00000000ed47ca0] d00000000007dcdc .scsi_remove_device+0xb4/0x194 [scsi_mod]
[c00000000ed47d30] d0000000000a5864 .ipr_worker_thread+0x1d4/0x27c [ipr]
[c00000000ed47dd0] c0000000000734c4 .worker_thread+0x238/0x2f4
[c00000000ed47ee0] c0000000000796c0 .kthread+0xcc/0x11c
[c00000000ed47f90] c000000000018ad0 .kernel_thread+0x4c/0x6c

Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-06-03 12:25:35 -05:00
James Bottomley b1abb4d67f [SCSI] aic7xxx: remove separate target and device allocations
Since the aic driver is now taught to speak in terms of the generic
linux devices, we can now also dispense with the transport class get
routines (since we update the parameters when the driver sees they
change) and also plumb it into the spi transport transfer agreement
reporting infrastructure.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-26 14:28:31 -04:00
James Bottomley 153b1e1fd9 Automatic merge of ../scsi-misc-2.6-old/ 2005-05-26 14:14:55 -04:00
Linus Torvalds cdbbde14cb Merge of 'misc-fixes' branch from
rsync://rsync.kernel.org/pub/scm/linux/kernel/git/jgarzik/libata-dev
2005-05-26 10:02:30 -07:00
James Bottomley a283bd37d0 [SCSI] Add target alloc/destroy callbacks to the host template
This gives the HBA driver notice when a target is created and
destroyed to allow it to manage its own target based allocations
accordingly.

This is a much reduced verson of the original patch sent in by
James.Smart@Emulex.com

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-26 11:27:53 -04:00
Al Viro 631e8a1398 [SCSI] TYPE_RBC cache fixes (sbp2.c affected)
a) TYPE_SDAD renamed to TYPE_RBC and taken to scsi.h
	b) in sbp2.c remapping of TYPE_RPB to TYPE_DISK turned off
	c) relevant places in midlayer and sd.c taught to accept TYPE_RBC
	d) sd.c::sd_read_cache_type() looks into page 6 when dealing with
TYPE_RBC - these guys have writeback cache flag there and are not guaranteed
to have page 8 at all.
	e) sd_read_cache_type() got an extra sanity check - it checks that
it got the page it asked for before using its contents.  And screams if
mismatch had happened.  Rationale: there are broken devices out there that
are "helpful" enough to go for "I don't have a page you've asked for, here,
have another one".  For example, PL3507 had been caught doing just that...
	f) sbp2 sets sdev->use_10_for_rw and sdev->use_10_for_ms instead
of bothering to remap READ6/WRITE6/MOD_SENSE, so most of the conversions
in there are gone now.

	Incidentally, I wonder if USB storage devices that have no
mode page 8 are simply RBC ones.  I haven't touched that, but it might
be interesting to check...

Signed-off-by: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-26 08:41:15 -05:00
Matthew Wilcox 53222b9069 [SCSI] sym2 version 2.2.1
sym2 version 2.2.1:
 - Fix MMIO BAR detection (Thanks to Bob Picco)
 - Fix odd-sized transfers with a wide bus (Thanks to Larry Stephens)
 - Write posting fixes (Thanks to Thibaut Varene)
 - Change one of the GFP_KERNEL allocations back into a GFP_ATOMIC
 - Make CCB_BA() return a script-endian address
 - Move range checks and disabling of devices from the queuecommand path
   to slave_alloc()
 - Remove a warning in sym_setup_cdb()
 - Keep a pointer to the scsi_target instead of the scsi_dev in the tcb
 - Remove a check for the upper layers passing an oversized cmd
 - Replace CAM_REQ_ constants with the Linux DID_ constants
 - Replace CAM_DIR_ constants with the Linux DMA_ constants
 - Inline sym_read_parisc_pdc() on non-parisc systems

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-26 08:41:14 -05:00
Stuart Hayes 41bb4c43b3 [PATCH] ide-scsi: kmap scatter/gather before doing PIO
From: Stuart Hayes <Stuart_Hayes@dell.com>

The system can panic with a null pointer dereference using ide-scsi if
PIO is being done on scatter gather pages that are in high memory,
because page_address() returns 0.  We are actually seeing this using a
tape drive.  This patch will kmap_atomic() the pages before performing
PIO.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@elka.pw.edu.pl>
2005-05-26 15:38:45 +02:00
Bartlomiej Zolnierkiewicz 8604affde9 [PATCH] convert IDE device drivers to driver-model
* add ide_bus_match() and export ide_bus_type
* split ide_remove_driver_from_hwgroup() out of ide_unregister()
* move device cleanup from ide_unregister() to drive_release_dev()
* convert ide_driver_t->name to driver->name
* convert ide_driver_t->{attach,cleanup} to driver->{probe,remove}
* remove ide_driver_t->busy as ide_bus_type->subsys.rwsem
  protects against concurrent ->{probe,remove} calls
* make ide_{un}register_driver() void as it cannot fail now
* use driver_{un}register() directly, remove ide_{un}register_driver()
* use device_register() instead of ata_attach(), remove ata_attach()
* add proc_print_driver() and ide_drivers_show(), remove ide_drivers_op
* fix ide_replace_subdriver() and move it to ide-proc.c
* remove ide_driver_t->drives, ide_drives and drives_lock
* remove ide_driver_t->drivers, drivers and drivers_lock
* remove ide_drive_t->driver and DRIVER() macro

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@elka.pw.edu.pl>
2005-05-26 14:55:34 +02:00
Albert Lee 32529e0128 [PATCH] libata: Fix zero sg_dma_len() on 64-bit platform
When testing ATAPI PIO data transfer on the ppc64 platform,  __atapi_pio_bytes() got zero when
sg_dma_len() is used. I checked the <asm-ppc64/scatterlish.h>, the struct scatterlist is defined as:

struct scatterlist {
	struct page *page;
	unsigned int offset;
	unsigned int length;

	/* For TCE support */
	u32 dma_address;
	u32 dma_length;
};

#define sg_dma_address(sg)	((sg)->dma_address)
#define sg_dma_len(sg)		((sg)->dma_length)

So, if the scatterlist is not DMA mapped, sg_dma_len() will return zero on ppc64.
The same problem should occur on the x86-64 platform.
On the i386 platform, sg_dma_len() returns sg->length, that's why the problem does not occur on an i386.

Changes:
- Use sg->length if the scatterlist is not DMA mapped (yet).

Signed-off-by: Albert Lee <albertcc@tw.ibm.com>
2005-05-26 03:49:42 -04:00
Francisco Javier 4c3a53d410 [PATCH] sata_promise: add PCI ID for FastTrak TX2200 2-ports 2005-05-25 19:29:37 -04:00
NAKAMURA Kenta 525a099771 [PATCH] sata_sil: new ID 1002:437A for ATI IXP400 2005-05-25 19:28:38 -04:00
Andrew Morton d981289627 [PATCH] aic7xxx_osm build fix
Fix a c99ism.

Cc: James Bottomley <James.Bottomley@steeleye.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-05-24 20:08:14 -07:00
Linus Torvalds 9636273dae Automatic merge of rsync://www.parisc-linux.org/~jejb/git/scsi-for-linus-2.6.git 2005-05-20 17:21:03 -07:00
James Bottomley 2bf2c568c8 [SCSI] aic7xxx: fix U160 mode
The new period/dt setting routines don't get the coupling of these
parameters correct.  This means that Domain Validation never gets DT
set, and thus the drive gets restricted to U80.

Fix this by restoring the couplings in the set routines.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 16:43:51 -05:00
James Bottomley fb3089dfb5 [SCSI] aic7xxx: add back locking
Tampering with the settings has to be done under the host lock ...
slave_alloc isn't called under any lock, so this has to be done
explicitly.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 15:54:43 -05:00
James Bottomley c7525233d2 [SCSI] aic7xxx: make correct use of slave_alloc/destroy and remove the per device timer
The allocation of all of our components should be done in slave alloc.
Currently it's rather fancifully refcounted in the queuecommand
callback.  This patch moves allocation and destroy to their correct
places in slave_alloc/slave_destory.  Now we can guarantee that
everywhere a device is requested, it's actually been allocated, so don't
check for this anymore.

Additionally, the per device busy timer was the only source of potential
use after free.  It's been deleted because Linux does the correct thing
with busy returns, so there's no need to implement a separate timer in
the driver.

Finally, implement code that forces all the device parameters to zero
(i.e. async and narrow) in the slave alloc, inform the spi class of the
bios recorded maximums and wait until slave configure before trying
anything more adventurous.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 15:54:42 -05:00
James Bottomley 8e45ebcc66 [SCSI] aic7xxx: remove the completeq
This should finish the spurious queue removal from aic7xxx (there are
other queues that are probably unnecessary, but at least the major and
obviously unnecessary ones are done with).

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 15:54:40 -05:00
James Bottomley 38c29ce06d [SCSI] aic7xxx: remove the last vestiges of the runq
This was rendered obsolete by the busyq removal; remove some of the last
remnants of its presence.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 15:54:39 -05:00
Christoph Hellwig 013791ee01 [SCSI] aic7xxx: remove usage of obsolete typedefs
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 15:54:38 -05:00
Christoph Hellwig 7dfa0f2673 [SCSI] remove dma_mask hacks
pci_alloc_consistent is under 4G by default.  Also simplify the
definition of bus_dmamap_t.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 15:54:37 -05:00
Christoph Hellwig dedd831081 [SCSI] aic7xxx: remove Linux 2.4 ifdefs
There's not much sense in sharing code anymore now that aic7xxx uses
various transport class facilities.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 15:54:36 -05:00
Christoph Hellwig c06716fe1c [SCSI] aic7xxx: remove some DV leftovers
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 15:54:35 -05:00
James Bottomley e4e360c325 [SCSI] remove aic7xxx busyq
The aic7xxx driver has two spurious queues in it's linux glue code: the
busyq which queues incoming commands to the driver and the completeq
which queues finished commands before sending them back to the mid-layer

This patch just removes the busyq and makes the aic finally return the
correct status to get the mid-layer to manage its queueing, so a command
is either committed to the sequencer or returned to the midlayer for
requeue.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 15:54:34 -05:00
James Bottomley fad01ef88d [SCSI] correct aic7xxx period setting routines
This is similar to the previous sym2 problem.  For Domain Validation to
work we can't allow any period setting to turn wide on if it was
previously off.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 15:54:33 -05:00
James Bottomley 62a8612972 [SCSI] implement parameter limits in the SPI transport class
There's a basic need not to have parameters go under or over certain
values when doing domain validation.  The basic ones are

max_offset, max_width and min_period

This patch makes the transport class take and enforce these three
limits.  Currently they can be set by the user, although they could
obviously be read from the HBA's on-board NVRAM area during
slave_configure (if it has one).

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 15:54:32 -05:00
Mark Haverkamp 7c00ffa314 [SCSI] 2.6 aacraid: Variable FIB size (updated patch)
New code from the Adaptec driver.  Performance enhancement for newer
adapters.  I hope that this isn't too big for a single patch.  I believe
that other than the few small cleanups mentioned, that the changes are
all related.

- Added Variable FIB size negotiation for new adapters.
- Added support to maximize scatter gather tables and thus permit
  requests larger than 64KB/each.
- Limit Scatter Gather to 34 elements for ROMB platforms.
- aac_printf is only enabled with AAC_QUIRK_34SG
- Large FIB ioctl support
- some minor cleanup

Passes sparse check.
I have tested it on x86 and ppc64 machines.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 15:48:00 -05:00
Ju, Seokmann 672b2d38da [SCSI] megaraid version 2.20.4.6
Signed-off by: Seokmann Ju <sju@lsil.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 15:47:59 -05:00
Patrick Mansfield 793698ce28 [SCSI] saved and restore result for timed out commands
Save and restore the scmd->result, so that timed out commands do not
return the result of the TEST UNIT READY or the start/stop commands. Code
is already in place to save and restore the result for the request sense
case.

The previous version of this patch erroneously removed the "if" check,
instead add a comment as to why the "if" is needed.

Signed-off-by: Patrick Mansfield <patmans@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 15:47:52 -05:00
James Bottomley ad34ea2cc3 merge by hand - fix up rejections in Documentation/DocBook/Makefile 2005-05-20 15:27:44 -05:00
Tejun Heo d8c37e7b9a [SCSI] remove a timer race in scsi_queue_insert()
scsi_queue_insert() has four callers.  Three callers call with
timer disabled and one (the second invocation in
scsi_dispatch_cmd()) calls with timer activated.
scsi_queue_insert() used to always call scsi_delete_timer()
and ignore the return value.  This results in race with timer
expiration.  Remove scsi_delete_timer() call from
scsi_queue_insert() and make the caller delete timer and check
the return value.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 12:53:54 -05:00
Tejun Heo 5b8ef84258 [SCSI] remove spurious if tests from scsi_eh_{times_out|done}
'if' tests which check if eh_action isn't NULL in both
functions are always true.  Remove the redundant if's as it
can give wrong impressions.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 12:53:53 -05:00
Tejun Heo 0155a37ea5 [SCSI] remove unnecessary scsi_delete_timer() call in scsi_reset_provider()
scsi_reset_provider() calls scsi_delete_timer() on exit which
isn't necessary.  Remove it.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 12:53:52 -05:00
Gerd Knorr 21feb5ccd5 [SCSI] convert scsi changer driver from class simple
Here is a incremental patch which switches the driver over to
the new non-simple functions.  Compile-tested.

Signed-off-by: Gerd Knorr <kraxel@bytesex.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 12:53:51 -05:00
Gerd Knorr daa6eda65a [SCSI] add scsi changer driver
This patch adds a device driver for scsi media changer devices.

Signed-off-by: Gerd Knorr <kraxel@bytesex.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 12:53:50 -05:00
brking@us.ibm.com 5cbf5eaef7 [SCSI] ipr: Fix ipr PCI hotplug hang with CDROM attach
Currently, during PCI hotplug remove, if the upper layer
drivers of the attached devices send commands down as part
of the remove action, like a CDROM, the hotplug action
will hang forever due to the ipr driver returning
SCSI_MLQUEUE_HOST_BUSY. Patch fixes this.

Signed-off-by: Brian King <brking@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-05-20 12:53:48 -05:00