History log of /linux-master/drivers/scsi/advansys.c
Revision Date Author Comments
# 8afc6e14 22-Mar-2023 Bart Van Assche <bvanassche@acm.org>

scsi: advansys: Declare SCSI host template const

Make it explicit that the SCSI host template is not modified.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Link: https://lore.kernel.org/r/20230322195515.1267197-18-bvanassche@acm.org
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 17d4c2e2 18-Feb-2022 Bart Van Assche <bvanassche@acm.org>

scsi: advansys: Move the SCSI pointer to private command data

Set .cmd_size in the SCSI host template instead of using the SCSI pointer
from struct scsi_cmnd. This patch prepares for removal of the SCSI pointer
from struct scsi_cmnd.

Link: https://lore.kernel.org/r/20220218195117.25689-14-bvanassche@acm.org
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# af049dfd 07-Oct-2021 Bart Van Assche <bvanassche@acm.org>

scsi: core: Remove the 'done' argument from SCSI queuecommand_lck functions

The DEF_SCSI_QCMD() macro passes the addresses of the SCSI host lock and
also that of the scsi_done function to the queuecommand_lck() function
implementations. Remove the 'scsi_done' argument since its address is
now a constant and instead call 'scsi_done' directly from inside the
queuecommand_lck() functions.

Link: https://lore.kernel.org/r/20211007204618.2196847-14-bvanassche@acm.org
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# f3bc9338 07-Oct-2021 Bart Van Assche <bvanassche@acm.org>

scsi: advansys: Call scsi_done() directly

Conditional statements are faster than indirect calls. Hence call
scsi_done() directly.

Link: https://lore.kernel.org/r/20211007202923.2174984-19-bvanassche@acm.org
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# d4996c6e 29-Sep-2021 Guo Zhi <qtxuning1999@sjtu.edu.cn>

scsi: advansys: Fix kernel pointer leak

Pointers should be printed with %p or %px rather than cast to 'unsigned
long' and printed with %lx.

Change %lx to %p to print the hashed pointer.

Link: https://lore.kernel.org/r/20210929122538.1158235-1-qtxuning1999@sjtu.edu.cn
Signed-off-by: Guo Zhi <qtxuning1999@sjtu.edu.cn>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 568778f5 25-Sep-2021 Len Baker <len.baker@gmx.com>

scsi: advansys: Prefer struct_size() over open-coded arithmetic

As noted in the "Deprecated Interfaces, Language Features, Attributes, and
Conventions" documentation [1], size calculations (especially
multiplication) should not be performed in memory allocator (or similar)
function arguments due to the risk of them overflowing. This could lead to
values wrapping around and a smaller allocation being made than the caller
was expecting. Using those allocations could lead to linear overflows of
heap memory and other misbehaviors.

Use the struct_size() helper to do the arithmetic instead of the argument
"size + count * size" in the kzalloc() function.

This code was detected with the help of Coccinelle and audited and fixed
manually.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments

Link: https://lore.kernel.org/r/20210925114205.11377-1-len.baker@gmx.com
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Len Baker <len.baker@gmx.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 40e16ce7 09-Aug-2021 Bart Van Assche <bvanassche@acm.org>

scsi: advansys: Use scsi_cmd_to_rq() instead of scsi_cmnd.request

Prepare for removal of the request pointer by using scsi_cmd_to_rq()
instead. This patch does not change any functionality.

Link: https://lore.kernel.org/r/20210809230355.8186-15-bvanassche@acm.org
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# ac87ee0a 27-Apr-2021 Hannes Reinecke <hare@suse.de>

scsi: advansys: Do not set message byte in SCSI status

The host byte in the SCSI status takes precedence during error recovery, so
there is no point in setting the message byte in addition to a host byte
which is not DID_OK.

Link: https://lore.kernel.org/r/20210427083046.31620-32-hare@suse.de
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 464a00c9 27-Apr-2021 Hannes Reinecke <hare@suse.de>

scsi: core: Kill DRIVER_SENSE

Replace the check for DRIVER_SENSE with a check for
scsi_status_is_check_condition().

Audit all callsites to ensure the SAM status is set correctly. For
backwards compability move the DRIVER_SENSE definition to sg.h, and update
sg, bsg, and scsi_ioctl to set the DRIVER_SENSE driver_status whenever
SAM_STAT_CHECK_CONDITION is present.

[mkp: fix zeroday srp warning]

Link: https://lore.kernel.org/r/20210427083046.31620-10-hare@suse.de
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

fix


# 9b4c8eaa 31-Mar-2021 Christoph Hellwig <hch@lst.de>

advansys: remove ISA support

This is the last piece in the kernel requiring the block layer ISA
bounce buffering, and it does not actually look used. So remove it
to see if anyone screams, in which case we'll need to find a solution
to fix it back up.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Link: https://lore.kernel.org/r/20210331073001.46776-5-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>


# ce0b6e38 25-Mar-2021 ganjisheng <ganjisheng@yulong.com>

scsi: advansys: Fix spelling of 'is'

s/isi/is/

Link: https://lore.kernel.org/r/20210326030412.1656-1-qiumibaozi_1@163.com
Signed-off-by: ganjisheng <ganjisheng@yulong.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# aced5500 13-Jan-2021 Hannes Reinecke <hare@suse.de>

scsi: advansys: Kill driver-defined status byte accessors

Replace the driver-defined status byte accessors with the mid-layer defined
ones.

Link: https://lore.kernel.org/r/20210113090500.129644-35-hare@suse.de
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 30e88d01 22-Jan-2021 Uwe Kleine-König <uwe@kleine-koenig.org>

isa: Make the remove callback for isa drivers return void

The driver core ignores the return value of the remove callback, so
don't give isa drivers the chance to provide a value.

Adapt all isa_drivers with a remove callbacks accordingly; they all
return 0 unconditionally anyhow.

Acked-by: Marc Kleine-Budde <mkl@pengutronix.de> # for drivers/net/can/sja1000/tscan1.c
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>
Acked-by: Wolfram Sang <wsa@kernel.org> # for drivers/i2c/
Reviewed-by: Takashi Iway <tiwai@suse.de> # for sound/
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for drivers/media/
Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Link: https://lore.kernel.org/r/20210122092449.426097-4-uwe@kleine-koenig.org
Signed-off-by: Takashi Iwai <tiwai@suse.de>


# 90ab1123 02-Nov-2020 Lee Jones <lee.jones@linaro.org>

scsi: advansys: Relocate or remove unused variables

Fixes the following W=1 kernel build warning(s):

drivers/scsi/advansys.c: In function ‘asc_prt_asc_board_eeprom’:
drivers/scsi/advansys.c:2879:15: warning: variable ‘asc_dvc_varp’ set but not used [-Wunused-but-set-variable]
drivers/scsi/advansys.c: In function ‘asc_prt_driver_conf’:
drivers/scsi/advansys.c:3174:6: warning: variable ‘chip_scsi_id’ set but not used [-Wunused-but-set-variable]
drivers/scsi/advansys.c: In function ‘AdvISR’:
drivers/scsi/advansys.c:6114:9: warning: variable ‘target_bit’ set but not used [-Wunused-but-set-variable]

Link: https://lore.kernel.org/r/20201102142359.561122-17-lee.jones@linaro.org
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Hannes Reinecke <hare@suse.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# b417107a 12-Feb-2020 Gustavo A. R. Silva <gustavo@embeddedor.com>

scsi: advansys: Replace zero-length array with flexible-array member

