U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Timur Tabi <timur@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/5] powerpc/85xx: verify the current address of CCSR before relocating it
Date: Mon, 31 Oct 2011 13:30:44 -0500	[thread overview]
Message-ID: <1320085845-10547-4-git-send-email-timur@freescale.com> (raw)
In-Reply-To: <1320085845-10547-1-git-send-email-timur@freescale.com>

Verify that CCSR is actually located where it is supposed to be before
we relocate it.  This is useful in detecting U-Boot configurations that
are broken (e.g. an incorrect value for CONFIG_SYS_CCSRBAR_DEFAULT).
If the current value is wrong, we enter an infinite loop, which is handy
for debuggers.

Signed-off-by: Timur Tabi <timur@freescale.com>
---
 arch/powerpc/cpu/mpc85xx/start.S |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/cpu/mpc85xx/start.S b/arch/powerpc/cpu/mpc85xx/start.S
index ccb331a..6de8765 100644
--- a/arch/powerpc/cpu/mpc85xx/start.S
+++ b/arch/powerpc/cpu/mpc85xx/start.S
@@ -422,6 +422,33 @@ create_ccsr_old_tlb:
 	msync
 	tlbwe
 
+	/*
+	 * We have a TLB for what we think is the current (old) CCSR.  Let's
+	 * verify that, otherwise we won't be able to move it.
+	 * CONFIG_SYS_CCSRBAR_DEFAULT is always a 32-bit number, so we only
+	 * need to compare the lower 32 bits of CCSRBAR on CoreNet systems.
+	 */
+verify_old_ccsr:
+	lis     r0, CONFIG_SYS_CCSRBAR_DEFAULT at h
+	ori     r0, r0, CONFIG_SYS_CCSRBAR_DEFAULT at l
+#ifdef CONFIG_FSL_CORENET
+	lwz	r1, 4(r9)		/* CCSRBARL */
+#else
+	lwz	r1, 0(r9)		/* CCSRBAR, shifted right by 12 */
+	slwi	r1, r1, 12
+#endif
+
+	cmpl	0, r0, r1
+
+	/*
+	 * If the value we read from CCSRBARL is not what we expect, then
+	 * enter an infinite loop.  This will at least allow a debugger to
+	 * halt execution and examine TLBs, etc.  There's no point in going
+	 * on.
+	 */
+infinite_debug_loop:
+	bne	infinite_debug_loop
+
 #ifdef CONFIG_FSL_CORENET
 
 #define CCSR_LAWBARH0	(CONFIG_SYS_CCSRBAR + 0x1000)
-- 
1.7.3.4

  parent reply	other threads:[~2011-10-31 18:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-31 18:30 [U-Boot] [PATCH 1/5] powerpc/85xx: fix definition of MAS register macros Timur Tabi
2011-10-31 18:30 ` [U-Boot] [PATCH 2/5] powerpc/85xx: fix some comments in the CCSR relocation code Timur Tabi
2011-11-08 14:31   ` Kumar Gala
2011-10-31 18:30 ` [U-Boot] [PATCH 3/5] powerpc/85xx: add some missing sync instructions " Timur Tabi
2011-11-08 14:32   ` Kumar Gala
2011-10-31 18:30 ` Timur Tabi [this message]
2011-11-08 14:32   ` [U-Boot] [PATCH 4/5] powerpc/85xx: verify the current address of CCSR before relocating it Kumar Gala
2011-10-31 18:30 ` [U-Boot] [PATCH 5/5] powerpc/85xx: resize the boot page TLB before relocating CCSR Timur Tabi
2011-11-08 14:32   ` Kumar Gala
2011-11-08 14:31 ` [U-Boot] [PATCH 1/5] powerpc/85xx: fix definition of MAS register macros Kumar Gala

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=1320085845-10547-4-git-send-email-timur@freescale.com \
    --to=timur@freescale.com \
    --cc=u-boot@lists.denx.de \
    /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