From: Ilpo Järvinen Subject: [PATCH] PCI: Check also host bridge windows in pbus_select_window_for_res_addr() Check also host bridge windows in pbus_select_window_for_res_addr() as they don't seem to appear in appear as root bus resources. Signed-off-by: Ilpo Järvinen --- drivers/pci/probe.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 097389f25853..66f0763113cb 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -206,10 +206,12 @@ static void __pci_size_rom(struct pci_dev *dev, unsigned int pos, u32 *sizes) } static struct resource *pbus_select_window_for_res_addr( - const struct pci_bus *bus, + struct pci_bus *bus, const struct resource *res) { unsigned long type = res->flags & IORESOURCE_TYPE_BITS; + struct pci_host_bridge *host_bridge; + struct resource_entry *window; struct resource *r; pci_bus_for_each_resource(bus, r) { @@ -222,6 +224,19 @@ static struct resource *pbus_select_window_for_res_addr( if (resource_contains(r, res)) return r; } + + if (!pci_is_root_bus(bus)) + return NULL; + + host_bridge = pci_find_host_bridge(bus); + resource_list_for_each_entry(window, &host_bridge->windows) { + if ((window->res->flags & IORESOURCE_TYPE_BITS) != type) + continue; + + if (resource_contains(window->res, res)) + return r; + } + return NULL; } -- tg: (7970e5d038d5..) fix/check-host-bridge-windows (depends on: fix/iov-resource-init)