@@ -623,11 +623,27 @@ static int __init pci_parse_mcfg(struct acpi_table_header *header)
}
}
- i = entries * sizeof(*cfg_table);
- pci_acpi_mcfg_array = kmalloc(i, GFP_KERNEL);
- if (pci_acpi_mcfg_array) {
- memcpy(pci_acpi_mcfg_array, cfg_table, i);
- pci_acpi_mcfg_entries = entries;
+ return 0;
+}
+
+static int __init pci_cache_mcfg(struct acpi_table_header *header)
+{
+ unsigned long i;
+ struct acpi_table_mcfg *mcfg;
+ struct acpi_mcfg_allocation *cfg_table;
+
+ if (!header)
+ return -EINVAL;
+
+ i = (header->length - sizeof(struct acpi_table_mcfg));
+ if (i) {
+ pci_acpi_mcfg_array = kmalloc(i, GFP_KERNEL);
+ if (pci_acpi_mcfg_array) {
+ mcfg = (struct acpi_table_mcfg *)header;
+ cfg_table = (struct acpi_mcfg_allocation *) &mcfg[1];
+ memcpy(pci_acpi_mcfg_array, cfg_table, i);
+ pci_acpi_mcfg_entries = i / sizeof (*cfg_table);
+ }
}
return 0;
@@ -682,8 +698,11 @@ 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_acpi_mcfg_array)
- free_all_mmcfg();
+ if (!early && !acpi_disabled && !known_bridge) {
+ acpi_table_parse(ACPI_SIG_MCFG, pci_cache_mcfg);
+ if (pci_acpi_mcfg_array)
+ free_all_mmcfg();
+ }
}
void __init pci_mmcfg_early_init(void)