aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin/kernel
diff options
context:
space:
mode:
authorRobin Getz <robin.getz@analog.com>2009-06-18 18:53:43 -0400
committerMike Frysinger <vapier@gentoo.org>2009-06-22 21:16:17 -0400
commitbd854c077e660b5f44b5049219645042bcba61ac (patch)
tree19f464eecd7d93db5055d10abc182d194849d582 /arch/blackfin/kernel
parent3aca47c02097a78a566f67e7ec5fa3e0f2583a73 (diff)
Blackfin: fix early crash when booting on wrong cpu
Make sure we process the kernel command line before poking the hardware, so that we can process early printk. This helps ensure that if you boot a kernel configured for a different processor, something will be left in the log buffer. Signed-off-by: Robin Getz <robin.getz@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin/kernel')
-rw-r--r--arch/blackfin/kernel/setup.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 8d7892820130..298f023bcc09 100644
--- a/arch/blackfin/kernel/setup.c
+++ b/arch/blackfin/kernel/setup.c
@@ -477,9 +477,11 @@ static __init void parse_cmdline_early(char *cmdline_p)
477 } else if (!memcmp(to, "clkin_hz=", 9)) { 477 } else if (!memcmp(to, "clkin_hz=", 9)) {
478 to += 9; 478 to += 9;
479 early_init_clkin_hz(to); 479 early_init_clkin_hz(to);
480#ifdef CONFIG_EARLY_PRINTK
480 } else if (!memcmp(to, "earlyprintk=", 12)) { 481 } else if (!memcmp(to, "earlyprintk=", 12)) {
481 to += 12; 482 to += 12;
482 setup_early_printk(to); 483 setup_early_printk(to);
484#endif
483 } else if (!memcmp(to, "memmap=", 7)) { 485 } else if (!memcmp(to, "memmap=", 7)) {
484 to += 7; 486 to += 7;
485 parse_memmap(to); 487 parse_memmap(to);
@@ -798,6 +800,11 @@ void __init setup_arch(char **cmdline_p)
798{ 800{
799 unsigned long sclk, cclk; 801 unsigned long sclk, cclk;
800 802
803 /* Check to make sure we are running on the right processor */
804 if (unlikely(CPUID != bfin_cpuid()))
805 printk(KERN_ERR "ERROR: Not running on ADSP-%s: unknown CPUID 0x%04x Rev 0.%d\n",
806 CPU, bfin_cpuid(), bfin_revid());
807
801#ifdef CONFIG_DUMMY_CONSOLE 808#ifdef CONFIG_DUMMY_CONSOLE
802 conswitchp = &dummy_con; 809 conswitchp = &dummy_con;
803#endif 810#endif
@@ -812,14 +819,17 @@ void __init setup_arch(char **cmdline_p)
812 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE); 819 memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
813 boot_command_line[COMMAND_LINE_SIZE - 1] = '\0'; 820 boot_command_line[COMMAND_LINE_SIZE - 1] = '\0';
814 821
815 /* setup memory defaults from the user config */
816 physical_mem_end = 0;
817 _ramend = get_mem_size() * 1024 * 1024;
818
819 memset(&bfin_memmap, 0, sizeof(bfin_memmap)); 822 memset(&bfin_memmap, 0, sizeof(bfin_memmap));
820 823
824 /* If the user does not specify things on the command line, use
825 * what the bootloader set things up as
826 */
827 physical_mem_end = 0;
821 parse_cmdline_early(&command_line[0]); 828 parse_cmdline_early(&command_line[0]);
822 829
830 if (_ramend == 0)
831 _ramend = get_mem_size() * 1024 * 1024;
832
823 if (physical_mem_end == 0) 833 if (physical_mem_end == 0)
824 physical_mem_end = _ramend; 834 physical_mem_end = _ramend;
825 835
@@ -910,10 +920,7 @@ void __init setup_arch(char **cmdline_p)
910 else 920 else
911 printk(KERN_INFO "Compiled for ADSP-%s Rev 0.%d\n", CPU, bfin_compiled_revid()); 921 printk(KERN_INFO "Compiled for ADSP-%s Rev 0.%d\n", CPU, bfin_compiled_revid());
912 922
913 if (unlikely(CPUID != bfin_cpuid())) 923 if (likely(CPUID == bfin_cpuid())) {
914 printk(KERN_ERR "ERROR: Not running on ADSP-%s: unknown CPUID 0x%04x Rev 0.%d\n",
915 CPU, bfin_cpuid(), bfin_revid());
916 else {
917 if (bfin_revid() != bfin_compiled_revid()) { 924 if (bfin_revid() != bfin_compiled_revid()) {
918 if (bfin_compiled_revid() == -1) 925 if (bfin_compiled_revid() == -1)
919 printk(KERN_ERR "Warning: Compiled for Rev none, but running on Rev %d\n", 926 printk(KERN_ERR "Warning: Compiled for Rev none, but running on Rev %d\n",