aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aha1542.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-04-20Annotate hardware config module parameters in drivers/scsi/David Howells1-1/+1
When the kernel is running in secure boot mode, we lock down the kernel to prevent userspace from modifying the running kernel image. Whilst this includes prohibiting access to things like /dev/mem, it must also prevent access by means of configuring driver modules in such a way as to cause a device to access or modify the kernel image. To this end, annotate module_param* statements that refer to hardware configuration and indicate for future reference what type of parameter they specify. The parameter parser in the core sees this information and can skip such parameters with an error message if the kernel is locked down. The module initialisation then runs as normal, but just sees whatever the default values for those parameters is. Note that we do still need to do the module initialisation because some drivers have viable defaults set in case parameters aren't specified and some drivers support automatic configuration (e.g. PNP or PCI) in addition to manually coded parameters. This patch annotates drivers in drivers/scsi/. Suggested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk> Signed-off-by: David Howells <dhowells@redhat.com> cc: "Juergen E. Fischer" <fischer@norbit.de> cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com> cc: "Martin K. Petersen" <martin.petersen@oracle.com> cc: Dario Ballabio <ballabio_dario@emc.com> cc: Finn Thain <fthain@telegraphics.com.au> cc: Michael Schmitz <schmitzmic@gmail.com> cc: Achim Leubner <achim_leubner@adaptec.com> cc: linux-scsi@vger.kernel.org
2016-02-23scsi: aha1542: avoid uninitialized variable warningsArnd Bergmann1-0/+3
Gcc incorrectly detects that two variables in aha1542_queuecommand might be used without an initialization: scsi/aha1542.c: In function 'aha1542_queuecommand': scsi/aha1542.c:382:16: error: 'cptr' may be used uninitialized in this function [-Werror=maybe-uninitialized] scsi/aha1542.c:379:11: error: 'sg_count' may be used uninitialized in this function [-Werror=maybe-uninitialized] The only user of these is doing the same check that the assigment has, so it is actually guaranteed to work. Adding an "else" clause with a fake initialization shuts up the warning. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2015-05-31scsi: Do not set cmd_per_lun to 1 in the host templateHannes Reinecke1-1/+0
'0' is now used as the default cmd_per_lun value, so there's no need to explicitly set it to '1' in the host template. Signed-off-by: Hannes Reinecke <hare@suse.de> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-27aha1542: Allocate memory before taking a lockOndrej Zary1-12/+11
The driver currently calls kmalloc with GFP_KERNEL while holding a lock. Fix it by doing the allocation earlier, before taking the lock. Tested on AHA-1542B. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: remove loop from aha1542_outbOndrej Zary1-8/+5
The loop in aha1542_outb with double-check is no longer needed, remove it. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Fix bus resetOndrej Zary1-1/+1
Bus reset always fails because aha1542_reset waits for the controller to assert the INIT bit (Mailbox Initialization Required) which it never does. This bit is asserted only after host reset. Remove the requirement for INIT bit (we really need only the IDLE bit). Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: rework lockingOndrej Zary1-84/+34
Remove aha1542_lock and use host_lock instead. Remove interrupt and queuecommand function wrappers. Remove locking from lowlevel _out and _in functions, they now can onle be called (at runtime) with host_lock being held. Remove ssleep(4) in aha1542_reset as we can't sleep while holding a spinlock. It's useless anyway as wait_mask will wait until the controller is idle and kernel waits for 10 seconds (HOST_RESET_SETTLE_TIME) after that. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Don't reduce functionality with DEBUG enabledOndrej Zary1-21/+10
Enabling DEBUG disables write commands and devices with ID > 1. Remove this "feature" to allow real debugging. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Use print_hex_dump_bytes in debug codeOndrej Zary1-26/+8
Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: remove DEB macro and simplify debug codeOndrej Zary1-34/+22
Remove DEB macro and join ifdef DEBUG blocks Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Use shost_printk instead of printkOndrej Zary1-35/+32
Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Change aha1542_set_bus_times parametersOndrej Zary1-18/+16
Pass struct Scsi_Host *sh and dma parameters instead of index to aha1542_set_bus_times. This is required for printk conversion. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Pass struct Scsi_Host * to functionsOndrej Zary1-62/+63
Pass struct Scsi_Host * to functions instead of base address. This reduces the number of parameters and is also required for printk conversion. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: cleanup includesOndrej Zary1-8/+3
Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: remove useless changelogOndrej Zary1-22/+3
Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Always name Scsi_Host variables shOndrej Zary1-49/+49
Make Scsi_Host variable names consistent - use sh everywhere. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1524: Use struct scsi_cmndOndrej Zary1-75/+75
Use struct scsi_cmnd instead of Scsi_Cmnd and also rename the variables to get rid of SC prefix Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: clean up cmd variablesOndrej Zary1-29/+24
Make sure that there's no variable named cmd Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Simplify aha1542_biosparamOndrej Zary1-13/+8
Simplify aha1542_biosparam, use sector_div, remove unused BIOS_TRANSLATION_1632. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: rework configuration parametersOndrej Zary1-159/+54
Remove __setup and introduce separate io, bus_on, bus_off and dma_speed module parameters. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: rework hw_initOndrej Zary1-81/+58
Cleanup hw_init, use goto for error handling. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Call wait_mask from aha1542_outOndrej Zary1-10/+7
aha1542_out call is always followed by wait_mask. Move the call into aha1542_out to simplify code. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: split out code from aha1542_hw_initOndrej Zary1-30/+35
Split out bus times related block of aha1542_hw_init into separate function aha1542_set_bus_times. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Merge aha1542_host_reset and aha1542_bus_resetOndrej Zary1-68/+14
aha1542_host_reset and aha1542_bus_reset are almost same, merge them into aha1542_reset Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Remove aha1542_restartOndrej Zary1-26/+2
aha1542_restart does nothing (except useless printk), remove it Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: remove useless code from aha1542_test_portOndrej Zary1-14/+1
Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Remove unneeded gotosOndrej Zary1-39/+19
Remove gotos that are no longer needed. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Split aha1542_outOndrej Zary1-40/+35
aha1542_out are in fact two separate functions. Split them into aha1542_out and aha1542_outb to simplify the code. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Unify aha1542_in and aha1542_in1Ondrej Zary1-26/+7
Unify aha1542_in and aha1542_in1 functions, they differ only in timeout and printk. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Remove WAIT and WAITd macrosOndrej Zary1-47/+57
Convert the ugly WAIT and WAITd macros into wait_mask function. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: remove empty aha1542_statOndrej Zary1-15/+1
Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Reorder functions to remove forward declarationsOndrej Zary1-27/+24
Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Use u8 instead of uncharOndrej Zary1-25/+25
Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Convert aha1542_intr_reset to functionOndrej Zary1-1/+4
Convert aha1542_intr_reset macro to inline function Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Remove HOSTDATA macroOndrej Zary1-59/+55
Remove HOSTDATA macro and use shost_priv instead Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Remove SCSI_BUF_PA, SCSI_SG_PA, AHA1542_SCATTER and AHA1542_CMDLUNOndrej Zary1-13/+10
Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: remove dead codeOndrej Zary1-242/+1
Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2015-04-09aha1542: Stop using scsi_module.cOndrej Zary1-132/+168
Convert aha1542 to use scsi_add_host instead of scsi_module.c Use pnp_driver and isa_driver to manage cards. Signed-off-by: Ondrej Zary <linux@rainbow-software.org> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: James Bottomley <JBottomley@Odin.com>
2012-06-28treewide: Put a space between #include and FILEPaul Bolle1-1/+1
Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2012-05-17scsi: delete the MCA specific drivers and driver codePaul Gortmaker1-64/+2
The support for CONFIG_MCA is being removed, since the 20 year old hardware simply isn't capable of meeting today's software demands on CPU and memory resources. This commit removes the MCA specific SCSI drivers, and the MCA specific portions of code in dual role ISA/MCA drivers. Also, the MCA specific SCSI documentation is removed. Cc: James Bottomley <JBottomley@parallels.com> Cc: linux-scsi@vger.kernel.org Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2012-03-28Remove all #inclusions of asm/system.hDavid Howells1-1/+0
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>
2012-01-13module_param: make bool parameters really bool (drivers & misc)Rusty Russell1-1/+1
module_param(bool) used to counter-intuitively take an int. In fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy trick. It's time to remove the int/unsigned int option. For this version it'll simply give a warning, but it'll break next kernel version. Acked-by: Mauro Carvalho Chehab <mchehab@redhat.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2010-11-16SCSI host lock push-downJeff Garzik1-1/+3
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>
2010-08-07aha1532: remove ISA_DMA_THRESHOLD usageFUJITA Tomonori1-25/+0
We can safely remove ISA_DMA_THRESHOLD usage in aha1542. aha1542 uses ISA_DMA_THRESHOLD to see if: - the buffers in scatter/list are below 16MB. - scsi_host is below 16MB. Both checkings were added in the ancient times but aren't necessary nowadays since we properly bounce the buffers and allocate scsi_host below 16MB with non-zero unchecked_isa_dma. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Acked-by: James Bottomley <James.Bottomley@suse.de> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
2010-03-30include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.hTejun Heo1-0/+1
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>
2008-04-27[SCSI] aha1542: minor irq handler cleanupsJeff Garzik1-16/+10
- where the 'irq' function argument is known never to be used, rename it to 'dummy' to make this more obvious - replace per-irq lookup functions and tables with a direct reference to data object obtained via 'dev_id' function argument, passed from request_irq() Signed-off-by: Jeff Garzik <jgarzik@redhat.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2008-02-03MAINTAINERS: remove Adam Fritzler, remove his email address in other sourcesJoe Perches1-1/+1
Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Adrian Bunk <bunk@kernel.org>
2008-01-23[SCSI] replace sizeof sense_buffer with SCSI_SENSE_BUFFERSIZEFUJITA Tomonori1-2/+2
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>
2008-01-11[SCSI] aha1542: convert to accessors and !use_sg cleanupBoaz Harrosh1-35/+10
- convert to accessors and !use_sg cleanup Signed-off-by: Boaz Harrosh <bharrosh@panasas.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
2007-10-22[SG] Update drivers to use sg helpersJens Axboe1-5/+3
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>