[patch 5/19] pcmcia: mark parent bridge windows as resources
available for PCMCIA devices
Dominik Brodowski
linux at dominikbrodowski.net
Sun Mar 20 05:43:13 EST 2005
Automatically mark the parent PCI-PCI bridge windows as resources available
for PCMCIA usage.
Signed-off-by: Dominik Brodowski <linux at dominikbrodowski.net>
Index: 2.6.12-rc1/drivers/pcmcia/rsrc_mgr.c
===================================================================
--- 2.6.12-rc1.orig/drivers/pcmcia/rsrc_mgr.c 2005-03-19 11:49:09.000000000 +0100
+++ 2.6.12-rc1/drivers/pcmcia/rsrc_mgr.c 2005-03-19 11:55:25.000000000 +0100
@@ -72,7 +72,7 @@
/* you can't use the old interface if the new
* one was used before */
spin_lock_irqsave(&s->lock, flags);
- if ((s->resource_setup_done) &&
+ if ((s->resource_setup_new) &&
!(s->resource_setup_old)) {
spin_unlock_irqrestore(&s->lock, flags);
continue;
Index: 2.6.12-rc1/drivers/pcmcia/rsrc_nonstatic.c
===================================================================
--- 2.6.12-rc1.orig/drivers/pcmcia/rsrc_nonstatic.c 2005-03-19 11:55:18.000000000 +0100
+++ 2.6.12-rc1/drivers/pcmcia/rsrc_nonstatic.c 2005-03-19 11:56:02.000000000 +0100
@@ -768,6 +768,58 @@
return CS_UNSUPPORTED_FUNCTION;
}
+#ifdef CONFIG_PCI
+static int nonstatic_autoadd_resources(struct pcmcia_socket *s)
+{
+ struct resource *res;
+ int i, done = 0;
+
+ if (!s->cb_dev || !s->cb_dev->bus)
+ return -ENODEV;
+
+ for (i=0; i < PCI_BUS_NUM_RESOURCES; i++) {
+ res = s->cb_dev->bus->resource[i];
+ if (!res)
+ continue;
+
+ if (res->flags & IORESOURCE_IO) {
+ if (res == &ioport_resource)
+ continue;
+ printk(KERN_INFO "pcmcia: I/O behind socket: 0x%lx - 0x%lx\n",
+ res->start, res->end);
+ if (!adjust_io(s, ADD_MANAGED_RESOURCE, res->start, res->end))
+ done |= IORESOURCE_IO;
+
+ }
+
+ if (res->flags & IORESOURCE_MEM) {
+ if (res == &iomem_resource)
+ continue;
+ printk(KERN_INFO "pcmcia: Memory behind socket: 0x%lx - 0x%lx\n",
+ res->start, res->end);
+ if (!adjust_memory(s, ADD_MANAGED_RESOURCE, res->start, res->end))
+ done |= IORESOURCE_MEM;
+ }
+ }
+
+ /* if we got at least one of IO, and one of MEM, we can be glad and
+ * activate the PCMCIA subsystem */
+ if (done & (IORESOURCE_MEM | IORESOURCE_IO))
+ s->resource_setup_done = 1;
+
+ return 0;
+}
+
+#else
+
+static inline int nonstatic_autoadd_resources(struct pcmcia_socket *s)
+{
+ return -ENODEV;
+}
+
+#endif
+
+
static int nonstatic_init(struct pcmcia_socket *s)
{
struct socket_data *data;
@@ -782,6 +834,8 @@
s->resource_data = (void *) data;
+ nonstatic_autoadd_resources(s);
+
return 0;
}
@@ -862,6 +916,8 @@
return -EINVAL;
ret = adjust_io(s, add, start_addr, end_addr);
+ if (!ret)
+ s->resource_setup_new = 1;
return ret ? ret : count;
}
@@ -912,6 +968,8 @@
return -EINVAL;
ret = adjust_memory(s, add, start_addr, end_addr);
+ if (!ret)
+ s->resource_setup_new = 1;
return ret ? ret : count;
}
Index: 2.6.12-rc1/include/pcmcia/ss.h
===================================================================
--- 2.6.12-rc1.orig/include/pcmcia/ss.h 2005-03-19 11:49:09.000000000 +0100
+++ 2.6.12-rc1/include/pcmcia/ss.h 2005-03-19 11:55:25.000000000 +0100
@@ -211,8 +211,9 @@
/* is set to one if resource setup is done using adjust_resource_info() */
u8 resource_setup_old:1;
+ u8 resource_setup_new:1;
- u8 reserved:6;
+ u8 reserved:5;
/* socket operations */
struct pccard_operations * ops;
More information about the linux-pcmcia
mailing list