Re: pci_request_regions() failure
From: Alec H. Peterson
Date: Thu May 06 2004 - 14:59:15 EST
--On Thursday, May 6, 2004 3:50 PM -0400 "Richard B. Johnson"
<root@xxxxxxxxxxxxxxxxxx> wrote:
The BIOS should have aligned everything correctly.
0xec108fff - 0xec107000 = 0x1fff (0x2000 bytes)
0xec107000 / 0x2000 = 0x76083, * 0x2000 = 0xec106000
(where it should have been). Check to see if that region is
clear and if it is, write that address to the PCI
BAR. If it isn't, check the next higher address
(ex106000 + 0x2000), etc.
That region of memory is actually pretty tightly packed, but I think I have
managed to solve the problem.
In drivers/pcmcia/yenta.c, it seems that the regions of memory in question
are also too small in yenta_allocate_res() (BRIDGE_SIZE_MIN) in addition to
not being properly aligned. So, I added the following clause to check for
both cases (since yenta_allocate_res() will find a new block if necessary):
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;
Now everything is working perfectly, at least for me. I realize that this
sort of thing might break other stuff, but it seems to me that this sort of
check is a good idea regardless.
Note that this is my first attempt at a kernel patch, so please let me know
if this is horribly wrong or otherwise just a bad idea.
Thanks!
Alec
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/