diff options
author | Jiang Liu <jiang.liu@huawei.com> | 2012-06-22 02:55:10 -0400 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2012-06-22 16:59:15 -0400 |
commit | 2a76c450bd0377f715caf313ded530290d7dc7d7 (patch) | |
tree | 0ea022a64e06702b2400ed34e5b401d1b0571dc4 /arch/x86/pci | |
parent | 06aef8cec7563c40c7d7501d13ec1ed12f5e495b (diff) |
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: Yinghai Lu <yinghai@kernel.org>
Signed-off-by: Jiang Liu <liuj97@gmail.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'arch/x86/pci')
-rw-r--r-- | arch/x86/pci/mmconfig-shared.c | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c index 301e325992f6..f799949a08a5 100644 --- a/arch/x86/pci/mmconfig-shared.c +++ b/arch/x86/pci/mmconfig-shared.c | |||
@@ -474,39 +474,38 @@ static int __init is_mmconf_reserved(check_reserved_t is_reserved, | |||
474 | return valid; | 474 | return valid; |
475 | } | 475 | } |
476 | 476 | ||
477 | static int __devinit pci_mmcfg_check_reserved(struct pci_mmcfg_region *cfg, | ||
478 | int early) | ||
479 | { | ||
480 | if (!early && !acpi_disabled) { | ||
481 | if (is_mmconf_reserved(is_acpi_reserved, cfg, 0)) | ||
482 | return 1; | ||
483 | else | ||
484 | printk(KERN_ERR FW_BUG PREFIX | ||
485 | "MMCONFIG at %pR not reserved in " | ||
486 | "ACPI motherboard resources\n", | ||
487 | &cfg->res); | ||
488 | } | ||
489 | |||
490 | /* Don't try to do this check unless configuration | ||
491 | type 1 is available. how about type 2 ?*/ | ||
492 | if (raw_pci_ops) | ||
493 | return is_mmconf_reserved(e820_all_mapped, cfg, 1); | ||
494 | |||
495 | return 0; | ||
496 | } | ||
497 | |||
477 | static void __init pci_mmcfg_reject_broken(int early) | 498 | static void __init pci_mmcfg_reject_broken(int early) |
478 | { | 499 | { |
479 | struct pci_mmcfg_region *cfg; | 500 | struct pci_mmcfg_region *cfg; |
480 | 501 | ||
481 | list_for_each_entry(cfg, &pci_mmcfg_list, list) { | 502 | list_for_each_entry(cfg, &pci_mmcfg_list, list) { |
482 | int valid = 0; | 503 | if (pci_mmcfg_check_reserved(cfg, early) == 0) { |
483 | 504 | printk(KERN_INFO PREFIX "not using MMCONFIG\n"); | |
484 | if (!early && !acpi_disabled) { | 505 | free_all_mmcfg(); |
485 | valid = is_mmconf_reserved(is_acpi_reserved, cfg, 0); | 506 | return; |
486 | |||
487 | if (valid) | ||
488 | continue; | ||
489 | else | ||
490 | printk(KERN_ERR FW_BUG PREFIX | ||
491 | "MMCONFIG at %pR not reserved in " | ||
492 | "ACPI motherboard resources\n", | ||
493 | &cfg->res); | ||
494 | } | 507 | } |
495 | |||
496 | /* Don't try to do this check unless configuration | ||
497 | type 1 is available. how about type 2 ?*/ | ||
498 | if (raw_pci_ops) | ||
499 | valid = is_mmconf_reserved(e820_all_mapped, cfg, 1); | ||
500 | |||
501 | if (!valid) | ||
502 | goto reject; | ||
503 | } | 508 | } |
504 | |||
505 | return; | ||
506 | |||
507 | reject: | ||
508 | printk(KERN_INFO PREFIX "not using MMCONFIG\n"); | ||
509 | free_all_mmcfg(); | ||
510 | } | 509 | } |
511 | 510 | ||
512 | static int __initdata known_bridge; | 511 | static int __initdata known_bridge; |