• A
    PCI: Add pci_register_host_bridge() interface · 37d6a0a6
    Arnd Bergmann 提交于
    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: NArnd Bergmann <arnd@arndb.de>
    Signed-off-by: NThierry Reding <treding@nvidia.com>
    Signed-off-by: NBjorn Helgaas <helgaas@kernel.org>
    37d6a0a6
probe.c 64.0 KB