History log of /drivers/block/cciss.c
Revision Date Author Comments
577ebb374c78314ac4617242f509e2f5e7156649 12-Jan-2012 Paolo Bonzini <pbonzini@redhat.com> block: add and use scsi_blk_cmd_ioctl

Introduce a wrapper around scsi_cmd_ioctl that takes a block device.

The function will then be enhanced to detect partition block devices
and, in that case, subject the ioctls to whitelisting.

Cc: linux-scsi@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>
Cc: James Bottomley <JBottomley@parallels.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
59bd71a81b66990564eac69aedd28ad87a2c81f4 28-Nov-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: fix flush cache transfer length

We weren't filling in the transfer length of the
flush cache command (it transfers 4 bytes of zeroes).
Firmware didn't seem to be bothered by this, but it
should be fixed.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
6225da481597ebff09454c785fe0afc7f5fdbb77 28-Nov-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Add IRQF_SHARED back in for the non-MSI(X) interrupt handler

IRQF_SHARED is required for older controllers that don't support MSI(X)
and which may end up sharing an interrupt.

Also remove deprecated IRQF_DISABLED.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
0007a4c90a11a5371c8b3f80b220fa402a399189 16-Nov-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: auto engage SCSI mid layer at driver load time

A long time ago, probably in 2002, one of the distros, or maybe more than
one, loaded block drivers prior to loading the SCSI mid layer. This meant
that the cciss driver, being a block driver, could not engage the SCSI mid
layer at init time without panicking, and relied on being poked by a
userland program after the system was up (and the SCSI mid layer was
therefore present) to engage the SCSI mid layer.

This is no longer the case, and cciss can safely rely on the SCSI mid
layer being present at init time and engage the SCSI mid layer straight
away. This means that users will see their tape drives and medium
changers at driver load time without need for a script in /etc/rc.d that
does this:

for x in /proc/driver/cciss/cciss*
do
echo "engage scsi" > $x
done

However, if no tape drives or medium changers are detected, the SCSI mid
layer will not be engaged. If a tape drive or medium change is later
hot-added to the system it will then be necessary to use the above script
or similar for the device(s) to be acceesible.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
193733585692301f38d489b8ad8724c2f88349c0 11-Nov-2011 Matthew Garrett <mjg@redhat.com> The Windows driver .inf disables ASPM on all cciss devices. Do the same.

Signed-off-by: Matthew Garrett <mjg@redhat.com>
Cc: iss_storagedev@hp.com
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
ab5dbebe33e0c353e8545f09c34553ac3351dad6 20-Oct-2011 Mike Miller <mike.miller@hp.com> cciss: add small delay when using PCI Power Management to reset for kump

The P600 requires a small delay when changing states. Otherwise we may think
the board did not reset and we bail. This for kdump only and is particular
to the P600.

Cc: stable@kernel.org
Signed-off-by: Jens Axboe <axboe@kernel.dk>
f963d270cb7bbb8eeb57901d02b22a493e664fd2 08-Aug-2011 Joe Handzik <joseph.t.handzik@beardog.cce.hp.com> cciss: add transport mode attribute to sys

Signed-off-by: Joseph Handzik <joseph.t.handzik@beardog.cce.hp.com>
Acked-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
13049537007dee73a76f0a30fcbc24d02c6fa9e4 08-Aug-2011 Joseph Handzik <joseph.t.handzik@beardog.cce.hp.com> cciss: Adds simple mode functionality

Signed-off-by: Joseph Handzik <joseph.t.handzik@beardog.cce.hp.com>
Acked-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
edc83d47a9928281ecf6fb709753edb3c58ae7f1 06-May-2011 Jens Axboe <jaxboe@fusionio.com> cciss: fix compile issue

drivers/block/cciss.c: In function ‘cciss_send_reset’:
drivers/block/cciss.c:2515:2: error: implicit declaration of function ‘fill_cmd’
drivers/block/cciss.c: At top level:
drivers/block/cciss.c:2531:12: error: conflicting types for ‘fill_cmd’
drivers/block/cciss.c:2534:1: note: an argument type that has a default promotion can’t match an empty parameter name list declaration
drivers/block/cciss.c:2515:18: note: previous implicit declaration of ‘fill_cmd’ was here
make[1]: *** [drivers/block/cciss.o] Error 1
make: *** [drivers/block/cciss.o] Error 2

Move fill_cmd() to above where it is first used.

Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
8a4ec67bd5648beb09d7db988a75835b740e950d 03-May-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: add cciss_tape_cmds module paramter

This is to allow number of commands reserved for use by SCSI tape drives
and medium changers to be adjusted at driver load time via the kernel
parameter cciss_tape_cmds, with a default value of 6, and a range
of 2 - 16 inclusive. Previously, the driver limited the number of
commands which could be queued to the SCSI half of the the driver
to only 2. This is to fix the problem that if you had more than
two tape drives, you couldn't, for example, erase or rewind them all
at the same time.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
063d2cf72ab6101d2dd69bd6fb503b229be70325 03-May-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: do not use bit 2 doorbell reset

It causes NMIs which are undesirable at best, unsurvivable at worst.
Prefer the soft reset instead.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
ec52d5f1cb9a1a0db02143fdcc6004749ea19e0b 03-May-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: do not attempt PCI power management reset method if we know it won't work.

Just go straight to the soft-reset method instead.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
93c46c2fa7cfb272c3014327830d6cb30d8486a4 03-May-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: remove superfluous sleeps around reset code

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
5afe278114a8dd9480813377c75b5e40a42c5066 03-May-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: do soft reset if hard reset is broken

on driver load, if reset_devices is set, and the hard reset
attempts fail, try to bring up the controller to the point that
a command can be sent, and send it a soft reset command, then
after the reset undo whatever driver initialization was done to get
it to the point to take a command, and re-do it after the reset.

This is to get kdump to work on all the "non-resettable" controllers
(except 64xx controllers which can't be reset due to the potentially
shared cache module.)

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
bf2e2e6b87ae38fab460a36abfe272d99ae8be49 03-May-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: use new doorbell-bit-5 reset method

The bit-2-doorbell reset method seemed to cause (survivable) NMIs
on some systems and (unsurvivable) IOCK NMIs on some G7 servers.
Firmware guys implemented a new doorbell method to alleviate these
problems triggered by bit 5 of the doorbell register. We want to
use it if it's available.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
3e28601fdfdec75ce8f6aaaf58540fdd0883fb58 03-May-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: increase timeouts for post-reset no-ops

Just to reduce the messages about timeouts that appear.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
59ec86bb9872fbf9fd8572a936423f5e3ad615e7 03-May-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: clarify messages around reset behavior

When waiting for the board to become "not ready"
don't print a message saying "waiting for board to
become ready" (possibly followed by a message saying
"failed waiting for board to become not ready". Instead,
it should be "waiting for board to reset" and "failed
waiting for board to reset."

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
"
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
8f71bb829a964ef4deead86b60fda09452fb5c2f 03-May-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: get rid of message related magic numbers

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
e363e0143615a67f19d56e6b223b55df3bd9f580 03-May-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: fix reply pool and block fetch table memory leaks

Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
2b48085f972a761b38cf60c626031a7fdd9e6d55 03-May-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out irq request code

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
abf7966e616ef6e04393ef3678227f77d6179a8a 03-May-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out scatterlist allocation functions

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
54dae3432021f38cf20542ccd152dddb91c7c2d7 03-May-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out command pool allocation functions

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
62710ae1ceb839de1eebb5b4492ec8a7fbcf8d02 03-May-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: do a better job of detecting controller reset failure

Detect failure of controller reset by noticing if the 32 bytes of
"driver version" we store on the hardware in the config table
fail to get zeroed out. Previously we noticed if the controller
did not transition to "simple mode", but this did not detect reset
failure if the controller was already in simple mode prior to
the reset attempt (e.g. due to module parameter hpsa_simple_mode=1).

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
6d9a4f9e21486fa83526a9a9fdf88b9b2cdfd299 12-Mar-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: fix missed command status value CMD_UNABORTABLE

and fix a nearby typo, "do" that should have been "due"

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
fcab1c112ade881d884cd7b8161f7543194d12e1 12-Mar-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: remove unnecessary casts

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
16011131ced8bdb317e1bf03324ca78a27fa0a1c 12-Mar-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Mask off error bits of c->busaddr in cmd_special_free when calling pci_free_consistent

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
0498cc2a9e81de97674adde8ced8a1462a397013 12-Mar-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Inform controller we are using 32-bit tags.

Controller will DMA only 32-bits of the tag per command
on completion if it knows we are only using 32-bit tags.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
4a765046553a88e4ec80ad84d2131b9e69ab4ab0 12-Mar-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: hoist tag masking out of loop

In process_nonindexed_cmd, hoist figuring of masked tag out of loop since
it is the same throughout.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
957c2ec558caff09a3bdf333871fc617830f063d 11-Mar-2011 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: export resettable host attribute

This attribute, requested by Redhat, allows kexec-tools to know
whether the controller can honor the reset_devices kernel parameter
and actually reset the controller. For kdump to work properly it
is necessary that the reset_devices parameter be honored. This
attribute enables kexec-tools to warn the user if they attempt to
designate a non-resettable controller as the dump device.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
7eaceaccab5f40bbfda044629a6298616aeaed50 10-Mar-2011 Jens Axboe <jaxboe@fusionio.com> block: remove per-queue plugging

Code has been converted over to the new explicit on-stack plugging,
and delay users have been converted to use the new API for that.
So lets kill off the old plugging along with aops->sync_page().

Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
68264e9d6781f7163e92c517769bb470fa43f6cd 19-Jan-2011 Stephen M. Cameron <StephenM.Cameron> cciss: make cciss_revalidate not loop through CISS_MAX_LUNS volumes unnecessarily.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
e6e1ee936d61d697735d17517678a626b7701ce4 10-Jan-2011 Jens Axboe <jaxboe@fusionio.com> cciss: reinstate proper FIFO order of command queue list

Commit 8a3173de inadvertently changed the ordering when
switching to hlists. Change to regular list heads so we
can use tail list adds, this improves performance.

Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
453434cf3fdcd3954bb52460e37d4945a0913d3e 21-Dec-2010 Linus Torvalds <torvalds@linux-foundation.org> Fix build error in drivers/block/cciss.c

.. caused by a missing semi-colon, introduced in commit 0fc13c8995cd
("cciss: fix cciss_revalidate panic").

Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>
Reported-by: Thiago Farina <tfransosi@gmail.com>
Cc: Jens Axboe <jaxboe@fusionio.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
0fc13c8995cd96f4123de400c71c223d80400ed9 17-Dec-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: fix cciss_revalidate panic

If you delete a logical drive, and then run BLKRRPART (e.g. via fdisk)
on a logical drive which is "after" the deleted logical drive in the h->drv[]
array, then cciss_revalidate panics because it will access the null pointer
h->drv[x] when x hits the deleted drive.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Cc: stable@kernel.org
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
bbe425cd9ae83eacd0c9f09df2bf56dc911a54cd 17-Nov-2010 Jens Axboe <jaxboe@fusionio.com> cciss: fix build for PROC_FS disabled

The recent patch to fix the removal of a non-existing proc
directory introduced this build problem for !CONFIG_PROC_FS:

drivers/block/cciss.c:4929: error: 'proc_cciss' undeclared (first use in this function)

Fix it by moving proc_cciss outside of the CONFIG_PROC_FS scope.

Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
90fdb0b98a62d78a0650b9fd3ddc58a48f71d740 08-Nov-2010 Jens Axboe <jaxboe@fusionio.com> cciss: fix proc warning on attempt to remove non-existant directory

Randy reports that he gets the following stack trace when
removing the cciss module:

[ 109.164277] Pid: 3463, comm: rmmod Not tainted 2.6.37-rc1 #7
[ 109.164280] Call Trace:
[ 109.164292] [<ffffffff8107eb8d>] warn_slowpath_common+0xc6/0xf3
[ 109.164299] [<ffffffff8107ecaa>] warn_slowpath_fmt+0x5b/0x6b
[ 109.164307] [<ffffffff8155175b>] ? _raw_spin_unlock+0x40/0x4b
[ 109.164313] [<ffffffff8123dd1e>] remove_proc_entry+0x156/0x35e
[ 109.164320] [<ffffffff812cd91b>] ? do_raw_spin_unlock+0xff/0x10f
[ 109.164327] [<ffffffff8113823d>] ? trace_hardirqs_on+0x10/0x4a
[ 109.164333] [<ffffffff8155162d>] ? _raw_spin_unlock_irq+0x4c/0x7b
[ 109.164339] [<ffffffff8154d4d1>] ? wait_for_common+0x145/0x15e
[ 109.164345] [<ffffffff81075337>] ? default_wake_function+0x0/0x22
[ 109.164357] [<ffffffffa0615a8f>] cciss_cleanup+0xa9/0xc7 [cciss]
[ 109.164365] [<ffffffff810d3cb0>] sys_delete_module+0x2d6/0x368
[ 109.164371] [<ffffffff8155036b>] ? lockdep_sys_exit_thunk+0x35/0x67
[ 109.164377] [<ffffffff810fdfaf>] ? audit_syscall_entry+0x172/0x1a5
[ 109.164383] [<ffffffff815502f5>] ? trace_hardirqs_on_thunk+0x3a/0x3f
[ 109.164389] [<ffffffff8100ea72>] system_call_fastpath+0x16/0x1b
[ 109.164394] ---[ end trace 88e8568246ed0b1d ]---

which will happen if you don't actually have an HP CISS adapter,
since it'll do an uncondional removal of a proc directory it
never attempted to create in that case.

Reported-by: Randy Dunlap <randy.dunlap@oracle.com>
Tested-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
6fa977520871b1fc0be64247abad02b678c13fda 28-Oct-2010 Mike Miller <mike.miller@hp.com> cciss: remove overlapping PCI IDs

This patch removes the controller overlap between cciss and hpsa. It was
decided that no overlap should exist. All new controllers will use the hpsa
SCSI based driver.

Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
7ab5118d7c2be650bc936894f159dc1c597badae 28-Oct-2010 Vasiliy Kulikov <segooon@gmail.com> block: cciss: fix information leak to userland

Structure IOCTL_Command_struct is copied to userland with
some padding fields at the end of the struct unitialized.
It leads to leaking of contents of kernel stack memory.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
4205df34003eec4371020872cdfa228ffae5bd6a 23-Oct-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: remove controllers supported by hpsa

We would prefer not to have any overlap between the two drivers.
Remove the cciss_allow_hpsa option, as it it is no longer needed.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
332c2f80a894d349bfb95fae00daf74477d4afcd 22-Oct-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: use usleep_range not msleep for small sleeps

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
186fb9cf6a1154bc9b071adfd72fcf256285eb26 22-Oct-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: limit commands allocated on reset_devices

This is to conserve memory in a memory-limited kdump scenario

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
f442e64b93e16dba6bf9ab7e8dc5a90f6bcd8a85 22-Oct-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Use kernel provided PCI state save and restore functions

and use the doorbell reset method if available (which doesn't
lock up the controller if you properly save and restore all
the PCI registers that you're supposed to.)

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
afa842fa641e11a025725883b04d1e144e6bad39 22-Oct-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: fix board status waiting code

After a reset, we should first wait for the board to become "not ready",
and then wait for it to become "ready", instead of immediately
waiting for it to become "ready", and do this waiting *after*
restoring PCI config space registers.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
6362beea8914cbd4630ccde3617d944aeca2d48f 19-Oct-2010 Mike Miller <mike.miller@hp.com> cciss: fix PCI IDs for new Smart Array controllers

cciss: fix PCI IDs for new controllers

This patch fixes the botched up PCI IDs of new controllers. Please consider
this patch for inclusion.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
2a48fc0ab24241755dc93bfd4f01d68efab47f5a 02-Jun-2010 Arnd Bergmann <arnd@arndb.de> block: autoconvert trivial BKL users to private mutex

The block device drivers have all gained new lock_kernel
calls from a recent pushdown, and some of the drivers
were already using the BKL before.

This turns the BKL into a set of per-driver mutexes.
Still need to check whether this is safe to do.

file=$1
name=$2
if grep -q lock_kernel ${file} ; then
if grep -q 'include.*linux.mutex.h' ${file} ; then
sed -i '/include.*<linux\/smp_lock.h>/d' ${file}
else
sed -i 's/include.*<linux\/smp_lock.h>.*$/include <linux\/mutex.h>/g' ${file}
fi
sed -i ${file} \
-e "/^#include.*linux.mutex.h/,$ {
1,/^\(static\|int\|long\)/ {
/^\(static\|int\|long\)/istatic DEFINE_MUTEX(${name}_mutex);

} }" \
-e "s/\(un\)*lock_kernel\>[ ]*()/mutex_\1lock(\&${name}_mutex)/g" \
-e '/[ ]*cycle_kernel_lock();/d'
else
sed -i -e '/include.*\<smp_lock.h\>/d' ${file} \
-e '/cycle_kernel_lock()/d'
fi

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
b0722cb1ac84863f57471d2b254457c100319300 13-Sep-2010 Dan Carpenter <error27@gmail.com> cciss: freeing uninitialized data on error path

