aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2007-07-02 15:04:08 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2007-07-09 18:07:48 -0400
commit8526392ae816a2c69f57097ba032865523019caa (patch)
tree7f8b8e9e9298297bfd77740dbbe4e08d1c691ba3 /drivers
parentb4be016ad81af5a83f0be820edf106de883e6ade (diff)
firewire: fw-sbp2: fix DMA mapping of command ORBs
The CPU must not touch the buffer after it was DMA-mapped. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/firewire/fw-sbp2.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/firewire/fw-sbp2.c b/drivers/firewire/fw-sbp2.c
index a2ddf318a250..f488ff8903fc 100644
--- a/drivers/firewire/fw-sbp2.c
+++ b/drivers/firewire/fw-sbp2.c
@@ -1009,11 +1009,6 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
1009 1009
1010 /* Initialize rcode to something not RCODE_COMPLETE. */ 1010 /* Initialize rcode to something not RCODE_COMPLETE. */
1011 orb->base.rcode = -1; 1011 orb->base.rcode = -1;
1012 orb->base.request_bus =
1013 dma_map_single(device->card->device, &orb->request,
1014 sizeof(orb->request), DMA_TO_DEVICE);
1015 if (dma_mapping_error(orb->base.request_bus))
1016 goto fail_mapping;
1017 1012
1018 orb->unit = unit; 1013 orb->unit = unit;
1019 orb->done = done; 1014 orb->done = done;
@@ -1040,7 +1035,7 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
1040 COMMAND_ORB_DIRECTION(SBP2_DIRECTION_TO_MEDIA); 1035 COMMAND_ORB_DIRECTION(SBP2_DIRECTION_TO_MEDIA);
1041 1036
1042 if (cmd->use_sg && sbp2_command_orb_map_scatterlist(orb) < 0) 1037 if (cmd->use_sg && sbp2_command_orb_map_scatterlist(orb) < 0)
1043 goto fail_map_payload; 1038 goto fail_mapping;
1044 1039
1045 fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request)); 1040 fw_memcpy_to_be32(&orb->request, &orb->request, sizeof(orb->request));
1046 1041
@@ -1049,15 +1044,17 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
1049 memcpy(orb->request.command_block, cmd->cmnd, COMMAND_SIZE(*cmd->cmnd)); 1044 memcpy(orb->request.command_block, cmd->cmnd, COMMAND_SIZE(*cmd->cmnd));
1050 1045
1051 orb->base.callback = complete_command_orb; 1046 orb->base.callback = complete_command_orb;
1047 orb->base.request_bus =
1048 dma_map_single(device->card->device, &orb->request,
1049 sizeof(orb->request), DMA_TO_DEVICE);
1050 if (dma_mapping_error(orb->base.request_bus))
1051 goto fail_mapping;
1052 1052
1053 sbp2_send_orb(&orb->base, unit, sd->node_id, sd->generation, 1053 sbp2_send_orb(&orb->base, unit, sd->node_id, sd->generation,
1054 sd->command_block_agent_address + SBP2_ORB_POINTER); 1054 sd->command_block_agent_address + SBP2_ORB_POINTER);
1055 1055
1056 return 0; 1056 return 0;
1057 1057
1058 fail_map_payload:
1059 dma_unmap_single(device->card->device, orb->base.request_bus,
1060 sizeof(orb->request), DMA_TO_DEVICE);
1061 fail_mapping: 1058 fail_mapping:
1062 kfree(orb); 1059 kfree(orb);
1063 fail_alloc: 1060 fail_alloc: