[PATCH RFC] x86: Fix 64-bit DMA masks on VIA

From: Michael Buesch
Date: Wed Apr 23 2008 - 14:57:13 EST


This untested patch is supposed to fix DMAing on some VIA boards.
Currently the DMA subsystem returns an error, if the driver does
tell that it supports a 64bit DMA mask. So the driver probing
would fail in that case. This happens for some b43 cards with
64bit DMA engines on VIA boards.
Instead of failing the dma_supported() check, simply strip off the
high 32bits.

Signed-off-by: Michael Buesch <mb@xxxxxxxxx>

---

This is not tested, due to the lack of hardware.


Index: wireless-testing/arch/x86/kernel/pci-dma_64.c
===================================================================
--- wireless-testing.orig/arch/x86/kernel/pci-dma_64.c 2008-04-01 15:53:17.000000000 +0200
+++ wireless-testing/arch/x86/kernel/pci-dma_64.c 2008-04-23 20:49:42.000000000 +0200
@@ -173,11 +173,8 @@ int dma_supported(struct device *dev, u6
{
#ifdef CONFIG_PCI
if (mask > 0xffffffff && forbid_dac > 0) {
-
-
-
printk(KERN_INFO "PCI: Disallowing DAC for device %s\n", dev->bus_id);
- return 0;
+ /* We strip off the high 32 bits in dma_set_mask() */
}
#endif

@@ -215,6 +212,10 @@ int dma_set_mask(struct device *dev, u64
{
if (!dev->dma_mask || !dma_supported(dev, mask))
return -EIO;
+
+ if (forbid_dac > 0)
+ mask &= 0xffffffff;
+
*dev->dma_mask = mask;
return 0;
}
Index: wireless-testing/include/asm-x86/dma-mapping_32.h
===================================================================
--- wireless-testing.orig/include/asm-x86/dma-mapping_32.h 2008-02-16 19:08:15.000000000 +0100
+++ wireless-testing/include/asm-x86/dma-mapping_32.h 2008-04-23 20:46:12.000000000 +0200
@@ -137,10 +137,6 @@ dma_supported(struct device *dev, u64 ma
if(mask < 0x00ffffff)
return 0;

- /* Work around chipset bugs */
- if (forbid_dac > 0 && mask > 0xffffffffULL)
- return 0;
-
return 1;
}

@@ -150,6 +146,10 @@ dma_set_mask(struct device *dev, u64 mas
if(!dev->dma_mask || !dma_supported(dev, mask))
return -EIO;

+ /* Work around chipset bugs */
+ if (forbid_dac > 0)
+ mask &= 0xffffffffULL;
+
*dev->dma_mask = mask;

return 0;

--
Greetings Michael.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/