Merge branch 'linus' into core/generic-dma-coherent
authorIngo Molnar <mingo@elte.hu>
Mon, 28 Jul 2008 22:07:55 +0000 (00:07 +0200)
committerIngo Molnar <mingo@elte.hu>
Mon, 28 Jul 2008 22:07:55 +0000 (00:07 +0200)
Conflicts:

arch/x86/Kconfig

Signed-off-by: Ingo Molnar <mingo@elte.hu>
1  2 
arch/arm/Kconfig
arch/sh/Kconfig
arch/sh/mm/consistent.c
arch/x86/Kconfig
arch/x86/kernel/pci-dma.c
include/asm-arm/dma-mapping.h
include/asm-cris/dma-mapping.h
include/asm-sh/dma-mapping.h
include/asm-x86/dma-mapping.h
init/Kconfig
kernel/Makefile

Simple merge
diff --cc arch/sh/Kconfig
index 81894f0985aad0cf8440c44e7d42c88043444d82,7bfb0d219d67fadb87080a07364a4e45c59f78e9..0b88dc462d731c7c8c46525e3fa71eeb53e46cfd
@@@ -8,9 -8,9 +8,10 @@@ mainmenu "Linux/SuperH Kernel Configura
  config SUPERH
        def_bool y
        select EMBEDDED
+       select HAVE_CLK
        select HAVE_IDE
        select HAVE_OPROFILE
 +      select HAVE_GENERIC_DMA_COHERENT
        help
          The SuperH is a RISC processor targeted for use in embedded systems
          and consumer electronics; it was also used in the Sega Dreamcast
Simple merge
index 18a58ecfe6842215e854419054900a27cfac550b,b6fa2877b1734aad723805c2e5518fe301f3443d..3d0f2b6a5a16e6edd6f349b4b19756a5d2cecff7
@@@ -27,7 -30,7 +30,8 @@@ config X8
        select HAVE_FTRACE
        select HAVE_KVM if ((X86_32 && !X86_VOYAGER && !X86_VISWS && !X86_NUMAQ) || X86_64)
        select HAVE_ARCH_KGDB if !X86_VOYAGER
 +      select HAVE_GENERIC_DMA_COHERENT if X86_32
+       select HAVE_EFFICIENT_UNALIGNED_ACCESS
  
  config ARCH_DEFCONFIG
        string
