diff options
author | Daniel Axtens <dja@axtens.net> | 2015-03-31 01:00:42 -0400 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2015-04-11 06:49:11 -0400 |
commit | e02def5bce12b472e9eb6dcdd9f7af72239e6330 (patch) | |
tree | 9878fe07343f450446e63976d80a8cb50bc8b4de /arch/powerpc | |
parent | c88c2a188905cb3077c3c38dc498e7e9f8eebeee (diff) |
powerpc: Create pci_controller_ops.dma_dev_setup and shim
Introduces the pci_controller_ops structure.
Add pci_controller_ops.dma_dev_setup, shadowing ppc_md.pci_dma_dev_setup.
Add a shim, and change the callsites to use the shim.
Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/include/asm/pci-bridge.h | 21 | ||||
-rw-r--r-- | arch/powerpc/kernel/pci-common.c | 3 |
2 files changed, 22 insertions, 2 deletions
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h index 2c6dc2a3d14a..0f441b8e1ea1 100644 --- a/arch/powerpc/include/asm/pci-bridge.h +++ b/arch/powerpc/include/asm/pci-bridge.h | |||
@@ -15,6 +15,13 @@ | |||
15 | struct device_node; | 15 | struct device_node; |
16 | 16 | ||
17 | /* | 17 | /* |
18 | * PCI controller operations | ||
19 | */ | ||
20 | struct pci_controller_ops { | ||
21 | void (*dma_dev_setup)(struct pci_dev *dev); | ||
22 | }; | ||
23 | |||
24 | /* | ||
18 | * Structure of a PCI controller (host bridge) | 25 | * Structure of a PCI controller (host bridge) |
19 | */ | 26 | */ |
20 | struct pci_controller { | 27 | struct pci_controller { |
@@ -46,6 +53,7 @@ struct pci_controller { | |||
46 | resource_size_t isa_mem_phys; | 53 | resource_size_t isa_mem_phys; |
47 | resource_size_t isa_mem_size; | 54 | resource_size_t isa_mem_size; |
48 | 55 | ||
56 | struct pci_controller_ops controller_ops; | ||
49 | struct pci_ops *ops; | 57 | struct pci_ops *ops; |
50 | unsigned int __iomem *cfg_addr; | 58 | unsigned int __iomem *cfg_addr; |
51 | void __iomem *cfg_data; | 59 | void __iomem *cfg_data; |
@@ -260,5 +268,18 @@ static inline int pcibios_vaddr_is_ioport(void __iomem *address) | |||
260 | } | 268 | } |
261 | #endif /* CONFIG_PCI */ | 269 | #endif /* CONFIG_PCI */ |
262 | 270 | ||
271 | /* | ||
272 | * Shims to prefer pci_controller version over ppc_md where available. | ||
273 | */ | ||
274 | static inline void pci_dma_dev_setup(struct pci_dev *dev) | ||
275 | { | ||
276 | struct pci_controller *phb = pci_bus_to_host(dev->bus); | ||
277 | |||
278 | if (phb->controller_ops.dma_dev_setup) | ||
279 | phb->controller_ops.dma_dev_setup(dev); | ||
280 | else if (ppc_md.pci_dma_dev_setup) | ||
281 | ppc_md.pci_dma_dev_setup(dev); | ||
282 | } | ||
283 | |||
263 | #endif /* __KERNEL__ */ | 284 | #endif /* __KERNEL__ */ |
264 | #endif /* _ASM_POWERPC_PCI_BRIDGE_H */ | 285 | #endif /* _ASM_POWERPC_PCI_BRIDGE_H */ |
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c index 17827c7345a7..7e3757e403d4 100644 --- a/arch/powerpc/kernel/pci-common.c +++ b/arch/powerpc/kernel/pci-common.c | |||
@@ -969,8 +969,7 @@ static void pcibios_setup_device(struct pci_dev *dev) | |||
969 | set_dma_offset(&dev->dev, PCI_DRAM_OFFSET); | 969 | set_dma_offset(&dev->dev, PCI_DRAM_OFFSET); |
970 | 970 | ||
971 | /* Additional platform DMA/iommu setup */ | 971 | /* Additional platform DMA/iommu setup */ |
972 | if (ppc_md.pci_dma_dev_setup) | 972 | pci_dma_dev_setup(dev); |
973 | ppc_md.pci_dma_dev_setup(dev); | ||
974 | 973 | ||
975 | /* Read default IRQs and fixup if necessary */ | 974 | /* Read default IRQs and fixup if necessary */ |
976 | pci_read_irq_line(dev); | 975 | pci_read_irq_line(dev); |