]> Pileus Git - ~andy/linux/commitdiff
PCI/ACPI: Reserve firmware-allocated resources for hot-added root buses
authorYinghai Lu <yinghai@kernel.org>
Sun, 4 Nov 2012 04:39:31 +0000 (21:39 -0700)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 7 Jan 2013 22:58:48 +0000 (15:58 -0700)
Firmware may have assigned PCI BARs for hot-added devices, so reserve
those resources before trying to allocate more.

[bhelgaas: move empty weak definition here]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/acpi/pci_root.c
drivers/pci/bus.c
include/linux/pci.h

index 7928d4dc705618a833ccce3172ed5113307d4cff..dcbe9660e7569752798af15e8965fde58f89728d 100644 (file)
@@ -650,8 +650,10 @@ static int acpi_pci_root_start(struct acpi_device *device)
        struct acpi_pci_root *root = acpi_driver_data(device);
        struct acpi_pci_driver *driver;
 
-       if (system_state != SYSTEM_BOOTING)
+       if (system_state != SYSTEM_BOOTING) {
+               pcibios_resource_survey_bus(root->bus);
                pci_assign_unassigned_bus_resources(root->bus);
+       }
 
        mutex_lock(&acpi_pci_root_lock);
        list_for_each_entry(driver, &acpi_pci_drivers, node)
index ad6a8b63569201050dd3a7b487c5396b6b8ed28f..847f3ca47bb8822a669b104e3f67db883b4566a2 100644 (file)
@@ -158,6 +158,8 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
        return ret;
 }
 
+void __weak pcibios_resource_survey_bus(struct pci_bus *bus) { }
+
 /**
  * pci_bus_add_device - add a single device
  * @dev: device to add
index 15472d691ee68c6aad5dbeb0a75933ec18f00404..907b455ab603381a423571139b6497c8c0db5aef 100644 (file)
@@ -674,6 +674,7 @@ extern struct list_head pci_root_buses;     /* list of all known PCI buses */
 /* Some device drivers need know if pci is initiated */
 extern int no_pci_devices(void);
 
+void pcibios_resource_survey_bus(struct pci_bus *bus);
 void pcibios_fixup_bus(struct pci_bus *);
 int __must_check pcibios_enable_device(struct pci_dev *, int mask);
 /* Architecture specific versions may override this (weak) */