powerpc: Create pci_controller_ops.dma_bus_setup and shim
authorDaniel Axtens <dja@axtens.net>
Tue, 31 Mar 2015 05:00:43 +0000 (16:00 +1100)
committerMichael Ellerman <mpe@ellerman.id.au>
Sat, 11 Apr 2015 10:49:11 +0000 (20:49 +1000)
Add pci_controller_ops.dma_bus_setup, shadowing ppc_md.pci_dma_bus_setup.
Add a shim, and changes the callsites to use the shim.

Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/include/asm/pci-bridge.h
arch/powerpc/kernel/pci-common.c

index 0f441b8e1ea1ded07b0ca7dd12425352dd705c83..b9732fcb0f5f04b03757f1019d1cded526b5eec5 100644 (file)
@@ -19,6 +19,7 @@ struct device_node;
  */
 struct pci_controller_ops {
        void            (*dma_dev_setup)(struct pci_dev *dev);
+       void            (*dma_bus_setup)(struct pci_bus *bus);
 };
 
 /*
@@ -281,5 +282,15 @@ static inline void pci_dma_dev_setup(struct pci_dev *dev)
                ppc_md.pci_dma_dev_setup(dev);
 }
 
+static inline void pci_dma_bus_setup(struct pci_bus *bus)
+{
+       struct pci_controller *phb = pci_bus_to_host(bus);
+
+       if (phb->controller_ops.dma_bus_setup)
+               phb->controller_ops.dma_bus_setup(bus);
+       else if (ppc_md.pci_dma_bus_setup)
+               ppc_md.pci_dma_bus_setup(bus);
+}
+
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_PCI_BRIDGE_H */
index 7e3757e403d485bda52b8961a189a2e2c9084b33..af357cc38ff6f9d0eaf59e0e6da99da3fd94bb47 100644 (file)
@@ -953,8 +953,7 @@ void pcibios_setup_bus_self(struct pci_bus *bus)
                ppc_md.pcibios_fixup_bus(bus);
 
        /* Setup bus DMA mappings */
-       if (ppc_md.pci_dma_bus_setup)
-               ppc_md.pci_dma_bus_setup(bus);
+       pci_dma_bus_setup(bus);
 }
 
 static void pcibios_setup_device(struct pci_dev *dev)