]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/ia64/hp/common/sba_iommu.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[linux-2.6-omap-h63xx.git] / arch / ia64 / hp / common / sba_iommu.c
index 3c95f4184b996d26e98ba709acff2052d40313e8..a94445422cc65d895eb76e4a417897bf067556d9 100644 (file)
@@ -246,7 +246,7 @@ static int reserve_sba_gart = 1;
 static SBA_INLINE void sba_mark_invalid(struct ioc *, dma_addr_t, size_t);
 static SBA_INLINE void sba_free_range(struct ioc *, dma_addr_t, size_t);
 
-#define sba_sg_address(sg)     (page_address((sg)->page) + (sg)->offset)
+#define sba_sg_address(sg)     sg_virt((sg))
 
 #ifdef FULL_VALID_PDIR
 static u64 prefetch_spill_page;
@@ -1265,7 +1265,7 @@ sba_fill_pdir(
  * the sglist do both.
  */
 static SBA_INLINE int
-sba_coalesce_chunks( struct ioc *ioc,
+sba_coalesce_chunks(struct ioc *ioc, struct device *dev,
        struct scatterlist *startsg,
        int nents)
 {
@@ -1275,6 +1275,7 @@ sba_coalesce_chunks( struct ioc *ioc,
        struct scatterlist *dma_sg;        /* next DMA stream head */
        unsigned long dma_offset, dma_len; /* start/len of DMA stream */
        int n_mappings = 0;
+       unsigned int max_seg_size = dma_get_max_seg_size(dev);
 
        while (nents > 0) {
                unsigned long vaddr = (unsigned long) sba_sg_address(startsg);
@@ -1314,6 +1315,9 @@ sba_coalesce_chunks( struct ioc *ioc,
                            > DMA_CHUNK_SIZE)
                                break;
 
+                       if (dma_len + startsg->length > max_seg_size)
+                               break;
+
                        /*
                        ** Then look for virtually contiguous blocks.
                        **
@@ -1441,7 +1445,7 @@ int sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents, int di
        ** w/o this association, we wouldn't have coherent DMA!
        ** Access to the virtual address is what forces a two pass algorithm.
        */
-       coalesced = sba_coalesce_chunks(ioc, sglist, nents);
+       coalesced = sba_coalesce_chunks(ioc, dev, sglist, nents);
 
        /*
        ** Program the I/O Pdir
@@ -1871,7 +1875,7 @@ ioc_show(struct seq_file *s, void *v)
        return 0;
 }
 
-static struct seq_operations ioc_seq_ops = {
+static const struct seq_operations ioc_seq_ops = {
        .start = ioc_start,
        .next  = ioc_next,
        .stop  = ioc_stop,
@@ -2034,7 +2038,8 @@ sba_init(void)
        if (!ia64_platform_is("hpzx1") && !ia64_platform_is("hpzx1_swiotlb"))
                return 0;
 
-#if defined(CONFIG_IA64_GENERIC) && defined(CONFIG_CRASH_DUMP)
+#if defined(CONFIG_IA64_GENERIC) && defined(CONFIG_CRASH_DUMP) && \
+        defined(CONFIG_PROC_FS)
        /* If we are booting a kdump kernel, the sba_iommu will
         * cause devices that were not shutdown properly to MCA
         * as soon as they are turned back on.  Our only option for