提交 035f5e06 编写于 作者: F FUJITA Tomonori 提交者: James Bottomley

[SCSI] 3w-9xxx: use sg buffer copy helper functions

Signed-off-by: NFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Adam Radford <linuxraid@amcc.com>
Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
上级 e943752e
...@@ -1838,12 +1838,11 @@ static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, ...@@ -1838,12 +1838,11 @@ static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id,
if (scsi_sg_count(srb)) { if (scsi_sg_count(srb)) {
if ((scsi_sg_count(srb) == 1) && if ((scsi_sg_count(srb) == 1) &&
(scsi_bufflen(srb) < TW_MIN_SGL_LENGTH)) { (scsi_bufflen(srb) < TW_MIN_SGL_LENGTH)) {
if (srb->sc_data_direction == DMA_TO_DEVICE || srb->sc_data_direction == DMA_BIDIRECTIONAL) { if (srb->sc_data_direction == DMA_TO_DEVICE ||
struct scatterlist *sg = scsi_sglist(srb); srb->sc_data_direction == DMA_BIDIRECTIONAL)
char *buf = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; scsi_sg_copy_to_buffer(srb,
memcpy(tw_dev->generic_buffer_virt[request_id], buf, sg->length); tw_dev->generic_buffer_virt[request_id],
kunmap_atomic(buf - sg->offset, KM_IRQ0); TW_SECTOR_SIZE);
}
command_packet->sg_list[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]); command_packet->sg_list[0].address = TW_CPU_TO_SGL(tw_dev->generic_buffer_phys[request_id]);
command_packet->sg_list[0].length = cpu_to_le32(TW_MIN_SGL_LENGTH); command_packet->sg_list[0].length = cpu_to_le32(TW_MIN_SGL_LENGTH);
} else { } else {
...@@ -1915,13 +1914,11 @@ static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int re ...@@ -1915,13 +1914,11 @@ static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int re
(cmd->sc_data_direction == DMA_FROM_DEVICE || (cmd->sc_data_direction == DMA_FROM_DEVICE ||
cmd->sc_data_direction == DMA_BIDIRECTIONAL)) { cmd->sc_data_direction == DMA_BIDIRECTIONAL)) {
if (scsi_sg_count(cmd) == 1) { if (scsi_sg_count(cmd) == 1) {
struct scatterlist *sg = scsi_sglist(tw_dev->srb[request_id]); unsigned long flags;
char *buf; void *buf = tw_dev->generic_buffer_virt[request_id];
unsigned long flags = 0;
local_irq_save(flags); local_irq_save(flags);
buf = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; scsi_sg_copy_from_buffer(cmd, buf, TW_SECTOR_SIZE);
memcpy(buf, tw_dev->generic_buffer_virt[request_id], sg->length);
kunmap_atomic(buf - sg->offset, KM_IRQ0);
local_irq_restore(flags); local_irq_restore(flags);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册