libata-sff: prd is BMDMA specific
authorTejun Heo <tj@kernel.org>
Mon, 10 May 2010 19:41:41 +0000 (21:41 +0200)
committerJeff Garzik <jgarzik@redhat.com>
Wed, 19 May 2010 17:38:54 +0000 (13:38 -0400)
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>
drivers/ata/libata-sff.c
drivers/ata/pata_ns87415.c
drivers/ata/pata_scc.c
drivers/ata/sata_nv.c
drivers/ata/sata_promise.c
drivers/ata/sata_sil.c
drivers/ata/sata_svw.c
include/linux/ata.h
include/linux/libata.h

index a58693bdde9de4cf8ebdda5947032ec564d68677..6f52b598b8d2903fad221c7e687a44e5559ff612 100644 (file)
@@ -2650,6 +2650,7 @@ EXPORT_SYMBOL_GPL(ata_bmdma32_port_ops);
 static void ata_bmdma_fill_sg(struct ata_queued_cmd *qc)
 {
        struct ata_port *ap = qc->ap;
+       struct ata_bmdma_prd *prd = ap->bmdma_prd;
        struct scatterlist *sg;
        unsigned int si, pi;
 
@@ -2671,8 +2672,8 @@ static void ata_bmdma_fill_sg(struct ata_queued_cmd *qc)
                        if ((offset + sg_len) > 0x10000)
                                len = 0x10000 - offset;
 
-                       ap->prd[pi].addr = cpu_to_le32(addr);
-                       ap->prd[pi].flags_len = cpu_to_le32(len & 0xffff);
+                       prd[pi].addr = cpu_to_le32(addr);
+                       prd[pi].flags_len = cpu_to_le32(len & 0xffff);
                        VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, len);
 
                        pi++;
@@ -2681,7 +2682,7 @@ static void ata_bmdma_fill_sg(struct ata_queued_cmd *qc)
                }
        }
 
-       ap->prd[pi - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
+       prd[pi - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
 }
 
 /**
@@ -2700,6 +2701,7 @@ static void ata_bmdma_fill_sg(struct ata_queued_cmd *qc)
 static void ata_bmdma_fill_sg_dumb(struct ata_queued_cmd *qc)
 {
        struct ata_port *ap = qc->ap;
+       struct ata_bmdma_prd *prd = ap->bmdma_prd;
        struct scatterlist *sg;
        unsigned int si, pi;
 
@@ -2722,16 +2724,16 @@ static void ata_bmdma_fill_sg_dumb(struct ata_queued_cmd *qc)
                                len = 0x10000 - offset;
 
                        blen = len & 0xffff;
-                       ap->prd[pi].addr = cpu_to_le32(addr);
+                       prd[pi].addr = cpu_to_le32(addr);
                        if (blen == 0) {
                                /* Some PATA chipsets like the CS5530 can't
                                   cope with 0x0000 meaning 64K as the spec
                                   says */
-                               ap->prd[pi].flags_len = cpu_to_le32(0x8000);
+                               prd[pi].flags_len = cpu_to_le32(0x8000);
                                blen = 0x8000;
-                               ap->prd[++pi].addr = cpu_to_le32(addr + 0x8000);
+                               prd[++pi].addr = cpu_to_le32(addr + 0x8000);
                        }
-                       ap->prd[pi].flags_len = cpu_to_le32(blen);
+                       prd[pi].flags_len = cpu_to_le32(blen);
                        VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", pi, addr, len);
 
                        pi++;
@@ -2740,7 +2742,7 @@ static void ata_bmdma_fill_sg_dumb(struct ata_queued_cmd *qc)
                }
        }
 
