mmconfig-shared.c (fe47784ba5cbb6b713c013e046859946789b45e4) mmconfig-shared.c (ebd60cd64f8ab1170102c3ab072eb73042b7a33d)
1/*
2 * mmconfig-shared.c - Low-level direct PCI config space access via
3 * MMCONFIG - common code between i386 and x86-64.
4 *
5 * This code does:
6 * - known chipset handling
7 * - ACPI decoding and validation
8 *

--- 195 unchanged lines hidden (view full) ---

204 if (name) {
205 printk(KERN_INFO "PCI: Found %s %s MMCONFIG support.\n",
206 name, pci_mmcfg_config_num ? "with" : "without");
207 }
208
209 return name != NULL;
210}
211
1/*
2 * mmconfig-shared.c - Low-level direct PCI config space access via
3 * MMCONFIG - common code between i386 and x86-64.
4 *
5 * This code does:
6 * - known chipset handling
7 * - ACPI decoding and validation
8 *

--- 195 unchanged lines hidden (view full) ---

204 if (name) {
205 printk(KERN_INFO "PCI: Found %s %s MMCONFIG support.\n",
206 name, pci_mmcfg_config_num ? "with" : "without");
207 }
208
209 return name != NULL;
210}
211
212static void __init pci_mmcfg_insert_resources(unsigned long resource_flags)
212static void __init pci_mmcfg_insert_resources(void)
213{
214#define PCI_MMCFG_RESOURCE_NAME_LEN 19
215 int i;
216 struct resource *res;
217 char *names;
218 unsigned num_buses;
219
220 res = kcalloc(PCI_MMCFG_RESOURCE_NAME_LEN + sizeof(*res),

--- 7 unchanged lines hidden (view full) ---

228 for (i = 0; i < pci_mmcfg_config_num; i++, res++) {
229 struct acpi_mcfg_allocation *cfg = &pci_mmcfg_config[i];
230 num_buses = cfg->end_bus_number - cfg->start_bus_number + 1;
231 res->name = names;
232 snprintf(names, PCI_MMCFG_RESOURCE_NAME_LEN, "PCI MMCONFIG %u",
233 cfg->pci_segment);
234 res->start = cfg->address;
235 res->end = res->start + (num_buses << 20) - 1;
213{
214#define PCI_MMCFG_RESOURCE_NAME_LEN 19
215 int i;
216 struct resource *res;
217 char *names;
218 unsigned num_buses;
219
220 res = kcalloc(PCI_MMCFG_RESOURCE_NAME_LEN + sizeof(*res),

--- 7 unchanged lines hidden (view full) ---

228 for (i = 0; i < pci_mmcfg_config_num; i++, res++) {
229 struct acpi_mcfg_allocation *cfg = &pci_mmcfg_config[i];
230 num_buses = cfg->end_bus_number - cfg->start_bus_number + 1;
231 res->name = names;
232 snprintf(names, PCI_MMCFG_RESOURCE_NAME_LEN, "PCI MMCONFIG %u",
233 cfg->pci_segment);
234 res->start = cfg->address;
235 res->end = res->start + (num_buses << 20) - 1;
236 res->flags = IORESOURCE_MEM | resource_flags;
236 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
237 insert_resource(&iomem_resource, res);
238 names += PCI_MMCFG_RESOURCE_NAME_LEN;
239 }
240
241 /* Mark that the resources have been inserted. */
242 pci_mmcfg_resources_inserted = 1;
243}
244

--- 184 unchanged lines hidden (view full) ---

429 pci_mmcfg_reject_broken(early);
430 }
431
432 if ((pci_mmcfg_config_num == 0) ||
433 (pci_mmcfg_config == NULL) ||
434 (pci_mmcfg_config[0].address == 0))
435 return;
436
237 insert_resource(&iomem_resource, res);
238 names += PCI_MMCFG_RESOURCE_NAME_LEN;
239 }
240
241 /* Mark that the resources have been inserted. */
242 pci_mmcfg_resources_inserted = 1;
243}
244

--- 184 unchanged lines hidden (view full) ---

429 pci_mmcfg_reject_broken(early);
430 }
431
432 if ((pci_mmcfg_config_num == 0) ||
433 (pci_mmcfg_config == NULL) ||
434 (pci_mmcfg_config[0].address == 0))
435 return;
436
437 if (pci_mmcfg_arch_init()) {
438 if (known_bridge)
439 pci_mmcfg_insert_resources(IORESOURCE_BUSY);
437 if (pci_mmcfg_arch_init())
440 pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF;
438 pci_probe = (pci_probe & ~PCI_PROBE_MASK) | PCI_PROBE_MMCONF;
441 } else {
439 else {
442 /*
443 * Signal not to attempt to insert mmcfg resources because
444 * the architecture mmcfg setup could not initialize.
445 */
446 pci_mmcfg_resources_inserted = 1;
447 }
448}
449

--- 20 unchanged lines hidden (view full) ---

470 (pci_mmcfg_config[0].address == 0))
471 return 1;
472
473 /*
474 * Attempt to insert the mmcfg resources but not with the busy flag
475 * marked so it won't cause request errors when __request_region is
476 * called.
477 */
440 /*
441 * Signal not to attempt to insert mmcfg resources because
442 * the architecture mmcfg setup could not initialize.
443 */
444 pci_mmcfg_resources_inserted = 1;
445 }
446}
447

--- 20 unchanged lines hidden (view full) ---

468 (pci_mmcfg_config[0].address == 0))
469 return 1;
470
471 /*
472 * Attempt to insert the mmcfg resources but not with the busy flag
473 * marked so it won't cause request errors when __request_region is
474 * called.
475 */
478 pci_mmcfg_insert_resources(0);
476 pci_mmcfg_insert_resources();
479
480 return 0;
481}
482
483/*
484 * Perform MMCONFIG resource insertion after PCI initialization to allow for
485 * misprogrammed MCFG tables that state larger sizes but actually conflict
486 * with other system resources.
487 */
488late_initcall(pci_mmcfg_late_insert_resources);
477
478 return 0;
479}
480
481/*
482 * Perform MMCONFIG resource insertion after PCI initialization to allow for
483 * misprogrammed MCFG tables that state larger sizes but actually conflict
484 * with other system resources.
485 */
486late_initcall(pci_mmcfg_late_insert_resources);