X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=include%2Fasm-sh%2Fdma-mapping.h;h=84fefdaa01a53d8863fb145d0ff39e416328a597;hb=cfa76f024f7c9e65169425804e5b32e71f66d0ee;hp=8d0867b98e05141ce77d5bb4f3837e3877e0c124;hpb=f0eef25339f92f7cd4aeea23d9ae97987a5a1e82;p=linux-2.6 diff --git a/include/asm-sh/dma-mapping.h b/include/asm-sh/dma-mapping.h index 8d0867b98e..84fefdaa01 100644 --- a/include/asm-sh/dma-mapping.h +++ b/include/asm-sh/dma-mapping.h @@ -53,6 +53,10 @@ static inline void dma_free_coherent(struct device *dev, size_t size, consistent_free(vaddr, size); } +#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f) +#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h) +#define dma_is_consistent(d, h) (1) + static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size, enum dma_data_direction dir) { @@ -65,11 +69,11 @@ static inline dma_addr_t dma_map_single(struct device *dev, { #if defined(CONFIG_PCI) && !defined(CONFIG_SH_PCIDMA_NONCOHERENT) if (dev->bus == &pci_bus_type) - return virt_to_bus(ptr); + return virt_to_phys(ptr); #endif dma_cache_sync(dev, ptr, size, dir); - return virt_to_bus(ptr); + return virt_to_phys(ptr); } #define dma_unmap_single(dev, addr, size, dir) do { } while (0) @@ -112,7 +116,7 @@ static inline void dma_sync_single(struct device *dev, dma_addr_t dma_handle, if (dev->bus == &pci_bus_type) return; #endif - dma_cache_sync(dev, bus_to_virt(dma_handle), size, dir); + dma_cache_sync(dev, phys_to_virt(dma_handle), size, dir); } static inline void dma_sync_single_range(struct device *dev, @@ -124,7 +128,7 @@ static inline void dma_sync_single_range(struct device *dev, if (dev->bus == &pci_bus_type) return; #endif - dma_cache_sync(dev, bus_to_virt(dma_handle) + offset, size, dir); + dma_cache_sync(dev, phys_to_virt(dma_handle) + offset, size, dir); } static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg, @@ -156,6 +160,25 @@ static inline void dma_sync_single_for_device(struct device *dev, dma_sync_single(dev, dma_handle, size, dir); } +static inline void dma_sync_single_range_for_cpu(struct device *dev, + dma_addr_t dma_handle, + unsigned long offset, + size_t size, + enum dma_data_direction direction) +{ + dma_sync_single_for_cpu(dev, dma_handle+offset, size, direction); +} + +static inline void dma_sync_single_range_for_device(struct device *dev, + dma_addr_t dma_handle, + unsigned long offset, + size_t size, + enum dma_data_direction direction) +{ + dma_sync_single_for_device(dev, dma_handle+offset, size, direction); +} + + static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems, enum dma_data_direction dir)