aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2007-07-09 14:55:51 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2007-07-11 19:02:11 -0400
commitcaa5171622c8fef70fa20d2d74f4326866039df9 (patch)
treeeee98d71a3d57db4fcadd6bcca2612b64c367083
parentb7b095c154c50ee753832bbf78e8690c492fc8f6 (diff)
PCI: remove pci_dac_dma_... APIs
Based on replies to a respective query, remove the pci_dac_dma_...() APIs (except for pci_dac_dma_supported() on Alpha, where this function is used in non-DAC PCI DMA code). Signed-off-by: Jan Beulich <jbeulich@novell.com> Cc: Andi Kleen <ak@suse.de> Cc: Jesse Barnes <jesse.barnes@intel.com> Cc: Christoph Hellwig <hch@infradead.org> Acked-by: David Miller <davem@davemloft.net> Cc: Jeff Garzik <jeff@garzik.org> Cc: <linux-arch@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--Documentation/DMA-mapping.txt103
-rw-r--r--arch/alpha/kernel/pci_iommu.c32
-rw-r--r--arch/mips/pci/Makefile2
-rw-r--r--arch/mips/pci/pci-dac.c79
-rw-r--r--arch/x86_64/kernel/pci-dma.c3
-rw-r--r--include/asm-alpha/pci.h24
-rw-r--r--include/asm-arm/pci.h5
-rw-r--r--include/asm-cris/pci.h32
-rw-r--r--include/asm-frv/pci.h3
-rw-r--r--include/asm-i386/pci.h33
-rw-r--r--include/asm-ia64/pci.h8
-rw-r--r--include/asm-m68knommu/pci.h6
-rw-r--r--include/asm-mips/pci.h14
-rw-r--r--include/asm-parisc/pci.h3
-rw-r--r--include/asm-powerpc/dma-mapping.h1
-rw-r--r--include/asm-powerpc/pci.h18
-rw-r--r--include/asm-ppc/pci.h6
-rw-r--r--include/asm-sh/pci.h5
-rw-r--r--include/asm-sh64/pci.h5
-rw-r--r--include/asm-sparc/pci.h2
-rw-r--r--include/asm-sparc64/pci.h43
-rw-r--r--include/asm-v850/rte_cb.h1
-rw-r--r--include/asm-x86_64/pci.h40
-rw-r--r--include/asm-xtensa/pci.h3
24 files changed, 7 insertions, 464 deletions
diff --git a/Documentation/DMA-mapping.txt b/Documentation/DMA-mapping.txt
index 028614cdd062..e07f2530326b 100644
--- a/Documentation/DMA-mapping.txt
+++ b/Documentation/DMA-mapping.txt
@@ -664,109 +664,6 @@ It is that simple.
664Well, not for some odd devices. See the next section for information 664Well, not for some odd devices. See the next section for information
665about that. 665about that.
666 666
667 DAC Addressing for Address Space Hungry Devices
668
669There exists a class of devices which do not mesh well with the PCI
670DMA mapping API. By definition these "mappings" are a finite
671resource. The number of total available mappings per bus is platform
672specific, but there will always be a reasonable amount.
673
674What is "reasonable"? Reasonable means that networking and block I/O
675devices need not worry about using too many mappings.
676
677As an example of a problematic device, consider compute cluster cards.
678They can potentially need to access gigabytes of memory at once via
679DMA. Dynamic mappings are unsuitable for this kind of access pattern.
680
681To this end we've provided a small API by which a device driver
682may use DAC cycles to directly address all of physical memory.
683Not all platforms support this, but most do. It is easy to determine
684whether the platform will work properly at probe time.
685
686First, understand that there may be a SEVERE performance penalty for
687using these interfaces on some platforms. Therefore, you MUST only
688use these interfaces if it is absolutely required. %99 of devices can
689use the normal APIs without any problems.
690
691Note that for streaming type mappings you must either use these
692interfaces, or the dynamic mapping interfaces above. You may not mix
693usage of both for the same device. Such an act is illegal and is
694guaranteed to put a banana in your tailpipe.
695
696However, consistent mappings may in fact be used in conjunction with
697these interfaces. Remember that, as defined, consistent mappings are
698always going to be SAC addressable.
699
700The first thing your driver needs to do is query the PCI platform
701layer if it is capable of handling your devices DAC addressing
702capabilities:
703
704 int pci_dac_dma_supported(struct pci_dev *hwdev, u64 mask);
705
706You may not use the following interfaces if this routine fails.
707
708Next, DMA addresses using this API are kept track of using the
709dma64_addr_t type. It is guaranteed to be big enough to hold any
710DAC address the platform layer will give to you from the following
711routines. If you have consistent mappings as well, you still
712use plain dma_addr_t to keep track of those.
713
714All mappings obtained here will be direct. The mappings are not
715translated, and this is the purpose of this dialect of the DMA API.
716
717All routines work with page/offset pairs. This is the _ONLY_ way to
718portably refer to any piece of memory. If you have a cpu pointer
719(which may be validly DMA'd too) you may easily obtain the page
720and offset using something like this:
721
722 struct page *page = virt_to_page(ptr);
723 unsigned long offset = offset_in_page(ptr);
724
725Here are the interfaces:
726
727 dma64_addr_t pci_dac_page_to_dma(struct pci_dev *pdev,
728 struct page *page,
729 unsigned long offset,
730 int direction);
731
732The DAC address for the tuple PAGE/OFFSET are returned. The direction
733argument is the same as for pci_{map,unmap}_single(). The same rules
734for cpu/device access apply here as for the streaming mapping
735interfaces. To reiterate:
736
737 The cpu may touch the buffer before pci_dac_page_to_dma.
738 The device may touch the buffer after pci_dac_page_to_dma
739 is made, but the cpu may NOT.
740
741When the DMA transfer is complete, invoke:
742
743 void pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev,
744 dma64_addr_t dma_addr,
745 size_t len, int direction);
746
747This must be done before the CPU looks at the buffer again.
748This interface behaves identically to pci_dma_sync_{single,sg}_for_cpu().
749
750And likewise, if you wish to let the device get back at the buffer after
751the cpu has read/written it, invoke:
752
753 void pci_dac_dma_sync_single_for_device(struct pci_dev *pdev,
754 dma64_addr_t dma_addr,
755 size_t len, int direction);
756
757before letting the device access the DMA area again.
758
759If you need to get back to the PAGE/OFFSET tuple from a dma64_addr_t
760the following interfaces are provided:
761
762 struct page *pci_dac_dma_to_page(struct pci_dev *pdev,
763 dma64_addr_t dma_addr);
764 unsigned long pci_dac_dma_to_offset(struct pci_dev *pdev,
765 dma64_addr_t dma_addr);
766
767This is possible with the DAC interfaces purely because they are
768not translated in any way.
769
770 Optimizing Unmap State Space Consumption 667 Optimizing Unmap State Space Consumption
771 668
772On many platforms, pci_unmap_{single,page}() is simply a nop. 669On many platforms, pci_unmap_{single,page}() is simply a nop.
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index 28c84e55feb9..6b07f89a72c7 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -207,6 +207,10 @@ iommu_arena_free(struct pci_iommu_arena *arena, long ofs, long n)
207 p[i] = 0; 207 p[i] = 0;
208} 208}
209 209
210/* True if the machine supports DAC addressing, and DEV can
211 make use of it given MASK. */
212static int pci_dac_dma_supported(struct pci_dev *hwdev, u64 mask);
213
210/* Map a single buffer of the indicated size for PCI DMA in streaming 214/* Map a single buffer of the indicated size for PCI DMA in streaming
211 mode. The 32-bit PCI bus mastering address to use is returned. 215 mode. The 32-bit PCI bus mastering address to use is returned.
212 Once the device is given the dma address, the device owns this memory 216 Once the device is given the dma address, the device owns this memory
@@ -897,7 +901,7 @@ iommu_unbind(struct pci_iommu_arena *arena, long pg_start, long pg_count)
897/* True if the machine supports DAC addressing, and DEV can 901/* True if the machine supports DAC addressing, and DEV can
898 make use of it given MASK. */ 902 make use of it given MASK. */
899 903
900int 904static int
901pci_dac_dma_supported(struct pci_dev *dev, u64 mask) 905pci_dac_dma_supported(struct pci_dev *dev, u64 mask)
902{ 906{
903 dma64_addr_t dac_offset = alpha_mv.pci_dac_offset; 907 dma64_addr_t dac_offset = alpha_mv.pci_dac_offset;
@@ -917,32 +921,6 @@ pci_dac_dma_supported(struct pci_dev *dev, u64 mask)
917 921
918 return ok; 922 return ok;
919} 923}
920EXPORT_SYMBOL(pci_dac_dma_supported);
921
922dma64_addr_t
923pci_dac_page_to_dma(struct pci_dev *pdev, struct page *page,
924 unsigned long offset, int direction)
925{
926 return (alpha_mv.pci_dac_offset
927 + __pa(page_address(page))
928 + (dma64_addr_t) offset);
929}
930EXPORT_SYMBOL(pci_dac_page_to_dma);
931
932struct page *
933pci_dac_dma_to_page(struct pci_dev *pdev, dma64_addr_t dma_addr)
934{
935 unsigned long paddr = (dma_addr & PAGE_MASK) - alpha_mv.pci_dac_offset;
936 return virt_to_page(__va(paddr));
937}
938EXPORT_SYMBOL(pci_dac_dma_to_page);
939
940unsigned long
941pci_dac_dma_to_offset(struct pci_dev *pdev, dma64_addr_t dma_addr)
942{
943 return (dma_addr & ~PAGE_MASK);
944}
945EXPORT_SYMBOL(pci_dac_dma_to_offset);
946 924
947/* Helper for generic DMA-mapping functions. */ 925/* Helper for generic DMA-mapping functions. */
948 926
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index f26ede001a0b..c58bd3d036f4 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the PCI specific kernel interface routines under Linux. 2# Makefile for the PCI specific kernel interface routines under Linux.
3# 3#
4 4
5obj-y += pci.o pci-dac.o 5obj-y += pci.o
6 6
7# 7#
8# PCI bus host bridge specific code 8# PCI bus host bridge specific code
diff --git a/arch/mips/pci/pci-dac.c b/arch/mips/pci/pci-dac.c
deleted file mode 100644
index 0f0ea1b7d4dd..000000000000
--- a/arch/mips/pci/pci-dac.c
+++ /dev/null
@@ -1,79 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2000 Ani Joshi <ajoshi@unixbox.com>
7 * Copyright (C) 2000, 2001, 06 Ralf Baechle <ralf@linux-mips.org>
8 * swiped from i386, and cloned for MIPS by Geert, polished by Ralf.
9 */
10
11#include <linux/types.h>
12#include <linux/dma-mapping.h>
13#include <linux/mm.h>
14#include <linux/module.h>
15#include <linux/string.h>
16
17#include <asm/cache.h>
18#include <asm/io.h>
19
20#include <dma-coherence.h>
21
22#include <linux/pci.h>
23
24dma64_addr_t pci_dac_page_to_dma(struct pci_dev *pdev,
25 struct page *page, unsigned long offset, int direction)
26{
27 struct device *dev = &pdev->dev;
28
29 BUG_ON(direction == DMA_NONE);
30
31 if (!plat_device_is_coherent(dev)) {
32 unsigned long addr;
33
34 addr = (unsigned long) page_address(page) + offset;
35 dma_cache_wback_inv(addr, PAGE_SIZE);
36 }
37
38 return plat_map_dma_mem_page(dev, page) + offset;
39}
40
41EXPORT_SYMBOL(pci_dac_page_to_dma);
42
43struct page *pci_dac_dma_to_page(struct pci_dev *pdev,
44 dma64_addr_t dma_addr)
45{
46 return pfn_to_page(plat_dma_addr_to_phys(dma_addr) >> PAGE_SHIFT);
47}
48
49EXPORT_SYMBOL(pci_dac_dma_to_page);
50
51unsigned long pci_dac_dma_to_offset(struct pci_dev *pdev,
52 dma64_addr_t dma_addr)
53{
54 return dma_addr & ~PAGE_MASK;
55}
56
57EXPORT_SYMBOL(pci_dac_dma_to_offset);
58
59void pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev,
60 dma64_addr_t dma_addr, size_t len, int direction)
61{
62 BUG_ON(direction == PCI_DMA_NONE);
63
64 if (!plat_device_is_coherent(&pdev->dev))
65 dma_cache_wback_inv(dma_addr + PAGE_OFFSET, len);
66}
67
68EXPORT_SYMBOL(pci_dac_dma_sync_single_for_cpu);
69
70void pci_dac_dma_sync_single_for_device(struct pci_dev *pdev,
71 dma64_addr_t dma_addr, size_t len, int direction)
72{
73 BUG_ON(direction == PCI_DMA_NONE);
74
75 if (!plat_device_is_coherent(&pdev->dev))
76 dma_cache_wback_inv(dma_addr + PAGE_OFFSET, len);
77}
78
79EXPORT_SYMBOL(pci_dac_dma_sync_single_for_device);
diff --git a/arch/x86_64/kernel/pci-dma.c b/arch/x86_64/kernel/pci-dma.c
index 9f80aad3fe2d..90f6315d02d4 100644
--- a/arch/x86_64/kernel/pci-dma.c
+++ b/arch/x86_64/kernel/pci-dma.c
@@ -22,8 +22,7 @@ EXPORT_SYMBOL(bad_dma_address);
22int iommu_bio_merge __read_mostly = 0; 22int iommu_bio_merge __read_mostly = 0;
23EXPORT_SYMBOL(iommu_bio_merge); 23EXPORT_SYMBOL(iommu_bio_merge);
24 24
25int iommu_sac_force __read_mostly = 0; 25static int iommu_sac_force __read_mostly = 0;
26EXPORT_SYMBOL(iommu_sac_force);
27 26
28int no_iommu __read_mostly; 27int no_iommu __read_mostly;
29#ifdef CONFIG_IOMMU_DEBUG 28#ifdef CONFIG_IOMMU_DEBUG
diff --git a/include/asm-alpha/pci.h b/include/asm-alpha/pci.h
index 635d6f2b0b03..30ee7669b19f 100644
--- a/include/asm-alpha/pci.h
+++ b/include/asm-alpha/pci.h
@@ -199,30 +199,6 @@ pci_dma_sync_sg_for_device(struct pci_dev *dev, struct scatterlist *sg,
199 199
200extern int pci_dma_supported(struct pci_dev *hwdev, u64 mask); 200extern int pci_dma_supported(struct pci_dev *hwdev, u64 mask);
201 201
202/* True if the machine supports DAC addressing, and DEV can
203 make use of it given MASK. */
204extern int pci_dac_dma_supported(struct pci_dev *hwdev, u64 mask);
205
206/* Convert to/from DAC dma address and struct page. */
207extern dma64_addr_t pci_dac_page_to_dma(struct pci_dev *, struct page *,
208 unsigned long, int);
209extern struct page *pci_dac_dma_to_page(struct pci_dev *, dma64_addr_t);
210extern unsigned long pci_dac_dma_to_offset(struct pci_dev *, dma64_addr_t);
211
212static inline void
213pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev, dma64_addr_t dma_addr,
214 size_t len, int direction)
215{
216 /* Nothing to do. */
217}
218
219static inline void
220pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, dma64_addr_t dma_addr,
221 size_t len, int direction)
222{
223 /* Nothing to do. */
224}
225
226#ifdef CONFIG_PCI 202#ifdef CONFIG_PCI
227static inline void pci_dma_burst_advice(struct pci_dev *pdev, 203static inline void pci_dma_burst_advice(struct pci_dev *pdev,
228 enum pci_dma_burst_strategy *strat, 204 enum pci_dma_burst_strategy *strat,
diff --git a/include/asm-arm/pci.h b/include/asm-arm/pci.h
index 9299a3c1ac37..ed3f898191f4 100644
--- a/include/asm-arm/pci.h
+++ b/include/asm-arm/pci.h
@@ -26,11 +26,6 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
26#define PCI_DMA_BUS_IS_PHYS (0) 26#define PCI_DMA_BUS_IS_PHYS (0)
27 27
28/* 28/*
29 * We don't support DAC DMA cycles.
30 */
31#define pci_dac_dma_supported(pci_dev, mask) (0)
32
33/*
34 * Whether pci_unmap_{single,page} is a nop depends upon the 29 * Whether pci_unmap_{single,page} is a nop depends upon the
35 * configuration. 30 * configuration.
36 */ 31 */
diff --git a/include/asm-cris/pci.h b/include/asm-cris/pci.h
index 5f1986ef7db1..730ce40fdd0f 100644
--- a/include/asm-cris/pci.h
+++ b/include/asm-cris/pci.h
@@ -52,38 +52,6 @@ struct pci_dev;
52#define pci_unmap_len(PTR, LEN_NAME) (0) 52#define pci_unmap_len(PTR, LEN_NAME) (0)
53#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) 53#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
54 54
55/* This is always fine. */
56#define pci_dac_dma_supported(pci_dev, mask) (1)
57
58static inline dma64_addr_t
59pci_dac_page_to_dma(struct pci_dev *pdev, struct page *page, unsigned long offset, int direction)
60{
61 return ((dma64_addr_t) page_to_phys(page) +
62 (dma64_addr_t) offset);
63}
64
65static inline struct page *
66pci_dac_dma_to_page(struct pci_dev *pdev, dma64_addr_t dma_addr)
67{
68 return pfn_to_page(dma_addr >> PAGE_SHIFT);
69}
70
71static inline unsigned long
72pci_dac_dma_to_offset(struct pci_dev *pdev, dma64_addr_t dma_addr)
73{
74 return (dma_addr & ~PAGE_MASK);
75}
76
77static inline void
78pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
79{
80}
81
82static inline void
83pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
84{
85}
86
87#define HAVE_PCI_MMAP 55#define HAVE_PCI_MMAP
88extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 56extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
89 enum pci_mmap_state mmap_state, int write_combine); 57 enum pci_mmap_state mmap_state, int write_combine);
diff --git a/include/asm-frv/pci.h b/include/asm-frv/pci.h
index 3aee08c5a44f..585d9b49949a 100644
--- a/include/asm-frv/pci.h
+++ b/include/asm-frv/pci.h
@@ -40,9 +40,6 @@ extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
40extern void pci_free_consistent(struct pci_dev *hwdev, size_t size, 40extern void pci_free_consistent(struct pci_dev *hwdev, size_t size,
41 void *vaddr, dma_addr_t dma_handle); 41 void *vaddr, dma_addr_t dma_handle);
42 42
43/* This is always fine. */
44#define pci_dac_dma_supported(pci_dev, mask) (1)
45
46/* Return the index of the PCI controller for device PDEV. */ 43/* Return the index of the PCI controller for device PDEV. */
47#define pci_controller_num(PDEV) (0) 44#define pci_controller_num(PDEV) (0)
48 45
diff --git a/include/asm-i386/pci.h b/include/asm-i386/pci.h
index b974bd8ce9c6..392d3fe5d45e 100644
--- a/include/asm-i386/pci.h
+++ b/include/asm-i386/pci.h
@@ -56,39 +56,6 @@ struct pci_dev;
56#define pci_unmap_len(PTR, LEN_NAME) (0) 56#define pci_unmap_len(PTR, LEN_NAME) (0)
57#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) 57#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
58 58
59/* This is always fine. */
60#define pci_dac_dma_supported(pci_dev, mask) (1)
61
62static inline dma64_addr_t
63pci_dac_page_to_dma(struct pci_dev *pdev, struct page *page, unsigned long offset, int direction)
64{
65 return ((dma64_addr_t) page_to_phys(page) +
66 (dma64_addr_t) offset);
67}
68
69static inline struct page *
70pci_dac_dma_to_page(struct pci_dev *pdev, dma64_addr_t dma_addr)
71{
72 return pfn_to_page(dma_addr >> PAGE_SHIFT);
73}
74
75static inline unsigned long
76pci_dac_dma_to_offset(struct pci_dev *pdev, dma64_addr_t dma_addr)
77{
78 return (dma_addr & ~PAGE_MASK);
79}
80
81static inline void
82pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
83{
84}
85
86static inline void
87pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
88{
89 flush_write_buffers();
90}
91
92#define HAVE_PCI_MMAP 59#define HAVE_PCI_MMAP
93extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, 60extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
94 enum pci_mmap_state mmap_state, int write_combine); 61 enum pci_mmap_state mmap_state, int write_combine);
diff --git a/include/asm-ia64/pci.h b/include/asm-ia64/pci.h
index 26b69280f6c7..3523d2584598 100644
--- a/include/asm-ia64/pci.h
+++ b/include/asm-ia64/pci.h
@@ -71,14 +71,6 @@ pcibios_penalize_isa_irq (int irq, int active)
71#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ 71#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
72 (((PTR)->LEN_NAME) = (VAL)) 72 (((PTR)->LEN_NAME) = (VAL))
73 73
74/* The ia64 platform always supports 64-bit addressing. */
75#define pci_dac_dma_supported(pci_dev, mask) (1)
76#define pci_dac_page_to_dma(dev,pg,off,dir) ((dma_addr_t) page_to_bus(pg) + (off))
77#define pci_dac_dma_to_page(dev,dma_addr) (virt_to_page(bus_to_virt(dma_addr)))
78#define pci_dac_dma_to_offset(dev,dma_addr) offset_in_page(dma_addr)
79#define pci_dac_dma_sync_single_for_cpu(dev,dma_addr,len,dir) do { } while (0)
80#define pci_dac_dma_sync_single_for_device(dev,dma_addr,len,dir) do { mb(); } while (0)
81
82#ifdef CONFIG_PCI 74#ifdef CONFIG_PCI
83static inline void pci_dma_burst_advice(struct pci_dev *pdev, 75static inline void pci_dma_burst_advice(struct pci_dev *pdev,
84 enum pci_dma_burst_strategy *strat, 76 enum pci_dma_burst_strategy *strat,
diff --git a/include/asm-m68knommu/pci.h b/include/asm-m68knommu/pci.h
index a99ce768f4a6..a13f3cc87451 100644
--- a/include/asm-m68knommu/pci.h
+++ b/include/asm-m68knommu/pci.h
@@ -24,12 +24,6 @@ static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask)
24 return 1; 24 return 1;
25} 25}
26 26
27/*
28 * Not supporting more than 32-bit PCI bus addresses now, but
29 * must satisfy references to this function. Change if needed.
30 */
31#define pci_dac_dma_supported(pci_dev, mask) (0)
32
33#endif /* CONFIG_COMEMPCI */ 27#endif /* CONFIG_COMEMPCI */
34 28
35#endif /* M68KNOMMU_PCI_H */ 29#endif /* M68KNOMMU_PCI_H */
diff --git a/include/asm-mips/pci.h b/include/asm-mips/pci.h
index 6e8c5540bd27..4fcc185cb2d1 100644
--- a/include/asm-mips/pci.h
+++ b/include/asm-mips/pci.h
@@ -121,20 +121,6 @@ extern unsigned int PCI_DMA_BUS_IS_PHYS;
121 121
122#endif /* CONFIG_DMA_NEED_PCI_MAP_STATE */ 122#endif /* CONFIG_DMA_NEED_PCI_MAP_STATE */
123 123
124/* This is always fine. */
125#define pci_dac_dma_supported(pci_dev, mask) (1)
126
127extern dma64_addr_t pci_dac_page_to_dma(struct pci_dev *pdev,
128 struct page *page, unsigned long offset, int direction);
129extern struct page *pci_dac_dma_to_page(struct pci_dev *pdev,
130 dma64_addr_t dma_addr);
131extern unsigned long pci_dac_dma_to_offset(struct pci_dev *pdev,
132 dma64_addr_t dma_addr);
133extern void pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev,
134 dma64_addr_t dma_addr, size_t len, int direction);
135extern void pci_dac_dma_sync_single_for_device(struct pci_dev *pdev,
136 dma64_addr_t dma_addr, size_t len, int direction);
137
138#ifdef CONFIG_PCI 124#ifdef CONFIG_PCI
139static inline void pci_dma_burst_advice(struct pci_dev *pdev, 125static inline void pci_dma_burst_advice(struct pci_dev *pdev,
140 enum pci_dma_burst_strategy *strat, 126 enum pci_dma_burst_strategy *strat,
diff --git a/include/asm-parisc/pci.h b/include/asm-parisc/pci.h
index c331d49e4584..61fbd57a8323 100644
--- a/include/asm-parisc/pci.h
+++ b/include/asm-parisc/pci.h
@@ -238,9 +238,6 @@ extern inline void pcibios_register_hba(struct pci_hba_data *x)
238#define PCIBIOS_MIN_IO 0x10 238#define PCIBIOS_MIN_IO 0x10
239#define PCIBIOS_MIN_MEM 0x1000 /* NBPG - but pci/setup-res.c dies */ 239#define PCIBIOS_MIN_MEM 0x1000 /* NBPG - but pci/setup-res.c dies */
240 240
241/* Don't support DAC yet. */
242#define pci_dac_dma_supported(pci_dev, mask) (0)
243
244/* export the pci_ DMA API in terms of the dma_ one */ 241/* export the pci_ DMA API in terms of the dma_ one */
245#include <asm-generic/pci-dma-compat.h> 242#include <asm-generic/pci-dma-compat.h>
246 243
diff --git a/include/asm-powerpc/dma-mapping.h b/include/asm-powerpc/dma-mapping.h
index a19a6f1a1cf1..f6bd804d9090 100644
--- a/include/asm-powerpc/dma-mapping.h
+++ b/include/asm-powerpc/dma-mapping.h
@@ -61,7 +61,6 @@ struct dma_mapping_ops {
61 void (*unmap_sg)(struct device *dev, struct scatterlist *sg, 61 void (*unmap_sg)(struct device *dev, struct scatterlist *sg,
62 int nents, enum dma_data_direction direction); 62 int nents, enum dma_data_direction direction);
63 int (*dma_supported)(struct device *dev, u64 mask); 63 int (*dma_supported)(struct device *dev, u64 mask);
64 int (*dac_dma_supported)(struct device *dev, u64 mask);
65 int (*set_dma_mask)(struct device *dev, u64 dma_mask); 64 int (*set_dma_mask)(struct device *dev, u64 dma_mask);
66}; 65};
67 66
diff --git a/include/asm-powerpc/pci.h b/include/asm-powerpc/pci.h
index b36a284bedf3..e16e7bc9ab5c 100644
--- a/include/asm-powerpc/pci.h
+++ b/include/asm-powerpc/pci.h
@@ -74,18 +74,6 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
74extern void set_pci_dma_ops(struct dma_mapping_ops *dma_ops); 74extern void set_pci_dma_ops(struct dma_mapping_ops *dma_ops);
75extern struct dma_mapping_ops *get_pci_dma_ops(void); 75extern struct dma_mapping_ops *get_pci_dma_ops(void);
76 76
77/* For DAC DMA, we currently don't support it by default, but
78 * we let 64-bit platforms override this.
79 */
80static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask)
81{
82 struct dma_mapping_ops *d = get_pci_dma_ops();
83
84 if (d && d->dac_dma_supported)
85 return d->dac_dma_supported(&hwdev->dev, mask);
86 return 0;
87}
88
89static inline void pci_dma_burst_advice(struct pci_dev *pdev, 77static inline void pci_dma_burst_advice(struct pci_dev *pdev,
90 enum pci_dma_burst_strategy *strat, 78 enum pci_dma_burst_strategy *strat,
91 unsigned long *strategy_parameter) 79 unsigned long *strategy_parameter)
@@ -124,12 +112,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
124} 112}
125#endif 113#endif
126 114
127/*
128 * At present there are very few 32-bit PPC machines that can have
129 * memory above the 4GB point, and we don't support that.
130 */
131#define pci_dac_dma_supported(pci_dev, mask) (0)
132
133/* Return the index of the PCI controller for device PDEV. */ 115/* Return the index of the PCI controller for device PDEV. */
134#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index 116#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
135 117
diff --git a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h
index 0a66a6f1059a..d2442cd72a59 100644
--- a/include/asm-ppc/pci.h
+++ b/include/asm-ppc/pci.h
@@ -102,12 +102,6 @@ static inline void pci_dma_burst_advice(struct pci_dev *pdev,
102} 102}
103#endif 103#endif
104 104
105/*
106 * At present there are very few 32-bit PPC machines that can have
107 * memory above the 4GB point, and we don't support that.
108 */
109#define pci_dac_dma_supported(pci_dev, mask) (0)
110
111/* Return the index of the PCI controller for device PDEV. */ 105/* Return the index of the PCI controller for device PDEV. */
112#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index 106#define pci_domain_nr(bus) ((struct pci_controller *)(bus)->sysdata)->index
113 107
diff --git a/include/asm-sh/pci.h b/include/asm-sh/pci.h
index 6f741f3a5d45..2757ce096ff7 100644
--- a/include/asm-sh/pci.h
+++ b/include/asm-sh/pci.h
@@ -110,11 +110,6 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
110#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) 110#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
111#endif 111#endif
112 112
113/* Not supporting more than 32-bit PCI bus addresses now, but
114 * must satisfy references to this function. Change if needed.
115 */
116#define pci_dac_dma_supported(pci_dev, mask) (0)
117
118#ifdef CONFIG_PCI 113#ifdef CONFIG_PCI
119static inline void pci_dma_burst_advice(struct pci_dev *pdev, 114static inline void pci_dma_burst_advice(struct pci_dev *pdev,
120 enum pci_dma_burst_strategy *strat, 115 enum pci_dma_burst_strategy *strat,
diff --git a/include/asm-sh64/pci.h b/include/asm-sh64/pci.h
index 0a2b2bd48b87..57a67cf7a5c4 100644
--- a/include/asm-sh64/pci.h
+++ b/include/asm-sh64/pci.h
@@ -72,11 +72,6 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
72#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) 72#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
73#endif 73#endif
74 74
75/* Not supporting more than 32-bit PCI bus addresses now, but
76 * must satisfy references to this function. Change if needed.
77 */
78#define pci_dac_dma_supported(pci_dev, mask) (0)
79
80/* These macros should be used after a pci_map_sg call has been done 75/* These macros should be used after a pci_map_sg call has been done
81 * to get bus addresses of each of the SG entries and their lengths. 76 * to get bus addresses of each of the SG entries and their lengths.
82 * You should only work with the number of sg entries pci_map_sg 77 * You should only work with the number of sg entries pci_map_sg
diff --git a/include/asm-sparc/pci.h b/include/asm-sparc/pci.h
index a1ff7acc7644..b93b6c79e08f 100644
--- a/include/asm-sparc/pci.h
+++ b/include/asm-sparc/pci.h
@@ -142,8 +142,6 @@ static inline int pci_dma_supported(struct pci_dev *hwdev, u64 mask)
142 return 1; 142 return 1;
143} 143}
144 144
145#define pci_dac_dma_supported(dev, mask) (0)
146
147#ifdef CONFIG_PCI 145#ifdef CONFIG_PCI
148static inline void pci_dma_burst_advice(struct pci_dev *pdev, 146static inline void pci_dma_burst_advice(struct pci_dev *pdev,
149 enum pci_dma_burst_strategy *strat, 147 enum pci_dma_burst_strategy *strat,
diff --git a/include/asm-sparc64/pci.h b/include/asm-sparc64/pci.h
index 202915d82759..e11ac100f043 100644
--- a/include/asm-sparc64/pci.h
+++ b/include/asm-sparc64/pci.h
@@ -206,49 +206,6 @@ extern int pci_dma_supported(struct pci_dev *hwdev, u64 mask);
206#define PCI64_REQUIRED_MASK (~(dma64_addr_t)0) 206#define PCI64_REQUIRED_MASK (~(dma64_addr_t)0)
207#define PCI64_ADDR_BASE 0xfffc000000000000UL 207#define PCI64_ADDR_BASE 0xfffc000000000000UL
208 208
209/* Usage of the pci_dac_foo interfaces is only valid if this
210 * test passes.
211 */
212#define pci_dac_dma_supported(pci_dev, mask) \
213 ((((mask) & PCI64_REQUIRED_MASK) == PCI64_REQUIRED_MASK) ? 1 : 0)
214
215static inline dma64_addr_t
216pci_dac_page_to_dma(struct pci_dev *pdev, struct page *page, unsigned long offset, int direction)
217{
218 return (PCI64_ADDR_BASE +
219 __pa(page_address(page)) + offset);
220}
221
222static inline struct page *
223pci_dac_dma_to_page(struct pci_dev *pdev, dma64_addr_t dma_addr)
224{
225 unsigned long paddr = (dma_addr & PAGE_MASK) - PCI64_ADDR_BASE;
226
227 return virt_to_page(__va(paddr));
228}
229
230static inline unsigned long
231pci_dac_dma_to_offset(struct pci_dev *pdev, dma64_addr_t dma_addr)
232{
233 return (dma_addr & ~PAGE_MASK);
234}
235
236static inline void
237pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
238{
239 /* DAC cycle addressing does not make use of the
240 * PCI controller's streaming cache, so nothing to do.
241 */
242}
243
244static inline void
245pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
246{
247 /* DAC cycle addressing does not make use of the
248 * PCI controller's streaming cache, so nothing to do.
249 */
250}
251
252#define PCI_DMA_ERROR_CODE (~(dma_addr_t)0x0) 209#define PCI_DMA_ERROR_CODE (~(dma_addr_t)0x0)
253 210
254static inline int pci_dma_mapping_error(dma_addr_t dma_addr) 211static inline int pci_dma_mapping_error(dma_addr_t dma_addr)
diff --git a/include/asm-v850/rte_cb.h b/include/asm-v850/rte_cb.h
index 9f7f02cb0391..e85d261b79bf 100644
--- a/include/asm-v850/rte_cb.h
+++ b/include/asm-v850/rte_cb.h
@@ -64,7 +64,6 @@
64/* As we don't really support PCI DMA to cpu memory, and use bounce-buffers 64/* As we don't really support PCI DMA to cpu memory, and use bounce-buffers
65 instead, perversely enough, this becomes always true! */ 65 instead, perversely enough, this becomes always true! */
66# define pci_dma_supported(dev, mask) 1 66# define pci_dma_supported(dev, mask) 1
67# define pci_dac_dma_supported(dev, mask) 0
68# define pcibios_assign_all_busses() 1 67# define pcibios_assign_all_busses() 1
69 68
70#endif /* CONFIG_RTE_MB_A_PCI */ 69#endif /* CONFIG_RTE_MB_A_PCI */
diff --git a/include/asm-x86_64/pci.h b/include/asm-x86_64/pci.h
index d95c9e78fe1d..bda94fd5176f 100644
--- a/include/asm-x86_64/pci.h
+++ b/include/asm-x86_64/pci.h
@@ -54,14 +54,6 @@ extern int iommu_setup(char *opt);
54 54
55#if defined(CONFIG_IOMMU) || defined(CONFIG_CALGARY_IOMMU) 55#if defined(CONFIG_IOMMU) || defined(CONFIG_CALGARY_IOMMU)
56 56
57/*
58 * x86-64 always supports DAC, but sometimes it is useful to force
59 * devices through the IOMMU to get automatic sg list merging.
60 * Optional right now.
61 */
62extern int iommu_sac_force;
63#define pci_dac_dma_supported(pci_dev, mask) (!iommu_sac_force)
64
65#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ 57#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
66 dma_addr_t ADDR_NAME; 58 dma_addr_t ADDR_NAME;
67#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \ 59#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
@@ -78,8 +70,6 @@ extern int iommu_sac_force;
78#else 70#else
79/* No IOMMU */ 71/* No IOMMU */
80 72
81#define pci_dac_dma_supported(pci_dev, mask) 1
82
83#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) 73#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
84#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) 74#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
85#define pci_unmap_addr(PTR, ADDR_NAME) (0) 75#define pci_unmap_addr(PTR, ADDR_NAME) (0)
@@ -91,36 +81,6 @@ extern int iommu_sac_force;
91 81
92#include <asm-generic/pci-dma-compat.h> 82#include <asm-generic/pci-dma-compat.h>
93 83
94static inline dma64_addr_t
95pci_dac_page_to_dma(struct pci_dev *pdev, struct page *page, unsigned long offset, int direction)
96{
97 return ((dma64_addr_t) page_to_phys(page) +
98 (dma64_addr_t) offset);
99}
100
101static inline struct page *
102pci_dac_dma_to_page(struct pci_dev *pdev, dma64_addr_t dma_addr)
103{
104 return virt_to_page(__va(dma_addr));
105}
106
107static inline unsigned long
108pci_dac_dma_to_offset(struct pci_dev *pdev, dma64_addr_t dma_addr)
109{
110 return (dma_addr & ~PAGE_MASK);
111}
112
113static inline void
114pci_dac_dma_sync_single_for_cpu(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
115{
116}
117
118static inline void
119pci_dac_dma_sync_single_for_device(struct pci_dev *pdev, dma64_addr_t dma_addr, size_t len, int direction)
120{
121 flush_write_buffers();
122}
123
124#ifdef CONFIG_PCI 84#ifdef CONFIG_PCI
125static inline void pci_dma_burst_advice(struct pci_dev *pdev, 85static inline void pci_dma_burst_advice(struct pci_dev *pdev,
126 enum pci_dma_burst_strategy *strat, 86 enum pci_dma_burst_strategy *strat,
diff --git a/include/asm-xtensa/pci.h b/include/asm-xtensa/pci.h
index 644411c8e0ca..66410acf18b4 100644
--- a/include/asm-xtensa/pci.h
+++ b/include/asm-xtensa/pci.h
@@ -64,9 +64,6 @@ struct pci_dev;
64#define pci_ubnmap_len(PTR, LEN_NAME) (0) 64#define pci_ubnmap_len(PTR, LEN_NAME) (0)
65#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) 65#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
66 66
67/* We cannot access memory above 4GB */
68#define pci_dac_dma_supported(pci_dev, mask) (0)
69
70/* Map a range of PCI memory or I/O space for a device into user space */ 67/* Map a range of PCI memory or I/O space for a device into user space */
71int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma, 68int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
72 enum pci_mmap_state mmap_state, int write_combine); 69 enum pci_mmap_state mmap_state, int write_combine);