Skip to contentSkip to conversation

move swiotlb.h header file to common code

PATCH In review Muli Ben-Yehuda 2 participants 4 messages Nov 24, 2005 – Nov 27, 2005

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover move swiotlb.h header file to common code

This patchset does two things:

- creates an asm-generic/swiotlb.h header file and makes x86-64 and IA64 both use it.

- makes swiotlb use 'enum dma_direction_dir' instead of 'int dir', which is the right thing to according to the the DMA API, and updates x86-64 and ia64 accordingly. The code should be completely equivalent. Compile tested on x86-64 and IA64.

This is the first step towards having a common IOMMU infrastructure. Unfortunatly applying any of the patches require the other two. It was posted to lkml a few days ago and there were no comments.

Please apply.

Cheers,
Muli

Signature · 2 lines
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/
#1 lore raw

PATCH 1/3 move swiotlb header file into common code - generic bits

muli@granada:~/tmp$ diffstat move-swiotlb-into-generic-code-generic-bits-A1
 include/asm-generic/swiotlb.h      |   60 +++++++++++++++++++++++++++++++++++++
 include/linux/dma-data-direction.h |   13 ++++++++
 include/linux/dma-mapping.h        |   10 ------
 lib/swiotlb.c                      |   36 +++++++++++-----------
 4 files changed, 93 insertions(+), 26 deletions(-)

---

include/asm-generic/swiotlb.h +60 -0
diff -Naurp --exclude-from /home/muli/w/dontdiff vanilla/include/asm-generic/swiotlb.h dma_data_direction.hg/include/asm-generic/swiotlb.h
@@ -0,0 +1,60 @@
+#ifndef _ASM_GENERIC_SWIOTLB_H
+#define _ASM_GENERIC_SWTIOLB_H 1
+
+#include <linux/dma-data-direction.h>
+
+struct device;
+struct scatterlist;
+
+extern dma_addr_t
+swiotlb_map_single(struct device *hwdev, void *ptr, size_t size,
+        enum dma_data_direction dir);
+
+extern void
+swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr, size_t size,
+        enum dma_data_direction dir);
+
+extern void
+swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr, size_t size,
+       enum dma_data_direction dir);
+
+extern void
+swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr,
+       size_t size, enum dma_data_direction dir);
+
+extern void
+swiotlb_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
+       unsigned long offset, size_t size, enum dma_data_direction dir);
+
+extern void
+swiotlb_sync_single_range_for_device(struct device *hwdev, dma_addr_t dev_addr,
+       unsigned long offset, size_t size, enum dma_data_direction dir);
+
+extern void
+swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg, int nelems,
+       enum dma_data_direction dir);
+
+extern void
+swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
+       int nelems, enum dma_data_direction dir);
+
+extern int
+swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nents,
+       enum dma_data_direction direction);
+
+extern void
+swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
+       enum dma_data_direction direction);
+
+extern int
+swiotlb_dma_mapping_error(dma_addr_t dma_addr);
+
+extern void*
+swiotlb_alloc_coherent (struct device *hwdev, size_t size, dma_addr_t *dma_handle,
+       gfp_t flags);
+
+extern void
+swiotlb_free_coherent (struct device *hwdev, size_t size, void *vaddr,
+       dma_addr_t dma_handle);
+
+#endif /* _ASM_GENERIC_SWTIOLB_H */
include/linux/dma-data-direction.h +13 -0
diff -Naurp --exclude-from /home/muli/w/dontdiff vanilla/include/linux/dma-data-direction.h dma_data_direction.hg/include/linux/dma-data-direction.h
@@ -0,0 +1,13 @@
+#ifndef _ASM_LINUX_DMA_DATA_DIRECTION_H
+#define _ASM_LINUX_DMA_DATA_DIRECTION_H
+
+/* These definitions mirror those in pci.h, so they can be used
+ * interchangeably with their PCI_ counterparts */
+enum dma_data_direction {
+	DMA_BIDIRECTIONAL = 0,
+	DMA_TO_DEVICE = 1,
+	DMA_FROM_DEVICE = 2,
+	DMA_NONE = 3,
+};
+
+#endif /* _ASM_LINUX_DMA_DATA_DIRECTION_H */
include/linux/dma-mapping.h +1 -9
diff -Naurp --exclude-from /home/muli/w/dontdiff vanilla/include/linux/dma-mapping.h dma_data_direction.hg/include/linux/dma-mapping.h
@@ -3,15 +3,7 @@
 
 #include <linux/device.h>
 #include <linux/err.h>