-       ap->prd[pi - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
+       prd[pi - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
 }
 
 /**
@@ -2872,7 +2874,7 @@ void ata_bmdma_setup(struct ata_queued_cmd *qc)
 
        /* load PRD table addr. */
        mb();   /* make sure PRD table writes are visible to controller */
-       iowrite32(ap->prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS);
+       iowrite32(ap->bmdma_prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS);
 
        /* specify data direction, triple-check start bit is clear */
        dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
@@ -2977,9 +2979,10 @@ EXPORT_SYMBOL_GPL(ata_bmdma_status);
 int ata_bmdma_port_start(struct ata_port *ap)
 {
        if (ap->mwdma_mask || ap->udma_mask) {
-               ap->prd = dmam_alloc_coherent(ap->host->dev, ATA_PRD_TBL_SZ,
-                                             &ap->prd_dma, GFP_KERNEL);
-               if (!ap->prd)
+               ap->bmdma_prd =
+                       dmam_alloc_coherent(ap->host->dev, ATA_PRD_TBL_SZ,
+                                           &ap->bmdma_prd_dma, GFP_KERNEL);
+               if (!ap->bmdma_prd)
                        return -ENOMEM;
        }
 
index 830431f036a1b7f4b733a9910ec30129c74cbaf4..fdbba2d76d3e6dec4ff334b436838a5075ffeca2 100644 (file)
@@ -126,7 +126,7 @@ static void ns87415_bmdma_setup(struct ata_queued_cmd *qc)
 
        /* load PRD table addr. */
        mb();   /* make sure PRD table writes are visible to controller */
-       iowrite32(ap->prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS);
+       iowrite32(ap->bmdma_prd_dma, ap->ioaddr.bmdma_addr + ATA_DMA_TABLE_OFS);
 
        /* specify data direction, triple-check start bit is clear */
        dmactl = ioread8(ap->ioaddr.bmdma_addr + ATA_DMA_CMD);
index 93f690e51a7969a282d55bc564bf01f19b98d644..6f6193b707cb4f86da4d93f037f2893f39a65c78 100644 (file)
@@ -441,7 +441,7 @@ static void scc_bmdma_setup (struct ata_queued_cmd *qc)
        void __iomem *mmio = ap->ioaddr.bmdma_addr;
 
        /* load PRD table addr */
-       out_be32(mmio + SCC_DMA_TABLE_OFS, ap->prd_dma);
+       out_be32(mmio + SCC_DMA_TABLE_OFS, ap->bmdma_prd_dma);
 
        /* specify data direction, triple-check start bit is clear */
        dmactl = in_be32(mmio + SCC_DMA_CMD);
@@ -905,7 +905,7 @@ static int scc_port_start (struct ata_port *ap)
        if (rc)
                return rc;
 
-       out_be32(mmio + SCC_DMA_PTERADD, ap->prd_dma);
+       out_be32(mmio + SCC_DMA_PTERADD, ap->bmdma_prd_dma);
        return 0;
 }
 
index 7a283d5d68f356f625e845a845fbbdbb82df795c..4863a62c3d8c6989b59b97d983e1bcdf5a9aa181 100644 (file)
@@ -272,7 +272,7 @@ enum ncq_saw_flag_list {
 };
 
 struct nv_swncq_port_priv {
-       struct ata_prd  *prd;    /* our SG list */
+       struct ata_bmdma_prd *prd;       /* our SG list */
        dma_addr_t      prd_dma; /* and its DMA mapping */
        void __iomem    *sactive_block;
        void __iomem    *irq_block;
@@ -2027,7 +2027,7 @@ static void nv_swncq_fill_sg(struct ata_queued_cmd *qc)
        struct ata_port *ap = qc->ap;
        struct scatterlist *sg;
        struct nv_swncq_port_priv *pp = ap->private_data;
-       struct ata_prd *prd;
+       struct ata_bmdma_prd *prd;
        unsigned int si, idx;
 
        prd = pp->prd + ATA_MAX_PRD * qc->tag;
index 09a6179f5de38ec0763807d73a25f415674dc0bb..f03ad48273ffe10117cc82984f0f4b3be0f34bcc 100644 (file)
@@ -500,7 +500,7 @@ static int pdc_sata_scr_write(struct ata_link *link,
 static void pdc_atapi_pkt(struct ata_queued_cmd *qc)
 {
        struct ata_port *ap = qc->ap;
-       dma_addr_t sg_table = ap->prd_dma;
+       dma_addr_t sg_table = ap->bmdma_prd_dma;
        unsigned int cdb_len = qc->dev->cdb_len;
        u8 *cdb = qc->cdb;
        struct pdc_port_priv *pp = ap->private_data;
@@ -588,6 +588,7 @@ static void pdc_atapi_pkt(struct ata_queued_cmd *qc)
 static void pdc_fill_sg(struct ata_queued_cmd *qc)
 {
        struct ata_port *ap = qc->ap;
+       struct ata_bmdma_prd *prd = ap->bmdma_prd;
        struct scatterlist *sg;
        const u32 SG_COUNT_ASIC_BUG = 41*4;
        unsigned int si, idx;
@@ -614,8 +615,8 @@ static void pdc_fill_sg(struct ata_queued_cmd *qc)
                        if ((offset + sg_len) > 0x10000)
                                len = 0x10000 - offset;
 
-                       ap->prd[idx].addr = cpu_to_le32(addr);
-                       ap->prd[idx].flags_len = cpu_to_le32(len & 0xffff);
+                       prd[idx].addr = cpu_to_le32(addr);
+                       prd[idx].flags_len = cpu_to_le32(len & 0xffff);
                        VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len);
 
                        idx++;
@@ -624,27 +625,27 @@ static void pdc_fill_sg(struct ata_queued_cmd *qc)
                }
        }
 
-       len = le32_to_cpu(ap->prd[idx - 1].flags_len);
+       len = le32_to_cpu(prd[idx - 1].flags_len);
 
        if (len > SG_COUNT_ASIC_BUG) {
                u32 addr;
 
                VPRINTK("Splitting last PRD.\n");
 
-               addr = le32_to_cpu(ap->prd[idx - 1].addr);
-               ap->prd[idx - 1].flags_len = cpu_to_le32(len - SG_COUNT_ASIC_BUG);
+               addr = le32_to_cpu(prd[idx - 1].addr);
+               prd[idx - 1].flags_len = cpu_to_le32(len - SG_COUNT_ASIC_BUG);
                VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx - 1, addr, SG_COUNT_ASIC_BUG);
 
                addr = addr + len - SG_COUNT_ASIC_BUG;
                len = SG_COUNT_ASIC_BUG;
-               ap->prd[idx].addr = cpu_to_le32(addr);
-               ap->prd[idx].flags_len = cpu_to_le32(len);
+               prd[idx].addr = cpu_to_le32(addr);
+               prd[idx].flags_len = cpu_to_le32(len);
                VPRINTK("PRD[%u] = (0x%X, 0x%X)\n", idx, addr, len);
 
                idx++;
        }
 
-       ap->prd[idx - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
+       prd[idx - 1].flags_len |= cpu_to_le32(ATA_PRD_EOT);
 }
 
 static void pdc_qc_prep(struct ata_queued_cmd *qc)
@@ -659,7 +660,7 @@ static void pdc_qc_prep(struct ata_queued_cmd *qc)
                pdc_fill_sg(qc);
                /*FALLTHROUGH*/
        case ATA_PROT_NODATA:
-               i = pdc_pkt_header(&qc->tf, qc->ap->prd_dma,
+               i = pdc_pkt_header(&qc->tf, qc->ap->bmdma_prd_dma,
                                   qc->dev->devno, pp->pkt);
                if (qc->tf.flags & ATA_TFLAG_LBA48)
                        i = pdc_prep_lba48(&qc->tf, pp->pkt, i);
index 9c367f71c627bbb969cac1e4f83b8dd5101f919c..2dda312b6b9aa87df52adb0142af746886977665 100644 (file)
@@ -284,7 +284,7 @@ static void sil_bmdma_setup(struct ata_queued_cmd *qc)
        void __iomem *bmdma = ap->ioaddr.bmdma_addr;
 
        /* load PRD table addr. */
-       iowrite32(ap->prd_dma, bmdma + ATA_DMA_TABLE_OFS);
+       iowrite32(ap->bmdma_prd_dma, bmdma + ATA_DMA_TABLE_OFS);
 
        /* issue r/w command */
        ap->ops->sff_exec_command(ap, &qc->tf);
@@ -311,10 +311,10 @@ static void sil_fill_sg(struct ata_queued_cmd *qc)
 {
        struct scatterlist *sg;
        struct ata_port *ap = qc->ap;
-       struct ata_prd *prd, *last_prd = NULL;
+       struct ata_bmdma_prd *prd, *last_prd = NULL;
        unsigned int si;
 
-       prd = &ap->prd[0];
+       prd = &ap->bmdma_prd[0];
        for_each_sg(qc->sg, sg, qc->n_elem, si) {
                /* Note h/w doesn't support 64-bit, so we unconditionally
                 * truncate dma_addr_t to u32.
index 7257f2d5c52c79585ed7ed633b75922390b4f976..101fd6a198290a619b908967a8e6a5d6035d5c70 100644 (file)
@@ -224,7 +224,7 @@ static void k2_bmdma_setup_mmio(struct ata_queued_cmd *qc)
 
        /* load PRD table addr. */
        mb();   /* make sure PRD table writes are visible to controller */
-       writel(ap->prd_dma, mmio + ATA_DMA_TABLE_OFS);
+       writel(ap->bmdma_prd_dma, mmio + ATA_DMA_TABLE_OFS);
 
        /* specify data direction, triple-check start bit is clear */
        dmactl = readb(mmio + ATA_DMA_CMD);
index 700c5b9b358303a721dc1879b0df120f4eeb3176..fe6e681a9d742788be67c16003662b9a7a218e89 100644 (file)
@@ -467,7 +467,7 @@ enum ata_ioctls {
 
 /* core structures */
 
-struct ata_prd {
+struct ata_bmdma_prd {
        __le32                  addr;
        __le32                  flags_len;
 };
index 3675fd29b2e5a0c2deb952f9d466638b43702e70..d973972f0db27ff65191d8dd2996d4e7ecf600af 100644 (file)
@@ -716,14 +716,13 @@ struct ata_port {
        unsigned int            print_id; /* user visible unique port ID */
        unsigned int            port_no; /* 0 based port no. inside the host */
 
-       struct ata_prd          *prd;    /* our SG list */
-       dma_addr_t              prd_dma; /* and its DMA mapping */
-
 #ifdef CONFIG_ATA_SFF
        struct ata_ioports      ioaddr; /* ATA cmd/ctl/dma register blocks */
        u8                      ctl;    /* cache of ATA control register */
        u8                      last_ctl;       /* Cache last written value */
        struct delayed_work     sff_pio_task;
+       struct ata_bmdma_prd    *bmdma_prd;     /* BMDMA SG list */
+       dma_addr_t              bmdma_prd_dma;  /* and its DMA mapping */
 #endif /* CONFIG_ATA_SFF */
 
        unsigned int            pio_mask;