]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - arch/s390/kernel/setup.c
[POWERPC] Clean up it_lp_queue.h
[linux-2.6-omap-h63xx.git] / arch / s390 / kernel / setup.c
index 31e7b19348b75947e1d97c780c912b1bea0427a6..b282034452a4707357dadd5b75d9be0f3bd83206 100644 (file)
@@ -47,6 +47,7 @@
 #include <asm/irq.h>
 #include <asm/page.h>
 #include <asm/ptrace.h>
+#include <asm/sections.h>
 
 /*
  * Machine setup..
@@ -65,11 +66,6 @@ volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */
 unsigned long __initdata zholes_size[MAX_NR_ZONES];
 static unsigned long __initdata memory_end;
 
-/*
- * Setup options
- */
-extern int _text,_etext, _edata, _end;
-
 /*
  * This is set up by the setup-routine at boot-time
  * for S390 need to find out, what we have to setup
@@ -78,19 +74,13 @@ extern int _text,_etext, _edata, _end;
 
 #include <asm/setup.h>
 
-static char command_line[COMMAND_LINE_SIZE] = { 0, };
-
 static struct resource code_resource = {
        .name  = "Kernel code",
-       .start = (unsigned long) &_text,
-       .end = (unsigned long) &_etext - 1,
        .flags = IORESOURCE_BUSY | IORESOURCE_MEM,
 };
 
 static struct resource data_resource = {
        .name = "Kernel data",
-       .start = (unsigned long) &_etext,
-       .end = (unsigned long) &_edata - 1,
        .flags = IORESOURCE_BUSY | IORESOURCE_MEM,
 };
 
@@ -268,7 +258,7 @@ static void do_machine_restart_nonsmp(char * __unused)
        reipl_diag();
 
        if (MACHINE_IS_VM)
-               cpcmd ("IPL", NULL, 0);
+               cpcmd ("IPL", NULL, 0, NULL);
        else
                reipl (0x10000 | S390_lowcore.ipl_device);
 }
@@ -276,14 +266,14 @@ static void do_machine_restart_nonsmp(char * __unused)
 static void do_machine_halt_nonsmp(void)
 {
         if (MACHINE_IS_VM && strlen(vmhalt_cmd) > 0)
-                cpcmd(vmhalt_cmd, NULL, 0);
+                cpcmd(vmhalt_cmd, NULL, 0, NULL);
         signal_processor(smp_processor_id(), sigp_stop_and_store_status);
 }
 
 static void do_machine_power_off_nonsmp(void)
 {
         if (MACHINE_IS_VM && strlen(vmpoff_cmd) > 0)
-                cpcmd(vmpoff_cmd, NULL, 0);
+                cpcmd(vmpoff_cmd, NULL, 0, NULL);
         signal_processor(smp_processor_id(), sigp_stop_and_store_status);
 }
 
@@ -315,6 +305,11 @@ void machine_power_off(void)
        _machine_power_off();
 }
 
+/*
+ * Dummy power off function.
+ */
+void (*pm_power_off)(void) = machine_power_off;
+
 static void __init
 add_memory_hole(unsigned long start, unsigned long end)
 {
@@ -330,63 +325,38 @@ add_memory_hole(unsigned long start, unsigned long end)
        }
 }
 
-static void __init
-parse_cmdline_early(char **cmdline_p)
+static int __init early_parse_mem(char *p)
+{
+       memory_end = memparse(p, &p);
+       return 0;
+}
+early_param("mem", early_parse_mem);
+
+/*
+ * "ipldelay=XXX[sm]" sets ipl delay in seconds or minutes
+ */
+static int __init early_parse_ipldelay(char *p)
 {
-       char c = ' ', cn, *to = command_line, *from = COMMAND_LINE;
        unsigned long delay = 0;
 
-       /* Save unparsed command line copy for /proc/cmdline */
-       memcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE);
-       saved_command_line[COMMAND_LINE_SIZE-1] = '\0';
+       delay = simple_strtoul(p, &p, 0);
 
-       for (;;) {
-               /*
-                * "mem=XXX[kKmM]" sets memsize
-                */
-               if (c == ' ' && strncmp(from, "mem=", 4) == 0) {
-                       memory_end = simple_strtoul(from+4, &from, 0);
-                       if ( *from == 'K' || *from == 'k' ) {
-                               memory_end = memory_end << 10;
-                               from++;
-                       } else if ( *from == 'M' || *from == 'm' ) {
-                               memory_end = memory_end << 20;
-                               from++;
-                       }
-               }
-               /*
-                * "ipldelay=XXX[sm]" sets ipl delay in seconds or minutes
-                */
-               if (c == ' ' && strncmp(from, "ipldelay=", 9) == 0) {
-                       delay = simple_strtoul(from+9, &from, 0);
-                       if (*from == 's' || *from == 'S') {
-                               delay = delay*1000000;
-                               from++;
-                       } else if (*from == 'm' || *from == 'M') {
-                               delay = delay*60*1000000;
-                               from++;
-                       }
-                       /* now wait for the requested amount of time */
-                       udelay(delay);
-               }
-               cn = *(from++);
-               if (!cn)
-                       break;
-               if (cn == '\n')
-                       cn = ' ';  /* replace newlines with space */
-               if (cn == 0x0d)
-                       cn = ' ';  /* replace 0x0d with space */
-               if (cn == ' ' && c == ' ')
-                       continue;  /* remove additional spaces */
-               c = cn;
-               if (to - command_line >= COMMAND_LINE_SIZE)
-                       break;
-               *(to++) = c;
+       switch (*p) {
+       case 's':
+       case 'S':
+               delay *= 1000000;
+               break;
+       case 'm':
+       case 'M':
+               delay *= 60 * 1000000;
        }
-       if (c == ' ' && to > command_line) to--;
-       *to = '\0';
-       *cmdline_p = command_line;
+
+       /* now wait for the requested amount of time */
+       udelay(delay);
+
+       return 0;
 }