-
-/* These definitions mirror those in pci.h, so they can be used
- * interchangeably with their PCI_ counterparts */
-enum dma_data_direction {
-	DMA_BIDIRECTIONAL = 0,
-	DMA_TO_DEVICE = 1,
-	DMA_FROM_DEVICE = 2,
-	DMA_NONE = 3,
-};
+#include <linux/dma-data-direction.h>
 
 #define DMA_64BIT_MASK	0xffffffffffffffffULL
 #define DMA_40BIT_MASK	0x000000ffffffffffULL
lib/swiotlb.c +19 -17
diff -Naurp --exclude-from /home/muli/w/dontdiff vanilla/lib/swiotlb.c dma_data_direction.hg/lib/swiotlb.c
@@ -280,7 +280,7 @@ address_needs_mapping(struct device *hwd
  * Allocates bounce buffer and returns its kernel virtual address.
  */
 static void *
-map_single(struct device *hwdev, char *buffer, size_t size, int dir)
+map_single(struct device *hwdev, char *buffer, size_t size, enum dma_data_direction dir)
 {
 	unsigned long flags;
 	char *dma_addr;
@@ -363,7 +363,7 @@ map_single(struct device *hwdev, char *b
  * dma_addr is the kernel virtual address of the bounce buffer to unmap.
  */
 static void
-unmap_single(struct device *hwdev, char *dma_addr, size_t size, int dir)
+unmap_single(struct device *hwdev, char *dma_addr, size_t size, enum dma_data_direction dir)
 {
 	unsigned long flags;
 	int i, count, nslots = ALIGN(size, 1 << IO_TLB_SHIFT) >> IO_TLB_SHIFT;
@@ -408,7 +408,7 @@ unmap_single(struct device *hwdev, char 
 
 static void
 sync_single(struct device *hwdev, char *dma_addr, size_t size,
-	    int dir, int target)
+	    enum dma_data_direction dir, int target)
 {
 	int index = (dma_addr - io_tlb_start) >> IO_TLB_SHIFT;
 	char *buffer = io_tlb_orig_addr[index];
@@ -497,7 +497,7 @@ swiotlb_free_coherent(struct device *hwd
 }
 
 static void
-swiotlb_full(struct device *dev, size_t size, int dir, int do_panic)
+swiotlb_full(struct device *dev, size_t size, enum dma_data_direction dir, int do_panic)
 {
 	/*
 	 * Ran out of IOMMU space for this operation. This is very bad.
@@ -525,7 +525,7 @@ swiotlb_full(struct device *dev, size_t 
  * either swiotlb_unmap_single or swiotlb_dma_sync_single is performed.
  */
 dma_addr_t
-swiotlb_map_single(struct device *hwdev, void *ptr, size_t size, int dir)
+swiotlb_map_single(struct device *hwdev, void *ptr, size_t size, enum dma_data_direction dir)
 {
 	unsigned long dev_addr = virt_to_phys(ptr);
 	void *map;
@@ -589,7 +589,7 @@ mark_clean(void *addr, size_t size)
  */
 void
 swiotlb_unmap_single(struct device *hwdev, dma_addr_t dev_addr, size_t size,
-		     int dir)
+		     enum dma_data_direction dir)
 {
 	char *dma_addr = phys_to_virt(dev_addr);
 
@@ -613,7 +613,7 @@ swiotlb_unmap_single(struct device *hwde
  */
 static inline void
 swiotlb_sync_single(struct device *hwdev, dma_addr_t dev_addr,
-		    size_t size, int dir, int target)
+		    size_t size, enum dma_data_direction dir, int target)
 {
 	char *dma_addr = phys_to_virt(dev_addr);
 
@@ -627,14 +627,14 @@ swiotlb_sync_single(struct device *hwdev
 
 void
 swiotlb_sync_single_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
-			    size_t size, int dir)
+			    size_t size, enum dma_data_direction dir)
 {
 	swiotlb_sync_single(hwdev, dev_addr, size, dir, SYNC_FOR_CPU);
 }
 
 void
 swiotlb_sync_single_for_device(struct device *hwdev, dma_addr_t dev_addr,
-			       size_t size, int dir)
+			       size_t size, enum dma_data_direction dir)
 {
 	swiotlb_sync_single(hwdev, dev_addr, size, dir, SYNC_FOR_DEVICE);
 }
@@ -645,7 +645,7 @@ swiotlb_sync_single_for_device(struct de
 static inline void
 swiotlb_sync_single_range(struct device *hwdev, dma_addr_t dev_addr,
 			  unsigned long offset, size_t size,
-			  int dir, int target)
+			  enum dma_data_direction dir, int target)
 {
 	char *dma_addr = phys_to_virt(dev_addr) + offset;
 
@@ -659,7 +659,8 @@ swiotlb_sync_single_range(struct device 
 
 void
 swiotlb_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dev_addr,
-				  unsigned long offset, size_t size, int dir)
+				  unsigned long offset, size_t size,
+				  enum dma_data_direction dir)
 {
 	swiotlb_sync_single_range(hwdev, dev_addr, offset, size, dir,
 				  SYNC_FOR_CPU);
@@ -667,7 +668,8 @@ swiotlb_sync_single_range_for_cpu(struct
 
 void
 swiotlb_sync_single_range_for_device(struct device *hwdev, dma_addr_t dev_addr,
-				     unsigned long offset, size_t size, int dir)
+				     unsigned long offset, size_t size,
+				     enum dma_data_direction dir)
 {
 	swiotlb_sync_single_range(hwdev, dev_addr, offset, size, dir,
 				  SYNC_FOR_DEVICE);
@@ -691,7 +693,7 @@ swiotlb_sync_single_range_for_device(str
  */
 int
 swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nelems,
-	       int dir)
+	       enum dma_data_direction dir)
 {
 	void *addr;
 	unsigned long dev_addr;
@@ -726,7 +728,7 @@ swiotlb_map_sg(struct device *hwdev, str
  */
 void
 swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nelems,
-		 int dir)
+		 enum dma_data_direction dir)
 {
 	int i;
 
@@ -749,7 +751,7 @@ swiotlb_unmap_sg(struct device *hwdev, s
  */
 static inline void
 swiotlb_sync_sg(struct device *hwdev, struct scatterlist *sg,
-		int nelems, int dir, int target)
+		int nelems, enum dma_data_direction dir, int target)
 {
 	int i;
 
@@ -764,14 +766,14 @@ swiotlb_sync_sg(struct device *hwdev, st
 
 void
 swiotlb_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
-			int nelems, int dir)
+			int nelems, enum dma_data_direction dir)
 {
 	swiotlb_sync_sg(hwdev, sg, nelems, dir, SYNC_FOR_CPU);
 }
 
 void
 swiotlb_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
-			   int nelems, int dir)
+			   int nelems, enum dma_data_direction dir)
 {
 	swiotlb_sync_sg(hwdev, sg, nelems, dir, SYNC_FOR_DEVICE);
 }
Signature · 7 lines
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/


-- 
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/
#2 lore raw

PATCH 3/3 move swiotlb header file into common code - IA64 bits

In reply to Muli Ben-Yehuda
 arch/ia64/hp/common/hwsw_iommu.c   |   23 +++++++++++++++--------
 arch/ia64/hp/common/sba_iommu.c    |   12 ++++++++----
 arch/ia64/kernel/machvec.c         |    6 ++++--
 arch/ia64/sn/pci/pci_dma.c         |   16 ++++++++--------
 arch/ia64/sn/pci/pcibr/pcibr_dma.c |    3 ++-
 arch/ia64/sn/pci/tioca_provider.c  |    3 ++-
 arch/ia64/sn/pci/tioce_provider.c  |    3 ++-
 include/asm-ia64/machvec.h         |   22 ++++++++++++----------
 8 files changed, 53 insertions(+), 35 deletions(-)

---

arch/ia64/hp/common/hwsw_iommu.c +15 -8
diff -Naurp --exclude-from /home/muli/w/dontdiff vanilla/arch/ia64/hp/common/hwsw_iommu.c dma_data_direction.hg/arch/ia64/hp/common/hwsw_iommu.c
@@ -98,7 +98,7 @@ hwsw_free_coherent (struct device *dev, 
 }
 
 dma_addr_t
-hwsw_map_single (struct device *dev, void *addr, size_t size, int dir)
+hwsw_map_single (struct device *dev, void *addr, size_t size, enum dma_data_direction dir)
 {
 	if (use_swiotlb(dev))
 		return swiotlb_map_single(dev, addr, size, dir);
@@ -107,7 +107,8 @@ hwsw_map_single (struct device *dev, voi
 }
 
 void
-hwsw_unmap_single (struct device *dev, dma_addr_t iova, size_t size, int dir)
+hwsw_unmap_single (struct device *dev, dma_addr_t iova, size_t size,
+		   enum dma_data_direction dir)
 {
 	if (use_swiotlb(dev))
 		return swiotlb_unmap_single(dev, iova, size, dir);
@@ -117,7 +118,8 @@ hwsw_unmap_single (struct device *dev, d
 
 
 int
-hwsw_map_sg (struct device *dev, struct scatterlist *sglist, int nents, int dir)
+hwsw_map_sg (struct device *dev, struct scatterlist *sglist, int nents,
+	     enum dma_data_direction dir)
 {
 	if (use_swiotlb(dev))
 		return swiotlb_map_sg(dev, sglist, nents, dir);
@@ -126,7 +128,8 @@ hwsw_map_sg (struct device *dev, struct 
 }
 
 void
-hwsw_unmap_sg (struct device *dev, struct scatterlist *sglist, int nents, int dir)
+hwsw_unmap_sg (struct device *dev, struct scatterlist *sglist, int nents,
+	       enum dma_data_direction dir)
 {
 	if (use_swiotlb(dev))
 		return swiotlb_unmap_sg(dev, sglist, nents, dir);
@@ -135,7 +138,8 @@ hwsw_unmap_sg (struct device *dev, struc
 }
 
 void
-hwsw_sync_single_for_cpu (struct device *dev, dma_addr_t addr, size_t size, int dir)
+hwsw_sync_single_for_cpu (struct device *dev, dma_addr_t addr, size_t size,
+			  enum dma_data_direction dir)
 {
 	if (use_swiotlb(dev))
 		swiotlb_sync_single_for_cpu(dev, addr, size, dir);
@@ -144,7 +148,8 @@ hwsw_sync_single_for_cpu (struct device 
 }
 
 void
-hwsw_sync_sg_for_cpu (struct device *dev, struct scatterlist *sg, int nelems, int dir)
+hwsw_sync_sg_for_cpu (struct device *dev, struct scatterlist *sg, int nelems,
+		      enum dma_data_direction dir)
 {
 	if (use_swiotlb(dev))
 		swiotlb_sync_sg_for_cpu(dev, sg, nelems, dir);
@@ -153,7 +158,8 @@ hwsw_sync_sg_for_cpu (struct device *dev
 }
 
 void
-hwsw_sync_single_for_device (struct device *dev, dma_addr_t addr, size_t size, int dir)
+hwsw_sync_single_for_device (struct device *dev, dma_addr_t addr, size_t size,
+			     enum dma_data_direction dir)
 {
 	if (use_swiotlb(dev))
 		swiotlb_sync_single_for_device(dev, addr, size, dir);
@@ -162,7 +168,8 @@ hwsw_sync_single_for_device (struct devi
 }
 
 void
-hwsw_sync_sg_for_device (struct device *dev, struct scatterlist *sg, int nelems, int dir)
+hwsw_sync_sg_for_device (struct device *dev, struct scatterlist *sg, int nelems,
+			 enum dma_data_direction dir)
 {
 	if (use_swiotlb(dev))
 		swiotlb_sync_sg_for_device(dev, sg, nelems, dir);
arch/ia64/hp/common/sba_iommu.c +8 -4
diff -Naurp --exclude-from /home/muli/w/dontdiff vanilla/arch/ia64/hp/common/sba_iommu.c dma_data_direction.hg/arch/ia64/hp/common/sba_iommu.c
@@ -884,7 +884,8 @@ sba_mark_invalid(struct ioc *ioc, dma_ad
  * See Documentation/DMA-mapping.txt
  */
 dma_addr_t
-sba_map_single(struct device *dev, void *addr, size_t size, int dir)
+sba_map_single(struct device *dev, void *addr, size_t size,
+	       enum dma_data_direction dir)
 {
 	struct ioc *ioc;
 	dma_addr_t iovp;
@@ -998,7 +999,8 @@ sba_mark_clean(struct ioc *ioc, dma_addr
  *
  * See Documentation/DMA-mapping.txt
  */
-void sba_unmap_single(struct device *dev, dma_addr_t iova, size_t size, int dir)
+void sba_unmap_single(struct device *dev, dma_addr_t iova, size_t size,
+		      enum dma_data_direction dir)
 {
 	struct ioc *ioc;
 #if DELAYED_RESOURCE_CNT > 0
@@ -1387,7 +1389,8 @@ sba_coalesce_chunks( struct ioc *ioc,
  *
  * See Documentation/DMA-mapping.txt
  */
-int sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents, int dir)
+int sba_map_sg(struct device *dev, struct scatterlist *sglist, int nents,
+	       enum dma_data_direction dir)
 {
 	struct ioc *ioc;
 	int coalesced, filled = 0;
@@ -1477,7 +1480,8 @@ int sba_map_sg(struct device *dev, struc
  *
  * See Documentation/DMA-mapping.txt
  */
-void sba_unmap_sg (struct device *dev, struct scatterlist *sglist, int nents, int dir)
+void sba_unmap_sg (struct device *dev, struct scatterlist *sglist, int nents,
+		   enum dma_data_direction dir)
 {
 #ifdef ASSERT_PDIR_SANITY
 	struct ioc *ioc;
arch/ia64/kernel/machvec.c +4 -2
diff -Naurp --exclude-from /home/muli/w/dontdiff vanilla/arch/ia64/kernel/machvec.c dma_data_direction.hg/arch/ia64/kernel/machvec.c
@@ -56,14 +56,16 @@ machvec_timer_interrupt (int irq, void *
 EXPORT_SYMBOL(machvec_timer_interrupt);
 
 void
-machvec_dma_sync_single (struct device *hwdev, dma_addr_t dma_handle, size_t size, int dir)
+machvec_dma_sync_single (struct device *hwdev, dma_addr_t dma_handle, size_t size,
+			 enum dma_data_direction dir)
 {
 	mb();
 }
 EXPORT_SYMBOL(machvec_dma_sync_single);
 
 void
-machvec_dma_sync_sg (struct device *hwdev, struct scatterlist *sg, int n, int dir)
+machvec_dma_sync_sg (struct device *hwdev, struct scatterlist *sg, int n,
+		     enum dma_data_direction dir)
 {
 	mb();
 }
arch/ia64/sn/pci/pcibr/pcibr_dma.c +2 -1
diff -Naurp --exclude-from /home/muli/w/dontdiff vanilla/arch/ia64/sn/pci/pcibr/pcibr_dma.c dma_data_direction.hg/arch/ia64/sn/pci/pcibr/pcibr_dma.c
@@ -179,7 +179,8 @@ pcibr_dmatrans_direct32(struct pcidev_in
  * DMA mappings for Direct 64 and 32 do not have any DMA maps.
  */
 void
-pcibr_dma_unmap(struct pci_dev *hwdev, dma_addr_t dma_handle, int direction)
+pcibr_dma_unmap(struct pci_dev *hwdev, dma_addr_t dma_handle,
+		enum dma_data_direction direction)
 {
 	struct pcidev_info *pcidev_info = SN_PCIDEV_INFO(hwdev);
 	struct pcibus_info *pcibus_info =
arch/ia64/sn/pci/pci_dma.c +8 -8
diff -Naurp --exclude-from /home/muli/w/dontdiff vanilla/arch/ia64/sn/pci/pci_dma.c dma_data_direction.hg/arch/ia64/sn/pci/pci_dma.c
@@ -166,7 +166,7 @@ EXPORT_SYMBOL(sn_dma_free_coherent);
  *       figure out how to save dmamap handle so can use two step.
  */
 dma_addr_t sn_dma_map_single(struct device *dev, void *cpu_addr, size_t size,
-			     int direction)
+			     enum dma_data_direction direction)
 {
 	dma_addr_t dma_addr;
 	unsigned long phys_addr;
@@ -197,7 +197,7 @@ EXPORT_SYMBOL(sn_dma_map_single);
  * coherent, so we just need to free any ATEs associated with this mapping.
  */
 void sn_dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
-			 int direction)
+			 enum dma_data_direction direction)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
 	struct sn_pcibus_provider *provider = SN_PCIDEV_BUSPROVIDER(pdev);
@@ -218,7 +218,7 @@ EXPORT_SYMBOL(sn_dma_unmap_single);
  * Unmap a set of streaming mode DMA translations.
  */
 void sn_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-		     int nhwentries, int direction)
+		     int nhwentries, enum dma_data_direction direction)
 {
 	int i;
 	struct pci_dev *pdev = to_pci_dev(dev);
@@ -244,7 +244,7 @@ EXPORT_SYMBOL(sn_dma_unmap_sg);
  * Maps each entry of @sg for DMA.
  */
 int sn_dma_map_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
-		  int direction)
+		  enum dma_data_direction direction)
 {
 	unsigned long phys_addr;
 	struct scatterlist *saved_sg = sg;
@@ -281,28 +281,28 @@ int sn_dma_map_sg(struct device *dev, st
 EXPORT_SYMBOL(sn_dma_map_sg);
 
 void sn_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
-				size_t size, int direction)
+				size_t size, enum dma_data_direction direction)
 {
 	BUG_ON(dev->bus != &pci_bus_type);
 }
 EXPORT_SYMBOL(sn_dma_sync_single_for_cpu);
 
 void sn_dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
-				   size_t size, int direction)
+				   size_t size, enum dma_data_direction direction)
 {
 	BUG_ON(dev->bus != &pci_bus_type);
 }
 EXPORT_SYMBOL(sn_dma_sync_single_for_device);
 
 void sn_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
-			    int nelems, int direction)
+			    int nelems, enum dma_data_direction direction)
 {
 	BUG_ON(dev->bus != &pci_bus_type);
 }
 EXPORT_SYMBOL(sn_dma_sync_sg_for_cpu);
 
 void sn_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			       int nelems, int direction)
+			       int nelems, enum dma_data_direction direction)
 {
 	BUG_ON(dev->bus != &pci_bus_type);
 }
arch/ia64/sn/pci/tioca_provider.c +2 -1
diff -Naurp --exclude-from /home/muli/w/dontdiff vanilla/arch/ia64/sn/pci/tioca_provider.c dma_data_direction.hg/arch/ia64/sn/pci/tioca_provider.c
@@ -465,7 +465,8 @@ map_return:
  * resources to release.
  */
 static void
-tioca_dma_unmap(struct pci_dev *pdev, dma_addr_t bus_addr, int dir)
+tioca_dma_unmap(struct pci_dev *pdev, dma_addr_t bus_addr,
+		enum dma_data_direction dir)
 {
 	int i, entry;
 	struct tioca_common *tioca_common;
arch/ia64/sn/pci/tioce_provider.c +2 -1
diff -Naurp --exclude-from /home/muli/w/dontdiff vanilla/arch/ia64/sn/pci/tioce_provider.c dma_data_direction.hg/arch/ia64/sn/pci/tioce_provider.c
@@ -323,7 +323,8 @@ tioce_dma_barrier(uint64_t bus_addr, int
  * to release.
  */
 void
-tioce_dma_unmap(struct pci_dev *pdev, dma_addr_t bus_addr, int dir)
+tioce_dma_unmap(struct pci_dev *pdev, dma_addr_t bus_addr,
+		enum dma_data_direction dir)
 {
 	int i;
 	int port;
include/asm-ia64/machvec.h +12 -10
diff -Naurp --exclude-from /home/muli/w/dontdiff vanilla/include/asm-ia64/machvec.h dma_data_direction.hg/include/asm-ia64/machvec.h
@@ -13,6 +13,8 @@
 #include <linux/config.h>
 #include <linux/types.h>
 
+#include <asm-generic/swiotlb.h>
+
 /* forward declarations: */
 struct device;
 struct pt_regs;
@@ -39,14 +41,14 @@ typedef int ia64_mv_pci_legacy_write_t (
 typedef void ia64_mv_dma_init (void);
 typedef void *ia64_mv_dma_alloc_coherent (struct device *, size_t, dma_addr_t *, gfp_t);
 typedef void ia64_mv_dma_free_coherent (struct device *, size_t, void *, dma_addr_t);
-typedef dma_addr_t ia64_mv_dma_map_single (struct device *, void *, size_t, int);
-typedef void ia64_mv_dma_unmap_single (struct device *, dma_addr_t, size_t, int);
-typedef int ia64_mv_dma_map_sg (struct device *, struct scatterlist *, int, int);
-typedef void ia64_mv_dma_unmap_sg (struct device *, struct scatterlist *, int, int);
-typedef void ia64_mv_dma_sync_single_for_cpu (struct device *, dma_addr_t, size_t, int);
-typedef void ia64_mv_dma_sync_sg_for_cpu (struct device *, struct scatterlist *, int, int);
-typedef void ia64_mv_dma_sync_single_for_device (struct device *, dma_addr_t, size_t, int);
-typedef void ia64_mv_dma_sync_sg_for_device (struct device *, struct scatterlist *, int, int);
+typedef dma_addr_t ia64_mv_dma_map_single (struct device *, void *, size_t, enum dma_data_direction);
+typedef void ia64_mv_dma_unmap_single (struct device *, dma_addr_t, size_t, enum dma_data_direction);
+typedef int ia64_mv_dma_map_sg (struct device *, struct scatterlist *, int, enum dma_data_direction);
+typedef void ia64_mv_dma_unmap_sg (struct device *, struct scatterlist *, int, enum dma_data_direction);
+typedef void ia64_mv_dma_sync_single_for_cpu (struct device *, dma_addr_t, size_t, enum dma_data_direction);
+typedef void ia64_mv_dma_sync_sg_for_cpu (struct device *, struct scatterlist *, int, enum dma_data_direction);
+typedef void ia64_mv_dma_sync_single_for_device (struct device *, dma_addr_t, size_t, enum dma_data_direction);
+typedef void ia64_mv_dma_sync_sg_for_device (struct device *, struct scatterlist *, int, enum dma_data_direction);
 typedef int ia64_mv_dma_mapping_error (dma_addr_t dma_addr);
 typedef int ia64_mv_dma_supported (struct device *, u64);
 
@@ -87,8 +89,8 @@ machvec_noop_mm (struct mm_struct *mm)
 
 extern void machvec_setup (char **);
 extern void machvec_timer_interrupt (int, void *, struct pt_regs *);
-extern void machvec_dma_sync_single (struct device *, dma_addr_t, size_t, int);
-extern void machvec_dma_sync_sg (struct device *, struct scatterlist *, int, int);
+extern void machvec_dma_sync_single (struct device *, dma_addr_t, size_t, enum dma_data_direction);
+extern void machvec_dma_sync_sg (struct device *, struct scatterlist *, int, enum dma_data_direction);
 extern void machvec_tlb_migrate_finish (struct mm_struct *);
 
 # if defined (CONFIG_IA64_HP_SIM)
Signature · 7 lines
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/


-- 
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/