Problems with dma_alloc_coherent()

John Whitney jwhitney-linuxppc at sands-edge.com
Fri Apr 2 02:30:14 EST 2004


Whoops.  I accidentally had some previous changes in the patch I
submitted.  Here is the cleaned up version.

--- dma-mapping.h.orig	2004-04-01 10:38:33.000000000 -0500
+++ dma-mapping.h	2004-04-01 11:27:44.000000000 -0500
@@ -35,7 +35,18 @@
  		return pci_alloc_consistent(to_pci_dev(dev), size, dma_handle);
  #endif

+#ifdef CONFIG_NOT_COHERENT_CACHE
  	return consistent_alloc(flag, size, dma_handle);
+#else
+	void *ret;
+
+	ret = (void *)__get_free_pages(flag, get_order(size));
+	if (ret != NULL) {
+		*dma_handle = virt_to_bus(ret);
+	}
+
+    return ret;
+#endif /* CONFIG_NOT_COHERENT_CACHE */
  }

  static inline void
@@ -49,7 +60,11 @@
  	}
  #endif

+#ifdef CONFIG_NOT_COHERENT_CACHE
  	consistent_free(vaddr);
+#else
+	free_pages((unsigned long)vaddr, get_order(size));
+#endif
  }

  static inline dma_addr_t


-------------- next part --------------
A non-text attachment was scrubbed...
Name: dma-mapping.h.patch
Type: application/octet-stream
Size: 705 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20040401/a63a1951/attachment.obj>


More information about the Linuxppc-dev mailing list