x86/PCI: Don't track firmware-assigned BAR values for hot-added devices
authorYinghai Lu <yinghai@kernel.org>
Sun, 4 Nov 2012 04:39:28 +0000 (21:39 -0700)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 7 Jan 2013 22:58:43 +0000 (15:58 -0700)
The BIOS doesn't assign BAR values for hot-added devices, so don't
bother saving the original values when we enumerate these devices.

[bhelgaas: changelog, return constant 0 in pcibios_retrieve_fw_addr]
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
arch/x86/pci/i386.c

index 42dd75552351898b906dd936f7f85155318960b6..1bd672ab00844e4836c035c2cfb56e26d9d2b4bb 100644 (file)
@@ -51,6 +51,7 @@ struct pcibios_fwaddrmap {
 
 static LIST_HEAD(pcibios_fwaddrmappings);
 static DEFINE_SPINLOCK(pcibios_fwaddrmap_lock);
+static bool pcibios_fw_addr_done;
 
 /* Must be called with 'pcibios_fwaddrmap_lock' lock held. */
 static struct pcibios_fwaddrmap *pcibios_fwaddrmap_lookup(struct pci_dev *dev)
@@ -72,6 +73,9 @@ pcibios_save_fw_addr(struct pci_dev *dev, int idx, resource_size_t fw_addr)
        unsigned long flags;
        struct pcibios_fwaddrmap *map;
 
+       if (pcibios_fw_addr_done)
+               return;
+
        spin_lock_irqsave(&pcibios_fwaddrmap_lock, flags);
        map = pcibios_fwaddrmap_lookup(dev);
        if (!map) {
@@ -97,6 +101,9 @@ resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx)
        struct pcibios_fwaddrmap *map;
        resource_size_t fw_addr = 0;
 
+       if (pcibios_fw_addr_done)
+               return 0;
+
        spin_lock_irqsave(&pcibios_fwaddrmap_lock, flags);
        map = pcibios_fwaddrmap_lookup(dev);
        if (map)
@@ -106,7 +113,7 @@ resource_size_t pcibios_retrieve_fw_addr(struct pci_dev *dev, int idx)
        return fw_addr;
 }
 
-static void pcibios_fw_addr_list_del(void)
+static void __init pcibios_fw_addr_list_del(void)
 {
        unsigned long flags;
        struct pcibios_fwaddrmap *entry, *next;
@@ -118,6 +125,7 @@ static void pcibios_fw_addr_list_del(void)
                kfree(entry);
        }
        spin_unlock_irqrestore(&pcibios_fwaddrmap_lock, flags);
+       pcibios_fw_addr_done = true;
 }
 
 static int