Re: [PATCH linux-2.6 02/03] i386_and_x86_64: check broken_dac to i386 dma_supported()

From: Tejun Heo
Date: Wed Sep 28 2005 - 07:44:46 EST


02_i386_and_x86_64_add-broken-dac-check-to-i386.patch

check for broken_dac in i386 dma_supported() routine. This
disables 64-bit DMA for devices hanging off broken bridges.

Signed-off-by: Tejun Heo <htejun@xxxxxxxxx>

arch/i386/kernel/pci-dma.c | 22 ++++++++++++++++++++++
include/asm-i386/dma-mapping.h | 14 +-------------
2 files changed, 23 insertions(+), 13 deletions(-)

Index: linux-work/arch/i386/kernel/pci-dma.c
===================================================================
--- linux-work.orig/arch/i386/kernel/pci-dma.c 2005-09-28 21:41:46.000000000 +0900
+++ linux-work/arch/i386/kernel/pci-dma.c 2005-09-28 21:41:46.000000000 +0900
@@ -72,6 +72,28 @@ void dma_free_coherent(struct device *de
}
EXPORT_SYMBOL(dma_free_coherent);

+int dma_broken_dac(struct device *dev); /* arch/i386/kernel/quirks.c */
+
+int dma_supported(struct device *dev, u64 mask)
+{
+ /*
+ * we fall back to GFP_DMA when the mask isn't all 1s,
+ * so we can't guarantee allocations that must be
+ * within a tighter range than GFP_DMA..
+ */
+ if(mask < 0x00ffffff)
+ return 0;
+
+ /*
+ * Check if there is any bridge with broken DAC support
+ * between the device and memory.
+ */
+ if (mask > 0xffffffff && dma_broken_dac(dev))
+ return 0;
+
+ return 1;
+}
+
int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
dma_addr_t device_addr, size_t size, int flags)
{
Index: linux-work/include/asm-i386/dma-mapping.h
===================================================================
--- linux-work.orig/include/asm-i386/dma-mapping.h 2005-09-28 21:41:46.000000000 +0900
+++ linux-work/include/asm-i386/dma-mapping.h 2005-09-28 21:41:46.000000000 +0900
@@ -120,19 +120,7 @@ dma_mapping_error(dma_addr_t dma_addr)
return 0;
}

-static inline int
-dma_supported(struct device *dev, u64 mask)
-{
- /*
- * we fall back to GFP_DMA when the mask isn't all 1s,
- * so we can't guarantee allocations that must be
- * within a tighter range than GFP_DMA..
- */
- if(mask < 0x00ffffff)
- return 0;
-
- return 1;
-}
+int dma_supported(struct device *dev, u64 mask);

static inline int
dma_set_mask(struct device *dev, u64 mask)

-
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/