X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=init%2Fmain.c;h=a92989e7836af6acb73bb6ce8b95ad76ee727f53;hb=2bea90d43a050bbc4021d44e59beb34f384438db;hp=4e9e92bb2b89623507e1c145a6c9a275da7686a6;hpb=463020ce428e2f00d4f33a383d6f39c7453a6854;p=powerpc.git diff --git a/init/main.c b/init/main.c index 4e9e92bb2b..a92989e783 100644 --- a/init/main.c +++ b/init/main.c @@ -40,6 +40,8 @@ #include #include #include +#include +#include #include #include #include @@ -86,7 +88,6 @@ extern void init_IRQ(void); extern void fork_init(unsigned long); extern void mca_init(void); extern void sbus_init(void); -extern void sysctl_init(void); extern void signals_init(void); extern void pidhash_init(void); extern void pidmap_init(void); @@ -386,14 +387,19 @@ static void __init setup_per_cpu_areas(void) /* Called by boot processor to activate the rest. */ static void __init smp_init(void) { - unsigned int i; + unsigned int cpu; + unsigned highest = 0; + + for_each_cpu_mask(cpu, cpu_possible_map) + highest = cpu; + nr_cpu_ids = highest + 1; /* FIXME: This should be done in userspace --RR */ - for_each_present_cpu(i) { + for_each_present_cpu(cpu) { if (num_online_cpus() >= max_cpus) break; - if (!cpu_online(i)) - cpu_up(i); + if (!cpu_online(cpu)) + cpu_up(cpu); } /* Any cleanup work */ @@ -516,6 +522,7 @@ asmlinkage void __init start_kernel(void) * enable them */ lock_kernel(); + tick_init(); boot_cpu_init(); page_address_init(); printk(KERN_NOTICE); @@ -701,11 +708,7 @@ static void __init do_basic_setup(void) init_workqueues(); usermodehelper_init(); driver_init(); - -#ifdef CONFIG_SYSCTL - sysctl_init(); -#endif - + init_irq_proc(); do_initcalls(); } @@ -727,7 +730,49 @@ static void run_init_process(char *init_filename) kernel_execve(init_filename, argv_init, envp_init); } -static int init(void * unused) +/* This is a non __init function. Force it to be noinline otherwise gcc + * makes it inline to init() and it becomes part of init.text section + */ +static int noinline init_post(void) +{ + free_initmem(); + unlock_kernel(); + mark_rodata_ro(); + system_state = SYSTEM_RUNNING; + numa_default_policy(); + + if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) + printk(KERN_WARNING "Warning: unable to open an initial console.\n"); + + (void) sys_dup(0); + (void) sys_dup(0); + + if (ramdisk_execute_command) { + run_init_process(ramdisk_execute_command); + printk(KERN_WARNING "Failed to execute %s\n", + ramdisk_execute_command); + } + + /* + * We try each of these until one succeeds. + * + * The Bourne shell can be used instead of init if we are + * trying to recover a really broken machine. + */ + if (execute_command) { + run_init_process(execute_command); + printk(KERN_WARNING "Failed to execute %s. Attempting " + "defaults...\n", execute_command); + } + run_init_process("/sbin/init"); + run_init_process("/etc/init"); + run_init_process("/bin/init"); + run_init_process("/bin/sh"); + + panic("No init found. Try passing init= option to kernel."); +} + +static int __init init(void * unused) { lock_kernel(); /* @@ -775,39 +820,6 @@ static int init(void * unused) * we're essentially up and running. Get rid of the * initmem segments and start the user-mode stuff.. */ - free_initmem(); - unlock_kernel(); - mark_rodata_ro(); - system_state = SYSTEM_RUNNING; - numa_default_policy(); - - if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) - printk(KERN_WARNING "Warning: unable to open an initial console.\n"); - - (void) sys_dup(0); - (void) sys_dup(0); - - if (ramdisk_execute_command) { - run_init_process(ramdisk_execute_command); - printk(KERN_WARNING "Failed to execute %s\n", - ramdisk_execute_command); - } - - /* - * We try each of these until one succeeds. - * - * The Bourne shell can be used instead of init if we are - * trying to recover a really broken machine. - */ - if (execute_command) { - run_init_process(execute_command); - printk(KERN_WARNING "Failed to execute %s. Attempting " - "defaults...\n", execute_command); - } - run_init_process("/sbin/init"); - run_init_process("/etc/init"); - run_init_process("/bin/init"); - run_init_process("/bin/sh"); - - panic("No init found. Try passing init= option to kernel."); + init_post(); + return 0; }