Lines Matching refs:cfg
36 static void __init pci_mmconfig_remove(struct pci_mmcfg_region *cfg) in pci_mmconfig_remove() argument
38 if (cfg->res.parent) in pci_mmconfig_remove()
39 release_resource(&cfg->res); in pci_mmconfig_remove()
40 list_del(&cfg->list); in pci_mmconfig_remove()
41 kfree(cfg); in pci_mmconfig_remove()
46 struct pci_mmcfg_region *cfg, *tmp; in free_all_mmcfg() local
49 list_for_each_entry_safe(cfg, tmp, &pci_mmcfg_list, list) in free_all_mmcfg()
50 pci_mmconfig_remove(cfg); in free_all_mmcfg()
55 struct pci_mmcfg_region *cfg; in list_add_sorted() local
58 list_for_each_entry_rcu(cfg, &pci_mmcfg_list, list, pci_mmcfg_lock_held()) { in list_add_sorted()
59 if (cfg->segment > new->segment || in list_add_sorted()
60 (cfg->segment == new->segment && in list_add_sorted()
61 cfg->start_bus >= new->start_bus)) { in list_add_sorted()
62 list_add_tail_rcu(&new->list, &cfg->list); in list_add_sorted()
120 struct pci_mmcfg_region *cfg; in pci_mmconfig_lookup() local
122 list_for_each_entry_rcu(cfg, &pci_mmcfg_list, list, pci_mmcfg_lock_held()) in pci_mmconfig_lookup()
123 if (cfg->segment == segment && in pci_mmconfig_lookup()
124 cfg->start_bus <= bus && bus <= cfg->end_bus) in pci_mmconfig_lookup()
125 return cfg; in pci_mmconfig_lookup()
326 struct pci_mmcfg_region *cfg, *cfgx; in pci_mmcfg_check_end_bus_number() local
329 list_for_each_entry(cfg, &pci_mmcfg_list, list) { in pci_mmcfg_check_end_bus_number()
330 if (cfg->end_bus < cfg->start_bus) in pci_mmcfg_check_end_bus_number()
331 cfg->end_bus = 255; in pci_mmcfg_check_end_bus_number()
334 if (cfg->list.next == &pci_mmcfg_list) in pci_mmcfg_check_end_bus_number()
337 cfgx = list_entry(cfg->list.next, typeof(*cfg), list); in pci_mmcfg_check_end_bus_number()
338 if (cfg->end_bus >= cfgx->start_bus) in pci_mmcfg_check_end_bus_number()
339 cfg->end_bus = cfgx->start_bus - 1; in pci_mmcfg_check_end_bus_number()
448 struct pci_mmcfg_region *cfg, in is_mmconf_reserved() argument
451 u64 addr = cfg->res.start; in is_mmconf_reserved()
452 u64 size = resource_size(&cfg->res); in is_mmconf_reserved()
468 &cfg->res, method); in is_mmconf_reserved()
471 &cfg->res, method); in is_mmconf_reserved()
475 cfg->end_bus = cfg->start_bus + ((size>>20) - 1); in is_mmconf_reserved()
476 num_buses = cfg->end_bus - cfg->start_bus + 1; in is_mmconf_reserved()
477 cfg->res.end = cfg->res.start + in is_mmconf_reserved()
479 snprintf(cfg->name, PCI_MMCFG_RESOURCE_NAME_LEN, in is_mmconf_reserved()
481 cfg->segment, cfg->start_bus, cfg->end_bus); in is_mmconf_reserved()
487 &cfg->res, (unsigned long) cfg->address); in is_mmconf_reserved()
492 cfg->segment, cfg->start_bus, cfg->end_bus, in is_mmconf_reserved()
493 &cfg->res, (unsigned long) cfg->address); in is_mmconf_reserved()
500 pci_mmcfg_check_reserved(struct device *dev, struct pci_mmcfg_region *cfg, int early) in pci_mmcfg_check_reserved() argument
503 if (is_mmconf_reserved(is_acpi_reserved, cfg, dev, 0)) in pci_mmcfg_check_reserved()
510 &cfg->res); in pci_mmcfg_check_reserved()
515 &cfg->res); in pci_mmcfg_check_reserved()
530 return is_mmconf_reserved(e820__mapped_all, cfg, dev, 1); in pci_mmcfg_check_reserved()
537 struct pci_mmcfg_region *cfg; in pci_mmcfg_reject_broken() local
539 list_for_each_entry(cfg, &pci_mmcfg_list, list) { in pci_mmcfg_reject_broken()
540 if (pci_mmcfg_check_reserved(NULL, cfg, early) == 0) { in pci_mmcfg_reject_broken()
549 struct acpi_mcfg_allocation *cfg) in acpi_mcfg_check_entry() argument
551 if (cfg->address < 0xFFFFFFFF) in acpi_mcfg_check_entry()
561 "is above 4GB, ignored\n", cfg->pci_segment, in acpi_mcfg_check_entry()
562 cfg->start_bus_number, cfg->end_bus_number, cfg->address); in acpi_mcfg_check_entry()
569 struct acpi_mcfg_allocation *cfg_table, *cfg; in pci_parse_mcfg() local
593 cfg = &cfg_table[i]; in pci_parse_mcfg()
594 if (acpi_mcfg_check_entry(mcfg, cfg)) { in pci_parse_mcfg()
599 if (pci_mmconfig_add(cfg->pci_segment, cfg->start_bus_number, in pci_parse_mcfg()
600 cfg->end_bus_number, cfg->address) == NULL) { in pci_parse_mcfg()
617 struct pci_mmcfg_region *cfg; in pci_mmcfg_for_each_region() local
623 list_for_each_entry(cfg, &pci_mmcfg_list, list) { in pci_mmcfg_for_each_region()
624 rc = func(cfg->res.start, resource_size(&cfg->res), data); in pci_mmcfg_for_each_region()
643 const struct pci_mmcfg_region *cfg; in __pci_mmcfg_init() local
645 list_for_each_entry(cfg, &pci_mmcfg_list, list) { in __pci_mmcfg_init()
646 if (cfg->segment) in __pci_mmcfg_init()
648 pcibios_last_bus = cfg->end_bus; in __pci_mmcfg_init()
693 struct pci_mmcfg_region *cfg; in pci_mmcfg_late_insert_resources() local
706 list_for_each_entry(cfg, &pci_mmcfg_list, list) in pci_mmcfg_late_insert_resources()
707 if (!cfg->res.parent) in pci_mmcfg_late_insert_resources()
708 insert_resource(&iomem_resource, &cfg->res); in pci_mmcfg_late_insert_resources()
726 struct pci_mmcfg_region *cfg; in pci_mmconfig_insert() local
735 cfg = pci_mmconfig_lookup(seg, start); in pci_mmconfig_insert()
736 if (cfg) { in pci_mmconfig_insert()
737 if (cfg->end_bus < end) in pci_mmconfig_insert()
742 cfg->segment, cfg->start_bus, cfg->end_bus); in pci_mmconfig_insert()
753 cfg = pci_mmconfig_alloc(seg, start, end, addr); in pci_mmconfig_insert()
754 if (cfg == NULL) { in pci_mmconfig_insert()
757 } else if (!pci_mmcfg_check_reserved(dev, cfg, 0)) { in pci_mmconfig_insert()
759 &cfg->res); in pci_mmconfig_insert()
764 &cfg->res); in pci_mmconfig_insert()
770 &cfg->res, tmp->name, tmp); in pci_mmconfig_insert()
771 } else if (pci_mmcfg_arch_map(cfg)) { in pci_mmconfig_insert()
773 &cfg->res); in pci_mmconfig_insert()
775 list_add_sorted(cfg); in pci_mmconfig_insert()
777 &cfg->res, (unsigned long)addr); in pci_mmconfig_insert()
778 cfg = NULL; in pci_mmconfig_insert()
783 if (cfg) { in pci_mmconfig_insert()
784 if (cfg->res.parent) in pci_mmconfig_insert()
785 release_resource(&cfg->res); in pci_mmconfig_insert()
786 kfree(cfg); in pci_mmconfig_insert()
797 struct pci_mmcfg_region *cfg; in pci_mmconfig_delete() local
800 list_for_each_entry_rcu(cfg, &pci_mmcfg_list, list) in pci_mmconfig_delete()
801 if (cfg->segment == seg && cfg->start_bus == start && in pci_mmconfig_delete()
802 cfg->end_bus == end) { in pci_mmconfig_delete()
803 list_del_rcu(&cfg->list); in pci_mmconfig_delete()
805 pci_mmcfg_arch_unmap(cfg); in pci_mmconfig_delete()
806 if (cfg->res.parent) in pci_mmconfig_delete()
807 release_resource(&cfg->res); in pci_mmconfig_delete()
809 kfree(cfg); in pci_mmconfig_delete()