Memory resource problems with CardBus
Pavel Roskin
proski at gnu.org
Sat May 15 18:30:19 EDT 2004
On Sat, 15 May 2004, Russell King wrote:
> Maybe we should get the kernel to automatically reallocate the windows
> if they're smaller than a parameterised limit defaulting to, say, 1MB ?
There are already limits for memory and I/O windows, 16k and 32 bytes
respectively.
The attached patch checks that the preassigned window is at least as long
as the minimal size. If it's shorter, the window is reconfigured.
There is still code that allows shorter memory windows if the root
resource is too short. But preconfigured short windows are no longer
preserved.
--
Regards,
Pavel Roskin
-------------- next part --------------
--- linux.orig/drivers/pcmcia/yenta_socket.c
+++ linux/drivers/pcmcia/yenta_socket.c
@@ -548,20 +548,32 @@ static void yenta_allocate_res(struct ye
start = config_readl(socket, offset) & mask;
end = config_readl(socket, offset+4) | ~mask;
+
+ if (type & IORESOURCE_IO) {
+ min = BRIDGE_IO_MIN;
+ } else {
+ min = BRIDGE_MEM_MIN;
+ }
+
if (start && end > start) {
- res->start = start;
- res->end = end;
- if (request_resource(root, res) == 0)
- return;
- printk(KERN_INFO "yenta %s: Preassigned resource %d busy, reconfiguring...\n",
- pci_name(socket->dev), nr);
- res->start = res->end = 0;
+ if (end + 1 - start >= min) {
+ res->start = start;
+ res->end = end;
+ if (request_resource(root, res) == 0)
+ return;
+ printk(KERN_INFO "yenta %s: Preassigned resource %d "
+ "busy, reconfiguring...\n", pci_name(socket->dev), nr);
+ res->start = res->end = 0;
+ } else {
+ printk(KERN_INFO "yenta %s: Preassigned resource %d "
+ "too short, reconfiguring...\n",
+ pci_name(socket->dev), nr);
+ }
}
if (type & IORESOURCE_IO) {
align = 1024;
size = BRIDGE_IO_MAX;
- min = BRIDGE_IO_MIN;
start = PCIBIOS_MIN_CARDBUS_IO;
end = ~0U;
} else {
@@ -578,7 +590,6 @@ static void yenta_allocate_res(struct ye
}
if (size < BRIDGE_MEM_MIN)
size = BRIDGE_MEM_MIN;
- min = BRIDGE_MEM_MIN;
align = size;
start = PCIBIOS_MIN_MEM;
end = ~0U;
More information about the linux-pcmcia
mailing list