From: Yinghai Lu Date: Sun, 4 Nov 2012 04:39:31 +0000 (-0700) Subject: PCI/ACPI: Reserve firmware-allocated resources for hot-added root buses X-Git-Tag: firefly_0821_release~3680^2~1035^2~2^2~4 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3c449ed0075994b3f3371f8254560428ba787efc;p=firefly-linux-kernel-4.4.55.git PCI/ACPI: Reserve firmware-allocated resources for hot-added root buses 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 Signed-off-by: Bjorn Helgaas --- diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 7928d4dc7056..dcbe9660e756 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -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) diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index ad6a8b635692..847f3ca47bb8 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -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 diff --git a/include/linux/pci.h b/include/linux/pci.h index 15472d691ee6..907b455ab603 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -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) */