The "h->scatter_list" is allocated inside a for loop. If any of those
allocations fail, then the rest of the list is uninitialized data. When
we free it we should start from the top and free backwards so that we
don't call kfree() on uninitialized pointers.

Also if the allocation for "h->scatter_list" fails then we would get an
Oops here. I should have noticed this when I send: 4ee69851c "cciss:
handle allocation failure." but I didn't. Sorry about that.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
fcfb5c0ce11fe474cd6b4f7e83e0cc25f220d911 26-Aug-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: remove some superfluous tests from cciss_bigpassthru()

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
0c9f5ba7cb7435ea4b99599de4af0729f0740647 26-Aug-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_big_passthru

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
f32f125b1c14dcde49ec415ec941af750433251e 26-Aug-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_passthru

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
0894b32c5c1444d25f3e988cf03415ce8dfc5142 26-Aug-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_getluninfo

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
c525919ddf0b10ff0e1f528dd50d90edfdee4797 26-Aug-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_getdrivver

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
8a4f7fbfdd76a304c8f04dde6b8fd0e5c50bbe76 26-Aug-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_getfirmver

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
d18dfad4e2bf6c2d2c5c104d882b14b9fee71b14 26-Aug-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_getbustypes

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
93c74931131d3a7af3a6aa18aab0d39978b5d3b5 26-Aug-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_getheartbeat

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
4f43f32cd3f65cfee5f30d7e6be55854cf33809b 26-Aug-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_setnodename

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
252161094255ffdc277b8a0e5e12b0a8ff67b10f 26-Aug-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_getnodename

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
4c800eed9a46f7b6a469d24e7e6051b23e62bb69 26-Aug-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_setintinfo

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
576e661c658ab7d2a15cc12d5b8a1600db81ec0a 26-Aug-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_getintinfo

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
0a25a5aee727c4a56c7d39e0e595947b02ee2696 26-Aug-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_getpciinfo

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
2a643ec67f9efc4b6921a3dd6e257f3b5360622b 25-Aug-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: fix reporting of max queue depth since init

The ioctl path and the scsi tape path were not accounting
for their additions to the queue depth.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
4ee69851cd4880f574d22f5ce08bec35b01c94e3 23-Aug-2010 Dan Carpenter <error27@gmail.com> cciss: handle allocation failure

If kmalloc() fails then cleanup and return failure (-1).

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
75230ff2751e88d594a13a70eae2c146f45e323b 23-Aug-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: disable doorbell reset on reset_devices

The doorbell reset initially appears to work correctly,
the controller resets, comes up, some i/o can even be
done, but on at least some Smart Arrays in some servers,
it eventually causes a subsequent controller lockup due
to some kind of PCIe error, and kdump can end up leaving
the root filesystem in an unbootable state. For this
reason, until the problem is fixed, or at least isolated
to certain hardware enough to be avoided, the doorbell
reset should not be used at all.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
8112586063fe53958d60218631d661533f304504 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: cleanup interrupt_not_for_us

cciss: cleanup interrupt_not_for_us
In the case of MSI/MSIX interrutps, we don't need to check
if the interrupt is for us, and in the case of the intx interrupt
handler, when checking if the interrupt is for us, we don't need
to check if we're using MSI/MSIX, we know we're not.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
b2a4a43dbaf10383703d512bbe560d5a24da0bf2 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: change printks to dev_warn, etc.

cciss: change printks to dev_warn, etc.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
6b4d96b878d67c6768766e682c188a2a8bdc804a 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: separate cmd_alloc() and cmd_special_alloc()

cciss: separate cmd_alloc() and cmd_special_alloc()
cmd_alloc() took a parameter which caused it to either allocate
from a pre-allocated pool, or allocate using pci_alloc_consistent.
This parameter is always known at compile time, so this would
be better handled by breaking the function into two functions
and differentiating the cases by function names. Same goes
for cmd_free().

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
f70dba83669bf718c2f1731f0f58b8149e883593 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: use consistent variable names

cciss: use consistent variable names
"h", for the hba structure and "c" for the command structures.
and get rid of trivial CCISS_LOCK macro.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
058a0f9f31283d5eb9d8686d3b4f69e55d1589f1 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: forbid hard reset of 640x boards

cciss: forbid hard reset of 640x boards
The 6402/6404 are two PCI devices -- two Smart Array controllers
-- that fit into one slot. It is possible to reset them independently,
however, they share a battery backed cache module. One of the pair
controls the cache and the 2nd one access the cache through the first
one. If you reset the one controlling the cache, the other one will
not be a happy camper. So we just forbid resetting this conjoined
mess.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
adfbc1ff342ece2e482254bcc5381fadfffbbb89 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: sanitize max commands

cciss: sanitize max commands
Some controllers might try to tell us they support 0 commands
in performant mode. This is a lie told by buggy firmware.
We have to be wary of this lest we try to allocate a negative
number of command blocks, which will be treated as unsigned,
and get an out of memory condition.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
a6528d017234b483283274fbdd360f3541befe19 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: fix hard reset code.

cciss: Fix hard reset code.
Smart Array controllers newer than the P600 do not honor the
PCI power state method of resetting the controllers. Instead,
in these cases we can get them to reset via the "doorbell" register.

This escaped notice until we began using "performant" mode because
the fact that the controllers did not reset did not normally
impede subsequent operation, and so things generally appeared to
"work". Once the performant mode code was added, if the controller
does not reset, it remains in performant mode. The code immediately
after the reset presumes the controller is in "simple" mode
(which previously, it had remained in simple mode the whole time).
If the controller remains in performant mode any code which presumes
it is in simple mode will not work. So the reset needs to be fixed.

Unfortunately there are some controllers which cannot be reset by
either method. (eg. p800). We detect these cases by noticing that
the controller seems to remain in performant mode even after a
reset has been attempted. In those cases we ignore the controller,
as any commands outstanding on it will result in stale completions.
To sum up, we try to do a better job of resetting the controller if
"reset_devices" is set, and if it doesn't work, we ignore that
controller.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
83123cb11b5a5205233c59357da2c8d9a8dc9d24 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_reset_devices()

cciss: factor out cciss_reset_devices()

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
8e93bf6d6c9c6d864c17b7743f2cc5f2e052fe46 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_find_cfg_addrs.

Rationale for this is that I will also need to use this code
in fixing kdump host reset code prior to having the hba structure.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
b993313540de341e4c4df8f529d585e9400f43bd 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_enter_performant_mode

cciss: factor out cciss_enter_performant_mode

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
0f8a6a1e7b7162a51daee7df28f1b898da1a4165 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_wait_for_mode_change_ack()

cciss: factor out cciss_wait_for_mode_change_ack()

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
fe3b7527dbf1e717ccb3492bb2d84481ca7be6f9 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: make cciss_put_controller_into_performant_mode as __devinit

cciss: make cciss_put_controller_into_performant_mode as __devinit

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
ff5f58f06deb3f7b9a865093d7f580bbc2b9b498 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: cleanup some debug ifdefs

cciss: cleanup some debug ifdefs

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
bfd63ee571ed2a1ab7af99544e326483f84c0544 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_p600_dma_prefetch_quirk()

cciss: factor out cciss_p600_dma_prefetch_quirk()

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
322e304c4d71b79b3950ca560db4868cc3e04ee6 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_enable_scsi_prefetch()

cciss: factor out cciss_enable_scsi_prefetch()

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
501b92cd6b394ba56bb978fd55606b5639b4d3fb 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out CISS_signature_present()

cciss: factor out CISS_signature_present()

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
afadbf4b9591f3318508792ad98c347336a1a95d 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_find_board_params

cciss: factor out cciss_find_board_params

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
da5503217d7421dbf04a0557d16cae6d5fc0960e 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: fix leak of ioremapped memory

cciss: fix leak of ioremapped memory
in cciss_pci_init error path.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
4809d0988f10e305511d1a3e223880fa4b21f90e 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_find_cfgtables

cciss: factor out cciss_find_cfgtables

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
e99ba1362723df14bbe36da6eeaadf81d95782e6 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_wait_for_board_ready()

cciss: factor out cciss_wait_for_board_ready()

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
d474830da6218c0b7f81eab03aff7d8c539bdb57 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_find_memory_BAR()

cciss: factor out cciss_find_memory_BAR()

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
dac5488a9ed6b6e59749e161209a6678980803f1 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: remove board_id parameter from cciss_interrupt_mode()

cciss: remove board_id parameter from cciss_interrupt_mode()

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
dd9c426e92d0cbd710c8df5b84afe9a2eeda3918 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_board_disabled

cciss: factor out cciss_board_disabled

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
6539fa9b2e2e7fc3b3fe819e54aa7be83f0370fa 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out cciss_lookup_board_id

cciss: factor out cciss_lookup_board_id

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
292e50dd393a8359798f1f20ac4d48ec835ffa04 19-Jul-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: save pdev pointer in per hba structure early to avoid passing it around so much.

cciss: save pdev pointer in per hba structure early to avoid passing it around so much.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
6e9624b8caec290d28b4c6d9ec75749df6372b87 07-Aug-2010 Arnd Bergmann <arnd@arndb.de> block: push down BKL into .open and .release

The open and release block_device_operations are currently
called with the BKL held. In order to change that, we must
first make sure that all drivers that currently rely
on this have no regressions.

This blindly pushes the BKL into all .open and .release
operations for all block drivers to prepare for the
next step. The drivers can subsequently replace the BKL
with their own locks or remove it completely when it can
be shown that it is not needed.

The functions blkdev_get and blkdev_put are the only
remaining users of the big kernel lock in the block
layer, besides a few uses in the ioctl code, none
of which need to serialize with blkdev_{get,put}.

Most of these two functions is also under the protection
of bdev->bd_mutex, including the actual calls to
->open and ->release, and the common code does not
access any global data structures that need the BKL.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
8a6cfeb6deca3a8fefd639d898b0d163c0b5d368 08-Jul-2010 Arnd Bergmann <arnd@arndb.de> block: push down BKL into .locked_ioctl

As a preparation for the removal of the big kernel
lock in the block layer, this removes the BKL
from the common ioctl handling code, moving it
into every single driver still using it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
33659ebbae262228eef4e0fe990f393d1f0ed941 07-Aug-2010 Christoph Hellwig <hch@lst.de> block: remove wrappers for request type/flags

Remove all the trivial wrappers for the cmd_type and cmd_flags fields in
struct requests. This allows much easier grepping for different request
types instead of unwinding through macros.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
29979a71227c46b2ed970b9d603d529c718e5fc8 11-Jun-2010 Mike Miller <mike.miller@hp.com> cciss: move next_command function from ifdef

The definition of next_command also ended up in wrong place It ended up
inside an "#ifdef CONFIG_PROCFS". Already caught by Randy Dunlap and a
couple others. Tried to put it somewhere that made sense.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
b14aa6dcd083ad00fb416a93f76131734e6c3c17 11-Jun-2010 Mike Miller <mike.miller@hp.com> cciss: fix call to put_controller_in_performant_mode

call to put_controller_in_performant_mode was in the wrong place
The call inadvertently ended up in an error path.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
256aea3fd3b5c43e8d05ce66eaf43def83773612 11-Jun-2010 Mike Miller <mike.miller@hp.com> cciss: make sure we request the performant mode irq

Make sure we register the performant mode interrupt Another blunder.
Seemed to work because the call to put_controller_into_performant_mode was
never called.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
841fdffdd382722d33579a6aa1487e8a4e526dbd 02-Jun-2010 Mike Miller <mike.miller@hp.com> cciss: new controller support and bump driver version

Add support for new controllers due out next year. HP must continue to
support new controllers in older distros. All vendors require support be
upstream. These controllers support only 16 commands in simple mode but
can support up to 1024 in performant mode. See patch 5/6/ We have no
marketing names yet.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
5e216153c34ac21781110795284a784037f808e3 02-Jun-2010 Mike Miller <mike.miller@hp.com> cciss: add performant mode support for Stars/Sirius

Add a mode of controller operation called Performant Mode. Even though
cciss has been deprecated in favor of hpsa there are new controllers due
out next year that HP must support in older vendor distros. Vendors
require all fixes/features be upstream. These new controllers support
only 16 commands in simple mode but support up to 1024 in performant mode.
This requires us to add this support at this late date.

The performant mode transport minimizes host PCI accesses by performinf
many completions per read. PCI writes are posted so the host can write
then immediately get off the bus not waiting for the writwe to complete to
the target. In the context of performant mode the host read out to a
controller pulls all posted writes into host memory ensuring the reply
queue is coherent.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
2cf3af1c9ec26f8db3f386e48f9d979ad8bb3eff 02-Jun-2010 Mike Miller <mike.miller@hp.com> cciss: check for msi in interrupt_not_for_us

Check to see if h->msi[x]_vector is set. We need this for a following
patch. Without this check we process one interrupt then stop because in
msi[x] mode the interrupt pending bit is not set. Not sure why we didn't
encounter this before.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
0c2b39087c900bdb240b50ac95ee9da00d844565 02-Jun-2010 Mike Miller <mike.miller@hp.com> cciss: clean up interrupt handler

Simplify the interrupt handler code to more closely match hpsa and to
hopefully make it easier to follow.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
664a717d3ac5871efc1fd3bb5a32c552dc339d3f 02-Jun-2010 Mike Miller <mike.miller@hp.com> cciss: enqueue and submit io

Clean up some code where we subit our io. The same 5 lines appeared
several times. Also helps for a following patch.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
0e4a9d03df0a7ba516bbd94d2ec17d26859e46ba 28-Jun-2010 Kulikov Vasiliy <segooon@gmail.com> block: cciss: use ARRAY_SIZE

Change sizeof(x) / sizeof(*x) to ARRAY_SIZE(x).

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
c2d45b4da042720ae94648b417d0e051742441d4 30-Apr-2010 Bill Pemberton <wfp5p@virginia.edu> cciss: fix shadows sparse warning

Fix sparse warnings:

drivers/block/cciss.c:1591:37: warning: symbol 'i' shadows an earlier one
drivers/block/cciss.c:2437:21: warning: symbol 'i' shadows an earlier one

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
829f46af39d50a43e260adaa9e7bbdff74a9f696 06-Apr-2010 Dan Carpenter <error27@gmail.com> cciss: unlock on error path

We take the spin_lock again in fail_all_cmds() so we need to unlock here.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Steve Cameron <scameron@beardog.cce.hp.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
61917bdaaf6bea4b885525cf63f65272914f6be2 02-Apr-2010 Dan Carpenter <error27@gmail.com> cciss: unlock on error path

We take the spin_lock again in fail_all_cmds() so we need to unlock
here.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
d45033ef56fa9b09b73a6eb2a0f280fa7c1bab09 26-Feb-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out scatter gather chain block mapping code

cciss: factor out scatter gather chain block mapping code
Rationale is I want to use this code from the scsi half of the
driver.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2ad6cdc20fbeea1e1744190c00cebb64e4b4c491 26-Feb-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: fix scatter gather chain block dma direction kludge

cciss: fix scatter gather chain block dma direction kludge
The data direction for the chained block of scatter gather
elements should always be PCI_DMA_TODEVICE, but was mistakenly
set to the direction of the data transfer, then a kludge to
fix it was added, in which pci_dma_sync_single_for_device or
pci_dma_sync_single_for_cpu was called. If the correct direction
is used in the first place, the kludge isn't needed.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
dccc9b563e455b91f7247b1ca6b0face40323538 26-Feb-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: simplify scatter gather code

cciss: simplify scatter gather code.
Instead of allocating an array of pointers to a structure
containing an SGDescriptor structure, and two other elements
that aren't really used, just allocate SGDescriptor structs.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
49fc5601ea3bf9625d699dc777f80f72e8126c0b 26-Feb-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: factor out scatter gather chain block allocation and freeing

cciss: factor out scatter gather chain block allocation and freeing
Rationale is that I want to use this code from the scsi half of the
driver.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
1b7d0d28ad82cbd5650c26ec8e370176b112e407 26-Feb-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: detect bad alignment of scsi commands at build time

cciss: detect bad alignment of scsi commands at build time
Incidentally fix some nearby c++ style comments.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
8a78362c4eefc1deddbefe2c7f38aabbc2429d6b 26-Feb-2010 Martin K. Petersen <martin.petersen@oracle.com> block: Consolidate phys_segment and hw_segment limits

Except for SCSI no device drivers distinguish between physical and
hardware segment limits. Consolidate the two into a single segment
limit.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
086fa5ff0854c676ec333760f4c0154b3b242616 26-Feb-2010 Martin K. Petersen <martin.petersen@oracle.com> block: Rename blk_queue_max_sectors to blk_queue_max_hw_sectors

The block layer calling convention is blk_queue_<limit name>.
blk_queue_max_sectors predates this practice, leading to some confusion.
Rename the function to appropriately reflect that its intended use is to
set max_hw_sectors.

