aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/asm-powerpc/pci.h33
-rw-r--r--include/asm-ppc/pci.h23
2 files changed, 45 insertions, 11 deletions
diff --git a/include/asm-powerpc/pci.h b/include/asm-powerpc/pci.h
index 16f13319c769..ac656ee6bb19 100644
--- a/include/asm-powerpc/pci.h
+++ b/include/asm-powerpc/pci.h
@@ -143,8 +143,13 @@ int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
143/* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */ 143/* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */
144#define HAVE_PCI_MMAP 1 144#define HAVE_PCI_MMAP 1
145 145
146#ifdef CONFIG_PPC64 146#if defined(CONFIG_PPC64) || defined(CONFIG_NOT_COHERENT_CACHE)
147/* pci_unmap_{single,page} is not a nop, thus... */ 147/*
148 * For 64-bit kernels, pci_unmap_{single,page} is not a nop.
149 * For 32-bit non-coherent kernels, pci_dma_sync_single_for_cpu() and
150 * so on are not nops.
151 * and thus...
152 */
148#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ 153#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
149 dma_addr_t ADDR_NAME; 154 dma_addr_t ADDR_NAME;
150#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \ 155#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
@@ -158,6 +163,20 @@ int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
158#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ 163#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
159 (((PTR)->LEN_NAME) = (VAL)) 164 (((PTR)->LEN_NAME) = (VAL))
160 165
166#else /* 32-bit && coherent */
167
168/* pci_unmap_{page,single} is a nop so... */
169#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
170#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
171#define pci_unmap_addr(PTR, ADDR_NAME) (0)
172#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
173#define pci_unmap_len(PTR, LEN_NAME) (0)
174#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
175
176#endif /* CONFIG_PPC64 || CONFIG_NOT_COHERENT_CACHE */
177
178#ifdef CONFIG_PPC64
179
161/* The PCI address space does not equal the physical memory address 180/* The PCI address space does not equal the physical memory address
162 * space (we have an IOMMU). The IDE and SCSI device layers use 181 * space (we have an IOMMU). The IDE and SCSI device layers use
163 * this boolean for bounce buffer decisions. 182 * this boolean for bounce buffer decisions.
@@ -172,16 +191,8 @@ int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
172 */ 191 */
173#define PCI_DMA_BUS_IS_PHYS (1) 192#define PCI_DMA_BUS_IS_PHYS (1)
174 193
175/* pci_unmap_{page,single} is a nop so... */
176#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
177#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
178#define pci_unmap_addr(PTR, ADDR_NAME) (0)
179#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
180#define pci_unmap_len(PTR, LEN_NAME) (0)
181#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
182
183#endif /* CONFIG_PPC64 */ 194#endif /* CONFIG_PPC64 */
184 195
185extern void pcibios_resource_to_bus(struct pci_dev *dev, 196extern void pcibios_resource_to_bus(struct pci_dev *dev,
186 struct pci_bus_region *region, 197 struct pci_bus_region *region,
187 struct resource *res); 198 struct resource *res);
diff --git a/include/asm-ppc/pci.h b/include/asm-ppc/pci.h
index 11ffaaa5da16..9d162028dab9 100644
--- a/include/asm-ppc/pci.h
+++ b/include/asm-ppc/pci.h
@@ -61,6 +61,27 @@ extern unsigned long pci_bus_to_phys(unsigned int ba, int busnr);
61 */ 61 */
62#define PCI_DMA_BUS_IS_PHYS (1) 62#define PCI_DMA_BUS_IS_PHYS (1)
63 63
64#ifdef CONFIG_NOT_COHERENT_CACHE
65/*
66 * pci_unmap_{page,single} are NOPs but pci_dma_sync_single_for_cpu()
67 * and so on are not, so...
68 */
69
70#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
71 dma_addr_t ADDR_NAME;
72#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
73 __u32 LEN_NAME;
74#define pci_unmap_addr(PTR, ADDR_NAME) \
75 ((PTR)->ADDR_NAME)
76#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) \
77 (((PTR)->ADDR_NAME) = (VAL))
78#define pci_unmap_len(PTR, LEN_NAME) \
79 ((PTR)->LEN_NAME)
80#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
81 (((PTR)->LEN_NAME) = (VAL))
82
83#else /* coherent */
84
64/* pci_unmap_{page,single} is a nop so... */ 85/* pci_unmap_{page,single} is a nop so... */
65#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) 86#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
66#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) 87#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
@@ -69,6 +90,8 @@ extern unsigned long pci_bus_to_phys(unsigned int ba, int busnr);
69#define pci_unmap_len(PTR, LEN_NAME) (0) 90#define pci_unmap_len(PTR, LEN_NAME) (0)
70#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) 91#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
71 92
93#endif /* CONFIG_NOT_COHERENT_CACHE */
94
72#ifdef CONFIG_PCI 95#ifdef CONFIG_PCI
73static inline void pci_dma_burst_advice(struct pci_dev *pdev, 96static inline void pci_dma_burst_advice(struct pci_dev *pdev,
74 enum pci_dma_burst_strategy *strat, 97 enum pci_dma_burst_strategy *strat,