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_res_quirks(struct pci_bus
*b
)
14 struct pci_root_info
*info
;
16 /* don't go for it if _CRS is used already */
17 if (b
->resource
[0] != &ioport_resource
||
18 b
->resource
[1] != &iomem_resource
)
24 for (i
= 0; i
< pci_root_num
; i
++) {
25 if (pci_root_info
[i
].bus_min
== b
->number
)
29 if (i
== pci_root_num
)
32 printk(KERN_DEBUG
"PCI: peer root bus %02x res updated from pci conf\n",
35 pci_bus_remove_resources(b
);
36 info
= &pci_root_info
[i
];
37 for (j
= 0; j
< info
->res_num
; j
++) {
39 struct resource
*root
;
42 pci_bus_add_resource(b
, res
, 0);
43 if (res
->flags
& IORESOURCE_IO
)
44 root
= &ioport_resource
;
46 root
= &iomem_resource
;
47 insert_resource(root
, res
);
51 void __devinit
update_res(struct pci_root_info
*info
, resource_size_t start
,
52 resource_size_t end
, unsigned long flags
, int merge
)
60 if (start
== MAX_RESOURCE
)
66 /* try to merge it with old one */
67 for (i
= 0; i
< info
->res_num
; i
++) {
68 resource_size_t final_start
, final_end
;
69 resource_size_t common_start
, common_end
;
72 if (res
->flags
!= flags
)
75 common_start
= max(res
->start
, start
);
76 common_end
= min(res
->end
, end
);
77 if (common_start
> common_end
+ 1)
80 final_start
= min(res
->start
, start
);
81 final_end
= max(res
->end
, end
);
83 res
->start
= final_start
;
90 /* need to add that */
91 if (info
->res_num
>= RES_NUM
)
94 res
= &info
->res
[info
->res_num
];
95 res
->name
= info
->name
;