1 #include <linux/init.h>
7 struct pci_root_info pci_root_info
[PCI_ROOT_NR
];
9 void x86_pci_root_bus_res_quirks(struct pci_bus
*b
)
13 struct pci_root_info
*info
;
15 /* don't go for it if _CRS is used already */
16 if (b
->resource
[0] != &ioport_resource
||
17 b
->resource
[1] != &iomem_resource
)
23 for (i
= 0; i
< pci_root_num
; i
++) {
24 if (pci_root_info
[i
].bus_min
== b
->number
)
28 if (i
== pci_root_num
)
31 printk(KERN_DEBUG
"PCI: peer root bus %02x res updated from pci conf\n",
34 info
= &pci_root_info
[i
];
35 for (j
= 0; j
< info
->res_num
; j
++) {
37 struct resource
*root
;
41 if (res
->flags
& IORESOURCE_IO
)
42 root
= &ioport_resource
;
44 root
= &iomem_resource
;
45 insert_resource(root
, res
);
49 void __devinit
update_res(struct pci_root_info
*info
, resource_size_t start
,
50 resource_size_t end
, unsigned long flags
, int merge
)
61 /* try to merge it with old one */
62 for (i
= 0; i
< info
->res_num
; i
++) {
63 resource_size_t final_start
, final_end
;
64 resource_size_t common_start
, common_end
;
67 if (res
->flags
!= flags
)
70 common_start
= max(res
->start
, start
);
71 common_end
= min(res
->end
, end
);
72 if (common_start
> common_end
+ 1)
75 final_start
= min(res
->start
, start
);
76 final_end
= max(res
->end
, end
);
78 res
->start
= final_start
;
85 /* need to add that */
86 if (info
->res_num
>= RES_NUM
)
89 res
= &info
->res
[info
->res_num
];
90 res
->name
= info
->name
;