From: Kumar Gala <galak@kernel.crashing.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] ppc/85xx: Fix bug in setup_mp code
Date: Thu, 3 Sep 2009 08:58:12 -0500 [thread overview]
Message-ID: <1251986292-32035-1-git-send-email-galak@kernel.crashing.org> (raw)
Its possible that we try and copy the boot page code out of flash into a
DDR location that doesn't have a TLB cover it. For example, if we have
3G of DDR we typically only map the first 2G. In the cases of 4G+ this
wasn't an issue since the reset page TLB mapping covered the last page
of memory which we wanted to copy to.
We now change the physical address of the reset page TLB to map to the
true physical location of the boot page code, copy and than set the
TLB back to its 1:1 mapping of the reset page.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
cpu/mpc85xx/mp.c | 32 +++++++++++++++++++++++++++++---
1 files changed, 29 insertions(+), 3 deletions(-)
diff --git a/cpu/mpc85xx/mp.c b/cpu/mpc85xx/mp.c
index 2df55c7..fa65bed 100644
--- a/cpu/mpc85xx/mp.c
+++ b/cpu/mpc85xx/mp.c
@@ -25,6 +25,7 @@
#include <ioports.h>
#include <lmb.h>
#include <asm/io.h>
+#include <asm/mmu.h>
#include "mp.h"
DECLARE_GLOBAL_DATA_PTR;
@@ -209,8 +210,33 @@ void setup_mp(void)
ulong fixup = (ulong)&__secondary_start_page;
u32 bootpg = determine_mp_bootpg();
- memcpy((void *)bootpg, (void *)fixup, 4096);
- flush_cache(bootpg, 4096);
+ /* look for the tlb covering the reset page, there better be one */
+ int i = find_tlb_idx((void *)0xfffff000, 1);
- pq3_mp_up(bootpg);
+ /* we found a match */
+ if (i != -1) {
+ /* map reset page to bootpg so we can copy code there */
+ disable_tlb(i);
+
+ set_tlb(1, 0xfffff000, bootpg, /* tlb, epn, rpn */
+ MAS3_SX|MAS3_SW|MAS3_SR, MAS2_M, /* perms, wimge */
+ 0, i, BOOKE_PAGESZ_4K, 1); /* ts, esel, tsize, iprot */
+
+ memcpy((void *)0xfffff000, (void *)fixup, 4096);
+ flush_cache(0xfffff000, 4096);
+
+ disable_tlb(i);
+
+ /* setup reset page back to 1:1, we'll use HW boot translation
+ * to map this where we want
+ */
+ set_tlb(1, 0xfffff000, 0xfffff000, /* tlb, epn, rpn */
+ MAS3_SX|MAS3_SW|MAS3_SR, MAS2_I, /* perms, wimge */
+ 0, i, BOOKE_PAGESZ_4K, 1); /* ts, esel, tsize, iprot */
+
+ pq3_mp_up(bootpg);
+ } else {
+ puts("WARNING: No reset page TLB. "
+ "Skipping secondary core setup\n");
+ }
}
--
1.6.0.6
next reply other threads:[~2009-09-03 13:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-03 13:58 Kumar Gala [this message]
2009-09-03 14:41 ` [U-Boot] [PATCH] ppc/85xx: Fix bug in setup_mp code Peter Tyser
2009-09-03 15:31 ` Kumar Gala
2010-01-21 22:06 ` Swarthout Edward L-SWARTHOU
2010-01-21 23:27 ` Peter Tyser
2009-09-05 18:04 ` 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=1251986292-32035-1-git-send-email-galak@kernel.crashing.org \
--to=galak@kernel.crashing.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.