[PATCH] more for_each_cpu() conversions
[safe/jmp/linux-2.6] / arch / powerpc / kernel / setup_32.c
index 55f485f..dc2770d 100644 (file)
@@ -39,6 +39,8 @@
 #include <asm/nvram.h>
 #include <asm/xmon.h>
 #include <asm/time.h>
+#include <asm/serial.h>
+#include <asm/udbg.h>
 
 #include "setup.h"
 
@@ -57,10 +59,6 @@ extern void power4_idle(void);
 boot_infos_t *boot_infos;
 struct ide_machdep_calls ppc_ide_md;
 
-/* XXX should go elsewhere */
-int __irq_offset_value;
-EXPORT_SYMBOL(__irq_offset_value);
-
 int boot_cpuid;
 EXPORT_SYMBOL_GPL(boot_cpuid);
 int boot_cpuid_phys;
@@ -72,8 +70,6 @@ unsigned int DMA_MODE_WRITE;
 int have_of = 1;
 
 #ifdef CONFIG_PPC_MULTIPLATFORM
-int _machine = 0;
-
 extern void prep_init(void);
 extern void pmac_init(void);
 extern void chrp_init(void);
@@ -178,12 +174,23 @@ void __init platform_init(void)
  */
 void __init machine_init(unsigned long dt_ptr, unsigned long phys)
 {
+       /* If btext is enabled, we might have a BAT setup for early display,
+        * thus we do enable some very basic udbg output
+        */
+#ifdef CONFIG_BOOTX_TEXT
+       udbg_putc = btext_drawchar;
+#endif
+
+       /* Do some early initialization based on the flat device tree */
        early_init_devtree(__va(dt_ptr));
 
+       /* Check default command line */
 #ifdef CONFIG_CMDLINE
-       strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line));
+       if (cmd_line[0] == 0)
+               strlcpy(cmd_line, CONFIG_CMDLINE, sizeof(cmd_line));
 #endif /* CONFIG_CMDLINE */
 
+       /* Base init based on machine type */
        platform_init();
 
 #ifdef CONFIG_6xx
@@ -265,9 +272,8 @@ int __init ppc_init(void)
        if ( ppc_md.progress ) ppc_md.progress("             ", 0xffff);
 
        /* register CPU devices */
-       for (i = 0; i < NR_CPUS; i++)
-               if (cpu_possible(i))
-                       register_cpu(&cpu_devices[i], i, NULL);
+       for_each_cpu(i)
+               register_cpu(&cpu_devices[i], i, NULL);
 
        /* call platform init */
        if (ppc_md.init != NULL) {
@@ -281,7 +287,6 @@ arch_initcall(ppc_init);
 /* Warning, IO base is not yet inited */
 void __init setup_arch(char **cmdline_p)
 {
-       extern char *klimit;
        extern void do_init_bootmem(void);
 
        /* so udelay does something sensible, assume <= 1000 bogomips */
@@ -289,25 +294,20 @@ void __init setup_arch(char **cmdline_p)
 
        unflatten_device_tree();
        check_for_initrd();
-       finish_device_tree();
 
-       smp_setup_cpu_maps();
+       if (ppc_md.init_early)
+               ppc_md.init_early();
 
-#ifdef CONFIG_BOOTX_TEXT
-       init_boot_display();
-#endif
+       find_legacy_serial_ports();
+       finish_device_tree();
 
-#ifdef CONFIG_PPC_PMAC
-       /* This could be called "early setup arch", it must be done
-        * now because xmon need it
-        */
-       if (_machine == _MACH_Pmac)
-               pmac_feature_init();    /* New cool way */
-#endif
+       smp_setup_cpu_maps();
 
 #ifdef CONFIG_XMON_DEFAULT
        xmon_init(1);
 #endif
+       /* Register early console */
+       register_early_udbg_console();
 
 #if defined(CONFIG_KGDB)
        if (ppc_md.kgdb_map_scc)
@@ -340,7 +340,7 @@ void __init setup_arch(char **cmdline_p)
        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) klimit;
+       init_mm.brk = klimit;
 
        /* Save unparsed command line copy for /proc/cmdline */
        strlcpy(saved_command_line, cmd_line, COMMAND_LINE_SIZE);