summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-04-11 22:50:11 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-04-11 22:50:11 -0700
commit9ed9e7e5eb0ab64f58ef41e36779cb96abc17076 (patch)
treebe53ddc7c5541566ba8411fc12e60bc0c4a72d44
parentb7ceb1452399ef59ab14868337d2d74a9b5c4c8d (diff)
[PATCH] ppc64: DMA API updates
From: Anton Blanchard <anton@samba.org> DMA API updates, in particular adding the new cache flush interfaces.
-rw-r--r--arch/ppc64/kernel/dma.c24
-rw-r--r--include/asm-ppc64/dma-mapping.h69
-rw-r--r--include/asm-ppc64/vio.h17
3 files changed, 54 insertions, 56 deletions
diff --git a/arch/ppc64/kernel/dma.c b/arch/ppc64/kernel/dma.c
index f81dcd1e8da1..dec55efcc873 100644
--- a/arch/ppc64/kernel/dma.c
+++ b/arch/ppc64/kernel/dma.c
@@ -131,27 +131,3 @@ void dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
BUG();
}
EXPORT_SYMBOL(dma_unmap_sg);
-
-void dma_sync_single(struct device *dev, dma_addr_t dma_handle, size_t size,
- enum dma_data_direction direction)
-{
- if (dev->bus == &pci_bus_type)
- pci_dma_sync_single(to_pci_dev(dev), dma_handle, size, (int)direction);
- else if (dev->bus == &vio_bus_type)
- vio_dma_sync_single(to_vio_dev(dev), dma_handle, size, direction);
- else
- BUG();
-}
-EXPORT_SYMBOL(dma_sync_single);
-
-void dma_sync_sg(struct device *dev, struct scatterlist *sg, int nelems,
- enum dma_data_direction direction)
-{
- if (dev->bus == &pci_bus_type)
- pci_dma_sync_sg(to_pci_dev(dev), sg, nelems, (int)direction);
- else if (dev->bus == &vio_bus_type)
- vio_dma_sync_sg(to_vio_dev(dev), sg, nelems, direction);
- else
- BUG();
-}
-EXPORT_SYMBOL(dma_sync_sg);
diff --git a/include/asm-ppc64/dma-mapping.h b/include/asm-ppc64/dma-mapping.h
index e12753cf8861..0cdc5346f6f8 100644
--- a/include/asm-ppc64/dma-mapping.h
+++ b/include/asm-ppc64/dma-mapping.h
@@ -36,10 +36,43 @@ extern int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
enum dma_data_direction direction);
extern void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
int nhwentries, enum dma_data_direction direction);
-extern void dma_sync_single(struct device *dev, dma_addr_t dma_handle,
- size_t size, enum dma_data_direction direction);
-extern void dma_sync_sg(struct device *dev, struct scatterlist *sg, int nelems,
- enum dma_data_direction direction);
+
+static inline void
+dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
+ enum dma_data_direction direction)
+{
+ BUG_ON(direction == DMA_NONE);
+ /* nothing to do */
+}
+
+static inline void
+dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
+ enum dma_data_direction direction)
+{
+ BUG_ON(direction == DMA_NONE);
+ /* nothing to do */
+}
+
+static inline void
+dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
+ enum dma_data_direction direction)
+{
+ BUG_ON(direction == DMA_NONE);
+ /* nothing to do */
+}
+
+static inline void
+dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
+ enum dma_data_direction direction)
+{
+ BUG_ON(direction == DMA_NONE);
+ /* nothing to do */
+}
+
+static inline int dma_mapping_error(dma_addr_t dma_addr)
+{
+ return (dma_addr == DMA_ERROR_CODE);
+}
/* Now for the API extensions over the pci_ one */
@@ -56,27 +89,29 @@ dma_get_cache_alignment(void)
}
static inline void
-dma_sync_single_range(struct device *dev, dma_addr_t dma_handle,
- unsigned long offset, size_t size,
- enum dma_data_direction direction)
+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)
{
- /* just sync everything, that's all the pci API can do */
- dma_sync_single(dev, dma_handle, offset+size, direction);
+ BUG_ON(direction == DMA_NONE);
+ /* nothing to do */
}
static inline void
-dma_cache_sync(void *vaddr, size_t size,
- enum dma_data_direction direction)
+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)
{
- /* could define this in terms of the dma_cache ... operations,
- * but if you get this on a platform, you should convert the platform
- * to using the generic device DMA API */
- BUG();
+ BUG_ON(direction == DMA_NONE);
+ /* nothing to do */
}
-static inline int dma_mapping_error(dma_addr_t dma_addr)
+static inline void
+dma_cache_sync(void *vaddr, size_t size,
+ enum dma_data_direction direction)
{
- return (dma_addr == DMA_ERROR_CODE);
+ BUG_ON(direction == DMA_NONE);
+ /* nothing to do */
}
#endif /* _ASM_DMA_MAPPING_H */
diff --git a/include/asm-ppc64/vio.h b/include/asm-ppc64/vio.h
index 107201b25008..1ef9a270e7f7 100644
--- a/include/asm-ppc64/vio.h
+++ b/include/asm-ppc64/vio.h
@@ -78,23 +78,10 @@ static inline int vio_dma_supported(struct vio_dev *hwdev, u64 mask)
vio_map_single(dev, (page_address(page) + (off)), size, dir)
#define vio_unmap_page(dev,addr,sz,dir) vio_unmap_single(dev,addr,sz,dir)
-
-static inline void vio_dma_sync_single(struct vio_dev *hwdev,
- dma_addr_t dma_handle, size_t size,
- enum dma_data_direction direction)
-{
- BUG_ON(direction == DMA_NONE);
- /* nothing to do */
-}
-
-static inline void vio_dma_sync_sg(struct vio_dev *hwdev,
- struct scatterlist *sg, int nelems,
- enum dma_data_direction direction)
+static inline int vio_set_dma_mask(struct vio_dev *dev, u64 mask)
{
- BUG_ON(direction == DMA_NONE);
- /* nothing to do */
+ return -EIO;
}
-static inline int vio_set_dma_mask(struct vio_dev *dev, u64 mask) { return -EIO; }
extern struct bus_type vio_bus_type;