+early_param("ipldelay", early_parse_ipldelay);
 
 static void __init
 setup_lowcore(void)
@@ -427,7 +397,7 @@ setup_lowcore(void)
                __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, 0) + PAGE_SIZE;
        lc->current_task = (unsigned long) init_thread_union.thread_info.task;
        lc->thread_info = (unsigned long) &init_thread_union;
-#ifndef CONFIG_ARCH_S390X
+#ifndef CONFIG_64BIT
        if (MACHINE_HAS_IEEE) {
                lc->extended_save_area_addr = (__u32)
                        __alloc_bootmem(PAGE_SIZE, PAGE_SIZE, 0);
@@ -444,6 +414,11 @@ setup_resources(void)
        struct resource *res;
        int i;
 
+       code_resource.start = (unsigned long) &_text;
+       code_resource.end = (unsigned long) &_etext - 1;
+       data_resource.start = (unsigned long) &_etext;
+       data_resource.end = (unsigned long) &_edata - 1;
+
        for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) {
                res = alloc_bootmem_low(sizeof(struct resource));
                res->flags = IORESOURCE_BUSY | IORESOURCE_MEM;
@@ -562,22 +537,39 @@ setup_arch(char **cmdline_p)
         /*
          * print what head.S has found out about the machine
          */
-#ifndef CONFIG_ARCH_S390X
+#ifndef CONFIG_64BIT
        printk((MACHINE_IS_VM) ?
               "We are running under VM (31 bit mode)\n" :
               "We are running native (31 bit mode)\n");
        printk((MACHINE_HAS_IEEE) ?
               "This machine has an IEEE fpu\n" :
               "This machine has no IEEE fpu\n");
-#else /* CONFIG_ARCH_S390X */
+#else /* CONFIG_64BIT */
        printk((MACHINE_IS_VM) ?
               "We are running under VM (64 bit mode)\n" :
               "We are running native (64 bit mode)\n");
-#endif /* CONFIG_ARCH_S390X */
+#endif /* CONFIG_64BIT */
+
+       /* Save unparsed command line copy for /proc/cmdline */
+       strlcpy(saved_command_line, COMMAND_LINE, COMMAND_LINE_SIZE);
+
+       *cmdline_p = COMMAND_LINE;
+       *(*cmdline_p + COMMAND_LINE_SIZE - 1) = '\0';
 
         ROOT_DEV = Root_RAM0;
-#ifndef CONFIG_ARCH_S390X
-       memory_end = memory_size & ~0x400000UL;  /* align memory end to 4MB */
+
+       init_mm.start_code = PAGE_OFFSET;
+       init_mm.end_code = (unsigned long) &_etext;
+       init_mm.end_data = (unsigned long) &_edata;
+       init_mm.brk = (unsigned long) &_end;
+
+       memory_end = memory_size;
+
+       parse_early_param();
+
+#ifndef CONFIG_64BIT
+       memory_end &= ~0x400000UL;
+
         /*
          * 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
@@ -585,16 +577,9 @@ setup_arch(char **cmdline_p)
          */
         if (memory_end > 1920*1024*1024)
                 memory_end = 1920*1024*1024;
-#else /* CONFIG_ARCH_S390X */
-       memory_end = memory_size & ~0x200000UL;  /* detected in head.s */
-#endif /* CONFIG_ARCH_S390X */
-
-       init_mm.start_code = PAGE_OFFSET;
-       init_mm.end_code = (unsigned long) &_etext;
-       init_mm.end_data = (unsigned long) &_edata;
-       init_mm.brk = (unsigned long) &_end;
-
-       parse_cmdline_early(cmdline_p);
+#else /* CONFIG_64BIT */
+       memory_end &= ~0x200000UL;
+#endif /* CONFIG_64BIT */
 
        setup_memory();
        setup_resources();
@@ -602,6 +587,7 @@ setup_arch(char **cmdline_p)
 
         cpu_init();
         __cpu_logical_map[0] = S390_lowcore.cpu_data.cpu_addr;
+       smp_setup_cpu_possible_map();
 
        /*
         * Create kernel page tables and switch to virtual addressing.