index b7dd70fda0317c40c500261646bd041561dc3a42,37544123896db54a58ac8cb3ee746d6c114ff686..8dbffb846de9b66c5a1aec5cc542dc959acfa924
@@@ -201,12 -192,131 +192,13 @@@ static __init int iommu_setup(char *p
  }
  early_param("iommu", iommu_setup);
  
 -#ifdef CONFIG_X86_32
 -int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
 -                              dma_addr_t device_addr, size_t size, int flags)
 -{
 -      void __iomem *mem_base = NULL;
 -      int pages = size >> PAGE_SHIFT;
 -      int bitmap_size = BITS_TO_LONGS(pages) * sizeof(long);
 -
 -      if ((flags & (DMA_MEMORY_MAP | DMA_MEMORY_IO)) == 0)
 -              goto out;
 -      if (!size)
 -              goto out;
 -      if (dev->dma_mem)
 -              goto out;
 -
 -      /* FIXME: this routine just ignores DMA_MEMORY_INCLUDES_CHILDREN */
 -
 -      mem_base = ioremap(bus_addr, size);
 -      if (!mem_base)
 -              goto out;
 -
 -      dev->dma_mem = kzalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL);
 -      if (!dev->dma_mem)
 -              goto out;
 -      dev->dma_mem->bitmap = kzalloc(bitmap_size, GFP_KERNEL);
 -      if (!dev->dma_mem->bitmap)
 -              goto free1_out;
 -
 -      dev->dma_mem->virt_base = mem_base;
 -      dev->dma_mem->device_base = device_addr;
 -      dev->dma_mem->size = pages;
 -      dev->dma_mem->flags = flags;
 -
 -      if (flags & DMA_MEMORY_MAP)
 -              return DMA_MEMORY_MAP;
 -
 -      return DMA_MEMORY_IO;
 -
 - free1_out:
 -      kfree(dev->dma_mem);
 - out:
 -      if (mem_base)
 -              iounmap(mem_base);
 -      return 0;
 -}
 -EXPORT_SYMBOL(dma_declare_coherent_memory);
 -
 -void dma_release_declared_memory(struct device *dev)
 -{
 -      struct dma_coherent_mem *mem = dev->dma_mem;
 -
 -      if (!mem)
 -              return;
 -      dev->dma_mem = NULL;
 -      iounmap(mem->virt_base);
 -      kfree(mem->bitmap);
 -      kfree(mem);
 -}
 -EXPORT_SYMBOL(dma_release_declared_memory);
 -
 -void *dma_mark_declared_memory_occupied(struct device *dev,
 -                                      dma_addr_t device_addr, size_t size)
 -{
 -      struct dma_coherent_mem *mem = dev->dma_mem;
 -      int pos, err;
 -      int pages = (size + (device_addr & ~PAGE_MASK) + PAGE_SIZE - 1);
 -
 -      pages >>= PAGE_SHIFT;
 -
 -      if (!mem)
 -              return ERR_PTR(-EINVAL);
 -
 -      pos = (device_addr - mem->device_base) >> PAGE_SHIFT;
 -      err = bitmap_allocate_region(mem->bitmap, pos, get_order(pages));
 -      if (err != 0)
 -              return ERR_PTR(err);
 -      return mem->virt_base + (pos << PAGE_SHIFT);
 -}
 -EXPORT_SYMBOL(dma_mark_declared_memory_occupied);
 -
 -static int dma_alloc_from_coherent_mem(struct device *dev, ssize_t size,
 -                                     dma_addr_t *dma_handle, void **ret)
 -{
 -      struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
 -      int order = get_order(size);
 -
 -      if (mem) {
 -              int page = bitmap_find_free_region(mem->bitmap, mem->size,
 -                                                   order);
 -              if (page >= 0) {
 -                      *dma_handle = mem->device_base + (page << PAGE_SHIFT);
 -                      *ret = mem->virt_base + (page << PAGE_SHIFT);
 -                      memset(*ret, 0, size);
 -              }
 -              if (mem->flags & DMA_MEMORY_EXCLUSIVE)
 -                      *ret = NULL;
 -      }
 -      return (mem != NULL);
 -}
 -
 -static int dma_release_coherent(struct device *dev, int order, void *vaddr)
 -{
 -      struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
 -
 -      if (mem && vaddr >= mem->virt_base && vaddr <
 -                 (mem->virt_base + (mem->size << PAGE_SHIFT))) {
 -              int page = (vaddr - mem->virt_base) >> PAGE_SHIFT;
 -
 -              bitmap_release_region(mem->bitmap, page, order);
 -              return 1;
 -      }
 -      return 0;
 -}
 -#else
 -#define dma_alloc_from_coherent_mem(dev, size, handle, ret) (0)
 -#define dma_release_coherent(dev, order, vaddr) (0)
 -#endif /* CONFIG_X86_32 */
 -
  int dma_supported(struct device *dev, u64 mask)
  {
+       struct dma_mapping_ops *ops = get_dma_ops(dev);
  #ifdef CONFIG_PCI
        if (mask > 0xffffffff && forbid_dac > 0) {
-               printk(KERN_INFO "PCI: Disallowing DAC for device %s\n",
-                                dev->bus_id);
+               dev_info(dev, "PCI: Disallowing DAC for device\n");
                return 0;
        }
  #endif
@@@ -370,12 -480,14 +362,14 @@@ EXPORT_SYMBOL(dma_alloc_coherent)
  void dma_free_coherent(struct device *dev, size_t size,
                         void *vaddr, dma_addr_t bus)
  {
+       struct dma_mapping_ops *ops = get_dma_ops(dev);
        int order = get_order(size);
        WARN_ON(irqs_disabled());       /* for portability */
 -      if (dma_release_coherent(dev, order, vaddr))
 +      if (dma_release_from_coherent(dev, order, vaddr))
                return;
-       if (dma_ops->unmap_single)
-               dma_ops->unmap_single(dev, bus, size, 0);
+       if (ops->unmap_single)
+               ops->unmap_single(dev, bus, size, 0);
        free_pages((unsigned long)vaddr, order);
  }
  EXPORT_SYMBOL(dma_free_coherent);
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc init/Kconfig
Simple merge
diff --cc kernel/Makefile
Simple merge