patch-2.2.16 linux/arch/s390/kernel/setup.c

Next file: linux/arch/s390/kernel/signal.c
Previous file: linux/arch/s390/kernel/s390mach.c
Back to the patch index
Back to the overall index

diff -urN v2.2.15/linux/arch/s390/kernel/setup.c linux/arch/s390/kernel/setup.c
@@ -97,39 +97,60 @@
 }
 
 /*
+ * VM halt and poweroff setup routines
+ */
+char vmhalt_cmd[128] = "";
+char vmpoff_cmd[128] = "";
+
+static inline void strncpy_skip_quote(char *dst, char *src, int n)
+{
+        int sx, dx;
+
+        dx = 0;
+        for (sx = 0; src[sx] != 0; sx++) {
+                if (src[sx] == '"') continue;
+                dst[dx++] = src[sx];
+                if (dx >= n) break;
+        }
+}
+
+__initfunc(void vmhalt_setup(char *str, char *ints))
+{
+        strncpy_skip_quote(vmhalt_cmd, str, 127);
+        vmhalt_cmd[127] = 0;
+        return;
+}
+
+__initfunc(void vmpoff_setup(char *str, char *ints))
+{
+        strncpy_skip_quote(vmpoff_cmd, str, 127);
+        vmpoff_cmd[127] = 0;
+        return;
+}
+
+/*
  * Reboot, halt and power_off routines for non SMP.
  */
+
 #ifndef __SMP__
 void machine_restart(char * __unused)
 {
   reipl(S390_lowcore.ipl_device); 
-#if 0
-        if (MACHINE_IS_VM) {
-                cpcmd("IPL", NULL, 0);
-        } else {
-                /* FIXME: how to reipl ? */
-                disabled_wait(2);
-        }
-#endif
 }
 
 void machine_halt(void)
 {
-        if (MACHINE_IS_VM) {
-                cpcmd("IPL 200 STOP", NULL, 0);
-        } else {
+        if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0) 
+                cpcmd(vmhalt_cmd, NULL, 0);
                 disabled_wait(0);
         }
-}
 
 void machine_power_off(void)
 {
-        if (MACHINE_IS_VM) {
-                cpcmd("IPL CMS", NULL, 0);
-        } else {
+        if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0)
+                cpcmd(vmpoff_cmd, NULL, 0);
                 disabled_wait(0);
         }
-}
 #endif
 
 /*
@@ -190,6 +211,13 @@
 #endif
         memory_start = (unsigned long) &_end;    /* fixit if use $CODELO etc*/
 	memory_end = MEMORY_SIZE;
+        /*
+         * We need some free virtual space to be able to do vmalloc.
+         * On a machine with 2GB memory we make sure that we have at
+         * least 128 MB free space for vmalloc.
+         */
+        if (memory_end > 1920*1024*1024)
+                memory_end = 1920*1024*1024;
         init_task.mm->start_code = PAGE_OFFSET;
         init_task.mm->end_code = (unsigned long) &_etext;
         init_task.mm->end_data = (unsigned long) &_edata;
@@ -208,7 +236,6 @@
                  * memory size
                  */
                 if (c == ' ' && strncmp(from, "mem=", 4) == 0) {
-                        if (to != command_line) to--;
                         memory_end = simple_strtoul(from+4, &from, 0);
                         if ( *from == 'K' || *from == 'k' ) {
                                 memory_end = memory_end << 10;
@@ -218,10 +245,12 @@
                                 from++;
                         }
                 }
+                /*
+                 * "ipldelay=XXX[sSmM]" waits for the specified time
+                 */
                 if (c == ' ' && strncmp(from, "ipldelay=", 9) == 0) {
                         unsigned long delay;
 
-			if (to != command_line) to--;
                         delay = simple_strtoul(from+9, &from, 0);
 			if (*from == 's' || *from == 'S') {
 				delay = delay*1000000;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)