]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
Remove dma_cache_(wback|inv|wback_inv) functions
authorRalf Baechle <ralf@linux-mips.org>
Wed, 17 Oct 2007 06:29:42 +0000 (23:29 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 17 Oct 2007 15:42:57 +0000 (08:42 -0700)
dma_cache_(wback|inv|wback_inv) were the earliest attempt on a generalized
cache managment API for I/O purposes.  Originally it was basically the raw
MIPS low level cache API exported to the entire world.  The API has
suffered from a lack of documentation, was not very widely used unlike it's
more modern brothers and can easily be replaced by dma_cache_sync.  So
remove it rsp.  turn the surviving bits back into an arch private API, as
discussed on linux-arch.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Acked-by: Paul Mackerras <paulus@samba.org>
Acked-by: David S. Miller <davem@davemloft.net>
Acked-by: Kyle McMartin <kyle@parisc-linux.org>
Acked-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Cc: <linux-arch@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
24 files changed:
arch/avr32/mm/dma-coherent.c
arch/mips/mm/cache.c
arch/sh/drivers/pci/dma-dreamcast.c
arch/sh/mm/consistent.c
arch/sh64/mm/consistent.c
include/asm-alpha/io.h
include/asm-avr32/io.h
include/asm-blackfin/io.h
include/asm-h8300/io.h
include/asm-ia64/io.h
include/asm-m68k/io.h
include/asm-m68knommu/io.h
include/asm-mips/io.h
include/asm-parisc/io.h
include/asm-powerpc/io.h
include/asm-ppc/io.h
include/asm-sh/floppy.h
include/asm-sh/io.h
include/asm-sh64/dma-mapping.h
include/asm-sh64/io.h
include/asm-sparc/io.h
include/asm-sparc64/io.h
include/asm-x86/io_32.h
include/asm-x86/io_64.h

index 099212d4567c5d33d649c2c0988ec538dfb49803..177fea8f7b711e90d87e208db5f9d36adaef3be6 100644 (file)
@@ -21,13 +21,13 @@ void dma_cache_sync(struct device *dev, void *vaddr, size_t size, int direction)
 
        switch (direction) {
        case DMA_FROM_DEVICE:           /* invalidate only */
-               dma_cache_inv(vaddr, size);
+               invalidate_dcache_region(vaddr, size);
                break;
        case DMA_TO_DEVICE:             /* writeback only */
-               dma_cache_wback(vaddr, size);
+               clean_dcache_region(vaddr, size);
                break;
        case DMA_BIDIRECTIONAL:         /* writeback and invalidate */
-               dma_cache_wback_inv(vaddr, size);
+               flush_dcache_region(vaddr, size);
                break;
        default:
                BUG();
index 43dde874f4140a554148464040647fde608923b2..81f30ac2bff95fe7c406e3dcf7429899c0e74380 100644 (file)
@@ -47,8 +47,6 @@ void (*_dma_cache_wback)(unsigned long start, unsigned long size);
 void (*_dma_cache_inv)(unsigned long start, unsigned long size);
 
 EXPORT_SYMBOL(_dma_cache_wback_inv);
-EXPORT_SYMBOL(_dma_cache_wback);
-EXPORT_SYMBOL(_dma_cache_inv);
 
 #endif /* CONFIG_DMA_NONCOHERENT */
 
index 230d6ec0d2398df92d56525a9cbfbbc212e03d96..888a3405059916541c0781dfc6205f722599a976 100644 (file)
@@ -51,7 +51,7 @@ void *dreamcast_consistent_alloc(struct device *dev, size_t size,
        buf = P2SEGADDR(buf);
 
        /* Flush the dcache before we hand off the buffer */
-       dma_cache_wback_inv((void *)buf, size);
+       __flush_purge_region((void *)buf, size);
 
        return (void *)buf;
 }
index 38c82d890ffda6a5cb332ad3b387bde0476dc551..e220c29a3c00cf03fab0da8c4dd329160269d577 100644 (file)
@@ -34,7 +34,7 @@ void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *handle)
        /*
         * We must flush the cache before we pass it on to the device
         */
-       dma_cache_wback_inv(ret, size);
+       __flush_purge_region(ret, size);
 
        page = virt_to_page(ret);
        free = page + (size >> PAGE_SHIFT);
@@ -68,13 +68,13 @@ void consistent_sync(void *vaddr, size_t size, int direction)
 
        switch (direction) {
        case DMA_FROM_DEVICE:           /* invalidate only */
-               dma_cache_inv(p1addr, size);
+               __flush_invalidate_region(p1addr, size);
                break;
        case DMA_TO_DEVICE:             /* writeback only */
-               dma_cache_wback(p1addr, size);
+               __flush_wback_region(p1addr, size);
                break;
        case DMA_BIDIRECTIONAL:         /* writeback and invalidate */
-               dma_cache_wback_inv(p1addr, size);
+               __flush_purge_region(p1addr, size);
                break;
        default:
                BUG();
index 8875a2a40da72dafa6eb2f7f8315a76d60bebe67..c439620402cb1812d0666eaa6492ce04ebbabec4 100644 (file)
@@ -11,6 +11,7 @@
 #include <linux/mm.h>
 #include <linux/string.h>
 #include <linux/pci.h>
+#include <linux/dma-mapping.h>
 #include <linux/module.h>
 #include <asm/io.h>
 
@@ -32,7 +33,7 @@ void *consistent_alloc(struct pci_dev *hwdev, size_t size,
        if (vp != NULL) {
                memset(vp, 0, size);
                *dma_handle = virt_to_phys(ret);
-               dma_cache_wback_inv((unsigned long)ret, size);
+               dma_cache_sync(NULL, ret, size, DMA_BIDIRECTIONAL);
        }
 
        return vp;
index ab5b60dcef19f5b3ea7bf17ed2cdfaea1ddf42f4..38f18cf18c9d0e99ae5f353893379923193c6b1b 100644 (file)
@@ -551,12 +551,6 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);
 #endif
 #define RTC_ALWAYS_BCD 0
 
-/* Nothing to do */
-
-#define dma_cache_inv(_start,_size)            do { } while (0)
-#define dma_cache_wback(_start,_size)          do { } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { } while (0)
-
 /*
  * Some mucking forons use if[n]def writeq to check if platform has it.
  * It's a bloody bad idea and we probably want ARCH_HAS_WRITEQ for them
index 64bb92bb677338ec3c2ee872e0431719fb16bc91..8be7ea9c9047119b3541cd8d7ec860c1dd763d73 100644 (file)
@@ -298,13 +298,6 @@ extern void __iounmap(void __iomem *addr);
 #define ioport_map(port, nr)   ioremap(port, nr)
 #define ioport_unmap(port)     iounmap(port)
 
-#define dma_cache_wback_inv(_start, _size)     \
-       flush_dcache_region(_start, _size)
-#define dma_cache_inv(_start, _size)           \
-       invalidate_dcache_region(_start, _size)
-#define dma_cache_wback(_start, _size)         \
-       clean_dcache_region(_start, _size)
-
 /*
  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
  * access
index 525179bf43d70368fe1406ee926f70c18ffe5523..d1d2e6be3b59328f42f02d46e91402cffd0b5ab8 100644 (file)
@@ -183,10 +183,6 @@ extern void blkfin_inv_cache_all(void);
 #define        ioport_map(port, nr)            ((void __iomem*)(port))
 #define        ioport_unmap(addr)
 
-#define dma_cache_inv(_start,_size) do { blkfin_inv_cache_all();} while (0)
-#define dma_cache_wback(_start,_size) do { } while (0)
-#define dma_cache_wback_inv(_start,_size) do { blkfin_inv_cache_all();} while (0)
-
 /* Pages to physical address... */
 #define page_to_phys(page)      ((page - mem_map) << PAGE_SHIFT)
 #define page_to_bus(page)       ((page - mem_map) << PAGE_SHIFT)
index 91b7487cb7ae9582cc0d0c3e3d00ab9d7cfec071..7543a57b4ea13dce3ba67355eb161f8b14ce305f 100644 (file)
@@ -264,12 +264,6 @@ static inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size
 
 extern void iounmap(void *addr);
 
-/* Nothing to do */
-
-#define dma_cache_inv(_start,_size)            do { } while (0)
-#define dma_cache_wback(_start,_size)          do { } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { } while (0)
-
 /* H8/300 internal I/O functions */
 static __inline__ unsigned char ctrl_inb(unsigned long addr)
 {
index eb17a86929679834eaf5372b01a57ab5fd84edb0..4ebed77aa4726c5263e0ff1a0ff5dfacc60daf11 100644 (file)
@@ -435,10 +435,6 @@ extern void memcpy_fromio(void *dst, const volatile void __iomem *src, long n);
 extern void memcpy_toio(volatile void __iomem *dst, const void *src, long n);
 extern void memset_io(volatile void __iomem *s, int c, long n);
 
-#define dma_cache_inv(_start,_size)             do { } while (0)
-#define dma_cache_wback(_start,_size)           do { } while (0)
-#define dma_cache_wback_inv(_start,_size)       do { } while (0)
-
 # endif /* __KERNEL__ */
 
 /*
index 47bb9cf107b7aa4cf1b8935d3a451eb2f5d20313..baf4f9b8acfc327de5da8c759c310c7b43509e66 100644 (file)
@@ -384,12 +384,6 @@ static inline void __iomem *ioremap_fullcache(unsigned long physaddr,
        return __ioremap(physaddr, size, IOMAP_FULL_CACHING);
 }
 
-
-/* m68k caches aren't DMA coherent */
-extern void dma_cache_wback_inv(unsigned long start, unsigned long size);
-extern void dma_cache_wback(unsigned long start, unsigned long size);
-extern void dma_cache_inv(unsigned long start, unsigned long size);
-
 static inline void memset_io(volatile void __iomem *addr, unsigned char val, int count)
 {
        __builtin_memset((void __force *) addr, val, count);
index 8df4cee2a0cd272ee28339f75ae80772fde54f83..653d9b2d7ddfe5be3799ba95ca715d6898f3c56b 100644 (file)
@@ -165,12 +165,6 @@ static inline void *ioremap_fullcache(unsigned long physaddr, unsigned long size
 
 extern void iounmap(void *addr);
 
-/* Nothing to do */
-
-#define dma_cache_inv(_start,_size)            do { } while (0)
-#define dma_cache_wback(_start,_size)          do { } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { } while (0)
-
 /* Pages to physical address... */
 #define page_to_phys(page)      ((page - mem_map) << PAGE_SHIFT)
 #define page_to_bus(page)       ((page - mem_map) << PAGE_SHIFT)
index 2cd8323c8586f47d440aca4d72901478d9a21754..e62058b0d28c37c48d7a71c40c7271322fed5e63 100644 (file)
@@ -554,6 +554,8 @@ static inline void memcpy_toio(volatile void __iomem *dst, const void *src, int
  *    caches.  Dirty lines of the caches may be written back or simply
  *    be discarded.  This operation is necessary before dma operations
  *    to the memory.
+ *
+ * This API used to be exported; it now is for arch code internal use only.
  */
 #ifdef CONFIG_DMA_NONCOHERENT
 
index 4cc9bcec0564389bd33b69a136f66a24f4bafd96..95f00e11c7b495d0b54202ff3eb5d2200d3934a6 100644 (file)
@@ -270,11 +270,6 @@ extern void outsl (unsigned long port, const void *src, unsigned long count);
 /* IO Port space is :      BBiiii   where BB is HBA number. */
 #define IO_SPACE_LIMIT 0x00ffffff
 
-
-#define dma_cache_inv(_start,_size)            do { flush_kernel_dcache_range(_start,_size); } while (0)
-#define dma_cache_wback(_start,_size)          do { flush_kernel_dcache_range(_start,_size); } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { flush_kernel_dcache_range(_start,_size); } while (0)
-
 /* PA machines have an MM I/O space from 0xf0000000-0xffffffff in 32
  * bit mode and from 0xfffffffff0000000-0xfffffffffffffff in 64 bit
  * mode (essentially just sign extending.  This macro takes in a 32
index 0d0589ef8ea68314ae6c8af77413a5022b50326a..bf14ab4ef4c9794b30432d5d415ec06660d8c121 100644 (file)
@@ -498,23 +498,6 @@ static inline void name at                                 \
 #define writeq writeq
 #endif
 
-#ifdef CONFIG_NOT_COHERENT_CACHE
-
-#define dma_cache_inv(_start,_size) \
-       invalidate_dcache_range(_start, (_start + _size))
-#define dma_cache_wback(_start,_size) \
-       clean_dcache_range(_start, (_start + _size))
-#define dma_cache_wback_inv(_start,_size) \
-       flush_dcache_range(_start, (_start + _size))
-
-#else /* CONFIG_NOT_COHERENT_CACHE */
-
-#define dma_cache_inv(_start,_size)            do { } while (0)
-#define dma_cache_wback(_start,_size)          do { } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { } while (0)
-
-#endif /* !CONFIG_NOT_COHERENT_CACHE */
-
 /*
  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
  * access
index 8f58231a8bc67bdf490182294036b2e2a05733b3..a0d409a5d80f835a8ad6fdaf1060ed7071fb2418 100644 (file)
@@ -478,23 +478,6 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
 #include <asm/mpc8260_pci9.h>
 #endif
 
-#ifdef CONFIG_NOT_COHERENT_CACHE
-
-#define dma_cache_inv(_start,_size) \
-       invalidate_dcache_range(_start, (_start + _size))
-#define dma_cache_wback(_start,_size) \
-       clean_dcache_range(_start, (_start + _size))
-#define dma_cache_wback_inv(_start,_size) \
-       flush_dcache_range(_start, (_start + _size))
-
-#else
-
-#define dma_cache_inv(_start,_size)            do { } while (0)
-#define dma_cache_wback(_start,_size)          do { } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { } while (0)
-
-#endif
-
 /*
  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
  * access
index 942ade98757bb4f551736e28988ebd0cf658f50c..59fbfdc90dfb0bbbdcab34fb367e62317e821a0c 100644 (file)
@@ -213,7 +213,7 @@ static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
        }
 #endif
 
-       dma_cache_wback_inv(addr, size);
+       __flush_purge_region(addr, size);
 
        /* actual, physical DMA */
        doing_pdma = 0;
index 1a336cdc75fed1a5a3e9bca2a90178eeb21bca2c..6ed34d8eac5f48026088535adcd931a053a2d609 100644 (file)
@@ -326,31 +326,6 @@ __ioremap_mode(unsigned long offset, unsigned long size, unsigned long flags)
 #define iounmap(addr)                                  \
        __iounmap((addr))
 
-/*
- * The caches on some architectures aren't dma-coherent and have need to
- * handle this in software.  There are three types of operations that
- * can be applied to dma buffers.
- *
- *  - dma_cache_wback_inv(start, size) makes caches and RAM coherent by
- *    writing the content of the caches back to memory, if necessary.
- *    The function also invalidates the affected part of the caches as
- *    necessary before DMA transfers from outside to memory.
- *  - dma_cache_inv(start, size) invalidates the affected parts of the
- *    caches.  Dirty lines of the caches may be written back or simply
- *    be discarded.  This operation is necessary before dma operations
- *    to the memory.
- *  - dma_cache_wback(start, size) writes back any dirty lines but does
- *    not invalidate the cache.  This can be used before DMA reads from
- *    memory,
- */
-
-#define dma_cache_wback_inv(_start,_size) \
-    __flush_purge_region(_start,_size)
-#define dma_cache_inv(_start,_size) \
-    __flush_invalidate_region(_start,_size)
-#define dma_cache_wback(_start,_size) \
-    __flush_wback_region(_start,_size)
-
 /*
  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
  * access
index de4309960207779eb216d7d06ecc4cb9a6d32778..e661857f98dc8e83bf60bc181e35c4464b343a57 100644 (file)
@@ -42,7 +42,11 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
 static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
                                  enum dma_data_direction dir)
 {
-       dma_cache_wback_inv((unsigned long)vaddr, size);
+       unsigned long s = (unsigned long) vaddr & L1_CACHE_ALIGN_MASK;
+       unsigned long e = (vaddr + size) & L1_CACHE_ALIGN_MASK;
+
+       for (; s <= e; s += L1_CACHE_BYTES)
+               asm volatile ("ocbp     %0, 0" : : "r" (s));
 }
 
 static inline dma_addr_t dma_map_single(struct device *dev,
index 3de3ad99f45789d29f5b5c0eb496fed3bf9c762c..7bd7314d38c209e12fc36bf9bfb4abafc8b1086a 100644 (file)
@@ -181,54 +181,6 @@ extern void iounmap(void *addr);
 unsigned long onchip_remap(unsigned long addr, unsigned long size, const char* name);
 extern void onchip_unmap(unsigned long vaddr);
 
-/*
- * The caches on some architectures aren't dma-coherent and have need to
- * handle this in software.  There are three types of operations that
- * can be applied to dma buffers.
- *
- *  - dma_cache_wback_inv(start, size) makes caches and RAM coherent by
- *    writing the content of the caches back to memory, if necessary.
- *    The function also invalidates the affected part of the caches as
- *    necessary before DMA transfers from outside to memory.
- *  - dma_cache_inv(start, size) invalidates the affected parts of the
- *    caches.  Dirty lines of the caches may be written back or simply
- *    be discarded.  This operation is necessary before dma operations
- *    to the memory.
- *  - dma_cache_wback(start, size) writes back any dirty lines but does
- *    not invalidate the cache.  This can be used before DMA reads from
- *    memory,
- */
-
-static __inline__ void dma_cache_wback_inv (unsigned long start, unsigned long size)
-{
-       unsigned long s = start & L1_CACHE_ALIGN_MASK;
-       unsigned long e = (start + size) & L1_CACHE_ALIGN_MASK;
-
-       for (; s <= e; s += L1_CACHE_BYTES)
-               asm volatile ("ocbp     %0, 0" : : "r" (s));
-}
-
-static __inline__ void dma_cache_inv (unsigned long start, unsigned long size)
-{
-       // Note that caller has to be careful with overzealous
-       // invalidation should there be partial cache lines at the extremities
-       // of the specified range
-       unsigned long s = start & L1_CACHE_ALIGN_MASK;
-       unsigned long e = (start + size) & L1_CACHE_ALIGN_MASK;
-
-       for (; s <= e; s += L1_CACHE_BYTES)
-               asm volatile ("ocbi     %0, 0" : : "r" (s));
-}
-
-static __inline__ void dma_cache_wback (unsigned long start, unsigned long size)
-{
-       unsigned long s = start & L1_CACHE_ALIGN_MASK;
-       unsigned long e = (start + size) & L1_CACHE_ALIGN_MASK;
-
-       for (; s <= e; s += L1_CACHE_BYTES)
-               asm volatile ("ocbwb    %0, 0" : : "r" (s));
-}
-
 /*
  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
  * access
index c23e74a0eaa8d4021c101a6bb4c3a5922ddfb4b2..243bf8e9a058d799284d82f44323e0202a02e3d3 100644 (file)
@@ -310,13 +310,6 @@ extern void sbus_iounmap(volatile void __iomem *vaddr, unsigned long size);
 #define RTC_PORT(x)   (rtc_port + (x))
 #define RTC_ALWAYS_BCD  0
 
-/* Nothing to do */
-/* P3: Only IDE DMA may need these. XXX Verify that it still does... */
-
-#define dma_cache_inv(_start,_size)            do { } while (0)
-#define dma_cache_wback(_start,_size)          do { } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { } while (0)
-
 #endif
 
 #define __ARCH_HAS_NO_PAGE_ZERO_MAPPED         1
index 9565a892801e440c2051302973e6fc817c1a1659..cd7ef3097ac28b5734f39b4fc384789fdcd8d2c3 100644 (file)
@@ -474,12 +474,6 @@ extern void pci_iounmap(struct pci_dev *dev, void __iomem *);
 #define sbus_iounmap(__addr, __size)   \
        release_region((unsigned long)(__addr), (__size))
 
-/* Nothing to do */
-
-#define dma_cache_inv(_start,_size)            do { } while (0)
-#define dma_cache_wback(_start,_size)          do { } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { } while (0)
-
 /*
  * Convert a physical pointer to a virtual kernel pointer for /dev/mem
  * access
index e8e0bd64112052dd82fc9723e7695d17940dedc4..4ea7b1ad3c1d5c7fd6f3762ade3ef8a888f07065 100644 (file)
@@ -237,18 +237,9 @@ static inline void flush_write_buffers(void)
        __asm__ __volatile__ ("lock; addl $0,0(%%esp)": : :"memory");
 }
 
-#define dma_cache_inv(_start,_size)            flush_write_buffers()
-#define dma_cache_wback(_start,_size)          flush_write_buffers()
-#define dma_cache_wback_inv(_start,_size)      flush_write_buffers()
-
 #else
 
-/* Nothing to do */
-
-#define dma_cache_inv(_start,_size)            do { } while (0)
-#define dma_cache_wback(_start,_size)          do { } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { } while (0)
-#define flush_write_buffers()
+#define flush_write_buffers() do { } while (0)
 
 #endif
 
index 7475095c5061b1634066f439c3112a209b6c7c29..a037b079433200b0633d845e54cae305d6941d53 100644 (file)
@@ -249,12 +249,6 @@ void memset_io(volatile void __iomem *a, int b, size_t c);
  */
 #define __ISA_IO_base ((char __iomem *)(PAGE_OFFSET))
 
-/* Nothing to do */
-
-#define dma_cache_inv(_start,_size)            do { } while (0)
-#define dma_cache_wback(_start,_size)          do { } while (0)
-#define dma_cache_wback_inv(_start,_size)      do { } while (0)
-
 #define flush_write_buffers() 
 
 extern int iommu_bio_merge;