Skip to content

Commit

Permalink
x86/PCI: Don't track firmware-assigned BAR values for hot-added devices
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Yinghai Lu authored and Bjorn Helgaas committed Jan 7, 2013
1 parent dc2f56f commit 7452160
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion arch/x86/pci/i386.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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) {
Expand All @@ -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)
Expand All @@ -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;
Expand All @@ -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
Expand Down

0 comments on commit 7452160

Please sign in to comment.