aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ata/sata_promise.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ata/sata_promise.c')
-rw-r--r--drivers/ata/sata_promise.c40
1 files changed, 18 insertions, 22 deletions
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 01738d736d44..a07d319f6e8c 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -533,17 +533,15 @@ static void pdc_fill_sg(struct ata_queued_cmd *qc)
533{ 533{
534 struct ata_port *ap = qc->ap; 534 struct ata_port *ap = qc->ap;
535 struct scatterlist *sg; 535 struct scatterlist *sg;
536 unsigned int idx;
537 const u32 SG_COUNT_ASIC_BUG = 41*4; 536 const u32 SG_COUNT_ASIC_BUG = 41*4;
537 unsigned int si, idx;
538 u32 len;
538 539
539 if (!(qc->flags & ATA_QCFLAG_DMAMAP)) 540 if (!(qc->flags & ATA_QCFLAG_DMAMAP))
540 return; 541 return;
541 542
542 WARN_ON(qc->__sg == NULL);
543 WARN_ON(qc->n_elem == 0 && qc->pad_len == 0);
544
545 idx = 0; 543 idx = 0;
546 ata_for_each_sg(sg, qc) { 544 for_each_sg(qc->sg, sg, qc->n_elem, si) {
547 u32 addr, offset; 545 u32 addr, offset;
548 u32 sg_len, len; 546 u32 sg_len, len;
549 547
@@ -570,29 +568,27 @@ static void pdc_fill_sg(struct ata_queued_cmd *qc)
570 } 568 }
571 } 569 }
572 570
573 if (idx) { 571 len = le32_to_cpu(ap->prd[idx - 1].flags_len);
574 u32 len = le32_to_cpu(ap->prd[idx - 1].flags_len);
575 572
576 if (len > SG_COUNT_ASIC_BUG) { 573 if (len > SG_COUNT_ASIC_BUG) {
577 u32 addr; 574 u32 addr;
578 575
579 VPRINTK("Splitting last PRD.\n"); 576 VPRINTK("Splitting last PRD.\n");
580 577
581 addr = le32_to_cpu(ap->prd[idx - 1].addr); 578 addr = le32_to_cpu(ap->prd[idx - 1].addr);
582 ap->prd[idx - 1].flags_len = cpu_to_le32(len - SG_COUNT_ASIC_BUG); 579 ap->prd[idx - 1].flags_len = cpu_to_le32(len - SG_COUNT_ASIC_BUG);
583 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx - 1, addr, SG_COUNT_ASIC_BUG); 580 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx - 1, addr, SG_COUNT_ASIC_BUG);
584 581
585 addr = addr + len - SG_COUNT_ASIC_BUG; 582 addr = addr + len - SG_COUNT_ASIC_BUG;
586 len = SG_COUNT_ASIC_BUG; 583 len = SG_COUNT_ASIC_BUG;
587 ap->prd[idx].addr = cpu_to_le32(addr); 584 ap->prd[idx].addr = cpu_to_le32(addr);
588 ap->prd[idx].flags_len = cpu_to_le32(len); 585 ap->prd[idx].flags_len = cpu_to_le32(len);
589 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len); 586 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len);
590 587
591 idx++; 588 idx++;
592 }
593
594 ap->prd[idx - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
595 } 589 }
590
591 ap->prd[idx - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
596} 592}
597 593
598static void pdc_qc_prep(struct ata_queued_cmd *qc) 594static void pdc_qc_prep(struct ata_queued_cmd *qc)