lkml.org 
[lkml]   [2001]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH] yenta resource allocation fix
From
This fixes the problem of the yenta_socket driver not allocating IO port
windows if they weren't already. This caused no ports to be available
to a inserted CardBus card which in turn made the tulip driver complain
since it can't run without IO ports.

I'm no expert on the PCI/CardBus bridge stuff, but let's see: The OR
operation on the range end register with 0xfff seems pretty bogus to me.
Also the "if (start && ..." was always true since start included the 32
bit IO flag. What my patch does is to mask out the IO flags on both
start and end if the resource is indeed an IO resource, which seems
correct to me.

Now everything works for me. If I had known the fix was so easy I would
never have bothered with pcmcia-cs. Well, there is a problem that it
only picks up every second card insertion, so I have to
insert/remove/insert for my card to be recognized, but then it works.


diff -ruN linux-2.4.orig/drivers/pcmcia/yenta.c linux-2.4/drivers/pcmcia/yenta.c
--- linux-2.4.orig/drivers/pcmcia/yenta.c Fri Jul 27 02:21:28 2001
+++ linux-2.4/drivers/pcmcia/yenta.c Sun Aug 26 23:26:17 2001
@@ -701,8 +701,14 @@
struct resource *root, *res;
u32 start, end;
u32 align, size, min, max;
+ u32 mask;
unsigned offset;

+ if (type & IORESOURCE_IO)
+ mask = PCI_CB_IO_RANGE_MASK;
+ else
+ mask = ~0U;
+
offset = 0x1c + 8*nr;
bus = socket->dev->subordinate;
res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr;
@@ -715,8 +721,8 @@
if (!root)
return;

- start = config_readl(socket, offset);
- end = config_readl(socket, offset+4) | 0xfff;
+ start = config_readl(socket, offset) & mask;
+ end = config_readl(socket, offset+4) & mask;
if (start && end > start) {
res->start = start;
res->end = end;
--
Andreas E. Bombe <andreas.bombe@munich.netsurf.de> DSA key 0x04880A44
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:58    [W:0.020 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site