Skip to contentSkip to conversation

scsi_to_dma_dir

PATCH New Marc Zyngier 1 participant 1 message Apr 25, 2003 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi_to_dma_dir

James,

Christoph suggested that I send you the following patch, rather than having it in the aha1740 driver... It adds scsi_to_dma_dir, similar to scsi_to_{sbus,pci}_dir.

It is conditionnaly defined on CONFIG_EISA or CONFIG_MCA, because most non-PCI archs are still including asm-generic/dma-mapping.h and its bunch of PCI functions...

Patch is against 2.5.68.

Thanks,

        M.

===== drivers/scsi/scsi.h 1.73 vs edited =====

drivers/scsi/scsi.h +26 -0
@@ -67,6 +67,32 @@
 #endif
 #endif
 
+#if defined(CONFIG_EISA) || defined(CONFIG_MCA)
+/*
+ * XXX FIXME :
+ *  
+ * We should be able to have this unconditionnaly
+ * defined. Unfortunately, most non-PCI architectures are still
+ * including asm-generic/dma-mapping.h, which has lots of references
+ * to PCI functions...
+ */
+#include <linux/dma-mapping.h>
+#if ((SCSI_DATA_UNKNOWN == DMA_BIDIRECTIONAL) && (SCSI_DATA_WRITE == DMA_TO_DEVICE) && (SCSI_DATA_READ == DMA_FROM_DEVICE) && (SCSI_DATA_NONE == DMA_NONE))
+#define scsi_to_dma_dir(scsi_dir)   ((enum dma_data_direction)(scsi_dir))
+#else
+extern __inline__ enum dma_data_direction scsi_to_dma_dir(unsigned char scsi_dir)
+{
+        if (scsi_dir == SCSI_DATA_UNKNOWN)
+                return DMA_BIDIRECTIONAL;
+        if (scsi_dir == SCSI_DATA_WRITE)
+                return DMA_TO_DEVICE;
+        if (scsi_dir == SCSI_DATA_READ)
+                return DMA_FROM_DEVICE;
+        return DMA_NONE;
+}
+#endif
+#endif
+
 /*
  * Some defs, in case these are not defined elsewhere.
  */
Signature · 1 line
Places change, faces change. Life is so very strange.