pcmcia: rsrc_nonstatic.c
   allocate minimum io/mem for X86 system
   without running the pcmcia-socket-startup.

---

--- linux-2.6.32-rc7/drivers/pcmcia/rsrc_nonstatic.c.orig       2009-11-14 
07:58:40.000000000 +0900
+++ linux-2.6.32-rc7/drivers/pcmcia/rsrc_nonstatic.c    2009-11-14 
08:48:27.000000000 +0900
@@ -47,6 +47,13 @@ INT_MODULE_PARM(probe_io,    1);             /* IO por
 INT_MODULE_PARM(mem_limit,     0x10000);
 #endif
 
+#if defined(CONFIG_X86)
+static int default_io[] = {0x100, 0x3af, 0x3e0, 0x3ff};
+static int default_mem[] = {0xd0000, 0xdffff, 0xa0000000, 0xa0ffffff};
+static int default_io_count = sizeof(default_io)/sizeof(*default_io);
+static int default_mem_count = sizeof(default_mem)/sizeof(*default_mem);
+#endif
+
 /* for io_db and mem_db */
 struct resource_map {
        u_long                  base, num;
@@ -774,14 +781,28 @@ static int adjust_io(struct pcmcia_socke
 }
 
 
-#ifdef CONFIG_PCI
 static int nonstatic_autoadd_resources(struct pcmcia_socket *s)
 {
        struct resource *res;
        int i, done = 0;
 
+#if defined(CONFIG_X86)
+       /* allocate minimum io/mem resources */
+       for (i = 0; i < default_io_count; i = i + 2) {
+               if (!adjust_io(s, ADD_MANAGED_RESOURCE,
+                               default_io[i], default_io[i+1]))
+                       done |= IORESOURCE_IO;
+       }
+       for (i = 0; i < default_mem_count; i = i + 2) {
+               if (!adjust_memory(s, ADD_MANAGED_RESOURCE,
+                               default_mem[i], default_mem[i+1]))
+                       done |= IORESOURCE_MEM;
+       }
+#endif
+
+#ifdef CONFIG_PCI
        if (!s->cb_dev || !s->cb_dev->bus)
-               return -ENODEV;
+               goto out;
 
 #if defined(CONFIG_X86)
        /* If this is the root bus, the risk of hitting
@@ -791,7 +812,7 @@ static int nonstatic_autoadd_resources(s
         * of resources at the moment.
         */
        if (s->cb_dev->bus->number == 0)
-               return -EINVAL;
+               goto out;
 #endif
 
        for (i=0; i < PCI_BUS_NUM_RESOURCES; i++) {
@@ -824,7 +845,9 @@ static int nonstatic_autoadd_resources(s
                                done |= IORESOURCE_MEM;
                }
        }
+out:
 
+#endif
        /* 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))
@@ -833,16 +856,6 @@ static int nonstatic_autoadd_resources(s
        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;



_______________________________________________
Linux PCMCIA reimplementation list
http://lists.infradead.org/mailman/listinfo/linux-pcmcia

Reply via email to