summaryrefslogtreecommitdiff
path: root/include/linux/pci.h
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2016-11-25 11:57:09 +0100
committerBjorn Helgaas <helgaas@kernel.org>2016-12-07 11:05:42 -0600
commit37d6a0a6f4700ad3ae7bbf8db38b4557e97b3fe4 (patch)
treed16e0d4d892ba055980e46f9804c0a1f583e50a8 /include/linux/pci.h
parent1001354ca34179f3db924eb66672442a173147dc (diff)
downloadlwn-37d6a0a6f4700ad3ae7bbf8db38b4557e97b3fe4.tar.gz
lwn-37d6a0a6f4700ad3ae7bbf8db38b4557e97b3fe4.zip
PCI: Add pci_register_host_bridge() interface
Make the existing pci_host_bridge structure a proper device that is usable by PCI host drivers in a more standard way. In addition to the existing pci_scan_bus(), pci_scan_root_bus(), pci_scan_root_bus_msi(), and pci_create_root_bus() interfaces, this unfortunately means having to add yet another interface doing basically the same thing, and add some extra code in the initial step. However, this time it's more likely to be extensible enough that we won't have to do another one again in the future, and we should be able to reduce code much more as a result. The main idea is to pull the allocation of 'struct pci_host_bridge' out of the registration, and let individual host drivers and architecture code fill the members before calling the registration function. There are a number of things we can do based on this: * Use a single memory allocation for the driver-specific structure and the generic PCI host bridge * consolidate the contents of driver-specific structures by moving them into pci_host_bridge * Add a consistent interface for removing a PCI host bridge again when unloading a host driver module * Replace the architecture specific __weak pcibios_*() functions with callbacks in a pci_host_bridge device * Move common boilerplate code from host drivers into the generic function, based on contents of the structure * Extend pci_host_bridge with additional members when needed without having to add arguments to pci_scan_*(). * Move members of struct pci_bus into pci_host_bridge to avoid having lots of identical copies. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Bjorn Helgaas <helgaas@kernel.org>
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r--include/linux/pci.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index 0e49f70dbd9b..f79634612fbf 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -420,9 +420,13 @@ static inline int pci_channel_offline(struct pci_dev *pdev)
struct pci_host_bridge {
struct device dev;
struct pci_bus *bus; /* root bus */
+ struct pci_ops *ops;
+ void *sysdata;
+ int busnr;
struct list_head windows; /* resource_entry */
void (*release_fn)(struct pci_host_bridge *);
void *release_data;
+ struct msi_controller *msi;
unsigned int ignore_reset_delay:1; /* for entire hierarchy */
/* Resource alignment requirements */
resource_size_t (*align_resource)(struct pci_dev *dev,