Skip to content

Commit

Permalink
x86/PCI: split out pci_mmcfg_check_reserved() for code reuse
Browse files Browse the repository at this point in the history
Split out pci_mmcfg_check_reserved() for code reuse, which will be used
when supporting PCI host bridge hotplug.

Reviewed-by: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
  • Loading branch information
Jiang Liu authored and Bjorn Helgaas committed Jun 22, 2012
1 parent 06aef8c commit 2a76c45
Showing 1 changed file with 25 additions and 26 deletions.
51 changes: 25 additions & 26 deletions arch/x86/pci/mmconfig-shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,39 +474,38 @@ static int __init is_mmconf_reserved(check_reserved_t is_reserved,
return valid;
}

static int __devinit pci_mmcfg_check_reserved(struct pci_mmcfg_region *cfg,
int early)
{
if (!early && !acpi_disabled) {
if (is_mmconf_reserved(is_acpi_reserved, cfg, 0))
return 1;
else
printk(KERN_ERR FW_BUG PREFIX
"MMCONFIG at %pR not reserved in "
"ACPI motherboard resources\n",
&cfg->res);
}

/* Don't try to do this check unless configuration
type 1 is available. how about type 2 ?*/
if (raw_pci_ops)
return is_mmconf_reserved(e820_all_mapped, cfg, 1);

return 0;
}

static void __init pci_mmcfg_reject_broken(int early)
{
struct pci_mmcfg_region *cfg;

list_for_each_entry(cfg, &pci_mmcfg_list, list) {
int valid = 0;

if (!early && !acpi_disabled) {
valid = is_mmconf_reserved(is_acpi_reserved, cfg, 0);

if (valid)
continue;
else
printk(KERN_ERR FW_BUG PREFIX
"MMCONFIG at %pR not reserved in "
"ACPI motherboard resources\n",
&cfg->res);
if (pci_mmcfg_check_reserved(cfg, early) == 0) {
printk(KERN_INFO PREFIX "not using MMCONFIG\n");
free_all_mmcfg();
return;
}

/* Don't try to do this check unless configuration
type 1 is available. how about type 2 ?*/
if (raw_pci_ops)
valid = is_mmconf_reserved(e820_all_mapped, cfg, 1);

if (!valid)
goto reject;
}

return;

reject:
printk(KERN_INFO PREFIX "not using MMCONFIG\n");
free_all_mmcfg();
}

static int __initdata known_bridge;
Expand Down

0 comments on commit 2a76c45

Please sign in to comment.