aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/pci
diff options
context:
space:
mode:
authorJiang Liu <jiang.liu@huawei.com>2012-06-22 02:55:20 -0400
committerBjorn Helgaas <bhelgaas@google.com>2012-06-22 17:17:31 -0400
commit574a59414083df3911e5a1514742959b412b6947 (patch)
treef56675a895305ff300e3fa7046da42fd8f4d5419 /arch/x86/pci
parent8503562fd4e8e261bd7ca442705c6e8f0fd88228 (diff)
x86/PCI: refine __pci_mmcfg_init() for better code readability
Refine __pci_mmcfg_init() for better code readability. 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.c46
1 files changed, 21 insertions, 25 deletions
diff --git a/arch/x86/pci/mmconfig-shared.c b/arch/x86/pci/mmconfig-shared.c
index 332fabdeff43..ffe72b9d6869 100644
--- a/arch/x86/pci/mmconfig-shared.c
+++ b/arch/x86/pci/mmconfig-shared.c
@@ -544,8 +544,6 @@ static void __init pci_mmcfg_reject_broken(int early)
544 } 544 }
545} 545}
546 546
547static int __initdata known_bridge;
548
549static int __init acpi_mcfg_check_entry(struct acpi_table_mcfg *mcfg, 547static int __init acpi_mcfg_check_entry(struct acpi_table_mcfg *mcfg,
550 struct acpi_mcfg_allocation *cfg) 548 struct acpi_mcfg_allocation *cfg)
551{ 549{
@@ -617,28 +615,7 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header)
617 615
618static void __init __pci_mmcfg_init(int early) 616static void __init __pci_mmcfg_init(int early)
619{ 617{
620 /* MMCONFIG disabled */
621 if ((pci_probe & PCI_PROBE_MMCONF) == 0)
622 return;
623
624 /* MMCONFIG already enabled */
625 if (!early && !(pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF))
626 return;
627
628 /* for late to exit */
629 if (known_bridge)
630 return;
631
632 if (early) {
633 if (pci_mmcfg_check_hostbridge())
634 known_bridge = 1;
635 }
636
637 if (!known_bridge)
638 acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg);
639
640 pci_mmcfg_reject_broken(early); 618 pci_mmcfg_reject_broken(early);
641
642 if (list_empty(&pci_mmcfg_list)) 619 if (list_empty(&pci_mmcfg_list))
643 return; 620 return;
644 621
@@ -660,14 +637,33 @@ static void __init __pci_mmcfg_init(int early)
660 } 637 }
661} 638}
662 639
640static int __initdata known_bridge;
641
663void __init pci_mmcfg_early_init(void) 642void __init pci_mmcfg_early_init(void)
664{ 643{
665 __pci_mmcfg_init(1); 644 if (pci_probe & PCI_PROBE_MMCONF) {
645 if (pci_mmcfg_check_hostbridge())
646 known_bridge = 1;
647 else
648 acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg);
649 __pci_mmcfg_init(1);
650 }
666} 651}
667 652
668void __init pci_mmcfg_late_init(void) 653void __init pci_mmcfg_late_init(void)
669{ 654{
670 __pci_mmcfg_init(0); 655 /* MMCONFIG disabled */
656 if ((pci_probe & PCI_PROBE_MMCONF) == 0)
657 return;
658
659 if (known_bridge)
660 return;
661
662 /* MMCONFIG hasn't been enabled yet, try again */
663 if (pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF) {
664 acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg);
665 __pci_mmcfg_init(0);
666 }
671} 667}
672 668
673static int __init pci_mmcfg_late_insert_resources(void) 669static int __init pci_mmcfg_late_insert_resources(void)