mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: linux-kernel@vger.kernel.org
Cc: uclinux-dist-devel@blackfin.uclinux.org,
	Robin Getz <robin.getz@analog.com>
Subject: [PATCH 24/25] Blackfin: fix early crash when booting on wrong cpu
Date: Sat, 20 Jun 2009 14:44:47 -0400	[thread overview]
Message-ID: <1245523488-26536-25-git-send-email-vapier@gentoo.org> (raw)
In-Reply-To: <1245523488-26536-1-git-send-email-vapier@gentoo.org>

From: Robin Getz <robin.getz@analog.com>

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>
---
 arch/blackfin/kernel/setup.c |   23 +++++++++++++++--------
 1 files changed, 15 insertions(+), 8 deletions(-)

diff --git a/arch/blackfin/kernel/setup.c b/arch/blackfin/kernel/setup.c
index 8d78928..298f023 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)
 			} else if (!memcmp(to, "clkin_hz=", 9)) {
 				to += 9;
 				early_init_clkin_hz(to);
+#ifdef CONFIG_EARLY_PRINTK
 			} else if (!memcmp(to, "earlyprintk=", 12)) {
 				to += 12;
 				setup_early_printk(to);
+#endif
 			} else if (!memcmp(to, "memmap=", 7)) {
 				to += 7;
 				parse_memmap(to);
@@ -798,6 +800,11 @@ void __init setup_arch(char **cmdline_p)
 {
 	unsigned long sclk, cclk;
 
+	/* Check to make sure we are running on the right processor */
+	if (unlikely(CPUID != bfin_cpuid()))
+		printk(KERN_ERR "ERROR: Not running on ADSP-%s: unknown CPUID 0x%04x Rev 0.%d\n",
+			CPU, bfin_cpuid(), bfin_revid());
+
 #ifdef CONFIG_DUMMY_CONSOLE
 	conswitchp = &dummy_con;
 #endif
@@ -812,14 +819,17 @@ void __init setup_arch(char **cmdline_p)
 	memcpy(boot_command_line, command_line, COMMAND_LINE_SIZE);
 	boot_command_line[COMMAND_LINE_SIZE - 1] = '\0';
 
-	/* setup memory defaults from the user config */
-	physical_mem_end = 0;
-	_ramend = get_mem_size() * 1024 * 1024;
-
 	memset(&bfin_memmap, 0, sizeof(bfin_memmap));
 
+	/* If the user does not specify things on the command line, use
+	 * what the bootloader set things up as
+	 */
+	physical_mem_end = 0;
 	parse_cmdline_early(&command_line[0]);
 
+	if (_ramend == 0)
+		_ramend = get_mem_size() * 1024 * 1024;
+
 	if (physical_mem_end == 0)
 		physical_mem_end = _ramend;
 
@@ -910,10 +920,7 @@ void __init setup_arch(char **cmdline_p)
 	else
 		printk(KERN_INFO "Compiled for ADSP-%s Rev 0.%d\n", CPU, bfin_compiled_revid());
 
-	if (unlikely(CPUID != bfin_cpuid()))
-		printk(KERN_ERR "ERROR: Not running on ADSP-%s: unknown CPUID 0x%04x Rev 0.%d\n",
-			CPU, bfin_cpuid(), bfin_revid());
-	else {
+	if (likely(CPUID == bfin_cpuid())) {
 		if (bfin_revid() != bfin_compiled_revid()) {
 			if (bfin_compiled_revid() == -1)
 				printk(KERN_ERR "Warning: Compiled for Rev none, but running on Rev %d\n",
-- 
1.6.3.1


  parent reply	other threads:[~2009-06-20 18:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-20 18:44 [PATCH 00/25] Blackfin arch updates for 2.6.31 (part 3) Mike Frysinger
2009-06-20 18:44 ` [PATCH 01/25] Blackfin: unify memory region checks between kgdb and traps Mike Frysinger
2009-06-20 18:44 ` [PATCH 02/25] Blackfin: bf518f-ezbrd: update DSA resources Mike Frysinger
2009-06-20 18:44 ` [PATCH 03/25] Blackfin: bf533-ezkit: add resources for FISP devices Mike Frysinger
2009-06-20 18:44 ` [PATCH 04/25] Blackfin: update anomaly lists Mike Frysinger
2009-06-20 18:44 ` [PATCH 05/25] Blackfin: redo handling of bad irqs Mike Frysinger
2009-06-20 18:44 ` [PATCH 06/25] Blackfin: only build show_interrupts() when procfs is enabled Mike Frysinger
2009-06-20 18:44 ` [PATCH 07/25] Blackfin: simplify irq stack overflow checking Mike Frysinger
2009-06-20 18:44 ` [PATCH 08/25] Blackfin: abstract irq14 lowering in do_irq Mike Frysinger
2009-06-20 18:44 ` [PATCH 09/25] Blackfin: fix accidental reset in some boot modes Mike Frysinger
2009-06-20 18:44 ` [PATCH 10/25] Blackfin: bf526-ezbrd: set SPI flash resources to SST device Mike Frysinger
2009-06-20 18:44 ` [PATCH 11/25] Blackfin: allow people to select BF51x-0.1 silicon rev Mike Frysinger
2009-06-20 18:44 ` [PATCH 12/25] Blackfin: convert interrupt pipeline to irqflags Mike Frysinger
2009-06-20 18:44 ` [PATCH 13/25] Blackfin: allow CONFIG_TICKSOURCE_GPTMR0 with interrupt pipeline Mike Frysinger
2009-06-20 18:44 ` [PATCH 14/25] Blackfin: remove obsolete mcount support from I-pipe code Mike Frysinger
2009-06-20 18:44 ` [PATCH 15/25] Blackfin: update I-pipe patch level Mike Frysinger
2009-06-20 18:44 ` [PATCH 16/25] Blackfin: decouple unrelated cache settings to get exact behavior Mike Frysinger
2009-06-20 18:44 ` [PATCH 17/25] Blackfin: update defconfigs Mike Frysinger
2009-06-20 18:44 ` [PATCH 18/25] Blackfin: stick the CPU name into boot image name Mike Frysinger
2009-06-20 18:44 ` [PATCH 19/25] Blackfin: unify memory map headers Mike Frysinger
2009-06-20 18:44 ` [PATCH 20/25] Blackfin: fix typo in TRAS define in mem_init.h header Mike Frysinger
2009-06-20 18:44 ` [PATCH 21/25] Blackfin: bf526-ezbrd: handle different SDRAM chips Mike Frysinger
2009-06-20 18:44 ` [PATCH 22/25] Blackfin: drop unused ISP1760 port1_disable from board resources Mike Frysinger
2009-06-20 18:44 ` [PATCH 23/25] Blackfin: fix GPTMR0_CLOCKSOURCE dependency on BFIN_GPTIMERS Mike Frysinger
2009-06-20 18:44 ` Mike Frysinger [this message]
2009-06-20 18:44 ` [PATCH 25/25] Blackfin: drop BF535-specific text for exception 0x2A (unaligned instruction) Mike Frysinger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1245523488-26536-25-git-send-email-vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.getz@analog.com \
    --cc=uclinux-dist-devel@blackfin.uclinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®