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

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: linux-kernel <linux-kernel@...>
Cc: <vojtech@...>, <muli@...>, <jdmason@...>, <tglx@...>, <mingo@...>
Date: Wednesday, April 23, 2008 - 2:55 pm

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@bu3sch.de>

---

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.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH RFC] x86: Fix 64-bit DMA masks on VIA, Michael Buesch, (Wed Apr 23, 2:55 pm)
Re: [PATCH RFC] x86: Fix 64-bit DMA masks on VIA, Andi Kleen, (Thu Apr 24, 9:43 am)
Re: [PATCH RFC] x86: Fix 64-bit DMA masks on VIA, Michael Buesch, (Thu Apr 24, 10:06 am)
Re: [PATCH RFC] x86: Fix 64-bit DMA masks on VIA, Alan Cox, (Thu Apr 24, 10:32 am)
Re: [PATCH RFC] x86: Fix 64-bit DMA masks on VIA, Ingo Molnar, (Mon Apr 28, 12:53 pm)
Re: [PATCH RFC] x86: Fix 64-bit DMA masks on VIA, Jesse Barnes, (Mon Apr 28, 1:04 pm)
Re: [PATCH RFC] x86: Fix 64-bit DMA masks on VIA, Michael Buesch, (Mon Apr 28, 5:48 pm)
Re: [PATCH RFC] x86: Fix 64-bit DMA masks on VIA, Michael Buesch, (Thu Apr 24, 11:19 am)
Re: [PATCH RFC] x86: Fix 64-bit DMA masks on VIA, David Miller, (Thu Apr 24, 10:18 am)
Re: [PATCH RFC] x86: Fix 64-bit DMA masks on VIA, Andi Kleen, (Thu Apr 24, 10:12 am)