aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-powerpc/pci.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/asm-powerpc/pci.h')
-rw-r--r--include/asm-powerpc/pci.h63
1 files changed, 34 insertions, 29 deletions
diff --git a/include/asm-powerpc/pci.h b/include/asm-powerpc/pci.h
index 46afd29b904e..ac656ee6bb19 100644
--- a/include/asm-powerpc/pci.h
+++ b/include/asm-powerpc/pci.h
@@ -62,29 +62,23 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
62} 62}
63 63
64#ifdef CONFIG_PPC64 64#ifdef CONFIG_PPC64
65#define HAVE_ARCH_PCI_MWI 1
66static inline int pcibios_prep_mwi(struct pci_dev *dev)
67{
68 /*
69 * We would like to avoid touching the cacheline size or MWI bit
70 * but we cant do that with the current pcibios_prep_mwi
71 * interface. pSeries firmware sets the cacheline size (which is not
72 * the cpu cacheline size in all cases) and hardware treats MWI
73 * the same as memory write. So we dont touch the cacheline size
74 * here and allow the generic code to set the MWI bit.
75 */
76 return 0;
77}
78 65
79extern struct dma_mapping_ops pci_dma_ops; 66/*
67 * We want to avoid touching the cacheline size or MWI bit.
68 * pSeries firmware sets the cacheline size (which is not the cpu cacheline
69 * size in all cases) and hardware treats MWI the same as memory write.
70 */
71#define PCI_DISABLE_MWI
72
73extern struct dma_mapping_ops *pci_dma_ops;
80 74
81/* For DAC DMA, we currently don't support it by default, but 75/* For DAC DMA, we currently don't support it by default, but
82 * we let 64-bit platforms override this. 76 * we let 64-bit platforms override this.
83 */ 77 */
84static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask) 78static inline int pci_dac_dma_supported(struct pci_dev *hwdev,u64 mask)
85{ 79{
86 if (pci_dma_ops.dac_dma_supported) 80 if (pci_dma_ops && pci_dma_ops->dac_dma_supported)
87 return pci_dma_ops.dac_dma_supported(&hwdev->dev, mask); 81 return pci_dma_ops->dac_dma_supported(&hwdev->dev, mask);
88 return 0; 82 return 0;
89} 83}
90 84
@@ -149,8 +143,13 @@ int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
149/* 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() */
150#define HAVE_PCI_MMAP 1 144#define HAVE_PCI_MMAP 1
151 145
152#ifdef CONFIG_PPC64 146#if defined(CONFIG_PPC64) || defined(CONFIG_NOT_COHERENT_CACHE)
153/* 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 */
154#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \ 153#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) \
155 dma_addr_t ADDR_NAME; 154 dma_addr_t ADDR_NAME;
156#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \ 155#define DECLARE_PCI_UNMAP_LEN(LEN_NAME) \
@@ -164,6 +163,20 @@ int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
164#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \ 163#define pci_unmap_len_set(PTR, LEN_NAME, VAL) \
165 (((PTR)->LEN_NAME) = (VAL)) 164 (((PTR)->LEN_NAME) = (VAL))
166 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
167/* The PCI address space does not equal the physical memory address 180/* The PCI address space does not equal the physical memory address
168 * 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
169 * this boolean for bounce buffer decisions. 182 * this boolean for bounce buffer decisions.
@@ -178,16 +191,8 @@ int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma,
178 */ 191 */
179#define PCI_DMA_BUS_IS_PHYS (1) 192#define PCI_DMA_BUS_IS_PHYS (1)
180 193
181/* pci_unmap_{page,single} is a nop so... */
182#define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)
183#define DECLARE_PCI_UNMAP_LEN(LEN_NAME)
184#define pci_unmap_addr(PTR, ADDR_NAME) (0)
185#define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0)
186#define pci_unmap_len(PTR, LEN_NAME) (0)
187#define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0)
188
189#endif /* CONFIG_PPC64 */ 194#endif /* CONFIG_PPC64 */
190 195
191extern void pcibios_resource_to_bus(struct pci_dev *dev, 196extern void pcibios_resource_to_bus(struct pci_dev *dev,
192 struct pci_bus_region *region, 197 struct pci_bus_region *region,
193 struct resource *res); 198 struct resource *res);
@@ -216,6 +221,8 @@ extern int remap_bus_range(struct pci_bus *bus);
216extern void pcibios_fixup_device_resources(struct pci_dev *dev, 221extern void pcibios_fixup_device_resources(struct pci_dev *dev,
217 struct pci_bus *bus); 222 struct pci_bus *bus);
218 223
224extern void pcibios_setup_new_device(struct pci_dev *dev);
225
219extern void pcibios_claim_one_bus(struct pci_bus *b); 226extern void pcibios_claim_one_bus(struct pci_bus *b);
220 227
221extern struct pci_controller *init_phb_dynamic(struct device_node *dn); 228extern struct pci_controller *init_phb_dynamic(struct device_node *dn);
@@ -238,12 +245,10 @@ extern pgprot_t pci_phys_mem_access_prot(struct file *file,
238 unsigned long size, 245 unsigned long size,
239 pgprot_t prot); 246 pgprot_t prot);
240 247
241#if defined(CONFIG_PPC_MULTIPLATFORM) || defined(CONFIG_PPC32)
242#define HAVE_ARCH_PCI_RESOURCE_TO_USER 248#define HAVE_ARCH_PCI_RESOURCE_TO_USER
243extern void pci_resource_to_user(const struct pci_dev *dev, int bar, 249extern void pci_resource_to_user(const struct pci_dev *dev, int bar,
244 const struct resource *rsrc, 250 const struct resource *rsrc,
245 resource_size_t *start, resource_size_t *end); 251 resource_size_t *start, resource_size_t *end);
246#endif /* CONFIG_PPC_MULTIPLATFORM || CONFIG_PPC32 */
247 252
248#endif /* __KERNEL__ */ 253#endif /* __KERNEL__ */
249#endif /* __ASM_POWERPC_PCI_H */ 254#endif /* __ASM_POWERPC_PCI_H */