PCI resource allocation bug

From: S. Baker
Date: Wed Aug 27 2003 - 19:25:58 EST


Hi,
Could someone tell me if this is a bug, or if this should
be used in a different manner? I am using
pci_assign_resource(dev, 7);
Where:
dev->resource[7].start = 0
dev->resource[7].end = size to allocate
dev->resource[7].flags = IORESOURCE_MEM

In pci_assign_resource, 'min' gets assigned to PCIBIOS_MIN_MEM
(all that is important here is that it is not 0).
Also, 'align' gets assigned to 'res->start' (resource[7].start
from above). which is 0.

This routine calls allocate_resource, which calls find_resource,
in which we find that new->start (again resource[7].start above)
gets set to min. Then, there is the fateful line:
new->start = (new->start + align - 1) & ~(align - 1);
Since we know that align = 0, then ~(align-1) = 0, thus
new->start get assigned 0 again. This doesn't work, it
should be left to be min.

In kernel 2.4.18, the align variable was set to size, and thus
this all works. I can get it to be set to size again by using
resource 6 instead of 7, but I don't think that is the correct
solution here.

I would propose a patch, but I'm not sure what the intent here
is.

Could responses please be CC'd to me?

Thanks,
S. Baker
bakers@xxxxxxxxx

-
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/