Also introduce a temporary wrapper for backwards compability. This can
be removed after the merge window is closed.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
b028461d66a4dc2754d4e5dab1b3974c44798c5d 18-Feb-2010 dann frazier <dannf@hp.com> cciss: remove C99-style comments

Some cleanup before the header file split-out so we don't propagate this style
into new files.

Acked-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: dann frazier <dannf@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
531c2dc70d339c5dfa8c3eb628c3459dc6f3a075 05-Feb-2010 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Make cciss_seq_show handle holes in the h->drv[] array

It is possible (and expected) for there to be holes in the h->drv[]
array, that is, some elements may be NULL pointers. cciss_seq_show
needs to be made aware of this possibility to avoid an Oops.

To reproduce the Oops which this fixes:

1) Create two "arrays" in the Array Configuratino Utility and
several logical drives on each array.
2) cat /proc/driver/cciss/cciss* in an infinite loop
3) delete some of the logical drives in the first "array."

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Cc: stable@kernel.org
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
d61c42690c6e2ff093a3d01338dad49f35b1e27b 23-Nov-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: fix scatter gather cleanup problems

On driver unload, only free up the extra scatter gather data if they were
allocated in the first place (the controller supports it) and don't forget
to free up the sg_cmd_list array of pointers.

Signed-off-by: Don Brace <brace@beardog.cce.hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
69ac74822277fa999a3f469d8362e93262deb3f4 13-Nov-2009 Alex Chiang <achiang@hp.com> cciss: make device attrs static

No need to export those device attributes.

In fact, without this patch, we can trip over a build error if cciss
is a built-in and another driver also declares and exports attributes
with the same name.

You'll see errors like:

