@@ -1,6 +1,7 @@
/**
* Copyright (c) ???? Jochen Schäuble <psionic@psionic.de>
* Copyright (c) 2003-2004 Joern Engel <joern@wh.fh-wedel.de>
+ * Copyright (c) 2012 Hervé Fache <h-fache@ti.com>
*
* Usage:
*
@@ -233,7 +234,16 @@ static inline void kill_final_newline(char *str)
return 1; \
} while (0)
-static int phram_setup(const char *val, struct kernel_param *kp)
+/* This shall contain the module parameter if any. It is of the form:
+ * phram=<device>,<address>,<size> for module case
+ * phram.phram=<device>,<address>,<size> for built-in case
+ We leave 64 bytes for the device name, 12 for the address and 12 for the
+ size.
+ Example: phram.phram=rootfs,0xa0000000,512Mi
+*/
+static __initdata char phram_paramline[64+12+12];
+
+static int phram_setup(const char *val)
{
char buf[64+12+12], *str = buf;
char *token[3];
@@ -282,12 +292,26 @@ static int phram_setup(const char *val, struct kernel_param *kp)
return ret;
}
-module_param_call(phram, phram_setup, NULL, NULL, 000);
+static int phram_param_call(const char *val, struct kernel_param *kp)
+{
+ /* This function is always called before 'init_phram()', whether built-in or
+ module. */
+ if (strlen(val) >= sizeof(phram_paramline))
+ return -ENOSPC;
+ strcpy(phram_paramline, val);
+
+ return 0;
+}
+
+module_param_call(phram, phram_param_call, NULL, NULL, 000);
MODULE_PARM_DESC(phram, "Memory region to map. \"phram=<name>,<start>,<length>\"");
static int __init init_phram(void)
{
+ if (phram_paramline[0])
+ return phram_setup(phram_paramline);
+
return 0;
}