aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/hpsa.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index a23277d24383..7915dc45a37c 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -3236,6 +3236,17 @@ out:
3236 kfree(id_phys); 3236 kfree(id_phys);
3237} 3237}
3238 3238
3239static void hpsa_set_sg_descriptor(struct SGDescriptor *desc,
3240 struct scatterlist *sg)
3241{
3242 u64 addr64 = (u64) sg_dma_address(sg);
3243 unsigned int len = sg_dma_len(sg);
3244
3245 desc->Addr = cpu_to_le64(addr64);
3246 desc->Len = cpu_to_le32(len);
3247 desc->Ext = 0;
3248}
3249
3239/* 3250/*
3240 * hpsa_scatter_gather takes a struct scsi_cmnd, (cmd), and does the pci 3251 * hpsa_scatter_gather takes a struct scsi_cmnd, (cmd), and does the pci
3241 * dma mapping and fills in the scatter gather entries of the 3252 * dma mapping and fills in the scatter gather entries of the
@@ -3245,9 +3256,7 @@ static int hpsa_scatter_gather(struct ctlr_info *h,
3245 struct CommandList *cp, 3256 struct CommandList *cp,
3246 struct scsi_cmnd *cmd) 3257 struct scsi_cmnd *cmd)
3247{ 3258{
3248 unsigned int len;
3249 struct scatterlist *sg; 3259 struct scatterlist *sg;
3250 u64 addr64;
3251 int use_sg, i, sg_index, chained; 3260 int use_sg, i, sg_index, chained;
3252 struct SGDescriptor *curr_sg; 3261 struct SGDescriptor *curr_sg;
3253 3262
@@ -3270,13 +3279,11 @@ static int hpsa_scatter_gather(struct ctlr_info *h,
3270 curr_sg = h->cmd_sg_list[cp->cmdindex]; 3279 curr_sg = h->cmd_sg_list[cp->cmdindex];
3271 sg_index = 0; 3280 sg_index = 0;
3272 } 3281 }
3273 addr64 = (u64) sg_dma_address(sg); 3282 hpsa_set_sg_descriptor(curr_sg, sg);
3274 len = sg_dma_len(sg);
3275 curr_sg->Addr = cpu_to_le64(addr64);
3276 curr_sg->Len = cpu_to_le32(len);
3277 curr_sg->Ext = cpu_to_le32(0);
3278 curr_sg++; 3283 curr_sg++;
3279 } 3284 }
3285
3286 /* Back the pointer up to the last entry and mark it as "last". */
3280 (--curr_sg)->Ext = cpu_to_le32(HPSA_SG_LAST); 3287 (--curr_sg)->Ext = cpu_to_le32(HPSA_SG_LAST);
3281 3288
3282 if (use_sg + chained > h->maxSG) 3289 if (use_sg + chained > h->maxSG)