drivers/scsi/built-in.o: multiple definition of `dev_attr_lunid'
drivers/block/built-in.o: first defined here

Cc: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Alex Chiang <achiang@hp.com>
Cc: <mike.miller@hp.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
8721c81f6480e2c9acbf92078383953f825d1057 12-Nov-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Fix weird usage of ENXIO in cciss_scsi.c

cciss: Fix weird usage of ENXIO in cciss_scsi.c

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
5c07a311a80adb0138fc08e8279c60255d88d0b8 12-Nov-2009 Don Brace <brace@beardog.cce.hp.com> cciss: Add enhanced scatter-gather support.

cciss: Add enhanced scatter-gather support. For controllers which
supported, more than 512 scatter-gather elements per command may
be used, and the max transfer size can be increased to 8192 blocks.

Signed-off-by: Don Brace <brace@beardog.cce.hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
da0021841c3ea6a82588efae3260015847ea5d33 12-Nov-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Do not automatically rescan on UNIT ATTENTION/LUN DATA CHANGED

cciss: Do not automatically rescan on UNIT ATTENTION/LUN DATA CHANGED
There are problems with doing this. If, say, several logical drives
are deleted at once, several such UNIT ATTENTIONS will be encountered,
often during the rescan triggered by the first such UNIT ATTENTION.
The block layer may be in the midst of trying to add logical drives
which were just deleted (resulting in the subsequent UNIT ATTENTION(s).)
Making the rescan code robust enough to tolerate this kind of thing
is too complicated for the moment. So, for now, we just don't do it.
Note: This UNIT ATTENTION/LUN DATA CHANGED situation only occurs on
the MSA2012.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
d06dfbd236795acbb67e22e51bb8af12e953ced3 12-Nov-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Remove unnecessary check in scan_thread

cciss: Remove unnecessary check in scan_thread

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
aa43f11147141fcd0e5f2fca45a4d71eab3fbe88 12-Nov-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: remove sendcmd() as it is no longer used.

cciss: remove sendcmd() as it is no longer used.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
29009a036f2feb07d8a9b3c715a6365dddd82a7a 12-Nov-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: clean up code in cciss_shutdown

cciss: clean up code in cciss_shutdown. Send the flush cache
command down with interrupts still enabled, and do not do DMA
from the stack.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
7b838bde922730b9cfeaa93ba80bd31173941495 12-Nov-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Remove the "withirq" parameter from various functions where possible

cciss: Remove the "withirq" parameter from various functions where possible

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
c08fac6500b658c16834aceb13a08ebddd908333 12-Nov-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Retry driver initiated cmds with unit attention condition

cciss: Retry driver initiated cmds with unit attention condition

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fd8489cff419d216479655b8041b8574ed89f806 12-Nov-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Fix problem with remove_from_scan_list on driver unload

cciss: Fix problem with remove_from_scan_list that on driver unload
it doesn't remove the controller from the scan list correctly if
the controller is currently being scanned for new devices.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
8ba95c69fe6eb65ff36b64136ae24844ddba16a1 12-Nov-2009 Alex Chiang <achiang@hp.com> cciss: Make device attributes static

cciss: Make device attributes static

Cc: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Alex Chiang <achiang@hp.com>
Acked-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2ec24ff1d1875defa742c76c9c7d74dca06b7e1f 13-Oct-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Add cciss_allow_hpsa module parameter

Add cciss_allow_hpsa module parameter. This parameter causes
the cciss driver to ignore any Smart Array devices known to be
supported by the hpsa driver.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2cfa948c9ea8681e831743a3bb61157f590fa8d8 13-Oct-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Fix multiple calls to pci_release_regions

Fix multiple calls to pci_release_regions. If cciss_pci_init
fails, it already does any necessary call to pci_release_regions,
so this does not need to be done again in cciss_init_one in that
case.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
828c09509b9695271bcbdc53e9fc9a6a737148d2 02-Oct-2009 Alexey Dobriyan <adobriyan@gmail.com> const: constify remaining file_operations

[akpm@linux-foundation.org: fix KVM]
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1e6f2dc11984b81c6438ff6cd45cdf15a02e3dfd 24-Sep-2009 Alexander Beregalov <a.beregalov@gmail.com> cciss: fix build when !PROC_FS

Fix these build errors when CONFIG_PROC_FS is not set:
drivers/block/cciss.c: In function 'cciss_show_raid_level':
drivers/block/cciss.c:623: error: 'RAID_UNKNOWN' undeclared (first use in this function)
drivers/block/cciss.c:626: error: 'raid_label' undeclared (first use in this function)
drivers/block/cciss.c: In function 'cciss_geometry_inquiry':
drivers/block/cciss.c:2696: error: 'RAID_UNKNOWN' undeclared (first use in this function)

Signed-off-by: Alexander Beregalov <a.beregalov@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
9f792d9f58496161b1b201e2ca440a6b6e116c39 18-Sep-2009 Jens Axboe <jens.axboe@oracle.com> cciss: cciss_host_attr_groups should be const

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
9cef0d2f4f68a5a2c6ea0495f958a074d21fbd07 17-Sep-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Dynamically allocate the drive_info_struct for each logical drive.

cciss: Dynamically allocate the drive_info_struct for each logical drive.
This reduces the size of the per-hba ctlr_info structure from 106936
bytes to 8132 bytes. That's on 32-bit systems. On 64-bit systems, the
improvement is even bigger. Without this, the ctlr_info struct is so big
that the driver won't even load on a 64 bit system if CISS_MAX_LUN was
at it's current setting of 1024 logical drives.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
e272afecaf18912e971374df4605496975942e5c 17-Sep-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Add usage_count attribute to each logical drive in /sys

Add usage_count attribute to each logical drive at
/sys/devices/<dev>/ccissX/cXdY/usage_count for controller X,
logical drive Y. The usage count is the number of times
the device has currently been opened.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
3ff1111dc6e27524eeef267ab0ca9b5690594748 17-Sep-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Add a "raid_level" attribute to each logical drive in /sys

and change get rid of some magic numbers in raid lavel decoding.

Add raid_level attribute to each logical drive at
/sys/devices/<dev>/ccissX/cXdY/raid_level for controller X,
logical drive Y

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
fa52bec9df974096f9eb0e42a0b890512c0a0036 17-Sep-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: fix some magic numbers in the raid-level decoding

cciss: fix some magic numbers in the raid-level decoding

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
ce84a8aeac4a4a2cc421b3145dd2fb7cae860e4d 17-Sep-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Add lunid attribute to each logical drive in /sys

Add lunid attribute to each logical drive at
/sys/devices/<dev>/ccissX/cXdY/lunid for controller X,
logical drive Y

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2e043986d584cf95656d4ee0c40fb2051e8a8460 17-Sep-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Don't check h->busy_initializing in cciss_open().

Don't check h->busy_initializing in cciss_open(). Open won't be
called before things are ready, but h->busy_initializing won't be
unset until after the initial rebuild_lun_table is finished. But,
to read the partitions, cciss_open will be called for each logical
drive during rebuild_lun_table. If cciss_open checks h->busy_initializing,
then the reading of the partition information during the initial
rebuild_lun_table will fail, which is especially bad news if it
happens to be your boot device.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
39ccf9a645dbca7f9866317380912327570787c0 17-Sep-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Preserve all 8 bytes of LUN ID for logical drives.

Preserve all 8 bytes of the LunID field returned
by CCISS_REPORT_LOGICAL instead of only saving 4 bytes.
This fixes a bug with logical volume addressing encountered on
an MSA2012.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
983333cb0c445c56808502461bbb34876c63eb2b 17-Sep-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Silence noisy per-disk messages output by cciss_read_capacity

Silence noisy per-disk messages output by cciss_read_capacity

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2c935593ac1871211b43a54f023dc3bc605ad346 17-Sep-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Fix excessive gendisk freeing bug on driver unload.

Fix bug that free_hba was calling put_disk for all gendisk[]
pointers -- all 1024 of them -- regardless of whether the were
used or not (NULL). This bug could cause rmmod to oops if logical
drives had been deleted during the driver's lifetime.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
2d11d9931f5968bddac50d9d224c4812d4be869a 17-Sep-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Fix usage_count check in rebuild_lun_table when triggered via sysfs.

When rebuild_lun_table is reached via sysfs, the usage count that
is checked prior to messing with c0d0 has different constraints
(must be zero) than if rebuild_lun_table is reached via ioctl
(must be one.) Fix rebuild_lun_table to take that into account.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
9ddb27b44ffeb3080b71cc493b2edff2224d9356 17-Sep-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Clear all sysfs-exposed data for deleted logical drives.

When removing a logical drive, clear all the information that is
now exposed by sysfs (e.g. vendor, model, serial number.)

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
8ce51966d3b809d6c1ae4f3902058558589480b8 17-Sep-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Handle special case for sysfs attributes of the first logical drive.

For c0dx where x is not 0, we handle deletion and addition simply,
but for c0d0, there is the special case that even when there's no
disk, the device node exists so that the controller may be accessed.
So, for c0d0, we only create the sysfs entries once, when a controller
is added, and only remove them once, when a controller is being
taken down.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
361e9b07d11cfc8b77921a0e96910019402efe79 17-Sep-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Handle cases when cciss_add_disk fails.

Handle cases when cciss_add_disk fails.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
e8074f79770953be26b64539803d06a46d1a6e58 17-Sep-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Handle failure of blk_init_queue gracefully in cciss_add_disk.

Handle failure of blk_init_queue gracefully in cciss_add_disk.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
097d026453e7051a544722f4e05240085916499d 17-Sep-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Rearrange logical drive sysfs code to make the "changing a disk" path work.

Rearrange logical drive sysfs code to make the "changing a disk" path work.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
617e1344229d22ea9ecb6538e50808541618ed2b 17-Sep-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Dynamically allocate struct device for each logical drive as needed.

Dynamically allocate struct device for each logical drive as needed
instead of allocating the maximum we would ever need at driver init time.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
21d9db0b6231ef908fcdbfacefa392352776857f 17-Sep-2009 Stephen M. Cameron <scameron@beardog.cce.hp.com> cciss: Remove some unused code in rebuild_lun_table()

Remove some unused code in rebuild_lun_table()

Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
d6f4965d7d2e718eb9b223cb06db5f6a53b73507 17-Sep-2009 Andrew Patterson <andrew.patterson@hp.com> cciss: Allow triggering of rescan of logical drive topology via sysfs entry

Added /sys/bus/pci/devices/<dev>/ccissX/rescan sysfs entry used
to kick off a rescan that discovers logical drive topology changes.

Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
b368c9dd65984d1860b97bff77644c0e3e46df96 17-Sep-2009 Andrew Patterson <andrew.patterson@hp.com> cciss: Use one scan thread per controller and fix hang during rmmod

Replace the use of one scan kthread per controller with one per driver.
Use a queue to hold a list of controllers that need to be rescanned with
routines to add and remove controllers from the queue.

Fix locking and completion handling to prevent a hang during rmmod.

Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
c64bebcd7f33a6260b6d4c9999f797a633a3fa1c 17-Sep-2009 Andrew Patterson <andrew.patterson@hp.com> cciss: Remove sysfs entries for logical drives on driver cleanup.

Sysfs entries for logical drives need to be removed when a drive is
deleted during driver cleanup.

Signed-off-by: Andrew Patterson <andrew.patterson@hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cce.hp.com>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
4d761609471f7e543c880dd47ef5e1669076081b 18-Sep-2009 Randy Dunlap <randy.dunlap@oracle.com> cciss: fix schedule_timeout() parameters

Change schedule_timeout() parameter to not be specific to HZ=1000.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Mike Miller <mike.miller@hp.com>
Cc: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: "Cameron, Steve" <Steve.Cameron@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
88e9d34c727883d7d6f02cf1475b3ec98b8480c7 23-Sep-2009 James Morris <jmorris@namei.org> seq_file: constify seq_operations

Make all seq_operations structs const, to help mitigate against
revectoring user-triggerable function pointers.

This is derived from the grsecurity patch, although generated from scratch
because it's simpler than extracting the changes from there.

Signed-off-by: James Morris <jmorris@namei.org>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Acked-by: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
83d5cde47dedf01b6a4a4331882cbc0a7eea3c2e 22-Sep-2009 Alexey Dobriyan <adobriyan@gmail.com> const: make block_device_operations const

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
a4dbd6740df0872cdf0a86841f75beec8381964d 24-Jun-2009 David Brownell <dbrownell@users.sourceforge.net> driver model: constify attribute groups

Let attribute group vectors be declared "const". We'd
like to let most attribute metadata live in read-only
sections... this is a start.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
212a502676c308ead964a024e081529ad3f8d94c 24-Aug-2009 Eric Dumazet <eric.dumazet@gmail.com> cciss: memory leak in cciss_init_one()

commit 22bece00dc1f28dd3374c55e464c9f02eb642876
(cciss: fix regression firmware not displayed in procfs)
added a small memory leak in cciss_init_one()

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
405f55712dfe464b3240d7816cc4fe4174831be2 11-Jul-2009 Alexey Dobriyan <adobriyan@gmail.com> headers: smp_lock.h redux

* Remove smp_lock.h from files which don't need it (including some headers!)
* Add smp_lock.h to files which do need it
* Make smp_lock.h include conditional in hardirq.h
It's needed only for one kernel_locked() usage which is under CONFIG_PREEMPT

This will make hardirq.h inclusion cheaper for every PREEMPT=n config
(which includes allmodconfig/allyesconfig, BTW)

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
b59e64d0ddb756af57ea032383bfd393a286a8e8 02-Jul-2009 Hannes Reinecke <hare@suse.de> cciss: Ignore stale commands after reboot

When doing an unexpected shutdown like kexec the cciss
firmware might still have some commands in flight, which
it is trying to complete.
The driver is doing it's best on resetting the HBA,
but sadly there's a firmware issue causing the firmware
_not_ to abort or drop old commands.
So the firmware will send us commands which we haven't
accounted for, causing the driver to panic.

With this patch we're just ignoring these commands as
there is nothing we could be doing with them anyway.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <axboe@carl.(none)>
e212d6f25084e8e9b02a04ba514d7bb1e4a4924a 16-Jun-2009 Li Zefan <lizf@cn.fujitsu.com> block: remove some includings of blktrace_api.h

When porting blktrace to tracepoints, we changed to trace/block.h
for trace prober declarations.

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
72f9f1324fc4cd450c92e4600a710231b0445c75 08-Jun-2009 scameron@beardog.cca.cpqcorp.net <scameron@beardog.cca.cpqcorp.net> cciss: Remove no longer needed sendcmd reject processing code

Now that the cciss SCSI error handling routines operate with interrupts
enabled, we no longer need to maintain the list of command completions that
sendcmd() might inadvertantly scoop up, since now it only runs at driver init
time, and there won't be any other commands for it to scoop up. So we
can remove that list and the code that adds to it and processes it.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
85cc61ae41084cb6d8ecc6c9e01ac4563005c8ac 08-Jun-2009 scameron@beardog.cca.cpqcorp.net <scameron@beardog.cca.cpqcorp.net> cciss: change SCSI error handling routines to work with interrupts enabled.

Change cciss scsi error handling routines to work with interrupts enabled.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
789a424ad1352b335960e7c56494d0410577fa61 08-Jun-2009 scameron@beardog.cca.cpqcorp.net <scameron@beardog.cca.cpqcorp.net> cciss: separate error processing and command retrying code in sendcmd_withirq_core()

Separate the error processing from sendcmd_withirq_core from the code
which retries commands. The rationale for this is that the SCSI error
handling code can then be made to use sendcmd_withirq_core, but avoid
retrying commands.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
3c2ab40296894d1f7ad9714550fdf9b96d4e9ee6 08-Jun-2009 scameron@beardog.cca.cpqcorp.net <scameron@beardog.cca.cpqcorp.net> cciss: factor out fix target status processing code from sendcmd functions

Factor out code to process target status of completed commands in sendcmd()
and sendcmd_withirq_core(), and fix problem that bad target status was ignored in
sendcmd_withirq_core.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
b57695fe131b13d3f2460cfeb9175cff673ed337 08-Jun-2009 scameron@beardog.cca.cpqcorp.net <scameron@beardog.cca.cpqcorp.net> cciss: simplify interface of sendcmd() and sendcmd_withirq()

Simplify interfaces of sendcmd() and sendcmd_withirq() so that they
provide only one way to address commands instead of three ways.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
5390cfc3fea49d015ae1eed8551c0bf00489b50e 08-Jun-2009 scameron@beardog.cca.cpqcorp.net <scameron@beardog.cca.cpqcorp.net> cciss: factor out core of sendcmd_withirq() for use by SCSI error handling code

Factor the core of sendcmd_withirq out to provide a simpler interface
which provides access to full error information.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
7fe063268e73681cdca1a6496a25f93d3332f517 02-Jun-2009 Andrew Patterson <andrew.patterson@hp.com> cciss: add cciss driver sysfs entries

Add sysfs entries to the cciss driver needed for the dm/multipath tools.

A file for vendor, model, rev, and unique_id is added for each logical
drive under directory /sys/bus/pci/devices/<dev>/ccissX/cXdY. Where X =
the controller (or host) number and Y is the logical drive number.

A link from /sys/bus/pci/devices/<dev>/ccissX/cXdY/block:cciss!cXdY to
/sys/block/cciss!cXdY/device is also created. A bus is created in
/sys/bus/cciss. A link is created from the pci ccissX entry to
/sys/bus/cciss/devices/ccissX. Please consider this for inclusion.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
88f627ae394eadd75ada669904269f1a4a77b3bd 02-Jun-2009 Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net> cciss: fix SCSI device reset handler

Fix the SCSI reset error handler to send a working, properly addressed
reset message to the target device and add code to wait for the target
device to become ready by polling it with Test Unit Ready.

The existing reset code was broken in that it didn't bother to set the
8-byte LUN address to anything besides zero, so the command was addressed
to the controller, which pretended to the driver that the command
succeeded, while doing nothing. Ages ago I tested this code, but
unbeknownst to me, my test was flawed, and what I thought was a tape drive
getting reset was actually nothing of the sort. Unfortunately, there is
still lots of Smartarray firmware that doesn't handle doing target resets
right, and this code won't help in those cases, but it also shouldn't make
things worse in those cases than they already are.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
Cc: Mike Miller <mikem@beardog.cca.cpqcorp.net>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
4a4b2d7684c66dbd8ed04eb284bc94a78e061d29 02-Jun-2009 Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net> cciss: factor out core of sendcmd() for a more sane interface

Factor out the core of sendcmd() to provide a simpler interface which
exposes all the error information to the caller and make the original
sendcmd use this new function. Rationale: The SCSI error handling
routines need to send commands with interrupts turned off, but they also
need access to the full error information.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
Cc: Mike Miller <mikem@beardog.cca.cpqcorp.net>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
e1defc4ff0cf57aca6c5e3ff99fa503f5943c1f1 22-May-2009 Martin K. Petersen <martin.petersen@oracle.com> block: Do away with the notion of hardsect_size

Until now we have had a 1:1 mapping between storage device physical
block size and the logical block sized used when addressing the device.
With SATA 4KB drives coming out that will no longer be the case. The
sector size will be 4KB but the logical block size will remain
512-bytes. Hence we need to distinguish between the physical block size
and the logical ditto.

This patch renames hardsect_size to logical_block_size.

Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
9934c8c04561413609d2bc38c6b9f268cba774a4 08-May-2009 Tejun Heo <tj@kernel.org> block: implement and enforce request peek/start/fetch

Till now block layer allowed two separate modes of request execution.
A request is always acquired from the request queue via
elv_next_request(). After that, drivers are free to either dequeue it
or process it without dequeueing. Dequeue allows elv_next_request()
to return the next request so that multiple requests can be in flight.

Executing requests without dequeueing has its merits mostly in
allowing drivers for simpler devices which can't do sg to deal with
segments only without considering request boundary. However, the
benefit this brings is dubious and declining while the cost of the API
ambiguity is increasing. Segment based drivers are usually for very
old or limited devices and as converting to dequeueing model isn't
difficult, it doesn't justify the API overhead it puts on block layer
and its more modern users.

Previous patches converted all block low level drivers to dequeueing
model. This patch completes the API transition by...

* renaming elv_next_request() to blk_peek_request()

* renaming blkdev_dequeue_request() to blk_start_request()

* adding blk_fetch_request() which is combination of peek and start

* disallowing completion of queued (not started) requests

* applying new API to all LLDs

Renamings are for consistency and to break out of tree code so that
it's apparent that out of tree drivers need updating.

[ Impact: block request issue API cleanup, no functional change ]

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Mike Miller <mike.miller@hp.com>
Cc: unsik Kim <donari75@gmail.com>
Cc: Paul Clements <paul.clements@steeleye.com>
Cc: Tim Waugh <tim@cyberelk.net>
Cc: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Laurent Vivier <Laurent@lvivier.info>
Cc: Jeff Garzik <jgarzik@pobox.com>
Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Adrian McMenamin <adrian@mcmen.demon.co.uk>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Borislav Petkov <petkovbb@googlemail.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Alex Dubov <oakad@yahoo.com>
Cc: Pierre Ossman <drzeus@drzeus.cx>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Markus Lidel <Markus.Lidel@shadowconnect.com>
Cc: Stefan Weinhuber <wein@de.ibm.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
83096ebf1263b2c1ee5e653ba37d993d02e3eb7b 07-May-2009 Tejun Heo <tj@kernel.org> block: convert to pos and nr_sectors accessors

With recent cleanups, there is no place where low level driver
directly manipulates request fields. This means that the 'hard'
request fields always equal the !hard fields. Convert all
rq->sectors, nr_sectors and current_nr_sectors references to
accessors.

While at it, drop superflous blk_rq_pos() < 0 test in swim.c.

[ Impact: use pos and nr_sectors accessors ]

Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Tested-by: Grant Likely <grant.likely@secretlab.ca>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Tested-by: Adrian McMenamin <adrian@mcmen.demon.co.uk>
Acked-by: Adrian McMenamin <adrian@mcmen.demon.co.uk>
Acked-by: Mike Miller <mike.miller@hp.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Borislav Petkov <petkovbb@googlemail.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Paul Clements <paul.clements@steeleye.com>
Cc: Tim Waugh <tim@cyberelk.net>
Cc: Jeff Garzik <jgarzik@pobox.com>
Cc: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Alex Dubov <oakad@yahoo.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Dario Ballabio <ballabio_dario@emc.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: unsik Kim <donari75@gmail.com>
Cc: Laurent Vivier <Laurent@lvivier.info>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
c3a4d78c580de4edc9ef0f7c59812fb02ceb037f 07-May-2009 Tejun Heo <tj@kernel.org> block: add rq->resid_len

rq->data_len served two purposes - the length of data buffer on issue
and the residual count on completion. This duality creates some
headaches.

First of all, block layer and low level drivers can't really determine
what rq->data_len contains while a request is executing. It could be
the total request length or it coulde be anything else one of the
lower layers is using to keep track of residual count. This
complicates things because blk_rq_bytes() and thus
[__]blk_end_request_all() relies on rq->data_len for PC commands.
Drivers which want to report residual count should first cache the
total request length, update rq->data_len and then complete the
request with the cached data length.

Secondly, it makes requests default to reporting full residual count,
ie. reporting that no data transfer occurred. The residual count is
an exception not the norm; however, the driver should clear
rq->data_len to zero to signify the normal cases while leaving it
alone means no data transfer occurred at all. This reverse default
behavior complicates code unnecessarily and renders block PC on some
drivers (ide-tape/floppy) unuseable.

This patch adds rq->resid_len which is used only for residual count.

While at it, remove now unnecessasry blk_rq_bytes() caching in
ide_pc_intr() as rq->data_len is not changed anymore.

Boaz : spotted missing conversion in osd
Sergei : spotted too early conversion to blk_rq_bytes() in ide-tape

[ Impact: cleanup residual count handling, report 0 resid by default ]

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Cc: Borislav Petkov <petkovbb@googlemail.com>
Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Mike Miller <mike.miller@hp.com>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: Alan Stern <stern@rowland.harvard.edu>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Doug Gilbert <dgilbert@interlog.com>
Cc: Mike Miller <mike.miller@hp.com>
Cc: Eric Moore <Eric.Moore@lsi.com>
Cc: Darrick J. Wong <djwong@us.ibm.com>
Cc: Pete Zaitcev <zaitcev@redhat.com>
Cc: Boaz Harrosh <bharrosh@panasas.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
e930438c42e744ef1f8bfdbb338253c9f384df42 13-Apr-2009 Yang Hongyang <yanghy@cn.fujitsu.com> Replace all DMA_nBIT_MASK macro with DMA_BIT_MASK(n)

This is the second go through of the old DMA_nBIT_MASK macro,and there're not
so many of them left,so I put them into one patch.I hope this is the last round.
After this the definition of the old DMA_nBIT_MASK macro could be removed.

Signed-off-by: Yang Hongyang <yanghy@cn.fujitsu.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Tony Lindgren <tony@atomide.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Greg KH <greg@kroah.com>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
284901a90a9e0b812ca3f5f852cbbfb60d10249d 07-Apr-2009 Yang Hongyang <yanghy@cn.fujitsu.com> dma-mapping: replace all DMA_32BIT_MASK macro with DMA_BIT_MASK(32)

Replace all DMA_32BIT_MASK macro with DMA_BIT_MASK(32)

Signed-off-by: Yang Hongyang<yanghy@cn.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6a35528a8346f6e6fd32ed7e51f04d1fa4ca2c01 07-Apr-2009 Yang Hongyang <yanghy@cn.fujitsu.com> dma-mapping: replace all DMA_64BIT_MASK macro with DMA_BIT_MASK(64)

Replace all DMA_64BIT_MASK macro with DMA_BIT_MASK(64)

Signed-off-by: Yang Hongyang<yanghy@cn.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
e143858104e318263689c551543dfc3f186cea12 02-Apr-2009 Mike Miller <mike.miller@hp.com> cciss: change to discover first memory BAR

Add a method for discovering the first memory BAR. All Smart Array
controllers to date have always had the the memory BAR as the first BAR.
A new controller to be released later this year breaks that model.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
0a9279cc7cbe726e995c44a1acae81d446775816 02-Apr-2009 Mike Miller <mike.miller@hp.com> cciss: kernel scan thread for MSA2012

The MSA2012 cannot inform the driver of configuration changes since all
management is out of band. This is a departure from any storage we have
supported in the past. We need some way to detect changes on the topology
so we implement this kernel thread. In some instances there's nothing we
can do from the driver (like LUN failure) so just print out a message. In
the case where logical volumes are added or deleted we call
rebuild_lun_table to refresh the driver's view of the world.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
ac44e5b2ed62bf4acf9df84575d3f18c7a6fdf22 27-Mar-2009 Jens Axboe <jens.axboe@oracle.com> cciss: fix residual count for block pc requests

We must complete the full request, so store the request count and then set
the ->data_len to the residual count from the hardware.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
10cbda97e73c7d537d7174eadb2d098484f8f1da 27-Feb-2009 Jens Axboe <jens.axboe@oracle.com> cciss: add BUILD_BUG_ON() for catching bad CommandList_struct alignment

The hardware requires 64-bit alignment of commands, so add a build bug
check for that. The recent commit 8a3173de4ab4cdacc43675dc5c077f9a5bf17f5f
didn't change the size of the command, but other additions/changes may and
thus break badly at runtime.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
5e18cfd04feca78cc08a6b8b71a60a610de81eaa 27-Feb-2009 Jens Axboe <jens.axboe@oracle.com> cciss: remove 30 second initial timeout on controller reset

Commit 5e4c91c84b194b26cf592779e451f4b5be777cba forgot to remove the
initial sleep, get rid of it.

Thanks to Randy Dunlap <randy.dunlap@oracle.com> for spotting this error.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
5e4c91c84b194b26cf592779e451f4b5be777cba 23-Feb-2009 Jens Axboe <jens.axboe@oracle.com> cciss: shorten 30s timeout on controller reset

If reset_devices is set for kexec, then cciss will delay 30 seconds
since the old 5i controller _may_ need that long to recover. Replace
the long sleep with incremental sleep and tests to reduce the 30 seconds
to worst case for 5i, so that other controllers will proceed quickly.

Reviewed-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
82eb03cfd862a65363fa2826de0dbd5474cfe5e2 16-Feb-2009 Chip Coldwell <coldwell@redhat.com> cciss: PCI power management reset for kexec

The kexec kernel resets the CCISS hardware in three steps:

1. Use PCI power management states to reset the controller in the
kexec kernel.

2. Clear the MSI/MSI-X bits in PCI configuration space so that MSI
initialization in the kexec kernel doesn't fail.

3. Use the CCISS "No-op" message to determine when the controller
firmware has recovered from the PCI PM reset.

[akpm@linux-foundation.org: cleanups]
Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
a0ea8622918019ed76c0b85f5d0247809ba05a7c 18-Dec-2008 Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net> cciss: simplify parameters to deregister_disk function

Simplify parameters to deregister_disk function.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
8a3173de4ab4cdacc43675dc5c077f9a5bf17f5f 20-Nov-2008 Jens Axboe <jens.axboe@oracle.com> cciss: switch to using hlist for command list management

This both cleans up the code and also helps detect the spurious case
of a command attempted being removed from a queue it doesn't belong
to.

Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
d8a0be6ab7ba1ffa43e7ea0dcdde3e8b68d4f762 18-Dec-2008 Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net> cciss: fix problem that deleting multiple logical drives could cause a panic

Fix problem that deleting multiple logical drives could cause a panic.

It fixes a panic which can be easily reproduced in the following way: Just
create several "arrays," each with multiple logical drives via hpacucli,
then delete the first array, and it will blow up in deregister_disk(), in
the call to get_host() when it tries to dig the hba pointer out of a NULL
queue pointer.

The problem has been present since my code to make rebuild_lun_table
behave better went in.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
9f92f4719764acf1c9185a5958200887a43e3483 20-Nov-2008 Randy Dunlap <randy.dunlap@oracle.com> cciss: fix DEBUG printk formats

Fix printk format warnings when CCISS_DEBUG is defined.

drivers/block/cciss.c:2856: warning: format '%d' expects type 'int', but argument 2 has type 'long unsigned int'
drivers/block/cciss.c:3205: warning: format '%x' expects type 'unsigned int', but argument 2 has type 'long unsigned int'
drivers/block/cciss.c:3236: warning: format '%x' expects type 'unsigned int', but argument 2 has type '__u64'
drivers/block/cciss.c:3246: warning: format '%x' expects type 'unsigned int', but argument 2 has type '__u64'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
22bece00dc1f28dd3374c55e464c9f02eb642876 06-Nov-2008 Mike Miller <mike.miller@hp.com> cciss: fix regression firmware not displayed in procfs

This regression was introduced by commit
6ae5ce8e8d4de666f31286808d2285aa6a50fa40 ("cciss: remove redundant code").

This patch fixes a regression where the controller firmware version is not
displayed in procfs. The previous patch would be called anytime something
changed. This will get called only once for each controller.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: <stable@kernel.org> [2.6.27.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
404443081ce5e6f68b5f7eda16c959835ff200c0 06-Nov-2008 Mike Miller <mike.miller@hp.com> cciss: fix sysfs broken symlink regression

Regression introduced by commit 6ae5ce8e8d4de666f31286808d2285aa6a50fa40
("cciss: remove redundant code").

This patch fixes a broken symlink in sysfs that was introduced by the
above commit. We broke it in 2.6.27-rc on or about 20080804. Some
installers are broken if this symlink does not exist and they may not
detect the logical drives configured on the controller. It does not
require being backported into 2.6.26.x or earlier kernels.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: <stable@kernel.org> [2.6.27.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
77ca7286d10b798e4907af941f29672bf484db77 06-Nov-2008 Mike Miller <mike.miller@hp.com> cciss: new hardware support

Add support for 2 new SAS/SATA controllers.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
ef7822c2fbbb004e30e1fb6f79d6f8a1a1a144d7 02-Mar-2008 Al Viro <viro@zeniv.linux.org.uk> [PATCH] switch cciss

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
d4430d62fa77208824a37fe6f85ab2831d274769 02-Mar-2008 Al Viro <viro@zeniv.linux.org.uk> [PATCH] beginning of methods conversion

To keep the size of changesets sane we split the switch by drivers;
to keep the damn thing bisectable we do the following:
1) rename the affected methods, add ones with correct
prototypes, make (few) callers handle both. That's this changeset.
2) for each driver convert to new methods. *ALL* drivers
are converted in this series.
3) kill the old (renamed) methods.

Note that it _is_ a flagday; all in-tree drivers are converted and by the
end of this series no trace of old methods remain. The only reason why
we do that this way is to keep the damn thing bisectable and allow per-driver
debugging if anything goes wrong.

New methods:
open(bdev, mode)
release(disk, mode)
ioctl(bdev, mode, cmd, arg) /* Called without BKL */
compat_ioctl(bdev, mode, cmd, arg)
locked_ioctl(bdev, mode, cmd, arg) /* Called with BKL, legacy */

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
74f3c8aff36ad6552ea609c8b20bfd588fa16f38 27-Aug-2007 Al Viro <viro@zeniv.linux.org.uk> [PATCH] switch scsi_cmd_ioctl() to passing fmode_t

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
061837bc8687edc2739ef02f721b7ae0b8076390 22-Sep-2008 Julia Lawall <julia@diku.dk> drivers/block: Use DIV_ROUND_UP

The kernel.h macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /
(d)) but is perhaps more readable.

An extract of the semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@haskernel@
@@

#include <linux/kernel.h>

@depends on haskernel@
expression n,d;
@@

(
- (n + d - 1) / d
+ DIV_ROUND_UP(n,d)
|
- (n + (d - 1)) / d
+ DIV_ROUND_UP(n,d)
)

@depends on haskernel@
expression n,d;
@@

- DIV_ROUND_UP((n),d)
+ DIV_ROUND_UP(n,d)

@depends on haskernel@
expression n,d;
@@

- DIV_ROUND_UP(n,(d))
+ DIV_ROUND_UP(n,d)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
ba198efb5ef4e5f4927a18ff95a58f40c58cbaa9 04-Aug-2008 Mike Miller <mike.miller@hp.com> cciss: fix bug if scsi tape support is disabled

Bug fix. If SCSI tape support is turned off we get an implicit declaration
of cciss_unregister_scsi error in cciss_remove_one.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
eece695f8bf9d1aacf3a119ab8e21db31948e40b 04-Aug-2008 Mike Miller <mike.miller@hp.com> cciss: fix negative logical drive count in procfs

This patch fixes a problem where the logical volume count may go negative.
In some instances if several logical are configured on a controller and all
of them are deleted using the online utilities the volume count in /proc may
go negative with no way get it correct again.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
6ae5ce8e8d4de666f31286808d2285aa6a50fa40 04-Aug-2008 Mike Miller <mike.miller@hp.com> cciss: remove redundant code

This patch removes redundant code where ever logical volumes are added or
removed. It adds 3 new functions that are called instead of having the same
code spread throughout the driver. It also removes the cciss_getgeometry
function.
The patch is fairly complex but we haven't figured out how to make it any
simpler and still do everything that needs to be done. Some of the
complexity comes from having to special case booting from cciss. Otherwise
the gendisk doesn't get added in time and the switchroot will fail.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
a72da29b6cbc5cf918567f2a0d76df6871e94b01 04-Aug-2008 Mike Miller <mike.miller@hp.com> cciss: make rebuild_lun_table behave better

This patch makes the rebuild_lun_table smart enough to not rip a logical
volume out from under the OS. Without this fix if a customer is running
hpacucli to monitor their storage the driver will blindly remove and re-add
the disks whenever the utility calls the CCISS_REGNEWD ioctl. Unfortunately,
both hpacucli and ACUXE call the ioctl repeatedly. Customers have reported
IO coming to a standstill. Calling the ioctl is the problem, this patch is
the fix.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
f7108f91cdcaca07c6a99777b2724093294f36ee 04-Aug-2008 Nikanth Karthikesan <knikanth@suse.de> cciss: return -EFAULT if copy_from_user() fails

Return -EFAULT instead of -ENOMEM if copy_from_user() fails.

Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
756fcab27756f32722b748e2aff3393eef9a589d 05-Aug-2008 Hannes Reinecke <hare@suse.de> block/cciss.c: remove pointless curr_queue calculation

curr_queue is a local variable in a for loop, and it's being initialized
at the start of each loop. So any assignment at the end of the loop is
pointless.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
491539982aa01fa71de93c2a06ac5d890d4cf1e2 04-Jul-2008 Mike Miller <mike.miller@hp.com> cciss: read config to obtain max outstanding commands per controller

This patch changes the way we determine the maximum number of outstanding
commands for each controller.

Most Smart Array controllers can support up to 1024 commands, the notable
exceptions are the E200 and E200i.

The next generation of controllers which were just added support a mode of
operation called Zero Memory Raid (ZMR). In this mode they only support
64 outstanding commands. In Full Function Raid (FFR) mode they support
1024.

We have been setting the queue depth by arbitrarily assigning some value
for each controller. We needed a better way to set the queue depth to
avoid lots of annoying "fifo full" messages. So we made the driver a
little smarter. We now read the config table and subtract 4 from the
returned value. The -4 is to allow some room for ioctl calls which are
not tracked the same way as io commands are tracked.

Please consider this for inclusion.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
77b96bd7e5ee0b44aed1b77fef5949bc19e8301f 04-Jul-2008 Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net> cciss: fix regression that no device nodes are created if no logical drives are configured.

Fix regression in cciss driver that if no logical drives are configured,
no device nodes at all get created.

Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
24aac480e76c6f5d1391ac05c5e9c0eb9b0cd302 13-Jun-2008 Mike Miller <mike.miller@hp.com> cciss: add new hardware support

Add support for the next generation of HP Smart Array SAS/SATA
controllers. Shipping date is late Fall 2008.

Bump the driver version to 3.6.20 to reflect the new hardware support from
patch 1 of this set.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
3dfcf9c4bf1fda4aa75861bcf6c50607dd322fe5 01-May-2008 Denis V. Lunev <den@openvz.org> cciss: assign PDE->data before gluing PDE into /proc tree

Simply replace proc_create and further data assigned with proc_create_data.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Cc: Alexey Dobriyan <adobriyan@openvz.org>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Acked-by: Mike Miller <mike.miller@hp.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
928b4d8c8963e75bdb133f562b03b07f9aa4844a 29-Apr-2008 Alexey Dobriyan <adobriyan@gmail.com> proc: remove proc_root_driver

Use creation by full path: "driver/foo".

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
e14ac67026b46e94478134df9521682fc6501ac0 17-Apr-2008 scameron@beardog.cca.cpqcorp.net <scameron@beardog.cca.cpqcorp.net> cciss: Fix race between disk-adding code and interrupt handler

Fix race condition between cciss_init_one(), cciss_update_drive_info(),
and cciss_check_queues().

Signed-off-by: Stephen M. Cameron <scameron@beardog.cca.cpqcorp.net>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
231bc2a222411f43bfb0fbb6d64c0f34c7b1039f 11-Apr-2008 Mike Pagano <mpagano@gentoo.org> cciss: error: implicit declaration of function 'sg_init_table'

This patch adds the missing include directive <linux/scatterlist.h> to the
cciss.c source file.   This was discovered by our release team when building
the kernel for the Alpha architecture.

Errors were found as references to functions 'sg_init_table' and 'sg_page' do
not exist without the include for Alpha.

Signed-off-by: Mike Pagano <mpagano@gentoo.org>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
68d95b585f1b67b3c89ce0eb934e221ebeeb5c61 04-Mar-2008 Mike Miller <mike.miller@hp.com> cciss: remove READ_AHEAD define and use block layer defaults

This patch removes the #define READ_AHEAD 1024 from the driver and uses the
block layer defaults, instead. We have found that under certain workloads
the setting can cause a disk connected to the e200 controller to go offline.
If the disk hiccups the link may try to downshift but the controller is
never notified that the link successfully completed the renegotiation.
We've also found that performance using the block layer default of 32 pages
was on par with the 1024 setting. We tried setting it to zero at one time
based on info from our firmware guys but that killed performance. Turns out
we were talking about 2 different read ahead settings.
Please consider this for inclusion.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
89b6e743788516491846724d7ef89bcac7ac9c99 21-Feb-2008 Mike Miller <mike.miller@hp.com> resubmit: cciss: procfs updates to display info about many

volumes

This patch allows us to display information about all of the logical volumes
configured on a particular controller without stepping on memory even when
there are many volumes (128 or more) configured.
Please consider this for inclusion.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
582539e5a0480f1e00e3b9ffbe50bd5b2f59a16f 06-Feb-2008 Randy Dunlap <randy.dunlap@oracle.com> cciss: use upper_32_bits() macro to eliminate warnings

Use upper_32_bits(x) macro to handle shifts that may be >= the width of
the data type.

drivers/block/cciss.c: In function 'do_cciss_request':
drivers/block/cciss.c:2655: warning: right shift count >= width of type
drivers/block/cciss.c:2656: warning: right shift count >= width of type
drivers/block/cciss.c:2657: warning: right shift count >= width of type
drivers/block/cciss.c:2658: warning: right shift count >= width of type

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
e7d9dc9cfd9bcc9ca688fe7f94c0da7d0700bfe6 29-Jan-2008 Jens Axboe <jens.axboe@oracle.com> cciss: fix bug in overriding ->data_len before completion

For BLOCK_PC requests, we need that length for completing the request.
Andrew Vasquez <andrew.vasquez@qlogic.com> reported the following
oops

Hitting a consistent BUG() with recent Linus' linux-2.6.git:

[ 12.941428] ------------[ cut here ]------------
[ 12.944874] kernel BUG at drivers/block/cciss.c:1260!
[ 12.944874] invalid opcode: 0000 [1] SMP
[ 12.944874] CPU 0
[ 12.944874] Modules linked in:
[ 12.944874] Pid: 0, comm: swapper Not tainted 2.6.24 #43
[ 12.944874] RIP: 0010:[<ffffffff8039e43d>] [<ffffffff8039e43d>] cciss_softirq_done+0xbc/0x1bf
[ 12.944874] RSP: 0018:ffffffff8063aed0 EFLAGS: 00010202
[ 12.944874] RAX: 0000000000000001 RBX: ffff8100cf800010 RCX: ffff81042f1253b0
[ 12.944874] RDX: ffff81042de398f0 RSI: ffff81042de398f0 RDI: 0000000000000001
[ 12.944874] RBP: ffff81042daa0000 R08: ffff81042f1253b0 R09: 0000000000000001
[ 12.944874] R10: 00000000000000fe R11: 0000000000000000 R12: 0000000000000002
[ 12.944874] R13: 0000000000000001 R14: ffff8100cf800000 R15: ffff81042de398f0
[ 12.944874] FS: 0000000000000000(0000) GS:ffffffff805bb000(0000) knlGS:0000000000000000
[ 12.944874] CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b
[ 12.944874] CR2: 00002afed7eea340 CR3: 000000042dbba000 CR4: 00000000000006e0
[ 12.944874] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 12.944874] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[ 12.944874] Process swapper (pid: 0, threadinfo ffffffff805f4000, task ffffffff805624a0)
[ 12.944874] Stack: 0000000000000000 ffffffff8063af10 0000000000000001 ffffffff80632d60
[ 12.944874] 0000000000000000 000000000000000a ffffffff805bb900 ffffffff8032038f
[ 12.944874] ffffffff8063af10 ffffffff8063af10 ffffffff805bb940 ffffffff802346b4
[ 12.944874] Call Trace:
[ 12.944874] <IRQ> [<ffffffff8032038f>] blk_done_softirq+0x69/0x78
[ 12.944874] [<ffffffff802346b4>] __do_softirq+0x6f/0xd8
[ 12.944874] [<ffffffff8020c45c>] call_softirq+0x1c/0x30
[ 12.944874] [<ffffffff8020e347>] do_softirq+0x30/0x80
[ 12.944874] [<ffffffff8020e409>] do_IRQ+0x72/0xd9
[ 12.944874] [<ffffffff8020a50a>] mwait_idle+0x0/0x46
[ 12.944874] [<ffffffff8020a3da>] default_idle+0x0/0x3d
[ 12.944874] [<ffffffff8020b7e1>] ret_from_intr+0x0/0xa
[ 12.944874] <EOI> [<ffffffff8020a54c>] mwait_idle+0x42/0x46
[ 12.944874] [<ffffffff8020a481>] cpu_idle+0x6a/0xae
[ 12.944874]
[ 12.944874]
[ 12.944874] Code: 0f 0b eb fe 48 8d 85 d8 c0 00 00 48 89 04 24 48 89 c7 e8 e5
[ 12.944874] RIP [<ffffffff8039e43d>] cciss_softirq_done+0xbc/0x1bf
[ 12.944874] RSP <ffffffff8063aed0>
[ 12.944903] ---[ end trace e9c631603f90d22f ]---

which is caused by blk_end_request() returning 'not done' for a request,
since it gets asked to complete zero bytes.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
3daeea29f9348263e0dda89a565074390475bdf8 11-Dec-2007 Kiyoshi Ueda <k-ueda@ct.jp.nec.com> blk_end_request: changing cciss (take 4)

This patch converts cciss to use blk_end_request interfaces.
Related 'uptodate' arguments are converted to 'error'.

cciss is a little bit different from "normal" drivers.
cciss directly calls bio_endio() and disk_stat_add()
when completing request. But those can be replaced with
__end_that_request_first().
After the replacement, request completion procedures of
those drivers become like the following:
o end_that_request_first()
o add_disk_randomness()
o end_that_request_last()
This can be converted to blk_end_request() by following
the rule (a) mentioned in the patch subject
"[PATCH 01/30] blk_end_request: add new request completion interface".

Cc: Mike Miller <mike.miller@hp.com>
Signed-off-by: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
Signed-off-by: Jun'ichi Nomura <j-nomura@ce.jp.nec.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
7d1fd970e4b2e84a624b3274669fa642fcd19c98 14-Jan-2008 Randy Dunlap <randy.dunlap@oracle.com> cciss: section mismatch

Mark cciss_pci_init() as __devinit, to fix section mismatch warning.

WARNING: vmlinux.o(.text+0x601fc9): Section mismatch: reference to .init.text: (between 'cciss_pci_init' and 'cciss_getgeometry')

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: <mike.miller@hp.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
bd4f36d6da175ed51840fe07b8906951c4dea609 24-Oct-2007 Mike Miller <mike.miller@hp.com> cciss: update copyright notices

This patch updates the copyright information for the cciss driver. It
includes extending the year to 2007 (how timely) and some minor corrections
deemed necessary by HP legal and the Open Source Review Board. Please
consider this patch for inclusion.

Signed-off-by: Mike Miller <mike.miller@hp.com>
--------------------------------------------------------------------------------
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
45711f1af6eff1a6d010703b4862e0d2b9afd056 22-Oct-2007 Jens Axboe <jens.axboe@oracle.com> [SG] Update drivers to use sg helpers

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
5a9df732b6a547aa843e8655044db9573d7b4e71 17-Oct-2007 Adrian Bunk <bunk@kernel.org> drivers/block/cciss.c: fix check-after-use

The Coverity checker spotted that we have already oops'ed if "disk"
was NULL.

Since "disk" being NULL seems impossible at this point this patch
removes the NULL check.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1a614f505193fcfc1b298643268a5db5b48e297f 17-Oct-2007 Steve Cameron <scameron@quandary.americas.cpqcorp.net> cciss: fix error reporting for SG_IO

This fixes a problem with the way cciss was filling out the "errors" field
of the request structure upon completion of requests. Previously, it just
put a 1 or a 0 in there and used the negation of this as the uptodate
parameter to one of the functions in the block layer, being a block device.
For the SG_IO ioctl, this was not sufficient, and we noticed that, for
example, sg_turs from sg3_utils did not correctly detect problems due to
cciss having set rq->errors incorrectly.

Signed-off-by: Stephen M. Cameron <steve.cameron@hp.com>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
8bf50f71cbfc7d043f0f135da72b3feefeaa0eb8 17-Oct-2007 Mike Miller (OS Dev) <mikem@beardog.cca.cpqcorp.net> cciss: disable DMA refetch on Smart Array P600

This patch disables DMA refetch in the PCI bridge. We have disabled DMA
prefetch for quite some time. Testing with XEN revealed another ASIC bug. If
dom0 resides on a P600 the board can can an MCA bi accessing invalid memory
addresses. Apparently, we need to disable both prefetch and refetch.
My understanding is a refetch operation should not occur but it is a valid
thing to do if prefetched data is no longer available for whatever reason.
Please consider this patch for inclusion.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Alex Chiang <achiang@hp.com>

--------------------------------------------------------------------------------
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
a683d652d334a546be9175b894f42dbd8e399536 21-Sep-2007 Lee Schermerhorn <Lee.Schermerhorn@hp.com> Panic in blk_rq_map_sg() from CCISS driver

New scatter/gather list chaining [sg_next()] treats 'page' member of
struct scatterlist with low bit set [0x01] as a chain pointer to
another struct scatterlist [array]. The CCISS driver request function
passes an uninitialized, temporary, on-stack scatterlist array to
blk_rq_map_sq(). sg_next() interprets random data on the stack as a
chain pointer and eventually tries to de-reference an invalid pointer,
resulting in:

[<ffffffff8031dd70>] blk_rq_map_sg+0x70/0x170
PGD 6090c3067 PUD 0
Oops: 0000 [1] SMP
last sysfs file: /block/cciss!c0d0/cciss!c0d0p1/dev
CPU 6
Modules linked in: ehci_hcd ohci_hcd uhci_hcd
Pid: 1, comm: init Not tainted 2.6.23-rc6-mm1 #3
RIP: 0010:[<ffffffff8031dd70>] [<ffffffff8031dd70>] blk_rq_map_sg+0x70/0x170
RSP: 0018:ffff81060901f768 EFLAGS: 00010206
RAX: 000000040b161000 RBX: ffff81060901f7d8 RCX: 000000040b162c00
RDX: 0000000000000000 RSI: ffff81060b13a260 RDI: ffff81060b139600
RBP: 0000000000001400 R08: 00000000fffffffe R09: 0000000000000400
R10: 0000000000000000 R11: 000000040b163000 R12: ffff810102fe0000
R13: 0000000000000001 R14: 0000000000000001 R15: 00001e0000000000
FS: 00000000026108f0(0063) GS:ffff810409000b80(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
CR2: 000000010000001e CR3: 00000006090c6000 CR4: 00000000000006e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Process init (pid: 1, threadinfo ffff81060901e000, task ffff810409020800)
last branch before last exception/interrupt
from [<ffffffff8031de0a>] blk_rq_map_sg+0x10a/0x170
to [<ffffffff8031dd70>] blk_rq_map_sg+0x70/0x170
Stack: 000000018068ea00 ffff810102fe0000 0000000000000000 ffff810011400000
0000000000000002 0000000000000000 ffff81040b172000 ffffffff803acd3d
0000000000003ec1 ffff8106090d5000 ffff8106090d5000 ffff810102fe0000
Call Trace:
[<ffffffff803acd3d>] do_cciss_request+0x15d/0x4c0
[<ffffffff80298968>] new_slab+0x1c8/0x270
[<ffffffff80298ffd>] __slab_alloc+0x22d/0x470
[<ffffffff8027327b>] mempool_alloc+0x4b/0x130
[<ffffffff8032b21e>] cfq_set_request+0xee/0x380
[<ffffffff8027327b>] mempool_alloc+0x4b/0x130
[<ffffffff8031ff98>] get_request+0x168/0x360
[<ffffffff80331b0d>] rb_insert_color+0x8d/0x110
[<ffffffff8031cfd8>] elv_rb_add+0x58/0x60
[<ffffffff8032a329>] cfq_add_rq_rb+0x69/0xa0
[<ffffffff8031c1ab>] elv_merged_request+0x5b/0x60
[<ffffffff803224fd>] __make_request+0x23d/0x650
[<ffffffff80298ffd>] __slab_alloc+0x22d/0x470
[<ffffffff80270000>] generic_write_checks+0x140/0x190
[<ffffffff8031f012>] generic_make_request+0x1c2/0x3a0
<etc>
Kernel panic - not syncing: Attempted to kill init!

This patch initializes the tmp_sg array to zeroes. Perhaps not the ultimate
fix, but an effective work-around. I can now boot 23-rc6-mm1 on an HP
Proliant x86_64 with CCISS boot disk.

Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>

drivers/block/cciss.c | 1 +
1 file changed, 1 insertion(+)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
87ad90016483f7f112021c7c82d3d72e682324f6 15-Oct-2007 Jeff Garzik <jeff@garzik.org> drivers/block/cpqarray,cciss: kill unused var

The recent bio work and subsequent fixups created unused variables.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
b4482a4b2e2ff5ed96d8d16d72e83e75064062c5 14-Oct-2007 Al Viro <viro@ftp.linux.org.uk> more trivial signedness fixes in drivers

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
6712ecf8f648118c3363c142196418f89a510b90 27-Sep-2007 NeilBrown <neilb@suse.de> Drop 'size' argument from bio_endio and bi_end_io

As bi_end_io is only called once when the reqeust is complete,
the 'size' argument is now redundant. Remove it.

Now there is no need for bio_endio to subtract the size completed
from bi_size. So don't do that either.

While we are at it, change bi_end_io to return void.

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
1aebe18787ca2e915eb8204d365ba2484d53223b 11-Aug-2007 Mariusz Kozlowski <m.kozlowski@tuxland.pl> drivers/block/cciss.c: kmalloc + memset conversion to kzalloc

drivers/block/cciss.c | 104285 -> 104168 (-117 bytes)
drivers/block/cciss.o | 277400 -> 277124 (-276 bytes)

Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
f2912a1223c0917a7b4e054f18086209137891ea 31-Jul-2007 Jesper Juhl <jesper.juhl@gmail.com> cciss: fix memory leak

There's a memory leak in the cciss driver.

in alloc_cciss_hba() we may leak sizeof(ctlr_info_t) bytes if a
call to alloc_disk(1 << NWD_SHIFT) fails.
This patch should fix the issue.

Spotted by the Coverity checker.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
165125e1e480f9510a5ffcfbfee4e3ee38c05f23 24-Jul-2007 Jens Axboe <jens.axboe@oracle.com> [BLOCK] Get rid of request_queue_t typedef

Some of the code has been gradually transitioned to using the proper
struct request_queue, but there's lots left. So do a full sweet of
the kernel and get rid of this typedef and replace its uses with
the proper type.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
9793c3266755b4cae8915982825b2c07cd12e1c6 16-Jul-2007 S.Çağlar Onur <caglar@pardus.org.tr> Fix too few arguments to function `scsi_cmd_ioctl'

