aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/sparc64')
-rw-r--r--arch/sparc64/kernel/iommu.c7
-rw-r--r--arch/sparc64/kernel/iommu_common.c13
-rw-r--r--arch/sparc64/kernel/ldc.c2
-rw-r--r--arch/sparc64/kernel/pci_sun4v.c7
4 files changed, 11 insertions, 18 deletions
diff --git a/arch/sparc64/kernel/iommu.c b/arch/sparc64/kernel/iommu.c
index 29af777d7ac9..070a4846c0cb 100644
--- a/arch/sparc64/kernel/iommu.c
+++ b/arch/sparc64/kernel/iommu.c
@@ -472,8 +472,7 @@ static void dma_4u_unmap_single(struct device *dev, dma_addr_t bus_addr,
472 spin_unlock_irqrestore(&iommu->lock, flags); 472 spin_unlock_irqrestore(&iommu->lock, flags);
473} 473}
474 474
475#define SG_ENT_PHYS_ADDRESS(SG) \ 475#define SG_ENT_PHYS_ADDRESS(SG) (__pa(sg_virt((SG))))
476 (__pa(page_address((SG)->page)) + (SG)->offset)
477 476
478static void fill_sg(iopte_t *iopte, struct scatterlist *sg, 477static void fill_sg(iopte_t *iopte, struct scatterlist *sg,
479 int nused, int nelems, 478 int nused, int nelems,
@@ -565,9 +564,7 @@ static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist,
565 /* Fast path single entry scatterlists. */ 564 /* Fast path single entry scatterlists. */
566 if (nelems == 1) { 565 if (nelems == 1) {
567 sglist->dma_address = 566 sglist->dma_address =
568 dma_4u_map_single(dev, 567 dma_4u_map_single(dev, sg_virt(sglist),
569 (page_address(sglist->page) +
570 sglist->offset),
571 sglist->length, direction); 568 sglist->length, direction);
572 if (unlikely(sglist->dma_address == DMA_ERROR_CODE)) 569 if (unlikely(sglist->dma_address == DMA_ERROR_CODE))
573 return 0; 570 return 0;
diff --git a/arch/sparc64/kernel/iommu_common.c b/arch/sparc64/kernel/iommu_common.c
index d7ca900ec51d..78e8277df655 100644
--- a/arch/sparc64/kernel/iommu_common.c
+++ b/arch/sparc64/kernel/iommu_common.c
@@ -73,7 +73,7 @@ static int verify_one_map(struct scatterlist *dma_sg, struct scatterlist **__sg,
73 73
74 daddr = dma_sg->dma_address; 74 daddr = dma_sg->dma_address;
75 sglen = sg->length; 75 sglen = sg->length;
76 sgaddr = (unsigned long) (page_address(sg->page) + sg->offset); 76 sgaddr = (unsigned long) sg_virt(sg);
77 while (dlen > 0) { 77 while (dlen > 0) {
78 unsigned long paddr; 78 unsigned long paddr;
79 79
@@ -123,7 +123,7 @@ static int verify_one_map(struct scatterlist *dma_sg, struct scatterlist **__sg,
123 sg = sg_next(sg); 123 sg = sg_next(sg);
124 if (--nents <= 0) 124 if (--nents <= 0)
125 break; 125 break;
126 sgaddr = (unsigned long) (page_address(sg->page) + sg->offset); 126 sgaddr = (unsigned long) sg_virt(sg);
127 sglen = sg->length; 127 sglen = sg->length;
128 } 128 }
129 if (dlen < 0) { 129 if (dlen < 0) {
@@ -191,7 +191,7 @@ void verify_sglist(struct scatterlist *sglist, int nents, iopte_t *iopte, int np
191 printk("sg(%d): page_addr(%p) off(%x) length(%x) " 191 printk("sg(%d): page_addr(%p) off(%x) length(%x) "
192 "dma_address[%016x] dma_length[%016x]\n", 192 "dma_address[%016x] dma_length[%016x]\n",
193 i, 193 i,
194 page_address(sg->page), sg->offset, 194 page_address(sg_page(sg)), sg->offset,
195 sg->length, 195 sg->length,
196 sg->dma_address, sg->dma_length); 196 sg->dma_address, sg->dma_length);
197 } 197 }
@@ -207,15 +207,14 @@ unsigned long prepare_sg(struct scatterlist *sg, int nents)
207 unsigned long prev; 207 unsigned long prev;
208 u32 dent_addr, dent_len; 208 u32 dent_addr, dent_len;
209 209
210 prev = (unsigned long) (page_address(sg->page) + sg->offset); 210 prev = (unsigned long) sg_virt(sg);
211 prev += (unsigned long) (dent_len = sg->length); 211 prev += (unsigned long) (dent_len = sg->length);
212 dent_addr = (u32) ((unsigned long)(page_address(sg->page) + sg->offset) 212 dent_addr = (u32) ((unsigned long)(sg_virt(sg)) & (IO_PAGE_SIZE - 1UL));
213 & (IO_PAGE_SIZE - 1UL));
214 while (--nents) { 213 while (--nents) {
215 unsigned long addr; 214 unsigned long addr;
216 215
217 sg = sg_next(sg); 216 sg = sg_next(sg);
218 addr = (unsigned long) (page_address(sg->page) + sg->offset); 217 addr = (unsigned long) sg_virt(sg);
219 if (! VCONTIG(prev, addr)) { 218 if (! VCONTIG(prev, addr)) {
220 dma_sg->dma_address = dent_addr; 219 dma_sg->dma_address = dent_addr;
221 dma_sg->dma_length = dent_len; 220 dma_sg->dma_length = dent_len;
diff --git a/arch/sparc64/kernel/ldc.c b/arch/sparc64/kernel/ldc.c
index 85a2be0b0962..c8313cb60f0a 100644
--- a/arch/sparc64/kernel/ldc.c
+++ b/arch/sparc64/kernel/ldc.c
@@ -2057,7 +2057,7 @@ static void fill_cookies(struct cookie_state *sp, unsigned long pa,
2057 2057
2058static int sg_count_one(struct scatterlist *sg) 2058static int sg_count_one(struct scatterlist *sg)
2059{ 2059{
2060 unsigned long base = page_to_pfn(sg->page) << PAGE_SHIFT; 2060 unsigned long base = page_to_pfn(sg_page(sg)) << PAGE_SHIFT;
2061 long len = sg->length; 2061 long len = sg->length;
2062 2062
2063 if ((sg->offset | len) & (8UL - 1)) 2063 if ((sg->offset | len) & (8UL - 1))
diff --git a/arch/sparc64/kernel/pci_sun4v.c b/arch/sparc64/kernel/pci_sun4v.c
index fe46ace3e59f..8c4875bdb4a8 100644
--- a/arch/sparc64/kernel/pci_sun4v.c
+++ b/arch/sparc64/kernel/pci_sun4v.c
@@ -365,8 +365,7 @@ static void dma_4v_unmap_single(struct device *dev, dma_addr_t bus_addr,
365 spin_unlock_irqrestore(&iommu->lock, flags); 365 spin_unlock_irqrestore(&iommu->lock, flags);
366} 366}
367 367
368#define SG_ENT_PHYS_ADDRESS(SG) \ 368#define SG_ENT_PHYS_ADDRESS(SG) (__pa(sg_virt((SG))))
369 (__pa(page_address((SG)->page)) + (SG)->offset)
370 369
371static long fill_sg(long entry, struct device *dev, 370static long fill_sg(long entry, struct device *dev,
372 struct scatterlist *sg, 371 struct scatterlist *sg,
@@ -477,9 +476,7 @@ static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist,
477 /* Fast path single entry scatterlists. */ 476 /* Fast path single entry scatterlists. */
478 if (nelems == 1) { 477 if (nelems == 1) {
479 sglist->dma_address = 478 sglist->dma_address =
480 dma_4v_map_single(dev, 479 dma_4v_map_single(dev, sg_virt(sglist),
481 (page_address(sglist->page) +
482 sglist->offset),
483 sglist->length, direction); 480 sglist->length, direction);
484 if (unlikely(sglist->dma_address == DMA_ERROR_CODE)) 481 if (unlikely(sglist->dma_address == DMA_ERROR_CODE))
485 return 0; 482 return 0;