From: David W. <dw...@in...> - 2001-08-10 17:20:19
|
dw...@in... said: > Next, of course, I'll need to make the PCI DMA code actually use > these functions as appropriate. Done. The new config option CONFIG_SH_PCIDMA_NONCOHERENT is hard-coded off for now, because there's no code yet for the boards which actually need it. Unless anybody objects, I'll commit this soon. Index: ChangeLog =================================================================== RCS file: /cvsroot/linuxsh/kernel/ChangeLog,v retrieving revision 1.324 diff -u -r1.324 ChangeLog --- ChangeLog 2001/08/10 14:13:13 1.324 +++ ChangeLog 2001/08/10 17:02:40 @@ -1,3 +1,10 @@ +2001-08-10 David Woodhouse <dw...@in...> + + * arch/sh/config.in: New CONFIG_SH_PCIDMA_NONCOHERENT option + * include/asm-sh/pci.h: Include cache management calls for the + case where the above option is set. + * arch/sh/kernel/sh_ksyms.c: include linux/pci.h not asm/pci.h + 2001-08-10 NIIBE Yutaka <gn...@m1...> * arch/sh/mm/cache-sh4.c (__flush_wback_region, Index: arch/sh/config.in =================================================================== RCS file: /cvsroot/linuxsh/kernel/arch/sh/config.in,v retrieving revision 1.55 diff -u -r1.55 config.in --- arch/sh/config.in 2001/07/30 13:02:58 1.55 +++ arch/sh/config.in 2001/08/10 17:02:40 @@ -174,6 +174,7 @@ if [ "$CONFIG_PCI_GODIRECT" = "y" -o "$CONFIG_PCI_GOANY" = "y" ]; then define_bool CONFIG_PCI_DIRECT y fi + define_bool CONFIG_SH_PCIDMA_NONCOHERENT n fi source drivers/pci/Config.in Index: include/asm-sh/pci.h =================================================================== RCS file: /cvsroot/linuxsh/kernel/include/asm-sh/pci.h,v retrieving revision 1.12 diff -u -r1.12 pci.h --- include/asm-sh/pci.h 2001/07/27 06:09:47 1.12 +++ include/asm-sh/pci.h 2001/08/10 17:02:40 @@ -3,6 +3,8 @@ #ifdef __KERNEL__ +#include <linux/config.h> + /* Can be used to override the logic in pci_scan_bus for skipping already-configured bus numbers - to be used for buggy BIOSes or architectures with incomplete PCI setup by the loader */ @@ -76,9 +78,14 @@ * until either pci_unmap_single or pci_dma_sync_single is performed. */ static inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, - size_t size,int directoin) + size_t size, int direction) { - flush_cache_all(); + if (direction == PCI_DMA_NONE) + BUG(); + +#ifdef CONFIG_SH_PCIDMA_NONCOHERENT + dma_cache_wback_inv(ptr, size); +#endif return virt_to_bus(ptr); } @@ -111,9 +118,17 @@ * the same here. */ static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, - int nents,int direction) + int nents, int direction) { - flush_cache_all(); +#ifdef CONFIG_SH_PCIDMA_NONCOHERENT + int i; + + for (i=0; i<nents; i++) + dma_cache_wback_inv(sg[i].address, sg[i].length); +#endif + if (direction == PCI_DMA_NONE) + BUG(); + return nents; } @@ -122,7 +137,7 @@ * pci_unmap_single() above. */ static inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, - int nents,int direction) + int nents, int direction) { /* Nothing to do */ } @@ -138,9 +153,15 @@ */ static inline void pci_dma_sync_single(struct pci_dev *hwdev, dma_addr_t dma_handle, - size_t size,int direction) + size_t size, int direction) { - /* Nothing to do */ + if (direction == PCI_DMA_NONE) + BUG(); + +#ifdef CONFIG_SH_PCIDMA_NONCOHERENT + dma_cache_wback_inv(bus_to_virt(dma_handle), size); +#endif + } /* Make physical memory consistent for a set of streaming @@ -151,9 +172,17 @@ */ static inline void pci_dma_sync_sg(struct pci_dev *hwdev, struct scatterlist *sg, - int nelems,int direction) + int nelems, int direction) { - /* Nothing to do */ + if (direction == PCI_DMA_NONE) + BUG(); + +#ifdef CONFIG_SH_PCIDMA_NONCOHERENT + int i; + + for (i=0; i<nelems; i++) + dma_cache_wback_inv(sg[i].address, sg[i].length); +#endif } Index: arch/sh/kernel/sh_ksyms.c =================================================================== RCS file: /cvsroot/linuxsh/kernel/arch/sh/kernel/sh_ksyms.c,v retrieving revision 1.18 diff -u -r1.18 sh_ksyms.c --- arch/sh/kernel/sh_ksyms.c 2001/05/28 10:34:17 1.18 +++ arch/sh/kernel/sh_ksyms.c 2001/08/10 17:02:40 @@ -9,6 +9,7 @@ #include <linux/interrupt.h> #include <linux/smp_lock.h> #include <linux/vmalloc.h> +#include <linux/pci.h> #include <asm/semaphore.h> #include <asm/processor.h> @@ -18,7 +19,6 @@ #include <asm/hardirq.h> #include <asm/delay.h> #include <asm/pgalloc.h> -#include <asm/pci.h> #include <linux/irq.h> extern void dump_thread(struct pt_regs *, struct user *); -- dwmw2 |