This corrects the following compile error introduced by the merge of the
new bsg layer in commit e245befce7af0a1e1347079ed62695b059594bd4:

caglar@zangetsu linux-2.6 $ make
CHK include/linux/version.h
CHK include/linux/utsrelease.h
CALL scripts/checksyscalls.sh
CHK include/linux/compile.h
LD drivers/block/built-in.o
CC [M] drivers/block/cciss.o
drivers/block/cciss.c: In function `cciss_ioctl':
drivers/block/cciss.c:1173: warning: passing arg 2 of `scsi_cmd_ioctl' from incompatible pointer type
drivers/block/cciss.c:1173: warning: passing arg 3 of `scsi_cmd_ioctl' makes pointer from integer without a cast
drivers/block/cciss.c:1173: warning: passing arg 4 of `scsi_cmd_ioctl' makes integer from pointer without a cast
drivers/block/cciss.c:1173: error: too few arguments to function `scsi_cmd_ioctl'
...
make[2]: *** [drivers/block/cciss.o] Hata 1
make[1]: *** [drivers/block] Hata 2
make: *** [drivers] Hata 2

Signed-off-by: S.Çağlar Onur <caglar@pardus.org.tr>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
9cff3b383dad193b0762c27278a16237e10b53dc 19-Jun-2007 Mike Miller (OS Dev <mikem@beardog.cca.cpqcorp.net> cciss: add new controller support for P700m

This patch adds support for the Smart Array P700m SAS controller. This new
controller will ship Fall 2007.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
e9ca75b53576ddf82ea2d803f87c59dffac7bc42 14-May-2007 Gerald Britton <gbritton@alum.mit.edu> cciss: Fix pci_driver.shutdown while device is still active

Fix an Oops in the cciss driver caused by system shutdown while a filesystem
on a cciss device is still active. The cciss_remove_one function only
properly removes the device if the device has been cleanly released by its
users, which is not the case when the pci_driver.shutdown method is called.

This patch adds a new cciss_shutdown function to better match the pattern
used by various SCSI drivers: deactivate device interrupts and flush caches.
It also alters the cciss_remove_one function to match and readds the
__devexit annotation that was removed when cciss_remove_one was serving as
the pci_driver.shutdown method.

Signed-off-by: Gerald Britton <gbritton@alum.mit.edu>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
d5d3b736e3264934ec832a657a9a434b65f3d51f 08-May-2007 Stephen Cameron <steve.cameron@hp.com> cciss: include scsi/scsi.h unconditionally

Make cciss unconditionally include scsi/scsi.h, because of the use of
SCSI_IOCTL_GET_IDLUN and SCSI_IOCTL_GET_BUS_NUMBER.

Signed-off-by: Stephen M. Cameron <steve.cameron@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
198b766013e680a9e367aeb0d62f402029868a09 08-May-2007 Mike Miller (OS Dev) <mikem@beardog.cca.cpqcorp.net> cciss: set rq->errors more correctly in driver

Set rq->errors more correctly in cciss driver. Previously we had set it
synonymously with the meaning of the last parameter of end_that_last_request
and complete_buffers (the "uptodate" parameter) and had gotten away with it
for all this time because nobody ever looked at rq->errors.
SCSI_IOCTL_SEND_COMMAND looks at rq->errors, so now it matters that it be
right.

Signed-off-by: Stephen M. Cameron <steve.cameron@hp.com>
Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
03bbfee58d440f5dc2e880944ab75fc644534794 08-May-2007 Mike Miller (OS Dev) <mikem@beardog.cca.cpqcorp.net> cciss: add SG_IO ioctl to cciss

For all of you that think cciss should be a scsi driver here is the patch that
you have been waiting for all these years. This patch actually adds the SG_IO
ioctl to cciss. The primary purpose is for clustering and high-availibilty.
But now anyone can exploit this ioctl in any manner they wish.

Note, SCSI_IOCTL_SEND_COMMAND doesn't work with this patch due to rq->errors
being set incorrectly. Subsequent patch fixes that.

Signed-off-by: Stephen M. Cameron <steve.cameron@hp.com>
Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
d38ae168bfde9195466b9d45cb1126a657c10942 08-May-2007 Mike Miller (OS Dev) <mikem@beardog.cca.cpqcorp.net> cciss: reformat error handling

Reformat some error handling code to reduce line lengths a bit.

Signed-off-by: Stephen M. Cameron <steve.cameron@hp.com>
Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
b6550777a32f7204f87475beb4f40d054fb8d4b4 12-Apr-2007 Bjorn Helgaas <bjorn.helgaas@hp.com> [PATCH] cciss: unregister from SCSI before tearing down device resources

We must unregister from SCSI before we unmap device resources and unhook
the IRQ handler. Otherwise, SCSI may send us more requests, and we won't
be able to handle them.

I see the following oops during every reboot of my HP DL360:

...
Unmounting local filesystems...done.
Rebooting... Completed flushing cache on controller 0
BUG: unable to handle kernel paging request at virtual address f8808040
printing eip:
c02dc72b
*pde = 02120067
*pte = 00000000
Oops: 0002 [#1]
SMP
Modules linked in:
CPU: 1
EIP: 0060:[<c02dc72b>] Not tainted VLI
EFLAGS: 00010046 (2.6.21-rc6 #1)
EIP is at SA5_submit_command+0xb/0x20
eax: f8808000 ebx: f7a00000 ecx: f79f0000 edx: 37a00000
esi: f79f0000 edi: 00000000 ebp: 00000000 esp: dd717a44
ds: 007b es: 007b fs: 00d8 gs: 0000 ss: 0068
Process khelper (pid: 1427, ti=dd716000 task=c2260a70 task.ti=dd716000)
Stack: c02df2c0 f7a00000 f7a00000 00d41008 c02df691 00000000 00000010 00000002
00000001 f79f0000 f7fff844 c1398420 00000000 00000000 00001000 230a3020
69666564 5420656e 50434f49 465f544b 4853554c 44414552 0a312009 66656423
Call Trace:
[<c02df2c0>] start_io+0x80/0x120
[<c02df691>] do_cciss_request+0x331/0x350
[<c014242a>] mempool_alloc+0x2a/0xe0
[<c020ad71>] blk_alloc_request+0x61/0x80
[<c020b02e>] get_request+0x15e/0x1e0
[<c01595e0>] cache_alloc_refill+0xb0/0x1e0
[<c021049d>] as_update_rq+0x2d/0x80
[<c0210d28>] as_add_request+0x68/0x90
[<c0207f99>] elv_insert+0x119/0x160
[<c020bd0b>] __make_request+0xcb/0x320
[<c0122ee0>] lock_timer_base+0x20/0x50
[<c0123096>] del_timer+0x56/0x60
[<c020a7b8>] blk_remove_plug+0x38/0x70
[<c020a815>] __generic_unplug_device+0x25/0x30
[<c020a835>] generic_unplug_device+0x15/0x30
...

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
7f42d3b8a72ab585f3166a269276c8cca12088af 05-Apr-2007 Mike Miller (OS Dev) <mikem@beardog.cca.cpqcorp.net> [PATCH] cciss: add init of drv->cylinders back to cciss_geometry_inquiry

This patch adds initialization of drv->cylinders back into the failing case in
cciss_geometry_inquiry. I inadvertently removed it in one my 2TB updates.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
4c1f2b316878edcbd3a71f7165190f1c1b008e1e 14-Mar-2007 Al Viro <viro@ftp.linux.org.uk> [PATCH] cciss endian annotations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
de69fee82c5962fb7bdaf6eb8a81302f418d1a1d 06-Mar-2007 Mike Miller (OS Dev) <mikem@beardog.cca.cpqcorp.net> [PATCH] cciss: add struct pci_driver shutdown support (replaces reboot notifier)

This patch adds support for the struct pci_driver shutdown method to cciss.
We require notification of an impending reboot or shutdown so that we can
flush the battery backed write cache (BBWC) on the Smart Array controller.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
97c06978515ed6e071bfd4a5e858837dd2b0edcf 06-Mar-2007 Mike Miller (OS Dev) <mikem@beardog.cca.cpqcorp.net> [PATCH] cciss: fix for 2TB support

This patch changes the way we determine if a logical volume is larger than
2TB.

The original test looked for a total_size of 0. Originally we added 1 to the
total_size. That would make our read_capacity return size 0 for >2TB lv's.
We assumed that we could not have a lv size of 0 so it seemed OK until we were
in a clustered system. The backup node would see a size of 0 due to the
reservation on the drive. That caused the driver to switch to 16-byte CDB's
which are not supported on older controllers. After that everything was
broken.

It may seem petty but I don't see the value in trying to determine if the LBA
is beyond the 2TB boundary. That's why when we switch we use 16-byte CDB's
for all read/write operations. Please consider this for inclusion.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
0f5486ecf7d510595c2af630aae31ed5846bdbeb 30-Dec-2006 Randy Dunlap <randy.dunlap@oracle.com> [PATCH] cciss: build with PROC_FS=n

RAID_UNKNOWN is used even when PROC_FS=n, so move it outside of the
CONFIG_PROC_FS block.

drivers/block/cciss.c:1910: error: 'RAID_UNKNOWN' undeclared (first use in this function)

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: <mike.miller@hp.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
a52de245ef0b6217a56fb2472ff65c3a196cafd5 18-Dec-2006 Mike Miller <mike.miller@hp.com> [PATCH] cciss: fix XFER_READ/XFER_WRITE in do_cciss_request

This patch fixes a stupid bug. Sometime during the 2tb enhancement I ended up
replacing the macros XFER_READ and XFER_WRITE with h->cciss_read and
h->cciss_write respectively. It seemed to work somehow at least on x86_64 and
ia64. I don't know how. But people started complaining about command timeouts
on older controllers like the 64xx series and only on ia32. This resolves the
issue reproduced in our lab. Please consider this for inclusion.

Thanks,
mikem

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
89f97ad1894ab518b05b798906085fb3d1b2d00f 18-Dec-2006 Mike Miller <mike.miller@hp.com> [PATCH] cciss: set default raid level when reading geometry fails

This patch sets a default raid level on a volume that either does not support
reading the geometry or reports an invalid geometry for whatever reason. We
were always setting some values for heads and sectors but never set a raid
level. This caused lots of problems on some buggy firmware. Please consider
this for inclusion.

Thanks,
mikem

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
5cbded585d129d0226cb48ac4202b253c781be26 13-Dec-2006 Robert P. J. Day <rpjday@mindspring.com> [PATCH] getting rid of all casts of k[cmz]alloc() calls

Run this:

#!/bin/sh
for f in $(grep -Erl "\([^\)]*\) *k[cmz]alloc" *) ; do
echo "De-casting $f..."
perl -pi -e "s/ ?= ?\([^\)]*\) *(k[cmz]alloc) *\(/ = \1\(/" $f
done

And then go through and reinstate those cases where code is casting pointers
to non-pointers.

And then drop a few hunks which conflicted with outstanding work.

Cc: Russell King <rmk@arm.linux.org.uk>, Ian Molton <spyro@f2s.com>
Cc: Mikael Starvik <starvik@axis.com>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Greg KH <greg@kroah.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Paul Fulghum <paulkf@microgate.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Karsten Keil <kkeil@suse.de>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Cc: Jeff Garzik <jeff@garzik.org>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Cc: Ian Kent <raven@themaw.net>
Cc: Steven French <sfrench@us.ibm.com>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Cc: Jaroslav Kysela <perex@suse.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
872225ca77519a243d7e19270b062b0ac53418d8 13-Dec-2006 Mike Miller <mike.miller@hp.com> [PATCH] cciss: remove calls to pci_disable_device

Remove calls to pci_disable_device except in fail_all_cmds. The
pci_disable_device function does something nasty to Smart Array controllers
that pci_enable_device does not undo. So if the driver is unloaded it
cannot be reloaded.

Also, customers can disable any pci device via the ROM Based Setup Utility
(RBSU). If the customer has disabled the controller we should not try to
blindly enable the card from the driver. Please consider this for
inclusion.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
a5b92873a87cc579f6399693e2c9ae6b43932ddf 13-Dec-2006 Mike Miller <mike.miller@hp.com> [PATCH] cciss: map out more memory for config table

Map out more memory for our config table. It's required to reach offset
0x214 to disable DMA on the P600. I'm not sure how I lost this hunk.
Please consider this for inclusion.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2fc2c60df3d2b3a557eb8d750779def9d51934b1 13-Dec-2006 Jens Axboe <jens.axboe@oracle.com> [PATCH] Fixup cciss error handling

The previous cciss commit removed the err_out_disable_pdev label, but
there was still a user of that. Fix that up.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
c4977f596c5bce4d20fbd22cdb03486112985622 13-Dec-2006 mike.miller@hp.com <mike.miller@hp.com> [PATCH 2/2] cciss: remove calls to pci_disable_device

This patch removes calls to pci_disable_device except in fail_all_cmds. The
pci_disable_device function does something nasty to Smart Array controllers
that pci_enable_device does not undo. So if the driver is unloaded it cannot be
reloaded.

Also, customers can disable any pci device via the ROM Based Setup Utility
(RBSU). If the customer has disabled the controller we should not try to
blindly enable the card from the driver. Please consider this for inclusion.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Acked-by: Alan Cox <alan@redhat.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
98040015bc5d6cea3bd2dcb642fe1e8c4bded8e1 13-Dec-2006 mike.miller@hp.com <mike.miller@hp.com> [PATCH 1/2] cciss: map out more memory for config table

This patch maps out more memory for our config table. It's required to reach
offset 0x214 to disable DMA on the P600. I'm not sure how I lost this hunk.
Please consider this for inclusion.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
6c648be6f4183775679c1f2cc4d094128f104fb2 08-Dec-2006 Josef Sipek <jsipek@fsl.cs.sunysb.edu> [PATCH] struct path: convert block_drivers

Signed-off-by: Josef Sipek <jsipek@fsl.cs.sunysb.edu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1ecb9c0f3c9ef6af77c39a9f584940691847ccf4 07-Dec-2006 Mike Miller <mike.miller@hp.com> [PATCH] cciss: cleanup cciss_interrupt mode

A pretty simple cleanup for cciss_interrupt_mode.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
799202cbd0ef6a201446d99fcbd78b9f0bda6ae5 07-Dec-2006 Mike Miller <mike.miller@hp.com> [PATCH] cciss: add support for 1024 logical volumes

Add the support for a large number of logical volumes. We will soon have
hardware that support up to 1024 logical volumes.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
3833a748aa75dd39494bb861ab018216b0a2c14e 07-Dec-2006 Mike Miller <mike.miller@hp.com> [PATCH] cciss: remove unused revalidate_allvol function

Remove the no longer used revalidate_allvol function. It was replaced by
rebuild_lun_table.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
7a06f789e0a1b46e4ed2a68f885cbe5ff74a34d6 07-Dec-2006 Mike Miller <mike.miller@hp.com> [PATCH] cciss: change cciss_open for consistency

Change our open to test for drv->heads like we do in other places in the
driver. Mostly for consistency.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
92c4231aef720bd5e1d634d2f7335f31277318da 07-Dec-2006 Mike Miller <mike.miller@hp.com> [PATCH] cciss: set sector_size to 2048 for performance

Change the blk_queue_max_sectors from 512 to 2048. This helps increase
performance.

[akpm@osdl.org: s/sector_size/max_sectors/]
Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
f92e2f5f889803306e50c06e17ee330403e91b8d 07-Dec-2006 Mike Miller <mike.miller@hp.com> [PATCH] cciss: disable DMA prefetch on P600

Unconditionally disable DMA prefetch on the P600 controller. An ASIC bug may
result in prefetching beyond the end of physical memory.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
de9239167158c0210c5b9a709d67cea1b6f8ae56 07-Dec-2006 Mike Miller <mike.miller@hp.com> [PATCH] cciss: fix pci ssid for the E500 controller

Change the SSID on the E500 as a workaround for a firmware bug. It looks like
the original patch was backed out between rc2 and rc4.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
f880632f963c3611d096d9373d16663c076310c7 07-Dec-2006 Mike Miller <mike.miller@hp.com> [PATCH] cciss: increase number of commands on controller

Remove #define NR_CMDS and replace it w/hba[i]->nr_cmds. Most Smart Array
controllers can support up to 1024 commands but the E200 family can only
support 128. To prevent annoying "fifo full" messages we define nr_cmds on a
per controller basis by adding it the product table.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
4ff9a9a4baff2627d7bcf65d0ec07d647bc1ad29 07-Dec-2006 Mike Miller <mike.miller@hp.com> [PATCH] cciss: reference driver support

Add the support to fire up on any HP RAID class device that has a valid cciss
signature.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
9d827c9e8a9d8592167ac3fdc3a50544c86302b1 07-Dec-2006 Mike Miller <mike.miller@hp.com> [PATCH] cciss: version change

Change the cciss version number to 3.6.14 to reflect the following
functionality changes added by the rest of the set. They include:

- Support to fire up on any HP RAID class controller
- Increase nr_cmds to 512 for most controllers by adding it to the product table
- PCI subsystem ID fix fix was pulled
- Disable DMA prefetch for the P600 on IPF platforms
- Change from 512 to 2048 sector_size for performance
- Fix in cciss_open for consistency
- Remove the no longer used revalidate_allvol function
- Bug fix for busy configuring
- Support for more than 16 logical volumes
- Cleanups in cciss_interrupt_mode
- Fix for iostats, it's been broken for several kernel releases

Signed-off-by: Mike Miller <mike.miller@hp.com>
Acked-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
b369c2cfa47bc0ad495a95fe9a17c9888781d615 14-Nov-2006 Jens Axboe <jens.axboe@oracle.com> [PATCH] cciss: fix iostat

cciss needs to call disk_stat_add() for iostat to work.

Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
7b92aadfdae85ef837db343be38d4172115be72b 28-Oct-2006 Randy Dunlap <randy.dunlap@oracle.com> [PATCH] cciss: fix printk format warning

Fix printk format warnings:
drivers/block/cciss.c:2000: warning: long long int format, long unsigned int arg (arg 2)
drivers/block/cciss.c:2035: warning: long long int format, long unsigned int arg (arg 2)

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
3f7705eab6722ad1a346d748c4aad55755d6c241 21-Oct-2006 Matthew Wilcox <matthew@wil.cx> [PATCH] cciss: Fix warnings (and bug on 1TB discs)

CCISS was producing warnings about shifts being greater than the size of
the type and pointers being of incompatible type. Turns out this is
because it's calling do_div on a 32-bit quantity. Upon further
investigation, the sector_t total_size is being assigned to an int, and
then we're calling do_div on that int. Obviously, sector_div is called for
here, and I took the chance to refactor the code a little.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
7d12e780e003f93433d49ce78cfedf4b4c52adc5 05-Oct-2006 David Howells <dhowells@redhat.com> 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)
038b0a6d8d32db934bba6a24e74e76e4e327a94f 04-Oct-2006 Dave Jones <davej@redhat.com> Remove all inclusions of <linux/config.h>
kbuild explicitly includes this at build time.

Signed-off-by: Dave Jones <davej@redhat.com>
6e9a4738c9fadb7cbdcabc1e3b415159f3741ed9 01-Oct-2006 Peter Zijlstra <a.p.zijlstra@chello.nl> [PATCH] completions: lockdep annotate on stack completions

All on stack DECLARE_COMPLETIONs should be replaced by:
DECLARE_COMPLETION_ONSTACK

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Ingo Molnar <mingo@elte.hu>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
cc088d10d02978641c7a2eecd18caf1e01e597b3 01-Oct-2006 Metathronius Galabant <m.galabant@googlemail.com> [PATCH] cciss: remove unneeded spaces in output for attached volumes

It removes the awkwards spaces after the "=" when displaying the
geometry of the attached volumes.

Before:
cciss: using DAC cycles
blocks= 286734240 block_size= 512
heads= 255, sectors= 32, cylinders= 35139

After:
cciss: using DAC cycles
blocks=286734240 block_size=512
heads=255, sectors=32, cylinders=35139

Signed-off-by: Metathronius Galabant <m.galabant@gmail.com>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
00988a3514bbc0cce781c067cf52559741d88b80 01-Oct-2006 Mike Miller (OS Dev) <mikem@beardog.cca.cpqcorp.net> [PATCH] cciss: support for >2TB logical volumes

Add support for logical volumes >2TB. All SAS/SATA controllers support
large volumes.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
a3b05e8f58c95dfccbf2c824d0c68e5990571f24 28-Jul-2006 Jens Axboe <axboe@suse.de> [PATCH] Kill various deprecated/unused block layer defines/functions

Signed-off-by: Jens Axboe <axboe@suse.de>
1883c5aba9973331e3ff0050e05707fe8e84fe0d 13-Sep-2006 Mike Miller <mike.miller@hp.com> [PATCH] cciss: version update, new hw

Add support for new hardware and bumps the version to 3.6.10. It seems
there were several changes introduced including soft_irq. I decided to
bump the major number to reflect these changes. Since we're still
supporting older vendor kernels I need some way differentiate between
kernel versions <=2.6.10 and newer kernels >=2.6.16.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
7b30f09245d0e6868819b946b2f6879e5d3d106b 25-Jul-2006 Jens Axboe <axboe@suse.de> [PATCH] cciss: fix stall with softirq handling and CFQ

We need to postpone the queue startup until after the softirq
handler has actually finished some requests, otherwise we could
be racing with cciss_softirq_done() and not actually restart
the queue handling.

Signed-off-by: Jens Axboe <axboe@suse.de>
69ab3912d1b4dbf27ea1a383cb5731251fc0e109 02-Jul-2006 Thomas Gleixner <tglx@linutronix.de> [PATCH] irq-flags: drivers/block 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: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
ce7b0f46bbf4bff8daab2dd3d878b9e72a623d09 21-Jun-2005 Greg Kroah-Hartman <gregkh@suse.de> [PATCH] devfs: Remove the gendisk devfs_name field as it's no longer needed

And remove the now unneeded number field.
Also fixes all drivers that set these fields.

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
f82ccdb992d694f46b28f0478f62468260f45607 25-Jun-2006 Bjorn Helgaas <bjorn.helgaas@hp.com> [PATCH] CCISS: tidy up product table indentation

Make each one fit on a line so it's easier to read. I re-ordered
COMPAQ_CISSC/0x4091, which was out of order. I double-checked these, but it
would be good if you'd also check them to make sure I didn't miss any.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Cc: Jeff Garzik <jeff@garzik.org>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
7c8328355609be6d229e1a5e016a0115e9328b83 25-Jun-2006 Bjorn Helgaas <bjorn.helgaas@hp.com> [PATCH] CCISS: run through Lindent

cciss is full of inconsistent style ("for (" vs. "for(", lines that end with
whitespace, lines beginning with a mix of spaces & tabs, etc).

This patch changes only whitespace.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-by: Jeff Garzik <jeff@garzik.org>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
e2019b58fac87b93c04d9efc08324a28fd23d601 25-Jun-2006 Bjorn Helgaas <bjorn.helgaas@hp.com> [PATCH] CCISS: remove parens around return values

Typical Linux style is "return -EINVAL", not "return(-EINVAL)".

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-by: Jeff Garzik <jeff@garzik.org>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
d14c4ab58c77c9a03b716c28f230ef944b08dc34 25-Jun-2006 Bjorn Helgaas <bjorn.helgaas@hp.com> [PATCH] CCISS: fix a few spelling errors

Fix a few spelling errors.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-by: Jeff Garzik <jeff@garzik.org>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
5e8621e8bdc2460da516d5f1a5c71d3467ded5d2 25-Jun-2006 Bjorn Helgaas <bjorn.helgaas@hp.com> [PATCH] CCISS: use ARRAY_SIZE without intermediates

It's easier to verify loop bounds if the array name is mentioned the for()
statement that steps through the array.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-by: Jeff Garzik <jeff@garzik.org>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
40aabb5815723551e7c92dd08ed3ea82ec000ccd 25-Jun-2006 Bjorn Helgaas <bjorn.helgaas@hp.com> [PATCH] CCISS: announce cciss%d devices with PCI address/IRQ/DAC info

We already print "cciss: using DAC cycles" or similar for every adapter found:
why not just identify the device we're talking about and include other useful
information?

Jeff Garzik <jeff@garzik.org>:

Although this patch is correct, I would consider using dev_printk() rather
than referencing pci_name() in printk() arguments.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
4e570309e80f7c7a532fe0074e74df26ff8ef5d2 25-Jun-2006 Bjorn Helgaas <bjorn.helgaas@hp.com> [PATCH] CCISS: request all PCI resources

We should call pci_request_regions() to claim all resources the device
decodes. Previously, we claimed only the I/O port range.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-by: Jeff Garzik <jeff@garzik.org>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
c33ac89bc7d697e23ce09ddae73e0ece5f65ad48 25-Jun-2006 Bjorn Helgaas <bjorn.helgaas@hp.com> [PATCH] CCISS: disable device when returning failure

If something fails after we call pci_enable_device(), we should call
pci_disable_device() before returning the failure.

Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Acked-by: Jeff Garzik <jeff@garzik.org>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
8bd0b97e95d378df57938d4773ad674194278ac1 25-Jun-2006 Matt Mackall <mpm@selenic.com> [PATCH] random: make CCISS use add_disk_randomness

Disk devices should use the add_disk_randomness API rather than
SA_SAMPLE_RANDOM.

Signed-off-by: Matt Mackall <mpm@selenic.com>
Cc: <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
27c0ff868f2ad3c9732ce45abbb8dd7e1723931f 28-Apr-2006 Greg Kroah-Hartman <gregkh@suse.de> [PATCH] CCISS: add device symlink to the block cciss block devices in sysfs

Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
ca1e0484d9fe8a9048ac32b0f9894545f43704e8 11-Apr-2006 Mike Miller <mikem@beardog.cca.cpqcorp.net> [PATCH] cciss: bug fix for crash when running hpacucli

Fix a crash when running hpacucli with multiple logical volumes on a cciss
controller. We were not properly initializing the disk->queue and causing
a fault.

Thanks to Hasso Tepper for reporting the problem. Thanks to Steve Cameron
for root causing the problem. Most of the patch just moves things around.
The fix is a one-liner.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Stephen Cameron <steve.cameron@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
89a7689e5c039090d99cbdc3625252c3dee50f7f 24-Mar-2006 Eric Sesterhenn <snakebyte@gmx.de> [PATCH] unused label in drivers/block/cciss.

this patch removes a warning about an unused label, by
moving the label into the ifdef.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Jens Axboe <axboe@suse.de>
06ff37ffb4ba8bcbda0e9d19c712c954ef7b8a0a 08-Mar-2006 Eric Sesterhenn <snakebyte@gmx.de> [PATCH] kzalloc() conversion in drivers/block

this patch converts drivers/block to kzalloc usage.
Compile tested with allyesconfig.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Jens Axboe <axboe@suse.de>
089fe1b23da5468bbf02b721472f71f349837a7d 24-Mar-2006 Eric Sesterhenn <snakebyte@gmx.de> BUG_ON() Conversion in drivers/block/

this changes if() BUG(); constructs to BUG_ON() which is
cleaner, contains unlikely() and can better optimized away.

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2056a782f8e7e65fd4bfd027506b4ce1c5e9ccd4 23-Mar-2006 Jens Axboe <axboe@suse.de> [PATCH] Block queue IO tracing support (blktrace) as of 2006-03-23

Signed-off-by: Jens Axboe <axboe@suse.de>
61808c2bbba127ecd9786401c55ea4c394aa0240 23-Mar-2006 Patrick McHardy <kaber@trash.net> [PATCH] cciss: fix use-after-free in cciss_init_one

free_hba() sets hba[i] to NULL, the dereference afterwards results in this
crash. Setting busy_initializing to 0 actually looks unnecessary, but I'm
not entirely sure, which is why I left it in.

cciss: controller appears to be disabled
Unable to handle kernel NULL pointer dereference at virtual address 00000370
printing eip:
c1114d53
*pde = 00000000
Oops: 0002 [#1]
Modules linked in:
CPU: 0
EIP: 0060:[<c1114d53>] Not tainted VLI
EFLAGS: 00010286 (2.6.16 #1)
EIP is at cciss_init_one+0x4e9/0x4fe
eax: 00000000 ebx: c132cd60 ecx: c13154e4 edx: c27d3c00
esi: 00000000 edi: c2748800 ebp: c2536ee4 esp: c2536eb8
ds: 007b es: 007b ss: 0068
Process swapper (pid: 1, threadinfo=c2536000 task=c2535a30)
Stack: <0>00000000 00000000 00000000 c13fdba0 c2536ee8 c13159c0 c2536f38
f7c74740
c132cd60 c132cd60 ffffffed c2536ef0 c10c1d51 c2748800 c2536f04
c10c1d85
c132cd60 c2748800 c132cd8c c2536f14 c10c1db8 c2748848 00000000
c2536f28
Call Trace:
[<c10031d5>] show_stack_log_lvl+0xa8/0xb0
[<c1003305>] show_registers+0x102/0x16a
[<c10034a2>] die+0xc1/0x13c
[<c1288160>] do_page_fault+0x38a/0x525
[<c1002e9b>] error_code+0x4f/0x54
[<c10c1d51>] pci_call_probe+0xd/0x10
[<c10c1d85>] __pci_device_probe+0x31/0x43
[<c10c1db8>] pci_device_probe+0x21/0x34
[<c110a654>] driver_probe_device+0x44/0x99
[<c110a73f>] __driver_attach+0x39/0x5d
[<c1109e1c>] bus_for_each_dev+0x35/0x5a
[<c110a777>] driver_attach+0x14/0x16
[<c110a220>] bus_add_driver+0x5c/0x8f
[<c110ab22>] driver_register+0x73/0x78
[<c10c1f6d>] __pci_register_driver+0x5f/0x71
[<c13bf935>] cciss_init+0x1a/0x1c
[<c13aa718>] do_initcalls+0x4c/0x96
[<c13aa77e>] do_basic_setup+0x1c/0x1e
[<c10002b1>] init+0x35/0x118
[<c1000cf5>] kernel_thread_helper+0x5/0xb
Code: 04 b5 e0 de 40 c1 8d 50 04 8b 40 34 e8 3f b7 f9 ff 8b 04 b5 e0 de
40 c1 e8 aa f3 ff ff 89 f0 e8 e8 fa ff ff 8b 04 b5 e0 de 40 c1 <c7> 80
70 03 00 00 00 00 00 00 83 c8 ff 8d 65 f4 5b 5e 5f 5d c3
<0>Kernel panic - not syncing: Attempted to kill init!

Signed-off-by: Patrick McHardy <kaber@trash.net>
Cc: <mike.miller@hp.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
80682fa9f70932950c913fd10411c004c4c2e8b0 22-Mar-2006 Uwe Zeisberger <Uwe_Zeisberger@digi.com> Fix "frist", "fisrt", typos

Signed-off-by: Uwe Zeisberger <Uwe_Zeisberger@digi.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
1acc0b0ba409dcf4909890fb33e0829f7fd400be 05-Jan-2006 Andrew Morton <akpm@osdl.org> [SCSI] cciss: kfree(NULL) is legal

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
d43da75fd6be4197c280903e1553eafcc39218e2 07-Feb-2006 Jens Axboe <axboe@suse.de> [PATCH] cciss: softirq handler needs to save interrupt flags

The softirq rq completion handler needs to save/restore interrupt flags
appropriately.

Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
9bfab8cec652c80b4864b4d9247520dca042c2df 30-Nov-2005 Richard Knutsson <ricknu-0@student.ltu.se> [PATCH] drivers/block: Replace pci_module_init() with pci_register_driver()

Replace obsolete pci_module_init() with pci_register_driver().

Signed-off-by: Richard Knutsson <ricknu-0@student.ltu.se>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
a9925a06ea52a44b4bf4a941342e8240eaf22417 09-Jan-2006 Jens Axboe <axboe@suse.de> [BLOCK] CCISS: update for blk softirq completions

Signed-off-by: Jens Axboe <axboe@suse.de>
564de74a7e2778e1d11b2d2e50ee8dab1cf1456a 08-Jan-2006 Christoph Hellwig <hch@lst.de> [PATCH] cciss: avoid defining useless MAJOR_NR macro

This sneaked in with one of the updates.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
945f390f02ce44a13aefc6d9449c99f33c9286a5 08-Jan-2006 Tobias Klauser <tklauser@nuerscht.ch> [PATCH] drivers/block: Use ARRAY_SIZE macro

Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0]) and remove a
duplicate of ARRAY_SIZE. Some trailing whitespaces are also removed.

drivers/block/acsi* has been left out as it's marked BROKEN.

Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch>
Cc: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fb86a35b9ded8a7e53a432cbf28df603cdd4849c 08-Jan-2006 Mike Miller <mike.miller@hp.com> [PATCH] cciss: adds MSI and MSI-X support

This creates a new function, cciss_interrupt_mode called from
cciss_pci_init. This function determines what type of interrupt vector to
use, i.e., MSI, MSI-X, or IO-APIC.

One noticeable difference is changing the interrupt field of the controller
struct to an array of 4 unsigned ints. The Smart Array HW is capable of
generating 4 distinct interrupts depending on the transport method in use
during operation. These are:

#define DOORBELL_INT 0
Used to notify the contoller of configuration updates. We only use
this feature when in polling mode.

#define PERF_MODE_INT 0
Used when the controller is in Performant Mode.

#define SIMPLE_MODE_INT 2
Used when the controller is in Simple Mode (current Linux implementation).

#define MEMQ_INT_MODE 3
Not used.

When using IO-APIC interrupts these 4 lines are OR'ed together so when any
one fires an interrupt an is generated. In MSI or MSI-X mode this hardware
OR'ing is ignored. We must register for our interrupt depending on what
mode the controller is running. For Linux we use SIMPLE_MODE_INT
exclusively at this time. Please consider this for inclusion.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
a885c8c4316e1c1d2d2c8755da3f3d14f852528d 08-Jan-2006 Christoph Hellwig <hch@lst.de> [PATCH] Add block_device_operations.getgeo block device method

HDIO_GETGEO is implemented in most block drivers, and all of them have to
duplicate the code to copy the structure to userspace, as well as getting
the start sector. This patch moves that to common code [1] and adds a
->getgeo method to fill out the raw kernel hd_geometry structure. For many
drivers this means ->ioctl can go away now.

[1] the s390 block drivers are odd in this respect. xpram sets ->start
to 4 always which seems more than odd, and the dasd driver shifts
the start offset around, probably because of it's non-standard
sector size.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Cc: Jens Axboe <axboe@suse.de>
Cc: <mike.miller@hp.com>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paolo Giarrusso <blaisorblade@yahoo.it>
Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Cc: Neil Brown <neilb@cse.unsw.edu.au>
Cc: Markus Lidel <Markus.Lidel@shadowconnect.com>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
8ffdc6550c47f75ca4e6c9f30a2a89063e035cf2 06-Jan-2006 Tejun Heo <htejun@gmail.com> [BLOCK] add @uptodate to end_that_request_last() and @error to rq_end_io_fn()

add @uptodate argument to end_that_request_last() and @error
to rq_end_io_fn(). there's no generic way to pass error code
to request completion function, making generic error handling
of non-fs request difficult (rq->errors is driver-specific and
each driver uses it differently). this patch adds @uptodate
to end_that_request_last() and @error to rq_end_io_fn().

for fs requests, this doesn't really matter, so just using the
same uptodate argument used in the last call to
end_that_request_first() should suffice. imho, this can also
help the generic command-carrying request jens is working on.

Signed-off-by: tejun heo <htejun@gmail.com>
Signed-Off-By: Jens Axboe <axboe@suse.de>
2f6331faf58a4727a9f1138cd6db30d05b124220 13-Dec-2005 Mike Miller <mike.miller@hp.com> [PATCH] cciss: fix for deregister_disk

This patch adds setting our drv->queue = NULL back in deregister_disk. The
drv->queue is part of our controller struct. blk_cleanup_queue works only
on the queue in the gendisk struct.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
b4788f6d55548e587ced330ece711456f40ec8f1 12-Dec-2005 Jens Axboe <axboe@suse.de> [PATCH] cciss: double put_disk()

This undoes the put_disk patch I sent in before.

If I had been paying attention I would have seen that we call put_disk
from free_hba during driver unload. That's the only time we want to
call it. If it's called from deregister disk we may remove the
controller (cNd0) unintentionally.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
6f5a0f7c955d3567f800fa36f978758cb5b99aa2 18-Nov-2005 mikem <mikem@beardog.cca.cpqcorp.net> [PATCH 3/3] cciss: add put_disk into cleanup routines

Jeff Garzik pointed me to his code to see how to remove a disk from
the system _properly_. Well, here it is...
Every place we remove disks we are now testing before calling del_gendisk
or blk_cleanup_queue and then call put_disk.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <axboe@suse.de>
15534d3803993345d8db32246ec329d8f83502e1 18-Nov-2005 Jens Axboe <axboe@suse.de> [PATCH 2/3] cciss: bug fix for BIG_PASS_THRU

Applications using CCISS_BIG_PASSTHRU complained that the data written
was zeros. The problem is that the buffer is being cleared after the
user copy, unless the user copy has failed... Correct that logic.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Jens Axboe <axboe@suse.de>
6044ec8882c726e325017bd948aa0cd94ad33abc 07-Nov-2005 Jesper Juhl <jesper.juhl@gmail.com> [PATCH] kfree cleanup: misc remaining drivers

This is the remaining misc drivers/ part of the big kfree cleanup patch.

Remove pointless checks for NULL prior to calling kfree() in misc files in
drivers/.

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Acked-by: Aristeu Sergio Rozanski Filho <aris@cathedrallabs.org>
Acked-by: Roland Dreier <rolandd@cisco.com>
Acked-by: Pierre Ossman <drzeus@drzeus.cx>
Acked-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Len Brown <len.brown@intel.com>
Acked-by: "Antonino A. Daplas" <adaplas@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
3da8b713da723e78a03f0404beedf3cc6f4f860b 04-Nov-2005 mike.miller@hp.com <mike.miller@hp.com> [SCSI] cciss: scsi error handling

This patch adds SCSI error handling code to the SCSI portion
of the cciss driver.

Signed-off-by: Stephen M. Cameron <steve.cameron@hp.com>
Acked-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
d6dbf42ee36d4f9ffc2a93877c19937c81974124 21-Sep-2005 Mike Miller <mike.miller@hp.com> [PATCH] cciss: busy_initializing bug fix

This patch fixes the problem Bjorn reported. The busy_initializing flag
should have cleared before going into the for loop.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
bb2a37bf4131d64b76dcdb126e3ff5bf371b1842 13-Sep-2005 Mike Miller <mike.miller@hp.com> [PATCH] cciss: fix for DMA brokeness

The CCISS driver seems to loose track of DMA mappings created by it's
fill_cmd() routine. Neither callers of this routine are extracting the DMA
address created in order to do the unmap.

Instead, they simply try to unmap 0x0. It's easy to see this problem on an
x86_64 system when using the "swiotlb=force" boot option. In this case, the
driver is leaking resources of the swiotlb and not causing a sync of the
bounce buffer.

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
6a445d3ba6b90ce13a843ad5d1a0867388b08096 13-Sep-2005 Mike Miller <mike.miller@hp.com> [PATCH] cciss: bug fix in cciss_remove_one

This patch fixes a bug in cciss_remove_one. A set of braces was missing for
the if statement causing an Oops on driver unload.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
33079b21978f478865068ee6a3c5807b6c6ecdbe 13-Sep-2005 Mike Miller <mike.miller@hp.com> [PATCH] cciss: direct lookup for command completions

This patch changes the way we complete commands. In the old method when we
got a completion we searched our command list from the top until we find it.

This method uses a tag associated with each command (not SCSI command tagging)
to index us directly to the completed command. This helps performance.

Signed-off-by: Don Brace <dab@hp.com>
Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
ddd474420a0b0dfeda38b6b5f83c7af751235cc3 13-Sep-2005 Mike Miller <mike.miller@hp.com> [PATCH] cciss: new disk register/deregister routines

This patch removes a couple of functions dealing with configuration and
replaces them with new functions. This implementation fixes some bugs
associated with the ACUXE. It also allows a logical volume to be removed from
the middle without deleting all volumes behind it.

If a user has 5 logical volumes and decides he wants to reconfigure volume
number 3, he can now do that without removing volumes 4 & 5 first. This code
has been tested in our labs against all application software.

Signed-off-by: Chase Maupin <chase.maupin@hp.com>
Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
1f8ef3806c40e74733f45f436d44b3d8e9a2fa48 13-Sep-2005 Mike Miller <mike.miller@hp.com> [PATCH] cciss: busy_initializing flag

This patch adds a flag called busy_initializing. If there are multiple
controllers in a server AND the HP agents are running it's possible the agents
may try to poll a card that is still initializing if the driver is removed and
then added again.

Signed-off-by: Don Brace <dab@hp.com>
Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
9dc7a86e85593c834bb930f5d5aba3a19ee7a350 13-Sep-2005 Mike Miller <mike.miller@hp.com> [PATCH] cciss: new controller pci/subsystem ids

This patch adds new PCI and subsystem ID's that finally made the spec. It
also include a name change for one controller. I know there's a lot of
duplicat names but the fw folks wanted this for the different implementations.

Even though the same ASIC is used it may be embedded on some platforms,
standup card in others, and a mezzanine in other servers.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
86e8486245a01f05a3267b2e8b5c02c2303b670d 10-Sep-2005 Nishanth Aravamudan <nacc@us.ibm.com> [PATCH] drivers/block: fix-up schedule_timeout() usage

Use schedule_timeout_{un,}interruptible() instead of
set_current_state()/schedule_timeout() to reduce kernel size.

Signed-off-by: Nishanth Aravamudan <nacc@us.ibm.com>
Cc: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
ad2b93123d2b3cb4ba9a98dd5f62acb6d6b50391 28-Jul-2005 Mike Miller <mike.miller@hp.com> [PATCH] cciss per disk queue

This patch adds per disk queue functionality to cciss. Sometime back I
submitted a patch but it looks like only part of what I needed. In the 2.6
kernel if we have more than one logical volume the driver will Oops during
rmmod. It seems all of the queues actually point back to the same queue.
So after deleting the first volume you hit a null pointer on the second
one.

This has been tested in our labs. There is no difference in performance,
it just fixes the Oops.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Cc: Jens Axboe <axboe@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
97afa0a25afb43a82954662773a9d48d61b2996a 28-Jun-2005 Andrew Morton <akpm@osdl.org> [PATCH] cciss_ioctl() warning fix

Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
60564a313a5738960064d6c555ec066d9332f278 27-Jun-2005 Mike Miller <mike.miller@hp.com> [PATCH] cciss: remove partition info from CCISS_GETLUNINFO

This patch fulfills a promise I made to Christoph sometime back. I am
removing the partition info from the CCISS_GETLUNINFO ioctl as I was informed
my "driver had no damn business reading that structure." ;)

The application folks are to use /proc or /sys for partition info from now on.
I am only aware of a few apps that use this ioctl and I'm not sure they ever
used the partition info.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Acked-by: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
cd6fb584cf7f18ec6b221192b57d712ecc8c1859 27-Jun-2005 Mike Miller <mike.miller@hp.com> [PATCH] cciss: pci domain info pass 2

This is pass 2 of my patch to add pci domain info to an existing ioctl. This
time I insert the domain between dev_fn and board_id as Willy suggested and
change the var to unsigned short to ease Christoph's concerns. Although I
thought unsigned int was the correct var type for this. I also thought it
didn't matter where I inserted it in the structure.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Acked-by: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
3de0a70bd926ff974adb27a38d4fd1049f05e54e 27-Jun-2005 Mike Miller <mike.miller@hp.com> [PATCH] cciss: pci id fix

This patch fixes a PCI ID I got wrong before. It also adds support for
another new SAS controller due out this summer. I didn't have a marketing
name prior to my last submission. Also modifies the copyright date range.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Acked-by: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
eb0df9962d97f7156a0870aced9018bf5c8f54c1 10-Jun-2005 mike.miller@hp.com <mike.miller@hp.com> [SCSI] cciss 2.6 DMA mapping

Patch removes our homegrown DMA masks and uses the ones defined in the kernel.
This patch replaces the broken one I sent in earlier. It has been tested and works. Please discard the first submission.

Signed-off-by: Mike Miller <mike.miller@hp.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 17-Apr-2005 Linus Torvalds <torvalds@ppc970.osdl.org> Linux-2.6.12-rc2

Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!