Transparent" PCI-PCI bridges are currently "ignored" by the resource
management code in the PCI core. This means devices behind the bridge are
handled as if there was no bridge.
However, it seems more suitable -- and it seems to allow for proper
"prefetch"-type memory handling, too -- to handle a transparent PCI-PCI bridge
like any other PCI-PCI bridge, and to only break out of the limits set by
the bridge windows if the resource allocation code determines it needs to
The tricky part is in pci_find_parent_resource(). There are two types of
functions calling it: some functions already know the exact resource for
which they want to find the parent in order to properly insert it into the
resource database. This can be handled easily -- if the resource is inside
the bridge window, this is returned; if it isn't, the bridge's parent
resource is returned.
However, two callers (yenta_socket and i2o) intend something different: they
call pci_find_parent_resource() with an empty resource and want to find out
the biggest valid resource of the proper type in order to analyze it and
adapt its own hunger for resources to it. To keep this behaviour
backwards-compatible, we always need to not limit it to the bridge window
resources, but get back to the parent bus.
This patch is a modified and (hopefully) improved derivation of Linus'
"pcmcia-bridge-resource-management-fix.patch" included in 2.6.11-rc4-mm1.
Signed-off-by: Dominik Brodowski < XXXX@XXXXX.COM >
--- 2.6.11++.orig/drivers/pci/bus.c 2005-03-17 00:39:00.000000000 +0100
+++ 2.6.11++/drivers/pci/bus.c 2005-03-17 00:39:24.000000000 +0100
@@ -18,22 +18,12 @@
- * pci_bus_alloc_resource - allocate a resource from a parent bus
- * @bus: PCI bus
- * @res: resource to allocate
- * @size: size of resource to allocate
- * @align: alignment of resource to allocate
- * @min: minimum /proc/iomem address to allocate
- * @type_mask: IORESOURCE_* type flags
- * @alignf: resource alignment function
- * @alignf_data: data argument for resource alignment function
+ * pci_one_bus_alloc_resource - allocate a resource from one specific bus
- * Given the PCI bus a device resides on, the size, minimum address,
- * alignment and type, try to find an acceptable resource allocation
- * for a specific device resource.
+ * Always use pci_bus_alloc_resource() described below.
-pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
+pci_one_bus_alloc_resource(struct pci_bus *bus, struct resource *res,
unsigned long size, unsigned long align, unsigned long min,
unsigned int type_mask,
void (*alignf)(void *, struct resource *,
@@ -69,6 +59,48 @@
+ * pci_bus_alloc_resource - allocate a resource from a parent bus
+ * @bus: PCI bus
+ * @res: resource to allocate
+ * @size: size of resource to allocate
+ * @align: alignment of resource to allocate
+ * @min: minimum /proc/iomem address to allocate
+ * @type_mask: IORESOURCE_* type flags
+ * @alignf: resource alignment function
+ * @alignf_data: data argument for resource alignment function
+ * Given the PCI bus a device resides on, the size, minimum address,
+ * alignment and type, try to find an acceptable resource allocation
+ * for a specific device resource.