iommu: parisc: pass struct device to iommu_alloc_range
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Tue, 4 Mar 2008 22:29:28 +0000 (14:29 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 5 Mar 2008 00:35:17 +0000 (16:35 -0800)
This adds struct device argument to sba_alloc_range and ccio_alloc_range, a
preparation for modifications to fix the IOMMU segment boundary problem.  This
change enables ccio_alloc_range to access to LLD's segment boundary limits.

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: Kyle McMartin <kyle@parisc-linux.org>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Grant Grundler <grundler@parisc-linux.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/parisc/ccio-dma.c
drivers/parisc/iommu-helpers.h
drivers/parisc/sba_iommu.c

index d08b284de196b2e807518ac656d678e585f9560c..1695facfca3a834979309d1c0b107656e2d3d354 100644 (file)
@@ -341,7 +341,7 @@ static int ioc_count;
  * of available pages for the requested size.
  */
 static int
  * of available pages for the requested size.
  */
 static int
-ccio_alloc_range(struct ioc *ioc, size_t size)
+ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size)
 {
        unsigned int pages_needed = size >> IOVP_SHIFT;
        unsigned int res_idx;
 {
        unsigned int pages_needed = size >> IOVP_SHIFT;
        unsigned int res_idx;
@@ -760,7 +760,7 @@ ccio_map_single(struct device *dev, void *addr, size_t size,
        ioc->msingle_pages += size >> IOVP_SHIFT;
 #endif
 
        ioc->msingle_pages += size >> IOVP_SHIFT;
 #endif
 
-       idx = ccio_alloc_range(ioc, size);
+       idx = ccio_alloc_range(ioc, dev, size);
        iovp = (dma_addr_t)MKIOVP(idx);
 
        pdir_start = &(ioc->pdir_base[idx]);
        iovp = (dma_addr_t)MKIOVP(idx);
 
        pdir_start = &(ioc->pdir_base[idx]);
index 97ba8286c5969285294c2dd886a0e375071f4878..a9c46cc2db3701157485b8194af83a6c03c7b189 100644 (file)
@@ -96,8 +96,8 @@ iommu_fill_pdir(struct ioc *ioc, struct scatterlist *startsg, int nents,
 
 static inline unsigned int
 iommu_coalesce_chunks(struct ioc *ioc, struct device *dev,
 
 static inline unsigned int
 iommu_coalesce_chunks(struct ioc *ioc, struct device *dev,
-                     struct scatterlist *startsg, int nents,
-                     int (*iommu_alloc_range)(struct ioc *, size_t))
+               struct scatterlist *startsg, int nents,
+               int (*iommu_alloc_range)(struct ioc *, struct device *, size_t))
 {
        struct scatterlist *contig_sg;     /* contig chunk head */
        unsigned long dma_offset, dma_len; /* start/len of DMA stream */
 {
        struct scatterlist *contig_sg;     /* contig chunk head */
        unsigned long dma_offset, dma_len; /* start/len of DMA stream */
@@ -166,7 +166,7 @@ iommu_coalesce_chunks(struct ioc *ioc, struct device *dev,
                dma_len = ALIGN(dma_len + dma_offset, IOVP_SIZE);
                sg_dma_address(contig_sg) =
                        PIDE_FLAG 
                dma_len = ALIGN(dma_len + dma_offset, IOVP_SIZE);
                sg_dma_address(contig_sg) =
                        PIDE_FLAG 
-                       | (iommu_alloc_range(ioc, dma_len) << IOVP_SHIFT)
+                       | (iommu_alloc_range(ioc, dev, dma_len) << IOVP_SHIFT)
                        | dma_offset;
                n_mappings++;
        }
                        | dma_offset;
                n_mappings++;
        }
index d06627c3f353a607f7730b300af68a3d607b83b6..7d58bd2019b999cf12bdb5c40b0f8c3b4db18a51 100644 (file)
@@ -404,7 +404,7 @@ sba_search_bitmap(struct ioc *ioc, unsigned long bits_wanted)
  * resource bit map.
  */
 static int
  * resource bit map.
  */
 static int
-sba_alloc_range(struct ioc *ioc, size_t size)
+sba_alloc_range(struct ioc *ioc, struct device *dev, size_t size)
 {
        unsigned int pages_needed = size >> IOVP_SHIFT;
 #ifdef SBA_COLLECT_STATS
 {
        unsigned int pages_needed = size >> IOVP_SHIFT;
 #ifdef SBA_COLLECT_STATS
@@ -710,7 +710,7 @@ sba_map_single(struct device *dev, void *addr, size_t size,
        ioc->msingle_calls++;
        ioc->msingle_pages += size >> IOVP_SHIFT;
 #endif
        ioc->msingle_calls++;
        ioc->msingle_pages += size >> IOVP_SHIFT;
 #endif
-       pide = sba_alloc_range(ioc, size);
+       pide = sba_alloc_range(ioc, dev, size);
        iovp = (dma_addr_t) pide << IOVP_SHIFT;
 
        DBG_RUN("%s() 0x%p -> 0x%lx\n",
        iovp = (dma_addr_t) pide << IOVP_SHIFT;
 
        DBG_RUN("%s() 0x%p -> 0x%lx\n",