@@ -626,32 +626,15 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header)
return 0;
}
-static void __init __pci_mmcfg_init(int early)
+static int __init __pci_mmcfg_init(int early)
{
- /* MMCONFIG disabled */
- if ((pci_probe & PCI_PROBE_MMCONF) == 0)
- return;
-
- /* for late to exit */
- if (known_bridge)
- return;
-
- /* MMCONFIG already enabled */
- if (!early && !(pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF))
- goto out;
-
- if (early) {
- if (pci_mmcfg_check_hostbridge())
- known_bridge = 1;
- }
-
if (!known_bridge)
acpi_sfi_table_parse(ACPI_SIG_MCFG, pci_parse_mcfg);
pci_mmcfg_reject_broken(early);
if (list_empty(&pci_mmcfg_list))
- return;
+ return -EINVAL;
if (pcibios_last_bus < 0) {
const struct pci_mmcfg_region *cfg;
@@ -668,28 +651,43 @@ static void __init __pci_mmcfg_init(int early)
else {
free_all_mmcfg();
pci_mmcfg_arch_init_failed = true;
+ return -EINVAL;
}
-out:
- /*
- * Free all MCFG entries if ACPI is enabled. MCFG information will
- * be added back on demand by the pci_root driver later.
- */
- if (!early && !acpi_disabled && !known_bridge &&
- !pci_mmcfg_arch_init_failed) {
- if (!acpi_pci_cache_mcfg())
- free_all_mmcfg();
- }
+ return 0;
}
void __init pci_mmcfg_early_init(void)
{
- __pci_mmcfg_init(1);
+ if (pci_probe & PCI_PROBE_MMCONF) {
+ if (pci_mmcfg_check_hostbridge())
+ known_bridge = 1;
+ __pci_mmcfg_init(1);
+ }
}
void __init pci_mmcfg_late_init(void)
{
- __pci_mmcfg_init(0);
+ int ret = 0;
+
+ /* MMCONFIG disabled */
+ if ((pci_probe & PCI_PROBE_MMCONF) == 0)
+ return;
+
+ if (known_bridge)
+ return;
+
+ /* MMCONFIG hasn't been enabled yet */
+ if (pci_probe & PCI_PROBE_MASK & ~PCI_PROBE_MMCONF)
+ ret = __pci_mmcfg_init(0);
+
+ /*
+ * Free all MCFG entries if ACPI is enabled. MCFG information will
+ * be added back on demand by the pci_root driver later.
+ */
+ if (!acpi_disabled && !ret)
+ if (!acpi_pci_cache_mcfg())
+ free_all_mmcfg();
}
static int __init pci_mmcfg_late_insert_resources(void)