All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. J. Lu" <hjl@lucon.org>
To: dhinds <dhinds@sonic.net>, bombe@informatik.tu-muenchen.de
Cc: linux kernel <linux-kernel@vger.kernel.org>
Subject: PATCH: Fix CardBus bridge behind a PCI bridge
Date: Mon, 12 Aug 2002 10:49:02 -0700	[thread overview]
Message-ID: <20020812104902.A18430@lucon.org> (raw)
In-Reply-To: <20020810222355.A13749@lucon.org>; from hjl@lucon.org on Sat, Aug 10, 2002 at 10:23:55PM -0700

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

On Sat, Aug 10, 2002 at 10:23:55PM -0700, H. J. Lu wrote:
> On Fri, Aug 09, 2002 at 05:21:40PM -0700, dhinds wrote:
> > On Fri, Aug 09, 2002 at 04:48:35PM -0700, H. J. Lu wrote:
> > > On Fri, Aug 09, 2002 at 04:05:06PM -0700, dhinds wrote:
> > > > There's a current thread on linux-kernel about "PCI hotplug resource
> > > > reservation" that is relevant, and there's a patch that claims to
> > > > provide a workable solution to the problem for cPCI.
> > > 
> > > Thanks. Do you think if the "PCI<->PCI bridges, transparent resource
> > > fix" thread is related to it?
> > 
> > I glanced at that and didn't think so, but I didn't read much.
> > 
> 
> I think they are relevant. Your pcmcia-cs 3.20 works fine on Sony. Here
> is the output of "lspci -v". PCI bride has
> 
> 	I/O behind bridge: 00004000-00004fff
> 	Memory behind bridge: e8200000-e82fffff
> 
> The kernel cardbus code tries to allocate memory and I/O from them. It
> doesn't work. BTW, I checked another notebook. That code is not reached
> at all since slot has been initialized by BIOS. Your pcmcia-cs doesn't
> follow the PCI brigde:
> 
> 	I/O ports at 0200
> 	Memory at 60040000 (32-bit, non-prefetchable)
> 
> and works. Any ides why?
> 

Here is a patch against 2.4.18 to fix CardBus bridge behind a PCI
bridge with positive decode. I checked Windows XP. It is how it
allocates resources for the CardBus slots, that is outside of
the memory and I/O windows on the PCI bridge.

Let me know if it works for you. 


H.J.

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

--- linux/drivers/pcmcia/yenta.c.bridge	Sat Aug 10 20:30:35 2002
+++ linux/drivers/pcmcia/yenta.c	Mon Aug 12 10:41:56 2002
@@ -712,6 +712,7 @@ static void yenta_allocate_res(pci_socke
 	u32 align, size, min, max;
 	unsigned offset;
 	unsigned mask;
+	int failed;
 
 	/* The granularity of the memory limit is 4kB, on IO it's 4 bytes */
 	mask = ~0xfff;
@@ -739,17 +740,39 @@ 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)
-		return;
+
+	do {
+		failed = allocate_resource(root, res, size, min, max,
+					   align, NULL, NULL);
+		if (failed) {
+			/* If we failed to allocate the resources here, we
+			   try its parent if we are on a bridge with
+			   positive decode.  */
+			struct pci_dev *bridge;
+			bus = bus->parent;
+			if (bus == NULL)
+				return;
+			bridge = bus->self;
+			if (bridge == NULL
+			    || (bridge->class >> 16) != PCI_BASE_CLASS_BRIDGE
+			    || (bridge->class & 0xff) != 0)
+				return;
+			res->name = bridge->subordinate->name;
+			root = pci_find_parent_resource(bridge, res);
+		}
+	} while (failed);
 
 	config_writel(socket, offset, res->start);
 	config_writel(socket, offset+4, res->end);

       reply	other threads:[~2002-08-12 17:45 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             ` H. J. Lu [this message]
     [not found]               ` <20020812110431.A14125@sonic.net>
     [not found]                 ` <20020812112911.A18947@lucon.org>
     [not found]                   ` <20020812122158.A27172@sonic.net>
2002-08-12 21:07                     ` PATCH: Fix CardBus bridge behind a PCI bridge H. J. Lu
     [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=20020812104902.A18430@lucon.org \
    --to=hjl@lucon.org \
    --cc=bombe@informatik.tu-muenchen.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.