Commit 2a76c450 authored by Jiang Liu's avatar Jiang Liu Committed by Bjorn Helgaas

x86/PCI: split out pci_mmcfg_check_reserved() for code reuse

Split out pci_mmcfg_check_reserved() for code reuse, which will be used
when supporting PCI host bridge hotplug.
Reviewed-by: default avatarYinghai Lu <yinghai@kernel.org>
Signed-off-by: default avatarJiang Liu <liuj97@gmail.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 06aef8ce
...@@ -474,18 +474,12 @@ static int __init is_mmconf_reserved(check_reserved_t is_reserved, ...@@ -474,18 +474,12 @@ static int __init is_mmconf_reserved(check_reserved_t is_reserved,
return valid; return valid;
} }
static void __init pci_mmcfg_reject_broken(int early) static int __devinit pci_mmcfg_check_reserved(struct pci_mmcfg_region *cfg,
int early)
{ {
struct pci_mmcfg_region *cfg;
list_for_each_entry(cfg, &pci_mmcfg_list, list) {
int valid = 0;
if (!early && !acpi_disabled) { if (!early && !acpi_disabled) {
valid = is_mmconf_reserved(is_acpi_reserved, cfg, 0); if (is_mmconf_reserved(is_acpi_reserved, cfg, 0))
return 1;
if (valid)
continue;
else else
printk(KERN_ERR FW_BUG PREFIX printk(KERN_ERR FW_BUG PREFIX
"MMCONFIG at %pR not reserved in " "MMCONFIG at %pR not reserved in "
...@@ -496,17 +490,22 @@ static void __init pci_mmcfg_reject_broken(int early) ...@@ -496,17 +490,22 @@ static void __init pci_mmcfg_reject_broken(int early)
/* Don't try to do this check unless configuration /* Don't try to do this check unless configuration
type 1 is available. how about type 2 ?*/ type 1 is available. how about type 2 ?*/
if (raw_pci_ops) if (raw_pci_ops)
valid = is_mmconf_reserved(e820_all_mapped, cfg, 1); return is_mmconf_reserved(e820_all_mapped, cfg, 1);
if (!valid) return 0;
goto reject; }
}
return; static void __init pci_mmcfg_reject_broken(int early)
{
struct pci_mmcfg_region *cfg;
reject: list_for_each_entry(cfg, &pci_mmcfg_list, list) {
if (pci_mmcfg_check_reserved(cfg, early) == 0) {
printk(KERN_INFO PREFIX "not using MMCONFIG\n"); printk(KERN_INFO PREFIX "not using MMCONFIG\n");
free_all_mmcfg(); free_all_mmcfg();
return;
}
}
} }
static int __initdata known_bridge; static int __initdata known_bridge;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment