diff options
author | Daniel Axtens <dja@axtens.net> | 2015-03-31 08:00:46 +0300 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2015-04-11 13:49:13 +0300 |
commit | 542070baf4a0fe9de14cc2c4ca3ff1b43f14f90f (patch) | |
tree | 768ab816acf7f3370116b6009d1bc8b8c843b5bd /arch/powerpc/include/asm/pci-bridge.h | |
parent | b31e79f8d92ca115a935e37cfd4da74048739689 (diff) | |
download | linux-542070baf4a0fe9de14cc2c4ca3ff1b43f14f90f.tar.xz |
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>
Diffstat (limited to 'arch/powerpc/include/asm/pci-bridge.h')
-rw-r--r-- | arch/powerpc/include/asm/pci-bridge.h | 21 |
1 files changed, 21 insertions, 0 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 { /* Called when pci_enable_device() is called. Returns true to * allow assignment/enabling of the device. */ bool (*enable_device_hook)(struct pci_dev *); + + /* Called during PCI resource reassignment */ + resource_size_t (*window_alignment)(struct pci_bus *, unsigned long type); }; /* @@ -325,5 +328,23 @@ static inline bool pcibios_enable_device_hook(struct pci_dev *dev) return true; } +static inline resource_size_t pci_window_alignment(struct pci_bus *bus, + unsigned long type) +{ + struct pci_controller *phb = pci_bus_to_host(bus); + + if (phb->controller_ops.window_alignment) + return phb->controller_ops.window_alignment(bus, type); + if (ppc_md.pcibios_window_alignment) + return ppc_md.pcibios_window_alignment(bus, type); + + /* + * PCI core will figure out the default + * alignment: 4KiB for I/O and 1MiB for + * memory window. + */ + return 1; +} + #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_PCI_BRIDGE_H */ |