[Prism54-users] [Madwifi-users] PCI memory reservation failures

Alec H. Peterson ahp@hilander.com
Thu, 06 May 2004 19:45:41 -0600


Sorry for the crosspost, but this issue seems to have surfaced for users of 
both of these drivers.  And yes I know this is not describing a problem 
with either of the drivers represented on these lists, but hopefully people 
will find it relevant.

I believe I have found a fix to these problems.  The root cause of the 
problem is the fact that the BIOS in question is not aligning the memory it 
is assigning to the CardBus slots.  So the kernel is attempting to align it 
on its own, but then another problem comes up because in this case there is 
only 8K of memory available, and that is how much some of the cards need 
(in some cases they need even more).  According to the yenta driver the 
minimum amount of memory that should be allocated to each slot is 16K. 
Anyway, I have put a patch into drivers/pcmcia/yenta.c that looks like this 
(in yenta_allocate_res(), kernel 2.4.25):

        start = config_readl(socket, offset) & mask;
        end = config_readl(socket, offset+4) | ~mask;
#if 1
        if (!(type & IORESOURCE_IO) && (((end - start) < BRIDGE_SIZE_MIN) ||
            (start & (end - start))))
        {
                printk(KERN_INFO "yenta %s: Preassigned resource start %lx 
end %lx too small or not aligned.\n", socket->dev->slot_name, start, end);
                res->start = res->end = 0;
        }
        else
#endif
        if (start && end > start) {
                res->start = start;

Basically it is doing sanity checking on the memory that the PCI BIOS has 
pre-allocated, and if the sanity check fails it goes ahead and allocates a 
new block of memory (that happens automatically further along in 
yenta_allocate_res()).  With this patch in place I can now initialize and 
use both PrismGT and Atheros cards with no problems.

I welcome any feedback or input about this.  If this is good, bad, or an 
abomination against the kernel I would really like to hear about it.  I've 
sent it to the linux-kernel list as well (I received some helpful 
suggestions there) but I have not yet had any feedback about whether or not 
this is a good thing.  I don't have a huge variety of systems to test this 
against so I would really love to hear how this works on other systems.

Thanks!

Alec



-------------------------------------------------------
This SF.Net email is sponsored by Sleepycat Software
Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to 
deliver higher performing products faster, at low TCO.
http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3
_______________________________________________
Madwifi-users mailing list
Madwifi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/madwifi-users