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>
This commit is contained in:
committed by
Michael Ellerman
parent
c88c2a1889
commit
e02def5bce
@@ -14,6 +14,13 @@
|
|||||||
|
|
||||||
struct device_node;
|
struct device_node;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* PCI controller operations
|
||||||
|
*/
|
||||||
|
struct pci_controller_ops {
|
||||||
|
void (*dma_dev_setup)(struct pci_dev *dev);
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Structure of a PCI controller (host bridge)
|
* Structure of a PCI controller (host bridge)
|
||||||
*/
|
*/
|
||||||
@@ -46,6 +53,7 @@ struct pci_controller {
|
|||||||
resource_size_t isa_mem_phys;
|
resource_size_t isa_mem_phys;
|
||||||
resource_size_t isa_mem_size;
|
resource_size_t isa_mem_size;
|
||||||
|
|
||||||
|
struct pci_controller_ops controller_ops;
|
||||||
struct pci_ops *ops;
|
struct pci_ops *ops;
|
||||||
unsigned int __iomem *cfg_addr;
|
unsigned int __iomem *cfg_addr;
|
||||||
void __iomem *cfg_data;
|
void __iomem *cfg_data;
|
||||||
@@ -260,5 +268,18 @@ static inline int pcibios_vaddr_is_ioport(void __iomem *address)
|
|||||||
}
|
}
|
||||||
#endif /* CONFIG_PCI */
|
#endif /* CONFIG_PCI */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Shims to prefer pci_controller version over ppc_md where available.
|
||||||
|
*/
|
||||||
|
static inline void pci_dma_dev_setup(struct pci_dev *dev)
|
||||||
|
{
|
||||||
|
struct pci_controller *phb = pci_bus_to_host(dev->bus);
|
||||||
|
|
||||||
|
if (phb->controller_ops.dma_dev_setup)
|
||||||
|
phb->controller_ops.dma_dev_setup(dev);
|
||||||
|
else if (ppc_md.pci_dma_dev_setup)
|
||||||
|
ppc_md.pci_dma_dev_setup(dev);
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* __KERNEL__ */
|
#endif /* __KERNEL__ */
|
||||||
#endif /* _ASM_POWERPC_PCI_BRIDGE_H */
|
#endif /* _ASM_POWERPC_PCI_BRIDGE_H */
|
||||||
|
|||||||
@@ -969,8 +969,7 @@ static void pcibios_setup_device(struct pci_dev *dev)
|
|||||||
set_dma_offset(&dev->dev, PCI_DRAM_OFFSET);
|
set_dma_offset(&dev->dev, PCI_DRAM_OFFSET);
|
||||||
|
|
||||||
/* Additional platform DMA/iommu setup */
|
/* Additional platform DMA/iommu setup */
|
||||||
if (ppc_md.pci_dma_dev_setup)
|
pci_dma_dev_setup(dev);
|
||||||
ppc_md.pci_dma_dev_setup(dev);
|
|
||||||
|
|
||||||
/* Read default IRQs and fixup if necessary */
|
/* Read default IRQs and fixup if necessary */
|
||||||
pci_read_irq_line(dev);
|
pci_read_irq_line(dev);
|
||||||
|
|||||||
Reference in New Issue
Block a user