1 #include <linux/init.h>
3 #include <linux/range.h>
8 struct pci_root_info pci_root_info[PCI_ROOT_NR];
10 void x86_pci_root_bus_resources(int bus, struct list_head *resources)
14 struct pci_root_info *info;
17 goto default_resources;
19 for (i = 0; i < pci_root_num; i++) {
20 if (pci_root_info[i].bus_min == bus)
24 if (i == pci_root_num)
25 goto default_resources;
27 printk(KERN_DEBUG "PCI: root bus %02x: hardware-probed resources\n",
30 info = &pci_root_info[i];
31 for (j = 0; j < info->res_num; j++) {
33 struct resource *root;
36 pci_add_resource(resources, res);
37 if (res->flags & IORESOURCE_IO)
38 root = &ioport_resource;
40 root = &iomem_resource;
41 insert_resource(root, res);
47 * We don't have any host bridge aperture information from the
48 * "native host bridge drivers," e.g., amd_bus or broadcom_bus,
49 * so fall back to the defaults historically used by pci_create_bus().
51 printk(KERN_DEBUG "PCI: root bus %02x: using default resources\n", bus);
52 pci_add_resource(resources, &ioport_resource);
53 pci_add_resource(resources, &iomem_resource);
56 void __devinit update_res(struct pci_root_info *info, resource_size_t start,
57 resource_size_t end, unsigned long flags, int merge)
65 if (start == MAX_RESOURCE)
71 /* try to merge it with old one */
72 for (i = 0; i < info->res_num; i++) {
73 resource_size_t final_start, final_end;
74 resource_size_t common_start, common_end;
77 if (res->flags != flags)
80 common_start = max(res->start, start);
81 common_end = min(res->end, end);
82 if (common_start > common_end + 1)
85 final_start = min(res->start, start);
86 final_end = max(res->end, end);
88 res->start = final_start;
95 /* need to add that */
96 if (info->res_num >= RES_NUM)
99 res = &info->res[info->res_num];
100 res->name = info->name;