Subject: [PATCH] PCI: Return host bridge window res for bus addr converting We need to check if there is window or not, and also need to use that window res as parent for resource requesting. Signed-off-by: Yinghai Lu --- drivers/pci/host-bridge.c | 10 +++++++++- include/linux/pci.h | 5 +++-- 2 files changed, 12 insertions(+), 3 deletions(-) Index: linux-2.6/drivers/pci/host-bridge.c =================================================================== --- linux-2.6.orig/drivers/pci/host-bridge.c +++ linux-2.6/drivers/pci/host-bridge.c @@ -70,12 +70,17 @@ static bool region_contains(struct pci_b return region1->start <= region2->start && region1->end >= region2->end; } -void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res, +/* + * return host bridge window resource + */ +struct resource *pcibios_bus_to_resource(struct pci_bus *bus, + struct resource *res, struct pci_bus_region *region) { struct pci_host_bridge *bridge = pci_find_host_bridge(bus); struct resource_entry *window; resource_size_t offset = 0; + struct resource *res_ret = NULL; resource_list_for_each_entry(window, &bridge->windows) { struct pci_bus_region bus_region; @@ -88,11 +93,14 @@ void pcibios_bus_to_resource(struct pci_ if (region_contains(&bus_region, region)) { offset = window->offset; + res_ret = window->res; break; } } res->start = region->start + offset; res->end = region->end + offset; + + return res_ret; } EXPORT_SYMBOL(pcibios_bus_to_resource); Index: linux-2.6/include/linux/pci.h =================================================================== --- linux-2.6.orig/include/linux/pci.h +++ linux-2.6/include/linux/pci.h @@ -781,8 +781,9 @@ void pci_fixup_cardbus(struct pci_bus *) void pcibios_resource_to_bus(struct pci_bus *bus, struct pci_bus_region *region, struct resource *res); -void pcibios_bus_to_resource(struct pci_bus *bus, struct resource *res, - struct pci_bus_region *region); +struct resource *pcibios_bus_to_resource(struct pci_bus *bus, + struct resource *res, + struct pci_bus_region *region); void pcibios_scan_specific_bus(int busn); struct pci_bus *pci_find_bus(int domain, int busnr); void pci_bus_add_devices(const struct pci_bus *bus);