The current codebase makes use of the zero-length array language extension
to the C90 standard, but the preferred mechanism to declare variable-length
types such as these ones is a flexible array member[1][2], introduced in
C99:

struct foo {
int stuff;
struct boo array[];
};

By making use of the mechanism above, we will get a compiler warning
in case the flexible array does not occur last in the structure, which
will help us prevent some kind of undefined behavior bugs from being
inadvertently introduced[3] to the codebase from now on.

Also, notice that, dynamic memory allocations won't be affected by this
change:

"Flexible array members have incomplete type, and so the sizeof operator
may not be applied. As a quirk of the original implementation of
zero-length arrays, sizeof evaluates to zero."[1]

This issue was found with the help of Coccinelle.

[1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
[2] https://github.com/KSPP/linux/issues/21
[3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour")

Link: https://lore.kernel.org/r/20200213000211.GA23171@embeddedor.com
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# c0d0d81a 17-Jun-2019 Ming Lei <ming.lei@redhat.com>

scsi: advansys: use sg helper to iterate over scatterlist

Unlike the legacy I/O path, scsi-mq preallocates a large array to hold
the scatterlist for each request. This static allocation can consume
substantial amounts of memory on modern controllers which support a
large number of concurrently outstanding requests.

To facilitate a switch to a smaller static allocation combined with a
dynamic allocation for requests that need it, we need to make sure all
SCSI drivers handle chained scatterlists correctly.

Convert remaining drivers that directly dereference the scatterlist
array to using the iterator functions.

[mkp: clarified commit message]

Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 2874c5fd 27-May-2019 Thomas Gleixner <tglx@linutronix.de>

treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152

Based on 1 normalized pattern(s):

this program is free software you can redistribute it and or modify
it under the terms of the gnu general public license as published by
the free software foundation either version 2 of the license or at
your option any later version

extracted by the scancode license scanner the SPDX license identifier

GPL-2.0-or-later

has been chosen to replace the boilerplate/reference in 3029 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Allison Randal <allison@lohutok.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190527070032.746973796@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4af14d11 13-Dec-2018 Christoph Hellwig <hch@lst.de>

scsi: remove the use_clustering flag

The same effects can be achieved by setting the dma_boundary to
PAGE_SIZE - 1 and the max_segment_size to PAGE_SIZE, so shift those
settings into the drivers. Note that in many cases the setting might
be bogus, but this keeps the status quo.

[mkp: fix myrs and myrb]

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 2a3d4eb8 13-Dec-2018 Christoph Hellwig <hch@lst.de>

scsi: flip the default on use_clustering

Most SCSI drivers want to enable "clustering", that is merging of
segments so that they might span more than a single page. Remove the
ENABLE_CLUSTERING define, and require drivers to explicitly set
DISABLE_CLUSTERING to disable this feature.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# e6760cc4 17-Oct-2018 YueHaibing <yuehaibing@huawei.com>

scsi: advansys: remove unused variable 'srb_tag' in adv_isr_callback

drivers/scsi/advansys.c: In function 'adv_isr_callback':
drivers/scsi/advansys.c:5952:6: warning:
variable 'srb_tag' set but not used [-Wunused-but-set-variable]

It never used since introduction in
commit 9c17c62aedb0 ("advansys: use shared host tag map for command lookup")

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 874deb1c 20-Sep-2018 Nathan Chancellor <nathan@kernel.org>

scsi: advansys: Remove unnecessary parentheses

Clang warns when multiple pairs of parentheses are used for a single
conditional statement.

drivers/scsi/advansys.c:6451:20: warning: equality comparison with
extraneous parentheses [-Wparentheses-equality]
if ((sdtr_data == 0xFF)) {
~~~~~~~~~~^~~~~~~
drivers/scsi/advansys.c:6451:20: note: remove extraneous parentheses
around the comparison to silence this warning
if ((sdtr_data == 0xFF)) {
~ ^ ~
drivers/scsi/advansys.c:6451:20: note: use '=' to turn this equality
comparison into an assignment
if ((sdtr_data == 0xFF)) {
^~
=
1 warning generated.

Link: https://github.com/ClangBuiltLinux/linux/issues/155
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Acked-by: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# c84b023a 24-Jun-2018 Ming Lei <ming.lei@redhat.com>

scsi: read host_busy via scsi_host_busy()

No functional change.

Just introduce scsi_host_busy() and replace the direct read of
scsi_host->host_busy with this new API.

Cc: Omar Sandoval <osandov@fb.com>,
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>,
Cc: James Bottomley <james.bottomley@hansenpartnership.com>,
Cc: Christoph Hellwig <hch@lst.de>,
Cc: Don Brace <don.brace@microsemi.com>
Cc: Kashyap Desai <kashyap.desai@broadcom.com>
Cc: Mike Snitzer <snitzer@redhat.com>
Cc: Hannes Reinecke <hare@suse.de>
Cc: Laurence Oberman <loberman@redhat.com>
Cc: Bart Van Assche <bart.vanassche@wdc.com>

Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 91ebc1fa 13-Jun-2018 Johannes Thumshirn <jthumshirn@suse.de>

scsi: core: remove Scsi_Cmnd typedef

This will make subsequent refactoring easier to handle.

Note: this patch is nowhere checkpatch clean.

Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 44a5b977 23-Mar-2017 Arnd Bergmann <arnd@arndb.de>

scsi: advansys: fix uninitialized data access

gcc-7.0.1 now warns about a previously unnoticed access of uninitialized
struct members:

drivers/scsi/advansys.c: In function 'AscMsgOutSDTR':
drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+5)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
((ushort)s_buffer[i + 1] << 8) | s_buffer[i]);
^
drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+7)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+5)' may be used uninitialized in this function [-Werror=maybe-uninitialized]
drivers/scsi/advansys.c:3860:26: error: '*((void *)&sdtr_buf+7)' may be used uninitialized in this function [-Werror=maybe-uninitialized]

The code has existed in this exact form at least since v2.6.12, and the
warning seems correct. This uses named initializers to ensure we
initialize all members of the structure.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# f46e7cd3 24-Oct-2016 Arnd Bergmann <arnd@arndb.de>

scsi: advansys: fix build warning for PCI=n

The advansys probe function tries to handle both ISA and PCI cases, each
hidden in an #ifdef when unused. This leads to a warning indicating that
when PCI is disabled we could be using uninitialized data:

drivers/scsi/advansys.c: In function advansys_board_found :
drivers/scsi/advansys.c:11036:5: error: ret may be used uninitialized in this function [-Werror=maybe-uninitialized]
drivers/scsi/advansys.c:10928:28: note: ret was declared here
drivers/scsi/advansys.c:11309:8: error: share_irq may be used uninitialized in this function [-Werror=maybe-uninitialized]
drivers/scsi/advansys.c:10928:6: note: share_irq was declared here

This cannot happen in practice because the hardware in question only
exists for PCI, but changing the code to just error out here is better
for consistency and avoids the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 757b22f9 16-Nov-2015 Arnd Bergmann <arnd@arndb.de>

advansys: fix big-endian builds

Building the advansys driver in a big-endian configuration such as
ARM allmodconfig shows a warning:

drivers/scsi/advansys.c: In function 'adv_build_req':
include/uapi/linux/byteorder/big_endian.h:32:26: warning: large integer implicitly truncated to unsigned type [-Woverflow]
#define __cpu_to_le32(x) ((__force __le32)__swab32((x)))
drivers/scsi/advansys.c:7806:22: note: in expansion of macro 'cpu_to_le32'
scsiqp->sense_len = cpu_to_le32(SCSI_SENSE_BUFFERSIZE);

It turns out that the commit that introduced this used the cpu_to_le32()
incorrectly on an 8-bit field, which results in the sense_len to always
be set to zero, as the SCSI_SENSE_BUFFERSIZE value gets moved to upper
byte of the 32-bit intermediate.

This removes the cpu_to_le32() call to restore the original version.

I found this only by looking at the compiler output and have not done a
full review for possible further endianess bugs in the same driver.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 811ddc057aac ("advansys: use DMA-API for mapping sense buffer")
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cc: stable@vger.kernel.org # v4.2+
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>


# 64d513ac 08-Oct-2015 Christoph Hellwig <hch@lst.de>

scsi: use host wide tags by default

This patch changes the !blk-mq path to the same defaults as the blk-mq
I/O path by always enabling block tagging, and always using host wide
tags. We've had blk-mq available for a few releases so bugs with
this mode should have been ironed out, and this ensures we get better
coverage of over tagging setup over different configs.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Jens Axboe <axboe@kernel.dk>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# 8810eac8 03-Jun-2015 Johannes Thumshirn <jthumshirn@suse.de>

advansys: fix compilation errors and warnings when CONFIG_PCI is not set

Fix compilation errors on forgotten #include <linux/dmapool.h> and warnings when
CONFIG_PCI is not set.

Reported-by: Jim Davis <jim.epost@gmail.com>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# 6571fb3f 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: Update to version 3.5 and remove compilation warning

The driver has now been converted to DMA-API, so we should
increase the version number and remove the compilation
warning.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# bc31ec4d 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: Remove call to dma_cache_sync()

Only required if the dma buffer has been allocated via
dma_alloc_noncoherent(), which this one is not.
With that call removed we can now also compile on ARM.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# 00742c91 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: use spin_lock_irqsave() in interrupt handler

We should be using spin_lock_irqsave() when within the
interrupt handler.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# 22070634 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: Check for DMA mapping errors

DMA mapping might fail, so we need to check for errors here.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# e14f66e9 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: Remove cmd_per_lun setting

Ancient, and pretty much obsolete by now.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# 3754fc64 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: Remove obsolete virtual memory mapping comment

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# d9748dbc 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: Remove 'a_flag'

Unused, so remove it.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# 084e6c36 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: rename 'ASC_RQ_XX' to 'ADV_RQ_XX'

These definitions are only ever used for the wide-scsi board,
so they should be prefixed with 'ADV', not 'ASC'.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# 96aabb2a 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: Remove CC_VERY_LONG_SG_LIST

Was uncommented in the original driver, and I'm too lazy to
figure out the conversion.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# 9fef6ba4 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: Remove ASC_SCSI_REQ_Q

Removed unused structure ASC_SCSI_REQ_Q and update the
comments to 'ADV_SCSI_REQ_Q'.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# 37f64608 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: scsi_q1->data_addr is little endian

The 'data_addr' field is accessed by the board, and needs
to be kept in little endian format.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# f33134e5 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: cleanup function return codes

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# 6f0d2e1d 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: Make AscIsrChipHalted() a void function

AscIsrChipHalted will only ever return '0', so make it
a void function.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# f1138a84 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: remove 'ERR' definition

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# ae26759e 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: Remove 'TRUE' and 'FALSE' definitions

Use 'bool' type instead.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# 95cfab6c 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: use standard data types

No point in defining our own.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# d647c783 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: use 'bool' instead of 'int'

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# 0ce53822 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: Use dma_pool for sg elements

The sg elements should be allocated from a dma pool.
And rename the structure to 'adv_sg_block' as they
are only used by the wide board.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# 4b47e464 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: Use DMA-API for mapping request blocks

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# 98b96a7d 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: Use DMA-API for carrier buffer

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# 811ddc05 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: use DMA-API for mapping sense buffer

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# 9c17c62a 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: use shared host tag map for command lookup

Convert to use a shared host tag map for command lookup. This
saves us having an internal structure and avoid the command
pointer abuse.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# eac0b0c7 24-Apr-2015 Hannes Reinecke <hare@suse.de>

advansys: use host_reset

The advansys_reset() function is actually a host reset, not a
bus reset. And there is no need to have a 'last_reset'
value; the same value exists in struct Scsi_Host.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Odin.com>


# f50332ff 02-Dec-2014 Rasmus Villemoes <linux@rasmusvillemoes.dk>

scsi: print single-character strings with seq_putc

Using seq_putc to print a single character saves at least a strlen()
call and a memory access, and may also give a small .text reduction.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Christoph Hellwig <hch@lst.de>


# 3d30079c 02-Dec-2014 Rasmus Villemoes <linux@rasmusvillemoes.dk>

scsi: merge consecutive seq_puts calls

Consecutive seq_puts calls with literal strings may be replaced by a
single call, saving a little .text.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Christoph Hellwig <hch@lst.de>


# 2f979427 02-Dec-2014 Rasmus Villemoes <linux@rasmusvillemoes.dk>

advansys: replace seq_printf with seq_puts

Using seq_printf to print a simple string is a lot more expensive than
it needs to be, since seq_puts exists. Replace seq_printf with
seq_puts when possible.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Reviewed-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Christoph Hellwig <hch@lst.de>


# 68d81f40 24-Nov-2014 Christoph Hellwig <hch@infradead.org>

scsi: remove MSG_*_TAG defines

For SPI drivers use the message definitions from scsi.h, and for target
drivers introduce a new TCM_*_TAG namespace.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com


# db5ed4df 13-Nov-2014 Christoph Hellwig <hch@lst.de>

scsi: drop reason argument from ->change_queue_depth

Drop the now unused reason argument from the ->change_queue_depth method.
Also add a return value to scsi_adjust_queue_depth, and rename it to
scsi_change_queue_depth now that it can be used as the default
->change_queue_depth implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Hannes Reinecke <hare@suse.de>


# c8b09f6f 03-Nov-2014 Christoph Hellwig <hch@lst.de>

scsi: don't set tagging state from scsi_adjust_queue_depth

Remove the tagged argument from scsi_adjust_queue_depth, and just let it
handle the queue depth. For most drivers those two are fairly separate,
given that most modern drivers don't care about the SCSI "tagged" status
of a command at all, and many old drivers allow queuing of multiple
untagged commands in the driver.

Instead we start out with the ->simple_tags flag set before calling
->slave_configure, which is how all drivers actually looking at
->simple_tags except for one worke anyway. The one other case looks
broken, but I've kept the behavior as-is for now.

Except for that we only change ->simple_tags from the ->change_queue_type,
and when rejecting a tag message in a single driver, so keeping this
churn out of scsi_adjust_queue_depth is a clear win.

Now that the usage of scsi_adjust_queue_depth is more obvious we can
also remove all the trivial instances in ->slave_alloc or ->slave_configure
that just set it to the cmd_per_lun default.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>


# 74665016 22-Jan-2014 Christoph Hellwig <hch@lst.de>

scsi: convert host_busy to atomic_t

Avoid taking the host-wide host_lock to check the per-host queue limit.
Instead we do an atomic_inc_return early on to grab our slot in the queue,
and if necessary decrement it after finishing all checks.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Webb Scales <webbnh@hp.com>
Acked-by: Jens Axboe <axboe@kernel.dk>
Tested-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Robert Elliott <elliott@hp.com>


# 1abf635d 25-Jun-2014 Hannes Reinecke <hare@suse.de>

scsi: use 64-bit value for 'max_luns'

Now that we're using 64-bit LUNs internally we need to increase
the size of max_luns to 64 bits, too.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Christoph Hellwig <hch@infradead.org>
Reviewed-by: Ewan Milne <emilne@redhat.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>


# 50d14a70 23-Oct-2013 Hannes Reinecke <hare@suse.de>

[SCSI] advansys: Remove 'last_reset' references

Serves no purpose whatsoever.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>


# 31491e1a 31-Mar-2013 Al Viro <viro@zeniv.linux.org.uk>

advansys: fix buggered formats - unsigned long != u32 on 64bit

asc_prt_line() had been hiding several places where formats had not
matched the argument types. The previous commit has finally made them
visible...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>


# b59fb6fd 31-Mar-2013 Al Viro <viro@zeniv.linux.org.uk>

advansys: switch to ->show_info()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>


# 6f039790 21-Dec-2012 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Drivers: scsi: remove __dev* attributes.

CONFIG_HOTPLUG is going away as an option. As a result, the __dev*
markings need to be removed.

This change removes the use of __devinit, __devexit_p, __devinitdata,
__devinitconst, and __devexit from these drivers.

Based on patches originally written by Bill Pemberton, but redone by me
in order to handle some of the coding style issues better, by hand.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: Adam Radford <linuxraid@lsi.com>
Cc: "James E.J. Bottomley" <JBottomley@parallels.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9ffc93f2 28-Mar-2012 David Howells <dhowells@redhat.com>

Remove all #inclusions of asm/system.h

Remove all #inclusions of asm/system.h preparatory to splitting and killing
it. Performed with the following command:

perl -p -i -e 's!^#\s*include\s*<asm/system[.]h>.*\n!!' `grep -Irl '^#\s*include\s*<asm/system[.]h>' *`

Signed-off-by: David Howells <dhowells@redhat.com>


# 25985edc 30-Mar-2011 Lucas De Marchi <lucas.demarchi@profusion.mobi>

Fix common misspellings

Fixes generated by 'codespell' and manually reviewed.

Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>


# f281233d 16-Nov-2010 Jeff Garzik <jeff@garzik.org>

SCSI host lock push-down

Move the mid-layer's ->queuecommand() invocation from being locked
with the host lock to being unlocked to facilitate speeding up the
critical path for drivers who don't need this lock taken anyway.

The patch below presents a simple SCSI host lock push-down as an
equivalent transformation. No locking or other behavior should change
with this patch. All existing bugs and locking orders are preserved.

Additionally, add one parameter to queuecommand,
struct Scsi_Host *
and remove one parameter from queuecommand,
void (*done)(struct scsi_cmnd *)

Scsi_Host* is a convenient pointer that most host drivers need anyway,
and 'done' is redundant to struct scsi_cmnd->scsi_done.

Minimal code disturbance was attempted with this change. Most drivers
needed only two one-line modifications for their host lock push-down.

Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Acked-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 421f91d2 10-Jun-2010 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

fix typos concerning "initiali[zs]e"

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 9a908c1a 30-Mar-2010 Herton Ronaldo Krzesinski <herton@mandriva.com.br>

[SCSI] advansys: fix narrow board error path

Error handling on advansys_board_found is fixed, because it's buggy in
the case we have an ASC_NARROW_BOARD set and failure happens on
AscInitAsc1000Driver step: it was freeing items of wrong struct in the
dvc_var union of struct asc_board, which could lead to an oops in the
case we set some of the fields in struct of narrow board as code was
choosing to always freeing wide board fields, and not everything was
being freed/released properly.

Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>


# cf747445 19-Mar-2010 Herton Ronaldo Krzesinski <herton@mandriva.com.br>

[SCSI] advansys: fix regression with request_firmware change

On newer kernels users of advansys module are reporting system hang when
trying to load it without firmware files present. After looking closely
at description on https://qa.mandriva.com/show_bug.cgi?id=53220, I think
this is related to commit "[SCSI] advansys: use request_firmware". The
problem is that after switch to request_firmware, asc_dvc->err_code
isn't being set when firmware files aren't found or loading fails.

err_code is used by the driver to judge if there was a fatal error or
not, as can be seen for example on advansys_board_found, which will only
return -ENODEV when err_code is set. Because err_code isn't being set
when request_firmware fails, this is a change of behaviour of the code
before request_firmware addition, making it continue to load and it
fails later as the firmware wasn't really loaded.

Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>


# 6070d81e 04-Dec-2009 Adam Buchbinder <adam.buchbinder@gmail.com>

tree-wide: fix misspelling of "definition" in comments

"Definition" is misspelled "defintion" in several comments; this
patch fixes them. No code changes.

Signed-off-by: Adam Buchbinder <adam.buchbinder@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>


# 989bb5f5 01-Apr-2009 Jaswinder Singh Rajput <jaswinderrajput@gmail.com>

[SCSI] advansys: use request_firmware

Firmware blob looks like this...
__le32 checksum
unsigned char data[]

Signed-off-by: Jaswinder Singh Rajput <jaswinderrajput@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>


# 71610f55 03-Dec-2008 Kay Sievers <kay.sievers@vrfy.org>

[SCSI] struct device - replace bus_id with dev_name(), dev_set_name()

[jejb: limit ioctl to returning 20 characters to avoid overrun
on long device names and add a few more conversions]
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>


# 25729a7f 28-Sep-2008 Arjan van de Ven <arjan@linux.intel.com>

[SCSI] advansys, arcmsr, ipr, nsp32, qla1280, stex: use pci_ioremap_bar()

Use the newly introduced pci_ioremap_bar() function in drivers/scsi.
pci_ioremap_bar() just takes a pci device and a bar number, with the goal
of making it really hard to get wrong, while also having a central place
to stick sanity checks.

Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Acked-by: Matthew Wilcox <willy@linux.intel.com>
Cc: Brian King <brking@us.ibm.com>
Cc: Ed Lin <ed.lin@promise.com>
Cc: Nick Cheng <nick.cheng@areca.com.tw>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>


# 30037818 22-Nov-2008 Al Viro <viro@ftp.linux.org.uk>

advansys fix on ISA-less configs

The code

if (shost->dma_channel != NO_ISA_DMA)
free_dma(shost->dma_channel);

in there is triggerable only if we have CONFIG_ISA (we only set ->dma_channel to
something other than NO_ISA_DMA under #ifdef CONFIG_ISA). OTOH, free_dma() is
not guaranteed to be there in absense of CONFIG_ISA. IOW, driver runs into
undefined symbols on PCI-but-not-ISA configs (e.g. on frv) and it's a false
positive.

Fix: put the entire if () under #ifdef CONFIG_ISA; behaviour doesn't change and
dependency on free_dma() disappears for !CONFIG_ISA.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# cadbd4a5 04-Jul-2008 Harvey Harrison <harvey.harrison@gmail.com>

[SCSI] replace __FUNCTION__ with __func__

[jejb: fixed up a ton of missed conversions.

All of you are on notice this has happened, driver trees will now
need to be rebased]

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Cc: SCSI List <linux-scsi@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>


# 951b62c1 05-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Fix bug in AdvLoadMicrocode

buf[i] can be up to 0xfd, so doubling it and assigning the result to an
unsigned char truncates the value. Just use an unsigned int instead;
it's only a temporary.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Cc: Stable Tree <stable@kernel.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>


# 7d5d408c 07-Feb-2008 FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>

[SCSI] advansys: fix overrun_buf aligned bug

struct asc_dvc_var needs overrun buffer to be placed on an 8 byte
boundary. advansys defines struct asc_dvc_var:

struct asc_dvc_var {
...
uchar overrun_buf[ASC_OVERRUN_BSIZE] __aligned(8);

The problem is that struct asc_dvc_var is placed on
shost->hostdata. So if the hostdata is not on an 8 byte boundary, the
advansys crashes. The hostdata is placed on a sizeof(unsigned long)
boundary so the 8 byte boundary is not garanteed with x86_32.

With 2.6.23 and 2.6.24, the hostdata is on an 8 byte boundary by
chance, but with the current git, it's not.

This patch removes overrun_buf static array and use kzalloc.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>


# 63adcc58 05-Feb-2008 Adrian Bunk <bunk@kernel.org>

[SCSI] advansys: make 3 functions static

Signed-off-by: Adrian Bunk <bunk@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>


# b80ca4f7 12-Jan-2008 FUJITA Tomonori <tomof@acm.org>

[SCSI] replace sizeof sense_buffer with SCSI_SENSE_BUFFERSIZE

This replaces sizeof sense_buffer with SCSI_SENSE_BUFFERSIZE in
several LLDs. It's a preparation for the future changes to remove
sense_buffer array in scsi_cmnd structure.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>


# 747d016e 14-Jan-2008 Randy Dunlap <randy.dunlap@oracle.com>

advansys: fix section mismatch warning

Fix section mismatch warning:

WARNING: vmlinux.o(.exit.text+0x152a): Section mismatch: reference to .init.data:_asc_def_iop_base (between 'advansys_isa_remove' and 'advansys_exit')

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Matthew Wilcox <willy@debian.org>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>


# 9d511a4b 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Changes to work on parisc

Change PortAddr to be an unsigned int instead of an unsigned short (IO
Port address are 24 bit on parisc). Fix a couple of printk argument
warnings. Remove the Kconfig marking as 'BROKEN'.

I haven't removed the #warning yet because virt_to_bus/bus_to_virt are
only eliminated for narrow boards. Wide boards need more work.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# d10fb2c7 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Use dma mapping for overrun buffer

Convert the call to virt_to_bus() into a call to dma_map_single(). Some
architectures may require different DMA addresses for different devices,
so allocate one overrun buffer per host rather than one for all cards.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# b249c7fd 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Remove a couple of uses of bus_to_virt

Replace ASC_VADDR_TO_U32 and ASC_U32_TO_VADDR with an auto-expanding
array that maps pointers to 32-bit IDs and back. One of the uses of
ASC_VADDR_TO_U32 was in error; it should have been using ADV_VADDR_TO_U32.

Also replace the use of virt_to_bus when setting the sense_address with
a call to dma_map_single() followed by dma_cache_sync. This part cribbed
from the 53c700 driver.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 52c334e9 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: convert to use the data buffer accessors

- remove the unnecessary map_single path.
- convert to use the new accessors for the sg lists and the parameters.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>

- convert the statistics to not distinguish between single and sg xfers
- replace ASC_CEILING with DIV_ROUND_UP
- remove an obsolete comment

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# fd625f47 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Remove DvcGetPhyAddr

This rather complex function boiled down to calling virt_to_bus().
Also get rid of some obsolete defines and variables that could never vary.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 98d41c29 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Move a couple of fields from struct board to struct adv_dvc

board->carrp is a duplicate of asc_dvc->carrier_buf, so cut out the
middle-man and assign directly to carrier_buf. Move orig_reqp to adv_dvc
too, since it's wide-board specific. Also eliminate an unnecessary BUG_ON
(we'll never get there with a NULL carrier_buf, and will crash if we do).
The bulk of this patch is rearranging structures so everything's declared
in the right order.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# afbb68c3 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Make sdtr_period_tbl a pointer

It's somewhat neater to make this a pointer to one of two tables
than initialising an array in the driver. Also delete the unused
AscSynIndexToPeriod and rename host_init_sdtr_index to min_sdtr_index

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 9d0e96eb 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Get rid of board index number

It's always a mistake to have your own index of boards; just use the
scsi host number.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# f092d229 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Remove private lock

The board lock was essentially identical with the host lock.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# b352f923 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Sort out debug macros

Replace ASC_DBG{,1,2,3,4,5} with a single variadic macro ASC_DBG. As
suggested by Jeff Garzik, include DRV_NAME and __FUNCTION__ in the output.
Change all callers to no longer include the function name in the string.

Enabling ADVANSYS_DEBUG to test this feature shows a lot of other problems
that need to be fixed:
- Reorder asc_prt_* functions now that their prototypes have been removed.
- There is no longer a struct device in ASC_DVC_CFG/ADV_DVC_CFG, and it
wasn't necessarily a PCI device to begin with. Print the bus_id from
asc_board->dev instead.
- isr_callback no longer exists.
- ASC_DBG_PRT_SCSI_CMND isn't being used, so delete asc_prt_scsi_cmnd
too.
- A missing semicolon

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# b08fc565 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Remove library version & serial numbers

With the ASC and ADV libraries merged into the driver, there really is
no point in reporting their version numbers, or even trying to maintain
them.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# d2411495 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Remove asc_board_t typedef and ASC_BOARDP macro

asc_board_t was simply a typedef for struct asc_board. ASC_BOARDP()
can be replaced by shost_priv() except in the ASC_STATS* macros which
rely on the cast; add an explicit cast there.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 720349a8 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Merge ASC_IERR definitions

There were two blocks of ASC_IERR definitions; one for narrow and one for
wide boards. Some of the same names were used (with the same values),
and some of the same values were used with different names. This could
only lead to confusion, so I unified them in one block of definitions
with no overlapping values.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# d361db48 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Sort out irq number mess

The interrupt number was being stored in 4-5 different places, each with
its own type, rules and usage. Fix this by keeping an unsigned int in
the struct asc_board, and filling it in from the bus probe functions
(since it's different for each of the four bus types). In order to do
this, we have to allocate the Scsi_Host in the bus probe functions too.
Then we can return an error from advansys_board_found, which requires
a little rearranging of code (and removing of the err_code variable).
Move the Wide Board flag setting into the PCI bus probe function.

Split the AscGetChipIRQ function into three functions (one for each bus
type that needs it) and add some commentary to explain what's going on.
Also get rid of the AscSetChipIRQ function as we only ever set the
interrupt number to the same value it already had.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 9a256fa5 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Remove ASC_WIDE_BOARD predicate

Replace it with !ASC_NARROW_BOARD

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# ae002fec 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Remove ASC_SELECT_QUEUE_DEPTHS

It was only ever set; never tested, nor cleared.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 52fa0777 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Improve reset handler

- Don't need to set ASC_HOST_IN_RESET any more
- Don't need to test scp->device->host for NULL -- if it's NULL, we
couldn't've been called.
- Use scmd_printk instead of ASC_PRINT

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 05848b6e 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Fix simultaneous calls to ->queuecommand

The narrow board used two global structures to set up a command;
unfortunately they weren't locked, so with two boards in the machine,
one call to queuecommand could corrupt the data being used by the other
call to queuecommand.

Fix this by allocating asc_scsi_q on the stack (64 bytes) and using kmalloc
for the asc_sg_head (2k)

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 41d2493d 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Restructure asc_execute_scsi_cmnd()

The wide and narrow boards share identical handling of the return value,
except for some trivial error messages. Move the handling to the common
end of the function. Also move variable declarations to the arms of
the `if' that they're used in and delete some pointless comments.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 6e8905f4 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Remove array of scsi targets

The driver was saving a scsi_device for each target, but wasn't doing
anything useful with them. Just delete the array.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 51219358 02-Oct-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Eliminate prototypes

Rearrange a lot of the functions in the file to get rid of all the forward
declarations.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 01fbfe0b 09-Sep-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Use DRV_NAME

Follow the example of some other drivers by defining DRV_NAME to be
"advansys". Prevents spelling mistakes.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 95c9f162 09-Sep-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Comment/indentation/macro cleanup

- Delete comments relating to the previous structure of the driver.
I have no intention of honouring them ;-)
- Reformat comments > 80 columns
- Remove now-obsolete comments from advansys_interrupt
- Change adv_get_sglist() from do {} while (1) to for (;;)
- Return void from AscInitQLinkVar()
- Take out a level of indentation in adv_get_sglist()
- Reduce indentation level of AscAsyncFix()
- Remove unused macros
- Refactor AscSendScsiQueue slightly

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# b009bef6 09-Sep-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Remove some custom wrappers

- Replace ASC_ASSERT() with BUG_ON().
In a few places, get rid of the assertion altogether -- the ensuing
crash will tell us all we need to know. Use BUG() where it fits better
than BUG_ON(). Also fix a fencepost error in advansys_proc_info().
- Replace DvcSleepMilliSecond with mdelay.
Despite its name using 'sleep', the implementation was a delay.
I've marked some places with XXX where we should probably be using
msleep instead. They need to be audited to be sure we can sleep in
that context.
- Replace DvcDelayMicroSecond with udelay.
- Replace DvcDelayNanoSecond with udelay too.
All callers were multiples of 1000.
- Remove DvcEnterCritical and DvcLeaveCritical.
These functions are no-ops, and as the comments said, the spinlock
protects the critical sections.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# faac48ec 09-Sep-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Remove a check for an impossible condition

AscExeScsiQueue() has one caller, and it passes the address of a
variable; this cannot ever be NULL. This is the only place that ever
sets ASCQ_ERR_SCSIQ_NULL_PTR, so delete that error code too, as well as
several other unused ASCQ_ERR codes.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# f05ec594 09-Sep-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Support 16-byte commands properly

The SCSI midlayer won't send commands greater than ->max_cmd_len.
So the checks on length in asc_build_req and adv_build_req are obsolete
and can be deleted, but also we have to set the max_cmd_len in
advansys_board_found(). Also move the length definitions together, and
write a helpful comment.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# b2a7a4ba 09-Sep-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Enable interrupts earlier in queuecommand

Move as much as possible outside the critical section in queuecommand, eg:
- Set the scsi_done field before acquiring the lock
- Call asc_scsi_done after dropping the lock

Also remove a comment suggesting we should enable interrupts (now we do)
and do some minor reformatting for readability.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 349d2c44 09-Sep-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Remove `active' queue and all remaining internal queueing code

The `active' list was used in the reset handler -- but the midlayer
guarantees that list is empty by the time the reset handler is invoked.
It was also checked in the interrupt routines to be sure that this command
belonged to this board, but we don't need to check that either. We can
then delete the asc_prt_target_stats() function as it will never print
anything, along with asc_enqueue(), asc_dequeue_list(), asc_rmqueue(),
asc_scsi_done_list(), struct asc_queue, ASC_QUEUE_EMPTY, ASC_TID_ALL,
ASC_FRONT, ASC_BACK, and all the REQ* macros. Also remove this item from
the todo list.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 6ed1ef07 09-Sep-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Remove `done' queue

- Move the guts of asc_scsi_done_list() into a new function, asc_scsi_done.
- Call asc_scsi_done() in asc_isr_callback() and adv_isr_callback(). The
comment was wrong; scsi_done cannot enable interrupts.
- All other places which queued an scp on the done list are error paths
for queuecommand, and so we can just call asc_scsi_done() in queuecommand
if we receive an error.
- We no longer need to keep a list of done requests in advansys_interrupt

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 7686f02a 09-Sep-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Remove a check for an impossible condition

The midlayer guarantees it won't call ->queuecommand for a host which
is handling a reset condition.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# b6622925 09-Sep-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Remove `waiting' queue

If the adapter is busy, return the request to the midlayer rather than
queueing it in the driver. asc_execute_queue() and asc_dequeue() become
unused, and we don't need to print out stats on the waiting queue any more.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# c2dce2fa 09-Sep-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Shrink advansys_board_found a little more

Move the error reporting into AscInitGetConfig, AdvInitGetConfig and
AscInitSetConfig.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 629d688d 09-Sep-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Reformat microcode

It's just data, so format it to something that looks more visually
appealing (and saves some lines)

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# b9d96614 09-Sep-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Create AdvLoadMicrocode

Split AdvLoadMicrocode out of AdvInitAsc3550Driver, AdvInitAsc38C0800Driver
and AdvInitAsc38C1600Driver.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# a9f4a59a 09-Sep-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Create AdvBuildCarrierFreelist

Split AdvBuildCarrierFreelist out of AdvInitAsc3550Driver,
AdvInitAsc38C0800Driver and AdvInitAsc38C1600Driver.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# b8e5152b 09-Sep-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Fix VLB driver name

You can't have two drivers for the same bus type with the same name.
Since ISA and VLB are both isa_drivers, rename the VLB one to advansys_vlb.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 4bd6d7f3 30-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Move documentation to Documentation/scsi

The 700+-line comment at the top of the advansys driver fits more comfortably
in Documentation/scsi.

Delete the sections on:
- kernels supported
- other files modified (obsolete)
- source comments (obsolete)
- tests to run
- release history (that's what a VCS is for)
- contacting connectcom (the domain has expired and the phone number is
now in use by another organisation)

Known problems/fix list is moved down to the section where jejb put his FIXME.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# d68f4321 26-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: use memcpy instead of open-coded loop

Use memcpy to initialise eep_config instead of a loop. For
AdvInitFrom38C1600EEP where we need to modify the default EEPROM
configuration, do it after the loop, and do it using the structure
definition, not by finding the right byte. I think it was wrong for
big-endian machines.

Also delete some non-useful comments and prototypes.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 13ac2d9c 30-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Remove pci_slot_info

The driver kept a copy of the PCI config address; refer to the pci_dev
associated with the card instead.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 895d6b4c 26-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Remove library-style callback routines

Convert adv_isr_callback, adv_async_callback and asc_isr_callback into
direct calls. Remove the unused asc_exe_callback.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 394dbf3f 26-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Move struct device out of the cfg structures

The cfg structures are supposed to be disposable after initialisation;
with the 'dev' used for DMA mapping in there, that's not possible. Move
the dev to the board.

Also inline AscInitFromAscDvcVar into its only caller, remove some
unnecessary prototypes and sort out a few minor formatting issues.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 4a2d31c8 26-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Stop using n_io_port in Scsi_Host structure

n_io_port isn't suitable for advansys because some of the boards have
more than 255 bytes of io port space. There's already a driver-private
replacement, asc_n_io_port, but for some reason the driver was still
setting and occasionally reporting n_io_port.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 57ba5fe9 26-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: ioremap no longer needs page-aligned addresses

At some point during Linux 2.1 development, ioremap() gained the ability
to handle addresses which weren't page-aligned. Also expand the CONFIG_PCI
range to encompass that entire section of wide board initialisation, since
all wide boards are PCI.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 59fcf844 26-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: delete AscGetChipBusType

By moving a test from AscGetChipBusType into its only caller, we can delete
the whole function

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# ecec1947 30-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: misc reformatting

Remove some useless forward declarations
Reformat some comments, debug messages, and the occasional piece of real code
Removal of unnecessary braces
Remove duplicate setting of shost->irq

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 47d853cc 26-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: remove INQUIRY sniffing

Use slave_configure() to do all the work that used to be done in
AscInquiryHandling and AdvInquiryHandling. Split slave_configure into
two functions, one for wide and one for narrow controllers.

Remove some unused definitions, duplicate definitions, unnecessary
declarations, and scsireqq, cap_info and inquiry from struct asc_board.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# ce3a7f12 26-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: remove AscCompareString()

AscCompareString() is just another name for strncmp

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 9649af39 26-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: More PCI cleanups

- Remove wrappers around the PCI configuration space accessors
- Call pci_set_master() instead of poking at config space directly
- Move the latency setting into one function called for both narrow and
wide boards.
- Tidy up AdvInitGetConfig() a little.
- Delete a few unused prototypes and definitions.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 71f36115 30-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Update resource management

Make sure the resources are reserved and released by all the callers of
advansys_board_found(). This eliminates the check_region-style race.
It also allows us to use the pci_request_regions() API.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# c304ec94 30-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Convert to ISA driver model

Register two isa_drivers, one for ISA and one for VLB, in order to
preserve detection order. When deleting advansys_detect, we lose the
last vestiges of the code that limited IO port scanning. This code
has been effectively disabled for many years anyway; I'll restore it
in a module_param later. We also lose the code that placed all ISA PnP
cards into WaitForKey state -- drivers shouldn't be doing this anyway.
The asc_host array goes away too. Also remove some IOADR and other
definitions, such as ASC_NUM_BOARD_SUPPORTED.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# b09e05a7 30-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Convert to EISA driver model

- Switch EISA probing to the driver model
- Remove some now-unused macros and functions
- Update the FIXME now that we use the correct driver model probing API

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 78e77d8b 29-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Convert to PCI driver model

- Add a pci_driver interface for the PCI advansys devices (for
ISA/EISA/VLB devices, we still call advansys_detect).
- Many functions are converted from __init to __devinit to allow hotplug
PCI to work.
- Only keep devices found by advansys_detect in the asc_host list.
- Rename asc_board_count to asc_legacy_count. New asc_board_count is only
used to generate a unique name for each device.
- Remove some now-unused macros and struct definitions

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 8dfb5379 30-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Move to scsi hotplug initialisation model

- Switch from scsi_register/scsi_unregister to scsi_host_alloc,
scsi_add_host, scsi_scan_host and scsi_host_put.
- Rename the scsi_host_template to advansys_template
- Use module_init and module_exit instead of scsi_module.c
- Remove protection against advansys_detect being called twice

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# b2c16f58 29-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Make advansys_board_found a little more readable

- Put all the error cleanup at the end of the function and goto the
appropriate label
- Split advansys_wide_init_chip out of advansys_board_found
- Split advansys_wide_free_mem out of advansys_board_found. Use it
from advansys_release
- Use GFP_KERNEL, not GFP_ATOMIC, when allocating memory during
initialisation
- Eliminate lots of PROC_FS ifdefs by removing the ifdefs around the prtbuf
struct member

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 605fe598 29-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Stop checking the scsi_cmnd belongs to our Scsi_Host

The interrupt routines used to walk the list of Scsi_Hosts belonging to
this driver to make sure that the scsi_cmnd belonged to one of them.
This is a waste of time and gets in the way of later cleanups, so
delete it.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 074c8fe4 28-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Improve interrupt handler

Pass the Scsi_Host to the interrupt handler, rather than polling all
hosts for each interrupt.
Return IRQ_NONE if we didn't handle this interrupt
Don't set the IRQF_DISABLED flag; this is not a fast-executing interrupt
handler.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 2a437959 26-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: Clean up proc_info implementation

Just use the Scsi_Host passed in, rather than looking through the driver's
own array of boards for one that matches it.

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 8c6af9e1 26-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: undate version, copyright, etc

Update the version to 3.4
Add my copyright
Add myself to MAINTAINERS
Exercise my right to change the license from dual BSD/GPL to GPL
Don't force the definition of CONFIG_ISA on x86
Always include pci.h
Stop including stat.h

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 27c868c2 26-Jul-2007 Matthew Wilcox <willy@infradead.org>

[SCSI] advansys: lindent and other large, uninteresting changes

- Run Lindent
- Move advansys_detect and advansys_release to the end of the file
- Split advansys_board_found out of advansys_detect
- Rename a few variables, such as shp to shost and pci_devp to pdev
- Turn STATIC into static

Signed-off-by: Matthew Wilcox <matthew@wil.cx>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 70c8d897 23-May-2007 Adrian Bunk <bunk@stusta.de>

[SCSI] advansys: cleanups

- remove the unneeded advansys.h
- remove the unused advansys_setup()
- make needlessly global functions static

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 35d68483 05-Feb-2007 Ken Witherow <ken@krwtech.com>

[SCSI] advansys: clean up warnings

Fix typecast warnings and switch from check_region to request_region

(akpm: Ken and Jeffrey Phillips Freeman <jeffreyfreeman@syncleus.com> are
possible advansys testers)

Signed-off-by: Ken Witherow <ken@krwtech.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# d8dafd8c 21-Nov-2006 Randy Dunlap <randy.dunlap@oracle.com>

[SCSI] advansys: wrap PCI table inside ifdef CONFIG_PCI

The Advansys ISA/EISA/PCI driver has a compile error when
CONFIG_PCI=n, so wrap the pci_device_id table inside
ifdef CONFIG_PCI.

drivers/scsi/advansys.c: At top level:
drivers/scsi/advansys.c:18219: error: array type has incomplete element type
drivers/scsi/advansys.c:18221: error: 'PCI_ANY_ID' undeclared here (not in a function)
make[2]: *** [drivers/scsi/advansys.o] Error 1
make[1]: *** [drivers/scsi] Error 2
make: *** [drivers] Error 2

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# aa7677d4 10-Oct-2006 Al Viro <viro@ftp.linux.org.uk>

[PATCH] NULL noise removal: advansys

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 1e0dbafd 10-Oct-2006 Al Viro <viro@ftp.linux.org.uk>

[PATCH] advansys __iomem annotations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 7d12e780 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)


# 2672ea86 02-Aug-2006 Dave Jones <davej@redhat.com>

[SCSI] advansys pci tweaks.

Remove a lot of duplicate #defines from the advansys driver,
and make them look like PCI IDs as defined elsewhere in the kernel.
Also add a module table so that it automatically gets picked up
by tools relying on modinfo output (like say, distro installers).

Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 1d6f359a 01-Jul-2006 Thomas Gleixner <tglx@linutronix.de>

[PATCH] irq-flags: scsi: 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: James Bottomley <James.Bottomley@steeleye.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 6ab3d562 30-Jun-2006 Jörn Engel <joern@wohnheim.fh-wedel.de>

Remove obsolete #include <linux/config.h>

Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>


# d6e05edc 26-Jun-2006 Andreas Mohr <andi@lisas.de>

spelling fixes

acquired (aquired)
contiguous (contigious)
successful (succesful, succesfull)
surprise (suprise)
whether (weather)
some other misspellings

Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Adrian Bunk <bunk@stusta.de>


# c836043e 25-Jun-2006 Randy Dunlap <rdunlap@infradead.org>

[PATCH] advansys section fixes

Priority: not critical.
Mark 3 functions __init. Saves a little memory.
This makes these functions' calls to AdvWaitEEPCmd() (which is __init)
be clean (i.e., eliminates text -> init -> text call chain).

Fix multiple section mismatch warnings:
WARNING: drivers/scsi/advansys.o - Section mismatch: reference to .init.text: from .text between 'AdvSet3550EEPConfig' (at offset 0x7a22) and 'AdvSet38C0800EEPConfig'
WARNING: drivers/scsi/advansys.o - Section mismatch: reference to .init.text: from .text between 'AdvSet3550EEPConfig' (at offset 0x7a4e) and 'AdvSet38C0800EEPConfig'
WARNING: drivers/scsi/advansys.o - Section mismatch: reference to .init.text: from .text between 'AdvSet3550EEPConfig' (at offset 0x7a79) and 'AdvSet38C0800EEPConfig'
WARNING: drivers/scsi/advansys.o - Section mismatch: reference to .init.text: from .text between 'AdvSet3550EEPConfig' (at offset 0x7aa2) and 'AdvSet38C0800EEPConfig'
WARNING: drivers/scsi/advansys.o - Section mismatch: reference to .init.text: from .text between 'AdvSet3550EEPConfig' (at offset 0x7abb) and 'AdvSet38C0800EEPConfig'
WARNING: drivers/scsi/advansys.o - Section mismatch: reference to .init.text: from .text between 'AdvSet38C0800EEPConfig' (at offset 0x7ae0) and 'AdvSet38C1600EEPConfig'
WARNING: drivers/scsi/advansys.o - Section mismatch: reference to .init.text: from .text between 'AdvSet38C0800EEPConfig' (at offset 0x7b0c) and 'AdvSet38C1600EEPConfig'
WARNING: drivers/scsi/advansys.o - Section mismatch: reference to .init.text: from .text between 'AdvSet38C0800EEPConfig' (at offset 0x7b37) and 'AdvSet38C1600EEPConfig'
WARNING: drivers/scsi/advansys.o - Section mismatch: reference to .init.text: from .text between 'AdvSet38C0800EEPConfig' (at offset 0x7b60) and 'AdvSet38C1600EEPConfig'
WARNING: drivers/scsi/advansys.o - Section mismatch: reference to .init.text: from .text between 'AdvSet38C0800EEPConfig' (at offset 0x7b79) and 'AdvSet38C1600EEPConfig'
WARNING: drivers/scsi/advansys.o - Section mismatch: reference to .init.text: from .text between 'AdvSet38C1600EEPConfig' (at offset 0x7b9e) and 'AdvExeScsiQueue'
WARNING: drivers/scsi/advansys.o - Section mismatch: reference to .init.text: from .text between 'AdvSet38C1600EEPConfig' (at offset 0x7bca) and 'AdvExeScsiQueue'
WARNING: drivers/scsi/advansys.o - Section mismatch: reference to .init.text: from .text between 'AdvSet38C1600EEPConfig' (at offset 0x7bf5) and 'AdvExeScsiQueue'
WARNING: drivers/scsi/advansys.o - Section mismatch: reference to .init.text: from .text between 'AdvSet38C1600EEPConfig' (at offset 0x7c1e) and 'AdvExeScsiQueue'
WARNING: drivers/scsi/advansys.o - Section mismatch: reference to .init.text: from .text between 'AdvSet38C1600EEPConfig' (at offset 0x7c37) and 'AdvExeScsiQueue'

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# 4661e3ea 29-Apr-2006 Linus Torvalds <torvalds@g5.osdl.org>

[SCSI] advansys driver: limp along on x86

Let people enable the advansys driver on x86-32, even though it's broken
on other architectures due to missing DMA mapping infrastructure.

It's used by Jeffrey Phillips Freeman <jeffreyfreeman@syncleus.com> and
possibly others.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# d0be4a7d 31-Oct-2005 Christoph Hellwig <hch@lst.de>

[SCSI] remove Scsi_Host_Template typedef

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# c9475cb0 07-Nov-2005 Jesper Juhl <jesper.juhl@gmail.com>

[PATCH] kfree cleanup: drivers/scsi

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

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

Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Acked-by: Kai Makisara <kai.makisara@kolumbus.fi>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>


# b21a4138 05-Aug-2005 James Bottomley <James.Bottomley@steeleye.com>

[SCSI] add global timeout to the scsi mid-layer

There are certain rogue devices (and the aic7xxx driver) that return
BUSY or QUEUE_FULL forever. This code will apply a global timeout (of
the total number of retries times the per command timer) to a given
command. If it is exceeded, the command is completed regardless of its
state.

The patch also removes the unused field in the command: timeout and
timeout_total.

This solves the problem of detecting an endless loop in the mid-layer
because of BUSY/QUEUE_FULL bouncing, but will not recover the device.
In the aic7xxx case, the driver can be recovered by sending a bus reset,
so possibly this should be tied into the error handler?

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# f5ad5614 19-Jun-2005 Christoph Hellwig <hch@lst.de>

[SCSI] remove scsi_cmnd->abort_reason

Never used for anything but printing it out in debug routines.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 12413197 10-Jun-2005 Christoph Hellwig <hch@lst.de>

[SCSI] remove scsi_set_device

scsi_add_host is the proper place to set the device, but people copy
the scsi_set_device usage from older drivers again and again.

note that this leaves some legacy drivers like qlogicisp/qlogicfc
without pci association in sysfs, but they're scheduled to go away soon
anyway.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# c6295cdf 03-Apr-2005 Tejun Heo <htejun@gmail.com>

[PATCH] scsi: remove meaningless scsi_cmnd->serial_number_at_timeout field

scsi_cmnd->serial_number_at_timeout doesn't serve any purpose
anymore. All serial_number == serial_number_at_timeout tests
are always true in abort callbacks. Kill the field. Also, as
->pid always equals ->serial_number and ->serial_number
doesn't have any special meaning anymore, update comments
above ->serial_number accordingly. Once we remove all uses of
this field from all lldd's, this field should go.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# d3a933dc 03-Apr-2005 Tejun Heo <htejun@gmail.com>

[PATCH] scsi: remove unused scsi_cmnd->internal_timeout field

scsi_cmnd->internal_timeout field doesn't have any meaning
anymore. Kill the field.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 84011ae8 03-Apr-2005 Tejun Heo <htejun@gmail.com>

[PATCH] scsi: remove meaningless scsi_cmnd->serial_number_at_timeout field

scsi_cmnd->serial_number_at_timeout doesn't serve any purpose
anymore. All serial_number == serial_number_at_timeout tests
are always true in abort callbacks. Kill the field. Also, as
->pid always equals ->serial_number and ->serial_number
doesn't have any special meaning anymore, update comments
above ->serial_number accordingly. Once we remove all uses of
this field from all lldd's, this field should go.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 97665e9c 03-Apr-2005 Tejun Heo <htejun@gmail.com>

[PATCH] scsi: remove unused scsi_cmnd->internal_timeout field

scsi_cmnd->internal_timeout field doesn't have any meaning
anymore. Kill the field.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>


# 1da177e4 16-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!