aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-05-10 15:41:41 -0400
committerJeff Garzik <jgarzik@redhat.com>2010-05-19 13:38:54 -0400
commitf60d70113fa04e32aee2dedbf304a48469c9c45c (patch)
tree6e74f483773dfae0adda0faa8754b5ce6129d8f7
parentf47451c45fe0032ef491aaf3e0623fa0154e156d (diff)
libata-sff: prd is BMDMA specific
struct ata_prd and ap->prd are BMDMA specific. Add bmdma_ prefix to them and move them inside CONFIG_ATA_SFF. Signed-off-by: Tejun Heo <tj@kernel.org> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
-rw-r--r--drivers/ata/libata-sff.c27
-rw-r--r--drivers/ata/pata_ns87415.c2
-rw-r--r--drivers/ata/pata_scc.c4
-rw-r--r--drivers/ata/sata_nv.c4
-rw-r--r--drivers/ata/sata_promise.c21
-rw-r--r--drivers/ata/sata_sil.c6
-rw-r--r--drivers/ata/sata_svw.c2
-rw-r--r--include/linux/ata.h2
-rw-r--r--include/linux/libata.h5
9 files changed, 38 insertions, 35 deletions
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index a58693bdde9d..6f52b598b8d2 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -2650,6 +2650,7 @@ EXPORT_SYMBOL_GPL(ata_bmdma32_port_ops);
2650static void ata_bmdma_fill_sg(struct ata_queued_cmd *qc) 2650static void ata_bmdma_fill_sg(struct ata_queued_cmd *qc)
2651{ 2651{
2652 struct ata_port *ap = qc->ap; 2652 struct ata_port *ap = qc->ap;
2653 struct ata_bmdma_prd *prd = ap->bmdma_prd;
2653 struct scatterlist *sg; 2654 struct scatterlist *sg;
2654 unsigned int si, pi; 2655 unsigned int si, pi;
2655 2656
@@ -2671,8 +2672,8 @@ static void ata_bmdma_fill_sg(struct ata_queued_cmd *qc)
2671 if ((offset + sg_len) > 0x10000) 2672 if ((offset + sg_len) > 0x10000)
2672 len = 0x10000 - offset; 2673 len = 0x10000 - offset;
2673 2674
2674 ap->prd[pi].addr = cpu_to_le32(addr); 2675 prd[pi].addr = cpu_to_le32(addr);
2675 ap->prd[pi].flags_len = cpu_to_le32(len & 0xffff); 2676 prd[pi].flags_len = cpu_to_le32(len & 0xffff);
2676 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, len); 2677 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, len);
2677 2678
2678 pi++; 2679 pi++;
@@ -2681,7 +2682,7 @@ static void ata_bmdma_fill_sg(struct ata_queued_cmd *qc)
2681 } 2682 }
2682 } 2683 }
2683 2684
2684 ap->prd[pi - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT); 2685 prd[pi - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
2685} 2686}
2686 2687
2687/** 2688/**
@@ -2700,6 +2701,7 @@ static void ata_bmdma_fill_sg(struct ata_queued_cmd *qc)
2700static void ata_bmdma_fill_sg_dumb(struct ata_queued_cmd *qc) 2701static void ata_bmdma_fill_sg_dumb(struct ata_queued_cmd *qc)
2701{ 2702{
2702 struct ata_port *ap = qc->ap; 2703 struct ata_port *ap = qc->ap;
2704 struct ata_bmdma_prd *prd = ap->bmdma_prd;
2703 struct scatterlist *sg; 2705 struct scatterlist *sg;
2704 unsigned int si, pi; 2706 unsigned int si, pi;
2705 2707
@@ -2722,16 +2724,16 @@ static void ata_bmdma_fill_sg_dumb(struct ata_queued_cmd *qc)
2722 len = 0x10000 - offset; 2724 len = 0x10000 - offset;
2723 2725
2724 blen = len & 0xffff; 2726 blen = len & 0xffff;
2725 ap->prd[pi].addr = cpu_to_le32(addr); 2727 prd[pi].addr = cpu_to_le32(addr);
2726 if (blen == 0) { 2728 if (blen == 0) {
2727 /* Some PATA chipsets like the CS5530 can't 2729 /* Some PATA chipsets like the CS5530 can't
2728 cope with 0x0000 meaning 64K as the spec 2730 cope with 0x0000 meaning 64K as the spec
2729 says */ 2731 says */
2730 ap->prd[pi].flags_len = cpu_to_le32(0x8000); 2732 prd[pi].flags_len = cpu_to_le32(0x8000);
2731 blen = 0x8000; 2733 blen = 0x8000;
2732 ap->prd[++pi].addr = cpu_to_le32(addr + 0x8000); 2734 prd[++pi].addr = cpu_to_le32(addr + 0x8000);
2733 } 2735 }
2734 ap->prd[pi].flags_len = cpu_to_le32(blen); 2736 prd[pi].flags_len = cpu_to_le32(blen);
2735 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, len); 2737 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, len);
2736 2738
2737 pi++; 2739 pi++;
@@ -2740,7 +2742,7 @@ static void ata_bmdma_fill_sg_dumb(struct ata_queued_cmd *qc)
2740 } 2742 }
2741 } 2743 }
2742 2744
2743 ap->prd[pi - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT); 2745 prd[pi - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
2744} 2746}
2745 2747
2746/** 2748/**
@@ -2872,7 +2874,7 @@ void ata_bmdma_setup(struct ata_queued_cmd *qc)
2872 2874
2873 /* load PRD table addr. */ 2875 /* load PRD table addr. */
2874 mb(); /* make sure PRD table writes are visible to controller */ 2876 mb(); /* make sure PRD table writes are visible to controller */
2875 iowrite32(ap->prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS); 2877 iowrite32(ap->bmdma_prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS);
2876 2878
2877 /* specify data direction, triple-check start bit is clear */ 2879 /* specify data direction, triple-check start bit is clear */
2878 dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 2880 dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
@@ -2977,9 +2979,10 @@ EXPORT_SYMBOL_GPL(ata_bmdma_status);
2977int ata_bmdma_port_start(struct ata_port *ap) 2979int ata_bmdma_port_start(struct ata_port *ap)
2978{ 2980{
2979 if (ap->mwdma_mask || ap->udma_mask) { 2981 if (ap->mwdma_mask || ap->udma_mask) {
2980 ap->prd = dmam_alloc_coherent(ap->host->dev, ATA_PRD_TBL_SZ, 2982 ap->bmdma_prd =
2981 &ap->prd_dma, GFP_KERNEL); 2983 dmam_alloc_coherent(ap->host->dev, ATA_PRD_TBL_SZ,
2982 if (!ap->prd) 2984 &ap->bmdma_prd_dma, GFP_KERNEL);
2985 if (!ap->bmdma_prd)
2983 return -ENOMEM; 2986 return -ENOMEM;
2984 } 2987 }
2985 2988
diff --git a/drivers/ata/pata_ns87415.c b/drivers/ata/pata_ns87415.c
index 830431f036a1..fdbba2d76d3e 100644
--- a/drivers/ata/pata_ns87415.c
+++ b/drivers/ata/pata_ns87415.c
@@ -126,7 +126,7 @@ static void ns87415_bmdma_setup(struct ata_queued_cmd *qc)
126 126
127 /* load PRD table addr. */ 127 /* load PRD table addr. */
128 mb(); /* make sure PRD table writes are visible to controller */ 128 mb(); /* make sure PRD table writes are visible to controller */
129 iowrite32(ap->prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS); 129 iowrite32(ap->bmdma_prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS);
130 130
131 /* specify data direction, triple-check start bit is clear */ 131 /* specify data direction, triple-check start bit is clear */
132 dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD); 132 dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
diff --git a/drivers/ata/pata_scc.c b/drivers/ata/pata_scc.c
index 93f690e51a79..6f6193b707cb 100644
--- a/drivers/ata/pata_scc.c
+++ b/drivers/ata/pata_scc.c
@@ -441,7 +441,7 @@ static void scc_bmdma_setup (struct ata_queued_cmd *qc)
441 void __iomem *mmio = ap->ioaddr.bmdma_addr; 441 void __iomem *mmio = ap->ioaddr.bmdma_addr;
442 442
443 /* load PRD table addr */ 443 /* load PRD table addr */
444 out_be32(mmio + SCC_DMA_TABLE_OFS, ap->prd_dma); 444 out_be32(mmio + SCC_DMA_TABLE_OFS, ap->bmdma_prd_dma);
445 445
446 /* specify data direction, triple-check start bit is clear */ 446 /* specify data direction, triple-check start bit is clear */
447 dmactl = in_be32(mmio + SCC_DMA_CMD); 447 dmactl = in_be32(mmio + SCC_DMA_CMD);
@@ -905,7 +905,7 @@ static int scc_port_start (struct ata_port *ap)
905 if (rc) 905 if (rc)
906 return rc; 906 return rc;
907 907
908 out_be32(mmio + SCC_DMA_PTERADD, ap->prd_dma); 908 out_be32(mmio + SCC_DMA_PTERADD, ap->bmdma_prd_dma);
909 return 0; 909 return 0;
910} 910}
911 911
diff --git a/drivers/ata/sata_nv.c b/drivers/ata/sata_nv.c
index 7a283d5d68f3..4863a62c3d8c 100644
--- a/drivers/ata/sata_nv.c
+++ b/drivers/ata/sata_nv.c
@@ -272,7 +272,7 @@ enum ncq_saw_flag_list {
272}; 272};
273 273
274struct nv_swncq_port_priv { 274struct nv_swncq_port_priv {
275 struct ata_prd *prd; /* our SG list */ 275 struct ata_bmdma_prd *prd; /* our SG list */
276 dma_addr_t prd_dma; /* and its DMA mapping */ 276 dma_addr_t prd_dma; /* and its DMA mapping */
277 void __iomem *sactive_block; 277 void __iomem *sactive_block;
278 void __iomem *irq_block; 278 void __iomem *irq_block;
@@ -2027,7 +2027,7 @@ static void nv_swncq_fill_sg(struct ata_queued_cmd *qc)
2027 struct ata_port *ap = qc->ap; 2027 struct ata_port *ap = qc->ap;
2028 struct scatterlist *sg; 2028 struct scatterlist *sg;
2029 struct nv_swncq_port_priv *pp = ap->private_data; 2029 struct nv_swncq_port_priv *pp = ap->private_data;
2030 struct ata_prd *prd; 2030 struct ata_bmdma_prd *prd;
2031 unsigned int si, idx; 2031 unsigned int si, idx;
2032 2032
2033 prd = pp->prd + ATA_MAX_PRD * qc->tag; 2033 prd = pp->prd + ATA_MAX_PRD * qc->tag;
diff --git a/drivers/ata/sata_promise.c b/drivers/ata/sata_promise.c
index 09a6179f5de3..f03ad48273ff 100644
--- a/drivers/ata/sata_promise.c
+++ b/drivers/ata/sata_promise.c
@@ -500,7 +500,7 @@ static int pdc_sata_scr_write(struct ata_link *link,
500static void pdc_atapi_pkt(struct ata_queued_cmd *qc) 500static void pdc_atapi_pkt(struct ata_queued_cmd *qc)
501{ 501{
502 struct ata_port *ap = qc->ap; 502 struct ata_port *ap = qc->ap;
503 dma_addr_t sg_table = ap->prd_dma; 503 dma_addr_t sg_table = ap->bmdma_prd_dma;
504 unsigned int cdb_len = qc->dev->cdb_len; 504 unsigned int cdb_len = qc->dev->cdb_len;
505 u8 *cdb = qc->cdb; 505 u8 *cdb = qc->cdb;
506 struct pdc_port_priv *pp = ap->private_data; 506 struct pdc_port_priv *pp = ap->private_data;
@@ -588,6 +588,7 @@ static void pdc_atapi_pkt(struct ata_queued_cmd *qc)
588static void pdc_fill_sg(struct ata_queued_cmd *qc) 588static void pdc_fill_sg(struct ata_queued_cmd *qc)
589{ 589{
590 struct ata_port *ap = qc->ap; 590 struct ata_port *ap = qc->ap;
591 struct ata_bmdma_prd *prd = ap->bmdma_prd;
591 struct scatterlist *sg; 592 struct scatterlist *sg;
592 const u32 SG_COUNT_ASIC_BUG = 41*4; 593 const u32 SG_COUNT_ASIC_BUG = 41*4;
593 unsigned int si, idx; 594 unsigned int si, idx;
@@ -614,8 +615,8 @@ static void pdc_fill_sg(struct ata_queued_cmd *qc)
614 if ((offset + sg_len) > 0x10000) 615 if ((offset + sg_len) > 0x10000)
615 len = 0x10000 - offset; 616 len = 0x10000 - offset;
616 617
617 ap->prd[idx].addr = cpu_to_le32(addr); 618 prd[idx].addr = cpu_to_le32(addr);
618 ap->prd[idx].flags_len = cpu_to_le32(len & 0xffff); 619 prd[idx].flags_len = cpu_to_le32(len & 0xffff);
619 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len); 620 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len);
620 621
621 idx++; 622 idx++;
@@ -624,27 +625,27 @@ static void pdc_fill_sg(struct ata_queued_cmd *qc)
624 } 625 }
625 } 626 }
626 627
627 len = le32_to_cpu(ap->prd[idx - 1].flags_len); 628 len = le32_to_cpu(prd[idx - 1].flags_len);
628 629
629 if (len > SG_COUNT_ASIC_BUG) { 630 if (len > SG_COUNT_ASIC_BUG) {
630 u32 addr; 631 u32 addr;
631 632
632 VPRINTK("Splitting last PRD.\n"); 633 VPRINTK("Splitting last PRD.\n");
633 634
634 addr = le32_to_cpu(ap->prd[idx - 1].addr); 635 addr = le32_to_cpu(prd[idx - 1].addr);
635 ap->prd[idx - 1].flags_len = cpu_to_le32(len - SG_COUNT_ASIC_BUG); 636 prd[idx - 1].flags_len = cpu_to_le32(len - SG_COUNT_ASIC_BUG);
636 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx - 1, addr, SG_COUNT_ASIC_BUG); 637 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx - 1, addr, SG_COUNT_ASIC_BUG);
637 638
638 addr = addr + len - SG_COUNT_ASIC_BUG; 639 addr = addr + len - SG_COUNT_ASIC_BUG;
639 len = SG_COUNT_ASIC_BUG; 640 len = SG_COUNT_ASIC_BUG;
640 ap->prd[idx].addr = cpu_to_le32(addr); 641 prd[idx].addr = cpu_to_le32(addr);
641 ap->prd[idx].flags_len = cpu_to_le32(len); 642 prd[idx].flags_len = cpu_to_le32(len);
642 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len); 643 VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len);
643 644
644 idx++; 645 idx++;
645 } 646 }
646 647
647 ap->prd[idx - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT); 648 prd[idx - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
648} 649}
649 650
650static void pdc_qc_prep(struct ata_queued_cmd *qc) 651static void pdc_qc_prep(struct ata_queued_cmd *qc)
@@ -659,7 +660,7 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc)
659 pdc_fill_sg(qc); 660 pdc_fill_sg(qc);
660 /*FALLTHROUGH*/ 661 /*FALLTHROUGH*/
661 case ATA_PROT_NODATA: 662 case ATA_PROT_NODATA:
662 i = pdc_pkt_header(&qc->tf, qc->ap->prd_dma, 663 i = pdc_pkt_header(&qc->tf, qc->ap->bmdma_prd_dma,
663 qc->dev->devno, pp->pkt); 664 qc->dev->devno, pp->pkt);
664 if (qc->tf.flags & ATA_TFLAG_LBA48) 665 if (qc->tf.flags & ATA_TFLAG_LBA48)
665 i = pdc_prep_lba48(&qc->tf, pp->pkt, i); 666 i = pdc_prep_lba48(&qc->tf, pp->pkt, i);
diff --git a/drivers/ata/sata_sil.c b/drivers/ata/sata_sil.c
index 9c367f71c627..2dda312b6b9a 100644
--- a/drivers/ata/sata_sil.c
+++ b/drivers/ata/sata_sil.c
@@ -284,7 +284,7 @@ static void sil_bmdma_setup(struct ata_queued_cmd *qc)
284 void __iomem *bmdma = ap->ioaddr.bmdma_addr; 284 void __iomem *bmdma = ap->ioaddr.bmdma_addr;
285 285
286 /* load PRD table addr. */ 286 /* load PRD table addr. */
287 iowrite32(ap->prd_dma, bmdma + ATA_DMA_TABLE_OFS); 287 iowrite32(ap->bmdma_prd_dma, bmdma + ATA_DMA_TABLE_OFS);
288 288
289 /* issue r/w command */ 289 /* issue r/w command */
290 ap->ops->sff_exec_command(ap, &qc->tf); 290 ap->ops->sff_exec_command(ap, &qc->tf);
@@ -311,10 +311,10 @@ static void sil_fill_sg(struct ata_queued_cmd *qc)
311{ 311{
312 struct scatterlist *sg; 312 struct scatterlist *sg;
313 struct ata_port *ap = qc->ap; 313 struct ata_port *ap = qc->ap;
314 struct ata_prd *prd, *last_prd = NULL; 314 struct ata_bmdma_prd *prd, *last_prd = NULL;
315 unsigned int si; 315 unsigned int si;
316 316
317 prd = &ap->prd[0]; 317 prd = &ap->bmdma_prd[0];
318 for_each_sg(qc->sg, sg, qc->n_elem, si) { 318 for_each_sg(qc->sg, sg, qc->n_elem, si) {
319 /* Note h/w doesn't support 64-bit, so we unconditionally 319 /* Note h/w doesn't support 64-bit, so we unconditionally
320 * truncate dma_addr_t to u32. 320 * truncate dma_addr_t to u32.
diff --git a/drivers/ata/sata_svw.c b/drivers/ata/sata_svw.c
index 7257f2d5c52c..101fd6a19829 100644
--- a/drivers/ata/sata_svw.c
+++ b/drivers/ata/sata_svw.c
@@ -224,7 +224,7 @@ static void k2_bmdma_setup_mmio(struct ata_queued_cmd *qc)
224 224
225 /* load PRD table addr. */ 225 /* load PRD table addr. */
226 mb(); /* make sure PRD table writes are visible to controller */ 226 mb(); /* make sure PRD table writes are visible to controller */
227 writel(ap->prd_dma, mmio + ATA_DMA_TABLE_OFS); 227 writel(ap->bmdma_prd_dma, mmio + ATA_DMA_TABLE_OFS);
228 228
229 /* specify data direction, triple-check start bit is clear */ 229 /* specify data direction, triple-check start bit is clear */
230 dmactl = readb(mmio + ATA_DMA_CMD); 230 dmactl = readb(mmio + ATA_DMA_CMD);
diff --git a/include/linux/ata.h b/include/linux/ata.h
index 700c5b9b3583..fe6e681a9d74 100644
--- a/include/linux/ata.h
+++ b/include/linux/ata.h
@@ -467,7 +467,7 @@ enum ata_ioctls {
467 467
468/* core structures */ 468/* core structures */
469 469
470struct ata_prd { 470struct ata_bmdma_prd {
471 __le32 addr; 471 __le32 addr;
472 __le32 flags_len; 472 __le32 flags_len;
473}; 473};
diff --git a/include/linux/libata.h b/include/linux/libata.h
index 3675fd29b2e5..d973972f0db2 100644
--- a/include/linux/libata.h
+++ b/include/linux/libata.h
@@ -716,14 +716,13 @@ struct ata_port {
716 unsigned int print_id; /* user visible unique port ID */ 716 unsigned int print_id; /* user visible unique port ID */
717 unsigned int port_no; /* 0 based port no. inside the host */ 717 unsigned int port_no; /* 0 based port no. inside the host */
718 718
719 struct ata_prd *prd; /* our SG list */
720 dma_addr_t prd_dma; /* and its DMA mapping */
721
722#ifdef CONFIG_ATA_SFF 719#ifdef CONFIG_ATA_SFF
723 struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */ 720 struct ata_ioports ioaddr; /* ATA cmd/ctl/dma register blocks */
724 u8 ctl; /* cache of ATA control register */ 721 u8 ctl; /* cache of ATA control register */
725 u8 last_ctl; /* Cache last written value */ 722 u8 last_ctl; /* Cache last written value */
726 struct delayed_work sff_pio_task; 723 struct delayed_work sff_pio_task;
724 struct ata_bmdma_prd *bmdma_prd; /* BMDMA SG list */
725 dma_addr_t bmdma_prd_dma; /* and its DMA mapping */
727#endif /* CONFIG_ATA_SFF */ 726#endif /* CONFIG_ATA_SFF */
728 727
729 unsigned int pio_mask; 728 unsigned int pio_mask;