From ink@jurassic.park.msu.ru Mon Jun  6 17:16:28 2005
Date: Tue, 7 Jun 2005 04:07:02 +0400
From: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
To: gregkh@suse.de
Cc: ak@suse.de, akpm@osdl.org, len.brown@intel.com,
	rajesh.shah@intel.com, linux@dominikbrodowski.net
Subject: PCI: handle subtractive decode pci-pci bridge better
Message-ID: <20050607040702.A31561@jurassic.park.msu.ru>

With the number of PCI bus resources increased to 8, we can
handle the subtractive decode PCI-PCI bridge like a normal
bridge, taking into account standard PCI-PCI bridge windows
(resources 0-2). This helps to avoid problems with peer-to-peer DMA
behind such bridges, poor performance for MMIO ranges outside bridge
windows and prefetchable vs. non-prefetchable memory issues.

To reflect the fact that such bridges do forward all addresses to
the secondary bus (transparency), remaining bus resources 3-7 are
linked to resources 0-4 of the primary bus. These resources will be
used as fallback by resource management code if allocation from
standard bridge windows fails for some reason.

Signed-off-by: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Acked-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/pci/probe.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

--- gregkh-2.6.orig/drivers/pci/probe.c	2005-06-09 22:37:09.000000000 -0700
+++ gregkh-2.6/drivers/pci/probe.c	2005-06-09 22:37:31.000000000 -0700
@@ -239,9 +239,8 @@
 
 	if (dev->transparent) {
 		printk(KERN_INFO "PCI: Transparent bridge - %s\n", pci_name(dev));
-		for(i = 0; i < PCI_BUS_NUM_RESOURCES; i++)
-			child->resource[i] = child->parent->resource[i];
-		return;
+		for(i = 3; i < PCI_BUS_NUM_RESOURCES; i++)
+			child->resource[i] = child->parent->resource[i - 3];
 	}
 
 	for(i=0; i<3; i++)
