Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / arch / ia64 / hp / common / hwsw_iommu.c
index 80f8ef0..a5a5637 100644 (file)
@@ -17,7 +17,7 @@
 #include <asm/machvec.h>
 
 /* swiotlb declarations & definitions: */
-extern void swiotlb_init_with_default_size (size_t size);
+extern int swiotlb_late_init_with_default_size (size_t size);
 extern ia64_mv_dma_alloc_coherent      swiotlb_alloc_coherent;
 extern ia64_mv_dma_free_coherent       swiotlb_free_coherent;
 extern ia64_mv_dma_map_single          swiotlb_map_single;
@@ -67,11 +67,20 @@ void
 hwsw_init (void)
 {
        /* default to a smallish 2MB sw I/O TLB */
-       swiotlb_init_with_default_size (2 * (1<<20));
+       if (swiotlb_late_init_with_default_size (2 * (1<<20)) != 0) {
+#ifdef CONFIG_IA64_GENERIC
+               /* Better to have normal DMA than panic */
+               printk(KERN_WARNING "%s: Failed to initialize software I/O TLB,"
+                      " reverting to hpzx1 platform vector\n", __FUNCTION__);
+               machvec_init("hpzx1");
+#else
+               panic("Unable to initialize software I/O TLB services");
+#endif
+       }
 }
 
 void *
-hwsw_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, int flags)
+hwsw_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flags)
 {
        if (use_swiotlb(dev))
                return swiotlb_alloc_coherent(dev, size, dma_handle, flags);