aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/block/xpram.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/block/xpram.c')
-rw-r--r--drivers/s390/block/xpram.c74
1 files changed, 17 insertions, 57 deletions
diff --git a/drivers/s390/block/xpram.c b/drivers/s390/block/xpram.c
index 4c1e56b9b98d..1140302ff11d 100644
--- a/drivers/s390/block/xpram.c
+++ b/drivers/s390/block/xpram.c
@@ -71,11 +71,11 @@ static int xpram_devs;
71/* 71/*
72 * Parameter parsing functions. 72 * Parameter parsing functions.
73 */ 73 */
74static int devs = XPRAM_DEVS; 74static int __initdata devs = XPRAM_DEVS;
75static unsigned int sizes[XPRAM_MAX_DEVS]; 75static char __initdata *sizes[XPRAM_MAX_DEVS];
76 76
77module_param(devs, int, 0); 77module_param(devs, int, 0);
78module_param_array(sizes, int, NULL, 0); 78module_param_array(sizes, charp, NULL, 0);
79 79
80MODULE_PARM_DESC(devs, "number of devices (\"partitions\"), " \ 80MODULE_PARM_DESC(devs, "number of devices (\"partitions\"), " \
81 "the default is " __MODULE_STRING(XPRAM_DEVS) "\n"); 81 "the default is " __MODULE_STRING(XPRAM_DEVS) "\n");
@@ -86,59 +86,6 @@ MODULE_PARM_DESC(sizes, "list of device (partition) sizes " \
86 "claimed by explicit sizes\n"); 86 "claimed by explicit sizes\n");
87MODULE_LICENSE("GPL"); 87MODULE_LICENSE("GPL");
88 88
89#ifndef MODULE
90/*
91 * Parses the kernel parameters given in the kernel parameter line.
92 * The expected format is
93 * <number_of_partitions>[","<partition_size>]*
94 * where
95 * devices is a positive integer that initializes xpram_devs
96 * each size is a non-negative integer possibly followed by a
97 * magnitude (k,K,m,M,g,G), the list of sizes initialises
98 * xpram_sizes
99 *
100 * Arguments
101 * str: substring of kernel parameter line that contains xprams
102 * kernel parameters.
103 *
104 * Result 0 on success, -EINVAL else -- only for Version > 2.3
105 *
106 * Side effects
107 * the global variabls devs is set to the value of
108 * <number_of_partitions> and sizes[i] is set to the i-th
109 * partition size (if provided). A parsing error of a value
110 * results in this value being set to -EINVAL.
111 */
112static int __init xpram_setup (char *str)
113{
114 char *cp;
115 int i;
116
117 devs = simple_strtoul(str, &cp, 10);
118 if (cp <= str || devs > XPRAM_MAX_DEVS)
119 return 0;
120 for (i = 0; (i < devs) && (*cp++ == ','); i++) {
121 sizes[i] = simple_strtoul(cp, &cp, 10);
122 if (*cp == 'g' || *cp == 'G') {
123 sizes[i] <<= 20;
124 cp++;
125 } else if (*cp == 'm' || *cp == 'M') {
126 sizes[i] <<= 10;
127 cp++;
128 } else if (*cp == 'k' || *cp == 'K')
129 cp++;
130 while (isspace(*cp)) cp++;
131 }
132 if (*cp == ',' && i >= devs)
133 PRINT_WARN("partition sizes list has too many entries.\n");
134 else if (*cp != 0)
135 PRINT_WARN("ignored '%s' at end of parameter string.\n", cp);
136 return 1;
137}
138
139__setup("xpram_parts=", xpram_setup);
140#endif
141
142/* 89/*
143 * Copy expanded memory page (4kB) into main memory 90 * Copy expanded memory page (4kB) into main memory
144 * Arguments 91 * Arguments
@@ -357,6 +304,7 @@ static int __init xpram_setup_sizes(unsigned long pages)
357{ 304{
358 unsigned long mem_needed; 305 unsigned long mem_needed;
359 unsigned long mem_auto; 306 unsigned long mem_auto;
307 unsigned long long size;
360 int mem_auto_no; 308 int mem_auto_no;
361 int i; 309 int i;
362 310
@@ -374,7 +322,19 @@ static int __init xpram_setup_sizes(unsigned long pages)
374 mem_needed = 0; 322 mem_needed = 0;
375 mem_auto_no = 0; 323 mem_auto_no = 0;
376 for (i = 0; i < xpram_devs; i++) { 324 for (i = 0; i < xpram_devs; i++) {
377 xpram_sizes[i] = (sizes[i] + 3) & -4UL; 325 if (sizes[i]) {
326 size = simple_strtoull(sizes[i], &sizes[i], 0);
327 switch (sizes[i][0]) {
328 case 'g':
329 case 'G':
330 size <<= 20;
331 break;
332 case 'm':
333 case 'M':
334 size <<= 10;
335 }
336 xpram_sizes[i] = (size + 3) & -4UL;
337 }
378 if (xpram_sizes[i]) 338 if (xpram_sizes[i])
379 mem_needed += xpram_sizes[i]; 339 mem_needed += xpram_sizes[i];
380 else 340 else