aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Axtens <dja@axtens.net>2015-03-31 01:00:46 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2015-04-11 06:49:13 -0400
commit542070baf4a0fe9de14cc2c4ca3ff1b43f14f90f (patch)
tree768ab816acf7f3370116b6009d1bc8b8c843b5bd
parentb31e79f8d92ca115a935e37cfd4da74048739689 (diff)
powerpc: Create pci_controller_ops.window_alignment and shim
Add pci_controller_ops.window_alignment, shadowing ppc_md.pcibios_window_alignment. Add a shim, and changes the callsites to use the shim. Here, we use pci_window_alignment, as pcibios_window_alignment is already taken. Signed-off-by: Daniel Axtens <dja@axtens.net> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h21
-rw-r--r--arch/powerpc/kernel/pci-common.c10
2 files changed, 22 insertions, 9 deletions
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 9d02ea6255ff..ed4f8ce803bb 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -31,6 +31,9 @@ struct pci_controller_ops {
31 /* Called when pci_enable_device() is called. Returns true to 31 /* Called when pci_enable_device() is called. Returns true to
32 * allow assignment/enabling of the device. */ 32 * allow assignment/enabling of the device. */
33 bool (*enable_device_hook)(struct pci_dev *); 33 bool (*enable_device_hook)(struct pci_dev *);
34
35 /* Called during PCI resource reassignment */
36 resource_size_t (*window_alignment)(struct pci_bus *, unsigned long type);
34}; 37};
35 38
36/* 39/*
@@ -325,5 +328,23 @@ static inline bool pcibios_enable_device_hook(struct pci_dev *dev)
325 return true; 328 return true;
326} 329}
327 330
331static inline resource_size_t pci_window_alignment(struct pci_bus *bus,
332 unsigned long type)
333{
334 struct pci_controller *phb = pci_bus_to_host(bus);
335
336 if (phb->controller_ops.window_alignment)
337 return phb->controller_ops.window_alignment(bus, type);
338 if (ppc_md.pcibios_window_alignment)
339 return ppc_md.pcibios_window_alignment(bus, type);
340
341 /*
342 * PCI core will figure out the default
343 * alignment: 4KiB for I/O and 1MiB for
344 * memory window.
345 */
346 return 1;
347}
348
328#endif /* __KERNEL__ */ 349#endif /* __KERNEL__ */
329#endif /* _ASM_POWERPC_PCI_BRIDGE_H */ 350#endif /* _ASM_POWERPC_PCI_BRIDGE_H */
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 8639e9cd65d5..698e0328d9c3 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -109,15 +109,7 @@ void pcibios_free_controller(struct pci_controller *phb)
109resource_size_t pcibios_window_alignment(struct pci_bus *bus, 109resource_size_t pcibios_window_alignment(struct pci_bus *bus,
110 unsigned long type) 110 unsigned long type)
111{ 111{
112 if (ppc_md.pcibios_window_alignment) 112 return pci_window_alignment(bus, type);
113 return ppc_md.pcibios_window_alignment(bus, type);
114
115 /*
116 * PCI core will figure out the default
117 * alignment: 4KiB for I/O and 1MiB for
118 * memory window.
119 */
120 return 1;
121} 113}
122 114
123void pcibios_reset_secondary_bus(struct pci_dev *dev) 115void pcibios_reset_secondary_bus(struct pci_dev *dev)