linux/include/scsi
Guennadi Liakhovetski cdb8c2a6d8 [SCSI] dc395x: dynamically map scatter-gather for PIO
The current dc395x driver uses PIO to transfer up to 4 bytes which do not
get transferred by DMA (under unclear circumstances). For this the driver
uses page_address() which is broken on highmem. Apart from this the
actual calculation of the virtual address is wrong (even without highmem).
So, e.g., for reading it reads bytes from the driver to a wrong address
and returns wrong data, I guess, for writing it would just output random
data to the device.

The proper fix, as suggested by many, is to dynamically map data using
kmap_atomic(page, KM_BIO_SRC_IRQ) / kunmap_atomic(virt). The reason why it
has not been done until now, although I've done some preliminary patches
more than a year ago was that nobody interested in fixing this problem was
able to reliably reproduce it. Now it changed - with the help from
Sebastian Frei (CC'ed) I was able to trigger the PIO path. Thus, I was
also able to test and debug it.

There are 4 cases when PIO is used in dc395x - data-in / -out with and
without scatter-gather. I was able to reproduce and test only data-in with
and without SG. So, the data-out path is still untested, but it is also
somewhat simpler than the data-in. Fredrik Roubert (also CC'ed) also had
PIO triggering on his system, and in his case it was data-out without SG.
It would be great if he could test the attached patch on his system, but
even if he cannot, I would still request to apply the patch and just wait
if anybody cries...

Implementation: I put 2 new functions in scsi_lib.c and their declarations
in scsi_cmnd.h. I exported them without _GPL, although, I don't feel
strongly about that - not many drivers are likely to use them. But there
is at least one more - I want to use them in tmscsim.c. Whether these are
the right files for the functions and their declarations - not sure
either. Actually, they are not scsi-specific, so, might go somewhere
around other scattergather magic? They are not platform specific either,
and most SG functions are defined under arch/*/... As these issues were
discussed previously there were some more routines suggested to manipulate
scattergather buffers, I think, some of them were needed around
crypto code... So, might be a common place reasonable, like
lib/scattergather.c? I am open here.

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2006-04-14 16:45:27 -05:00
..
iscsi_if.h [SCSI] iscsi: add libiscsi 2006-04-14 14:09:00 -05:00
iscsi_proto.h [SCSI] iscsi: rename some proto defs 2005-09-20 12:35:27 -05:00
libiscsi.h [SCSI] iscsi: add libiscsi 2006-04-14 14:09:00 -05:00
scsi.h [SCSI] fix scsi process problems and clean up the target reap issues 2006-02-27 23:37:45 -06:00
scsi_cmnd.h [SCSI] dc395x: dynamically map scatter-gather for PIO 2006-04-14 16:45:27 -05:00
scsi_dbg.h [SCSI] Rename scsi_print_msg to spi_print_msg 2005-12-15 18:41:27 -08:00
scsi_device.h [SCSI] add scsi_mode_select to scsi_lib.c 2006-03-19 10:19:14 -06:00
scsi_devinfo.h Merge ../scsi-rc-fixes-2.6 2006-04-14 15:47:45 -05:00
scsi_driver.h [BLOCK] update SCSI to use new blk_ordered for barriers 2006-01-06 09:52:55 +01:00
scsi_eh.h [PATCH] SCSI: export scsi_eh_finish_cmd() and scsi_eh_flush_done_q() 2006-01-26 22:36:28 -05:00
scsi_host.h [PATCH] move ->eh_strategy_handler to the transport class 2006-04-10 14:15:47 -04:00
scsi_ioctl.h [SCSI] unify SCSI_IOCTL_SEND_COMMAND implementations 2006-04-13 10:13:15 -05:00
scsi_request.h [SCSI] remove scsi_wait_req 2005-11-06 12:45:20 -06:00
scsi_tcq.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
scsi_transport.h [PATCH] move ->eh_strategy_handler to the transport class 2006-04-10 14:15:47 -04:00
scsi_transport_fc.h [SCSI] FC transport: fixes for workq deadlocks 2006-04-13 13:25:16 -05:00
scsi_transport_iscsi.h [SCSI] iscsi: add libiscsi 2006-04-14 14:09:00 -05:00
scsi_transport_sas.h [SCSI] eliminate rphy allocation in favour of expander/end device allocation 2006-03-19 10:21:16 -06:00
scsi_transport_spi.h [SCSI] Add spi_populate_*_msg functions 2006-02-27 22:55:09 -06:00
scsicam.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sg.h Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
sg_request.h [PATCH] I2O: Adaptec specific SG_IO access, firmware access through sysfs and 2400A workaround 2005-06-24 00:05:28 -07:00
srp.h IB: Add SCSI RDMA Protocol (SRP) initiator 2005-11-02 14:07:13 -08:00