public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. J. Lu" <hjl@lucon.org>
To: dhinds <dhinds@sonic.net>
Cc: linux kernel <linux-kernel@vger.kernel.org>
Subject: PATCH: Fix CardBus bridge behind a PCI bridge
Date: Mon, 12 Aug 2002 14:07:30 -0700	[thread overview]
Message-ID: <20020812140730.A21710@lucon.org> (raw)
In-Reply-To: <20020812122158.A27172@sonic.net>; from dhinds@sonic.net on Mon, Aug 12, 2002 at 12:21:58PM -0700

[-- Attachment #1: Type: text/plain, Size: 1176 bytes --]

On Mon, Aug 12, 2002 at 12:21:58PM -0700, dhinds wrote:
> On Mon, Aug 12, 2002 at 11:29:11AM -0700, H. J. Lu wrote:
> > 
> > > what does "positive decode" mean in this context?  Does the bridge
> > > somehow figure out that if no other device claims a transaction, that
> > > it should do so?
> > 
> > I am not a PCI expert. As I understand, if a PCI bridge does negative
> > decode, you don't need to do it for the CardBus bride behind it. I
> > guess it is only needed for positive decode. For some reason, a PCI
> > bridge with positive decode may pass address to the CardBus bridge
> > behind it or the CardBus bridge has some back door to the PCI bus.
> 
> I pulled up the datasheet for this chip and now I think maybe I
> understand what's going on.
> 
> It says that the PCI-to-PCI bridge function in this chip forwards all
> transactions to the external PCI bus.  The bridge windows determine
> ranges of addresses which it may claim back as a target, in this case
> I guess just for the LAN function, which is the only integrated device
> on bus 2.
> 
> So this actually seems to be effectively a transparent bridge.
> 

How about this pacth? It works for me.


H.J.

[-- Attachment #2: linux-2.4.18-yenta-bridge.patch --]
[-- Type: text/plain, Size: 1887 bytes --]

--- linux/drivers/pcmcia/yenta.c.bridge	Sat Aug 10 20:30:35 2002
+++ linux/drivers/pcmcia/yenta.c	Mon Aug 12 14:00:38 2002
@@ -706,7 +706,8 @@ static int yenta_suspend(pci_socket_t *s
 
 static void yenta_allocate_res(pci_socket_t *socket, int nr, unsigned type)
 {
-	struct pci_bus *bus;
+	struct pci_bus *bus, *parent;
+	struct pci_dev *bridge;
 	struct resource *root, *res;
 	u32 start, end;
 	u32 align, size, min, max;
@@ -739,17 +740,43 @@ static void yenta_allocate_res(pci_socke
 		return;
 	}
 
-	align = size = 4*1024*1024;
-	min = PCIBIOS_MIN_MEM; max = ~0U;
 	if (type & IORESOURCE_IO) {
 		align = 1024;
 		size = 256;
 		min = 0x4000;
 		max = 0xffff;
 	}
+	else {
+		align = size = 4*1024*1024;
+		min = PCIBIOS_MIN_MEM;
+		max = ~0U;
+	}
 		
-	if (allocate_resource(root, res, size, min, max, align, NULL, NULL) < 0)
+
+	/* We check if we are behind an Intel 82801BAM/CAM PCI bridge
+	   which is a transparent bridge for us. We just allocate
+	   resources from its parent.  */
+	parent = bus->parent;
+	if (parent != NULL) {
+		bridge = parent->self;
+		if (bridge != NULL
+		    && (bridge->class >> 8) == PCI_CLASS_BRIDGE_PCI
+		    && bridge->vendor == PCI_VENDOR_ID_INTEL
+		    && bridge->device >= PCI_DEVICE_ID_INTEL_82801BA_0
+		    && bridge->device <= PCI_DEVICE_ID_INTEL_82801BA_11) {
+			res->name = bridge->subordinate->name;
+			root = pci_find_parent_resource(bridge, res);
+		}
+	}
+
+	if (allocate_resource(root, res, size, min, max, align, NULL, NULL) < 0) {
+		printk (KERN_NOTICE "PCI: CardBus bridge (%04x:%04x, %04x:%04x): Failed to allocate %s resource: %d bytes!\n",
+			socket->dev->vendor, socket->dev->device,
+			socket->dev->subsystem_vendor,
+			socket->dev->subsystem_device,
+			(type & IORESOURCE_IO) ? "I/O" : "memory", size);
 		return;
+	}
 
 	config_writel(socket, offset, res->start);
 	config_writel(socket, offset+4, res->end);

  parent reply	other threads:[~2002-08-12 21:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20020806105023.A17451@lucon.org>
     [not found] ` <20020806112636.A29360@sonic.net>
     [not found]   ` <20020806130420.A19613@lucon.org>
     [not found]     ` <20020809160506.A19549@sonic.net>
     [not found]       ` <20020809164835.B21110@lucon.org>
     [not found]         ` <20020809172140.A30911@sonic.net>
     [not found]           ` <20020810222355.A13749@lucon.org>
2002-08-12 17:49             ` PATCH: Fix CardBus bridge behind a PCI bridge H. J. Lu
     [not found]               ` <20020812110431.A14125@sonic.net>
     [not found]                 ` <20020812112911.A18947@lucon.org>
     [not found]                   ` <20020812122158.A27172@sonic.net>
2002-08-12 21:07                     ` H. J. Lu [this message]
     [not found]                       ` <20020812154851.A20073@sonic.net>
2002-08-13  3:29                         ` PATCH: New fix for " H. J. Lu
2002-08-16 15:48                           ` Ivan Kokshaysky
2002-08-17  5:49                             ` H. J. Lu
2002-08-17 14:55                               ` Ivan Kokshaysky
2002-08-17 15:26                               ` Jeff Garzik
2002-08-17 15:36                                 ` H. J. Lu
2002-08-18 10:49                                   ` Ivan Kokshaysky
2002-08-18 14:28                                     ` H. J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020812140730.A21710@lucon.org \
    --to=hjl@lucon.org \
    --cc=dhinds@sonic.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox