summaryrefslogtreecommitdiff
path: root/drivers/scsi/scsi_transport_spi.c
AgeCommit message (Collapse)Author
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156Thomas Gleixner
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 this program is distributed in the hope that it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details you should have received a copy of the gnu general public license along with this program if not write to the free software foundation inc 59 temple place suite 330 boston ma 02111 1307 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1334 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-06-26scsi: core: check for equality of result byte valuesJohannes Thumshirn
When evaluating a SCSI command's result using the field access macros, check for equality of the fields and not if a specific bit is set. This is a preparation patch, for reworking the results field in the SCSI command. Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Bart Van Assche <bart.vanassche@wdc.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-02-15scsi: scsi_transport_spi: make two const arrays static, shrinks object sizeColin Ian King
Don't populate the const read-only arrays spi_test_unit_ready and spi_test_unit_ready on the stack but instead make them static. Makes the object code smaller by over 100 bytes: Before: text data bss dec hex filename 40171 12832 128 53131 cf8b drivers/scsi/scsi_transport_spi.o After: text data bss dec hex filename 39922 12976 128 53026 cf22 drivers/scsi/scsi_transport_spi.o (gcc version 7.2.0 x86_64) Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2018-01-10block, scsi: Fix race between SPI domain validation and system suspendBart Van Assche
Avoid that the following warning is reported when suspending a system that is using the mptspi driver: WARNING: CPU: 0 PID: 4187 at drivers/scsi/scsi_lib.c:2960 scsi_device_quiesce+0x20/0xb0 EIP: scsi_device_quiesce+0x20/0xb0 Call Trace: spi_dv_device+0x65/0x5f0 [scsi_transport_spi] mptspi_dv_device+0x4d/0x170 [mptspi] mptspi_dv_renegotiate_work+0x49/0xc0 [mptspi] process_one_work+0x190/0x2e0 worker_thread+0x37/0x3f0 kthread+0xcb/0x100 ret_from_fork+0x19/0x24 Fixes: 3a0a529971ec (block, scsi: Make SCSI quiesce and resume work reliably) Reported-by: Woody Suwalski <terraluna977@gmail.com> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Acked-by: Martin K. Petersen <martin.petersen@oracle.com> [ rjw : Subject ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2017-12-14scsi: core: Use blist_flags_t consistentlyBart Van Assche
Use the type blist_flags_t for all variables that represent blacklist flags. Additionally, suppress recently introduced sparse warnings related to blacklist flags. [mkp: fixed commit id] Fixes: 5ebde4694e3b ("scsi: Use 'blist_flags_t' for scsi_devinfo flags") Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Hannes Reinecke <hare@suse.com> Cc: Johannes Thumshirn <jthumshirn@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2017-02-23scsi: merge __scsi_execute into scsi_executeChristoph Hellwig
All but one caller want the decoded sense header, so offer the existing __scsi_execute helper as the public scsi_execute API to simply the callers. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-08-07[SCSI] Fix printk typos in drivers/scsiMasanari Iida
This patch fix spme spelling typos in printk within drivers/scsi. Signed-off-by: Masanari Iida <standby24x7@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
2014-12-04scsi: remove MSG_*_TAG definesChristoph Hellwig
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
2014-11-12scsi: remove abuses of scsi_populate_tagChristoph Hellwig
Unless we want to build a SPI tag message we should just check SCMD_TAGGED instead of reverse engineering a tag type through the use of scsi_populate_tag_msg. Also rename the function to spi_populate_tag_msg, make it behave like the other spi message helpers, and move it to the spi transport class. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Reviewed-by: Hannes Reinecke <hare@suse.de>
2012-05-10[SCSI] scsi_transport_spi: fix for unbalanced reference countingMike Maslenkin
Check the domain validation flag on the given device before referencing scsi_device instance, otherwise if the flag is already set we return without decrementing the reference count. Signed-off-by: Mike Maslenkin <mihailm@parallels.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2012-01-03switch ->is_visible() to returning umode_tAl Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2011-07-26[SCSI] scsi_transport_spi: Export host width and HBA idHannes Reinecke
Currently it's impossible to find out if the host supports wide SCSI unless you're committed to trawl through syslog. And it's near impossible to find the actual HBA id, which is settable for some SCSI HBAs (like aic7xxx). So export them via sysfs. Signed-off-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Ankit Jain <jankit@suse.de> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2010-03-30include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo
implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2009-06-21scsi_transport_spi: Blacklist Ultrium-3 tape for IU transfersJames Bottomley
There have been several bug reports which identified the Ultrium-3 tape as just hanging up on the bus during certain types of IU transfer. The identified culpret is type 0x02 (MULTIPLE COMMAND) transfers. The only way to prevent this tape wedging is to prevent it from using IU transfers at all. So this patch uses the exported blacklist matching technology to recognise the drive and force it not to use IU transfers. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2009-06-21scsi_transport_spi: use spi target settings instead of inquiry data for DVJames Bottomley
Right at the moment, we carefully set up the spi_support_xx in the device configuration routines, but then we never actually use the results: we rely on the inquiry strings. If we're going to allow overrides to the inquiry data, we have to rely on our own internal settings. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2009-06-15[SCSI] aic79xx: make driver respect nvram for IU and QAS settingsJames Bottomley
This patch allows the Adaptec firmware to pass on its values for Packetize and QAS. To do this, the settings max_iu and max_qas have been introduced into the SPI transport class and populated from the adaptec NVram tables. Domain validation in the SPI transport class will respect the max settings when configuring to the highest possible speed for testing. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-12-29[SCSI] scsi_transport_spi: fix the misuse of scsi_execute return valueFUJITA Tomonori
[jejb: fix rejections] Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-12-29[SCSI] add residual argument to scsi_execute and scsi_execute_reqFUJITA Tomonori
scsi_execute() and scsi_execute_req() discard the residual length information. Some callers need it. This adds residual argument (optional) to scsi_execute and scsi_execute_req. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-10-13[SCSI] block: separate failfast into multiple bits.Mike Christie
Multipath is best at handling transport errors. If it gets a device error then there is not much the multipath layer can do. It will just access the same device but from a different path. This patch breaks up failfast into device, transport and driver errors. The multipath layers (md and dm mutlipath) only ask the lower levels to fast fail transport errors. The user of failfast, read ahead, will ask to fast fail on all errors. Note that blk_noretry_request will return true if any failfast bit is set. This allows drivers that do not support the multipath failfast bits to continue to fail on any failfast error like before. Drivers like scsi that are able to fail fast specific errors can check for the specific fail fast type. In the next patch I will convert scsi. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Cc: Jens Axboe <jens.axboe@oracle.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-07-30[SCSI] scsi_transport_spi: fix oops in revalidateJames Bottomley
The class_device->device conversion is causing an oops in revalidate because it's assuming that the device_for_each_child iterator will only return struct scsi_device children. The conversion made all former class_devices children of the device as well, so this assumption is broken. Fix it. Cc: Stable Tree <stable@kernel.org> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-27[SCSI] scsi_transport_spi: include sysfs.hRandy Dunlap
scsi_transport_spi.c needs to #include <linux/sysfs.h>: next-20080423/drivers/scsi/scsi_transport_spi.c:1467: error: implicit declaration of function 'sysfs_update_group' make[3]: *** [drivers/scsi/scsi_transport_spi.o] Error 1 Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-22[SCSI] scsi_transport_spi: fix the attribute settingsJames Bottomley
We now take advantage of the mode_t return of is_valid, and also update the attributes when the target is configured. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-04-19SCSI: convert struct class_device to struct deviceTony Jones
It's big, but there doesn't seem to be a way to split it up smaller... Signed-off-by: Tony Jones <tonyj@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Roland Dreier <rolandd@cisco.com> Cc: Sean Hefty <sean.hefty@intel.com> Cc: Hal Rosenstock <hal.rosenstock@gmail.com> Cc: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2008-01-23[SCSI] scsi_transport_spi: convert to attribute groupsJames Bottomley
This conversion makes full use of the is_visible() callback on attribute groups. Now, each device appears only with its capability flags in the transport class directory. Previously each device appeared with the capability of the host, so this is a functionality improvement. Converting to attribute groups allows us to sweep away most of the home grown #defines that were effectively doing the same thing. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2007-09-22[SCSI] scsi_transport_spi: fix domain validation failure from incorrect ↵James Bottomley
width setting Domain Validation in the SPI transport class is failing on boxes with damaged cables (and failing to the extent that the box hangs). The problem is that the first test it does is a cable integrity test for wide transfers and if this fails, it turns the wide bit off. The problem is that the next set of tests it does turns wide back on again, with the result that it runs through the entirety of DV with a known bad setting and then hangs the system. The attached patch fixes the problem by physically nailing the wide setting to what it deduces it should be for the whole of Domain Validation. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-02-02[SCSI] spi transport class: export spi_dv_pendingEric Moore
Signed-off-by: Eric Moore <Eric.Moore@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2007-01-03[SCSI] scsi_transport_spi: fix sense buffer size errorJames Bottomley
The code does this: unsigned char sense[SCSI_SENSE_BUFFERSIZE]; ... scsi_normalize_sense(sense, sizeof(*sense), sshdr) however the sizeof will return 1 not 96 which means the sense data will have no valid ASC/ASCQ values. Fix by putting the correct sense size. The only affected case for this would have been the DV buffer sanity check failure, which is fortunately quite rare. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-11-22WorkStruct: make allyesconfigDavid Howells
Fix up for make allyesconfig. Signed-Off-By: David Howells <dhowells@redhat.com>
2006-09-23[SCSI] SPI transport class: misc DV fixesJames Bottomley
Key more of the domain validation settings off the inquiry data from the disk (in particular, don't try IU or DT unless the disk claims to support them. Also add a new dv_in_progress flag to prevent recursive DV. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-06-30Remove obsolete #include <linux/config.h>Jörn Engel
Signed-off-by: Jörn Engel <joern@wohnheim.fh-wedel.de> Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-06-10[SCSI] spi transport: don't allow dt to be set on SE or HVD busesJames Bottomley
This is really just a belt and braces test. The standards require disks to respond DT not capable on a non-LVD bus ... however, not all disks follow the standards ... Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-06-10[SCSI] drivers/scsi: Use ARRAY_SIZE macroTobias Klauser
Use ARRAY_SIZE macro instead of sizeof(x)/sizeof(x[0]) and remove duplicates of the macro. Signed-off-by: Tobias Klauser <tklauser@nuerscht.ch> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-03-12[SCSI] fix minor problem in spi transport message functionsJames Bottomley
The check for a one byte message should be msg[0] == 0x55 not msg == 0x55 Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-03-12[SCSI] Missing names from SPI3, SPI4 and SPI5Matthew Wilcox
Add several missing messages from SPI3, SPI4 and SPI5: - Terminate Process - Continue Task - Target Transfer Disable - Clear ACA - LUN Reset - ACA - QAS Request Rename some older commands to their SPI5 names: - Command Complete -> Task Complete - Abort -> Abort Task Set - Bus device Reset -> Target Reset - Clear Queue -> Clear Task Set Change spi_print_msg() to always consume one byte, even if we don't recognise it. That allows drivers to call it in a loop to print all messages. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-02-27[SCSI] Improve message printing codeMatthew Wilcox
Fix a bug where we would consume one byte too many in the message printing code. Add support for 256-byte long messages. Add support for the Modify Bidirectional Data Pointer message. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-02-27[SCSI] Add EXPORT_SYMBOL for spi msg functionsJames Bottomley
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-02-27[SCSI] Make spi_print_msg more consistentMatthew Wilcox
Almost all the output from spi_print_msg() has a trailing space. This patch fixes up the three cases that don't. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-02-27[SCSI] Add spi_populate_*_msg functionsMatthew Wilcox
Introduce new helpers: - spi_populate_width_msg() - spi_populate_sync_msg() - spi_populate_ppr_msg() and use them in drivers which already enable the SPI transport. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-02-27[SCSI] unused show_spi_transport_period_helper parameterMatthew Wilcox
show_spi_transport_period_helper() doesn't need the class_device parameter Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-02-27[SCSI] SCSI core kmalloc2kzallocJes Sorensen
Change the core SCSI code to use kzalloc rather than kmalloc+memset where possible. Signed-off-by: Jes Sorensen <jes@sgi.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-01-14[SCSI] sem2mutex: scsi_transport_spi.cJes Sorensen
Convert the SCSI transport class code to use a mutex rather than a semaphore. Signed-off-by: Jes Sorensen <jes@sgi.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-01-12[SCSI] scsi_transport_spi.c: make print_nego() staticAdrian Bunk
Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-12-15[SCSI] Add PPR support to spi_print_msgMatthew Wilcox
Introduce a new helper, print_nego() to handle SDTR/WDTR/PPR. Split out the guts of show_spi_transport_period_helper() into period_to_str() and use it in print_nego to get the period factor conversion right. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-12-15[SCSI] Use ARRAY_SIZE in spi_print_msgMatthew Wilcox
Replace the custom NO_*_MSGS definitions with uses of ARRAY_SIZE. This fixes a bug in the definition of NO_EXTENDED_MSGS. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-12-15[SCSI] Fix printing of two-byte messagesMatthew Wilcox
A missing comma meant that "Ordered Queue Tag" and "Ignore Wide Residue" were being concatenated together. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-12-15[SCSI] Rename scsi_print_msg to spi_print_msgMatthew Wilcox
Rename scsi_print_msg to spi_print_msg and move its prototype from scsi_dbg.h to scsi_transport_spi.h Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-12-15[SCSI] Move scsi_print_msg to SPI classMatthew Wilcox
scsi_print_msg() is an SPI-specific concept. This patch moves it from constants.c to scsi_transport_spi.c and updates the Kconfig to link in the SPI class for the drivers which use scsi_print_msg(). Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-12-13[SCSI] Delete trailing full stopMatthew Wilcox
None of the other domain validation messages have a trailing full stop, so I don't see why this one should. Signed-off-by: Matthew Wilcox <matthew@wil.cx> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-12-01[SCSI] SPI DV: be more conservative about echo buffer usageJames Bottomley
Some SCSI devices apparently get very confused if we try to use the echo buffer on a non-DT negotiated bus (this mirrors the problems of using PPR on non-LVD for some devices). The fix is to be far more conservative about when we use an echo buffer. With this patch, we'll now see what parameters are negotiated by the read only test, and only look for an echo buffer if DT is negotiated. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-10-28[SCSI] move the mid-layer printk's over to shost/starget/sdev_printkJames Bottomley
This should eliminate (at least in the mid layer) to make numeric assumptions about any of the enumeration variables. As a side effect, it will also make all the messages consistent and line us up nicely for the error logging strategy (if it ever shows itself again). Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>