diff options
Diffstat (limited to 'init/main.c')
-rw-r--r-- | init/main.c | 79 |
1 files changed, 70 insertions, 9 deletions
diff --git a/init/main.c b/init/main.c index f715b9b89753..0766e69712b2 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -11,11 +11,9 @@ | |||
11 | 11 | ||
12 | #define __KERNEL_SYSCALLS__ | 12 | #define __KERNEL_SYSCALLS__ |
13 | 13 | ||
14 | #include <linux/config.h> | ||
15 | #include <linux/types.h> | 14 | #include <linux/types.h> |
16 | #include <linux/module.h> | 15 | #include <linux/module.h> |
17 | #include <linux/proc_fs.h> | 16 | #include <linux/proc_fs.h> |
18 | #include <linux/devfs_fs_kernel.h> | ||
19 | #include <linux/kernel.h> | 17 | #include <linux/kernel.h> |
20 | #include <linux/syscalls.h> | 18 | #include <linux/syscalls.h> |
21 | #include <linux/string.h> | 19 | #include <linux/string.h> |
@@ -43,10 +41,16 @@ | |||
43 | #include <linux/cpu.h> | 41 | #include <linux/cpu.h> |
44 | #include <linux/cpuset.h> | 42 | #include <linux/cpuset.h> |
45 | #include <linux/efi.h> | 43 | #include <linux/efi.h> |
44 | #include <linux/taskstats_kern.h> | ||
45 | #include <linux/delayacct.h> | ||
46 | #include <linux/unistd.h> | 46 | #include <linux/unistd.h> |
47 | #include <linux/rmap.h> | 47 | #include <linux/rmap.h> |
48 | #include <linux/mempolicy.h> | 48 | #include <linux/mempolicy.h> |
49 | #include <linux/key.h> | 49 | #include <linux/key.h> |
50 | #include <linux/unwind.h> | ||
51 | #include <linux/buffer_head.h> | ||
52 | #include <linux/debug_locks.h> | ||
53 | #include <linux/lockdep.h> | ||
50 | 54 | ||
51 | #include <asm/io.h> | 55 | #include <asm/io.h> |
52 | #include <asm/bugs.h> | 56 | #include <asm/bugs.h> |
@@ -79,7 +83,6 @@ extern void mca_init(void); | |||
79 | extern void sbus_init(void); | 83 | extern void sbus_init(void); |
80 | extern void sysctl_init(void); | 84 | extern void sysctl_init(void); |
81 | extern void signals_init(void); | 85 | extern void signals_init(void); |
82 | extern void buffer_init(void); | ||
83 | extern void pidhash_init(void); | 86 | extern void pidhash_init(void); |
84 | extern void pidmap_init(void); | 87 | extern void pidmap_init(void); |
85 | extern void prio_tree_init(void); | 88 | extern void prio_tree_init(void); |
@@ -125,6 +128,18 @@ static char *ramdisk_execute_command; | |||
125 | static unsigned int max_cpus = NR_CPUS; | 128 | static unsigned int max_cpus = NR_CPUS; |
126 | 129 | ||
127 | /* | 130 | /* |
131 | * If set, this is an indication to the drivers that reset the underlying | ||
132 | * device before going ahead with the initialization otherwise driver might | ||
133 | * rely on the BIOS and skip the reset operation. | ||
134 | * | ||
135 | * This is useful if kernel is booting in an unreliable environment. | ||
136 | * For ex. kdump situaiton where previous kernel has crashed, BIOS has been | ||
137 | * skipped and devices will be in unknown state. | ||
138 | */ | ||
139 | unsigned int reset_devices; | ||
140 | EXPORT_SYMBOL(reset_devices); | ||
141 | |||
142 | /* | ||
128 | * Setup routine for controlling SMP activation | 143 | * Setup routine for controlling SMP activation |
129 | * | 144 | * |
130 | * Command-line option of "nosmp" or "maxcpus=0" will disable SMP | 145 | * Command-line option of "nosmp" or "maxcpus=0" will disable SMP |
@@ -150,6 +165,14 @@ static int __init maxcpus(char *str) | |||
150 | 165 | ||
151 | __setup("maxcpus=", maxcpus); | 166 | __setup("maxcpus=", maxcpus); |
152 | 167 | ||
168 | static int __init set_reset_devices(char *str) | ||
169 | { | ||
170 | reset_devices = 1; | ||
171 | return 1; | ||
172 | } | ||
173 | |||
174 | __setup("reset_devices", set_reset_devices); | ||
175 | |||
153 | static char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, }; | 176 | static char * argv_init[MAX_INIT_ARGS+2] = { "init", NULL, }; |
154 | char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, }; | 177 | char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, }; |
155 | static const char *panic_later, *panic_param; | 178 | static const char *panic_later, *panic_param; |
@@ -159,16 +182,19 @@ extern struct obs_kernel_param __setup_start[], __setup_end[]; | |||
159 | static int __init obsolete_checksetup(char *line) | 182 | static int __init obsolete_checksetup(char *line) |
160 | { | 183 | { |
161 | struct obs_kernel_param *p; | 184 | struct obs_kernel_param *p; |
185 | int had_early_param = 0; | ||
162 | 186 | ||
163 | p = __setup_start; | 187 | p = __setup_start; |
164 | do { | 188 | do { |
165 | int n = strlen(p->str); | 189 | int n = strlen(p->str); |
166 | if (!strncmp(line, p->str, n)) { | 190 | if (!strncmp(line, p->str, n)) { |
167 | if (p->early) { | 191 | if (p->early) { |
168 | /* Already done in parse_early_param? (Needs | 192 | /* Already done in parse_early_param? |
169 | * exact match on param part) */ | 193 | * (Needs exact match on param part). |
194 | * Keep iterating, as we can have early | ||
195 | * params and __setups of same names 8( */ | ||
170 | if (line[n] == '\0' || line[n] == '=') | 196 | if (line[n] == '\0' || line[n] == '=') |
171 | return 1; | 197 | had_early_param = 1; |
172 | } else if (!p->setup_func) { | 198 | } else if (!p->setup_func) { |
173 | printk(KERN_WARNING "Parameter %s is obsolete," | 199 | printk(KERN_WARNING "Parameter %s is obsolete," |
174 | " ignored\n", p->str); | 200 | " ignored\n", p->str); |
@@ -178,7 +204,8 @@ static int __init obsolete_checksetup(char *line) | |||
178 | } | 204 | } |
179 | p++; | 205 | p++; |
180 | } while (p < __setup_end); | 206 | } while (p < __setup_end); |
181 | return 0; | 207 | |
208 | return had_early_param; | ||
182 | } | 209 | } |
183 | 210 | ||
184 | /* | 211 | /* |
@@ -446,10 +473,28 @@ static void __init boot_cpu_init(void) | |||
446 | cpu_set(cpu, cpu_possible_map); | 473 | cpu_set(cpu, cpu_possible_map); |
447 | } | 474 | } |
448 | 475 | ||
476 | void __init __attribute__((weak)) smp_setup_processor_id(void) | ||
477 | { | ||
478 | } | ||
479 | |||
449 | asmlinkage void __init start_kernel(void) | 480 | asmlinkage void __init start_kernel(void) |
450 | { | 481 | { |
451 | char * command_line; | 482 | char * command_line; |
452 | extern struct kernel_param __start___param[], __stop___param[]; | 483 | extern struct kernel_param __start___param[], __stop___param[]; |
484 | |||
485 | smp_setup_processor_id(); | ||
486 | |||
487 | /* | ||
488 | * Need to run as early as possible, to initialize the | ||
489 | * lockdep hash: | ||
490 | */ | ||
491 | unwind_init(); | ||
492 | lockdep_init(); | ||
493 | |||
494 | local_irq_disable(); | ||
495 | early_boot_irqs_off(); | ||
496 | early_init_irq_lock_class(); | ||
497 | |||
453 | /* | 498 | /* |
454 | * Interrupts are still disabled. Do necessary setups, then | 499 | * Interrupts are still disabled. Do necessary setups, then |
455 | * enable them | 500 | * enable them |
@@ -489,7 +534,13 @@ asmlinkage void __init start_kernel(void) | |||
489 | init_timers(); | 534 | init_timers(); |
490 | hrtimers_init(); | 535 | hrtimers_init(); |
491 | softirq_init(); | 536 | softirq_init(); |
537 | timekeeping_init(); | ||
492 | time_init(); | 538 | time_init(); |
539 | profile_init(); | ||
540 | if (!irqs_disabled()) | ||
541 | printk("start_kernel(): bug: interrupts were enabled early\n"); | ||
542 | early_boot_irqs_on(); | ||
543 | local_irq_enable(); | ||
493 | 544 | ||
494 | /* | 545 | /* |
495 | * HACK ALERT! This is early. We're enabling the console before | 546 | * HACK ALERT! This is early. We're enabling the console before |
@@ -499,8 +550,16 @@ asmlinkage void __init start_kernel(void) | |||
499 | console_init(); | 550 | console_init(); |
500 | if (panic_later) | 551 | if (panic_later) |
501 | panic(panic_later, panic_param); | 552 | panic(panic_later, panic_param); |
502 | profile_init(); | 553 | |
503 | local_irq_enable(); | 554 | lockdep_info(); |
555 | |||
556 | /* | ||
557 | * Need to run this when irqs are enabled, because it wants | ||
558 | * to self-test [hard/soft]-irqs on/off lock inversion bugs | ||
559 | * too: | ||
560 | */ | ||
561 | locking_selftest(); | ||
562 | |||
504 | #ifdef CONFIG_BLK_DEV_INITRD | 563 | #ifdef CONFIG_BLK_DEV_INITRD |
505 | if (initrd_start && !initrd_below_start_ok && | 564 | if (initrd_start && !initrd_below_start_ok && |
506 | initrd_start < min_low_pfn << PAGE_SHIFT) { | 565 | initrd_start < min_low_pfn << PAGE_SHIFT) { |
@@ -541,6 +600,8 @@ asmlinkage void __init start_kernel(void) | |||
541 | proc_root_init(); | 600 | proc_root_init(); |
542 | #endif | 601 | #endif |
543 | cpuset_init(); | 602 | cpuset_init(); |
603 | taskstats_init_early(); | ||
604 | delayacct_init(); | ||
544 | 605 | ||
545 | check_bugs(); | 606 | check_bugs(); |
546 | 607 | ||