diff options
Diffstat (limited to 'drivers/ata/sata_nv.c')
-rw-r--r-- | drivers/ata/sata_nv.c | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c index ed5dc7cb50cd..a0f98fdab7a0 100644 --- a/drivers/ata/sata_nv.c +++ b/drivers/ata/sata_nv.c | |||
@@ -1336,21 +1336,18 @@ static void nv_adma_fill_aprd(struct ata_queued_cmd *qc, | |||
1336 | static void nv_adma_fill_sg(struct ata_queued_cmd *qc, struct nv_adma_cpb *cpb) | 1336 | static void nv_adma_fill_sg(struct ata_queued_cmd *qc, struct nv_adma_cpb *cpb) |
1337 | { | 1337 | { |
1338 | struct nv_adma_port_priv *pp = qc->ap->private_data; | 1338 | struct nv_adma_port_priv *pp = qc->ap->private_data; |
1339 | unsigned int idx; | ||
1340 | struct nv_adma_prd *aprd; | 1339 | struct nv_adma_prd *aprd; |
1341 | struct scatterlist *sg; | 1340 | struct scatterlist *sg; |
1341 | unsigned int si; | ||
1342 | 1342 | ||
1343 | VPRINTK("ENTER\n"); | 1343 | VPRINTK("ENTER\n"); |
1344 | 1344 | ||
1345 | idx = 0; | 1345 | for_each_sg(qc->sg, sg, qc->n_elem, si) { |
1346 | 1346 | aprd = (si < 5) ? &cpb->aprd[si] : | |
1347 | ata_for_each_sg(sg, qc) { | 1347 | &pp->aprd[NV_ADMA_SGTBL_LEN * qc->tag + (si-5)]; |
1348 | aprd = (idx < 5) ? &cpb->aprd[idx] : | 1348 | nv_adma_fill_aprd(qc, sg, si, aprd); |
1349 | &pp->aprd[NV_ADMA_SGTBL_LEN * qc->tag + (idx-5)]; | ||
1350 | nv_adma_fill_aprd(qc, sg, idx, aprd); | ||
1351 | idx++; | ||
1352 | } | 1349 | } |
1353 | if (idx > 5) | 1350 | if (si > 5) |
1354 | cpb->next_aprd = cpu_to_le64(((u64)(pp->aprd_dma + NV_ADMA_SGTBL_SZ * qc->tag))); | 1351 | cpb->next_aprd = cpu_to_le64(((u64)(pp->aprd_dma + NV_ADMA_SGTBL_SZ * qc->tag))); |
1355 | else | 1352 | else |
1356 | cpb->next_aprd = cpu_to_le64(0); | 1353 | cpb->next_aprd = cpu_to_le64(0); |
@@ -1995,17 +1992,14 @@ static void nv_swncq_fill_sg(struct ata_queued_cmd *qc) | |||
1995 | { | 1992 | { |
1996 | struct ata_port *ap = qc->ap; | 1993 | struct ata_port *ap = qc->ap; |
1997 | struct scatterlist *sg; | 1994 | struct scatterlist *sg; |
1998 | unsigned int idx; | ||
1999 | struct nv_swncq_port_priv *pp = ap->private_data; | 1995 | struct nv_swncq_port_priv *pp = ap->private_data; |
2000 | struct ata_prd *prd; | 1996 | struct ata_prd *prd; |
2001 | 1997 | unsigned int si, idx; | |
2002 | WARN_ON(qc->__sg == NULL); | ||
2003 | WARN_ON(qc->n_elem == 0 && qc->pad_len == 0); | ||
2004 | 1998 | ||
2005 | prd = pp->prd + ATA_MAX_PRD * qc->tag; | 1999 | prd = pp->prd + ATA_MAX_PRD * qc->tag; |
2006 | 2000 | ||
2007 | idx = 0; | 2001 | idx = 0; |
2008 | ata_for_each_sg(sg, qc) { | 2002 | for_each_sg(qc->sg, sg, qc->n_elem, si) { |
2009 | u32 addr, offset; | 2003 | u32 addr, offset; |
2010 | u32 sg_len, len; | 2004 | u32 sg_len, len; |
2011 | 2005 | ||
@@ -2027,8 +2021,7 @@ static void nv_swncq_fill_sg(struct ata_queued_cmd *qc) | |||
2027 | } | 2021 | } |
2028 | } | 2022 | } |
2029 | 2023 | ||
2030 | if (idx) | 2024 | prd[idx - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT); |
2031 | prd[idx - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT); | ||
2032 | } | 2025 | } |
2033 | 2026 | ||
2034 | static unsigned int nv_swncq_issue_atacmd(struct ata_port *ap, | 2027 | static unsigned int nv_swncq_issue_atacmd(struct ata_port *ap, |