FRV PCI DMA fixes
PATCH 1/1 FRV PCI DMA fixes
The attached patch makes cache flushing work correctly on DMA consistent memory for the frv arch. On the FRV unmapped memory can't be flushed directly, but has to be kmapped first since the flush instructions take virtual pointers not physical ones.
It also splits the MMU and !MMU versions into separate files.
Signed-off-by David Howells <[email protected]>
---
warthog>diffstat pci-dma-2610rc2mm3.diff
arch/frv/mb93090-mb00/Makefile | 10 ++ arch/frv/mb93090-mb00/pci-dma-nommu.c | 152 ++++++++++++++++++++++++++++++++++ arch/frv/mb93090-mb00/pci-dma.c | 143 +++++++++++++------------------ include/asm-frv/dma-mapping.h | 38 +------- 4 files changed, 229 insertions(+), 114 deletions(-)
arch/frv/mb93090-mb00/Makefile renamed from warthog/kernels/linux-2.6.10-rc2-mm3/arch/frv/mb93090-mb00/Makefile +9 -1
@@ -2,4 +2,12 @@ # Makefile for the MB93090-MB00 motherboard stuff # -obj-$(CONFIG_PCI) := pci-frv.o pci-dma.o pci-irq.o pci-vdk.o +ifeq "$(CONFIG_PCI)" "y" +obj-y := pci-frv.o pci-irq.o pci-vdk.o + +ifeq "$(CONFIG_MMU)" "y" +obj-y += pci-dma.o +else +obj-y += pci-dma-nommu.o +endif +endif
arch/frv/mb93090-mb00/pci-dma.c renamed from warthog/kernels/linux-2.6.10-rc2-mm3/arch/frv/mb93090-mb00/pci-dma.c +62 -81
175 lines not on this page · raw message
arch/frv/mb93090-mb00/pci-dma-nommu.c renamed from warthog/kernels/linux-2.6.10-rc2-mm3/arch/frv/mb93090-mb00/pci-dma-nommu.c +152 -0
152 lines not on this page · raw message
include/asm-frv/dma-mapping.h renamed from warthog/kernels/linux-2.6.10-rc2-mm3/include/asm-frv/dma-mapping.h +6 -32
@@ -33,17 +33,8 @@* Once the device is given the dma address, the device owns this memory * until either pci_unmap_single or pci_dma_sync_single is performed. */ -static inline -dma_addr_t dma_map_single (struct device *dev,void *ptr,size_t size, -enum dma_data_direction direction) -{ -if (direction ==DMA_NONE ) -BUG (); - -frv_cache_wback_inv ((unsigned long ) ptr, (unsigned long ) ptr + size); - -return virt_to_bus (ptr); -} +extern dma_addr_t dma_map_single (struct device *dev,void *ptr,size_t size, +enum dma_data_direction direction);/* * Unmap a single streaming mode DMA translation. The dma_addr and size
@@ -76,21 +67,8 @@* Device ownership issues as mentioned above for pci_map_single are * the same here. */ -static inline -int dma_map_sg (struct device *dev,struct scatterlist *sg,int nents, -enum dma_data_direction direction) -{ -int i; - -for (i=0 ; i<nents; i++) -frv_cache_wback_inv (sg_dma_address (&sg[i]), -sg_dma_address (&sg[i]) +sg_dma_len (&sg[i])); - -if (direction ==DMA_NONE ) -BUG (); - -return nents; -} +extern int dma_map_sg (struct device *dev,struct scatterlist *sg,int nents, +enum dma_data_direction direction);/* * Unmap a set of streaming mode DMA translations.
@@ -104,13 +82,9 @@BUG_ON (direction ==DMA_NONE ); } -static inline +extern dma_addr_t dma_map_page (struct device *dev,struct page *page,unsigned long offset, -size_t size,enum dma_data_direction direction) -{ -BUG_ON (direction ==DMA_NONE ); -return (dma_addr_t)(page_to_pfn (page)) *PAGE_SIZE + offset; -} +size_t size,enum dma_data_direction direction); static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,