summaryrefslogtreecommitdiff
path: root/cpu/mpc85xx
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2009-09-03 08:20:24 -0500
committerTom Rix <Tom.Rix@windriver.com>2009-10-03 09:04:16 -0500
commit176c84efc5760a78deb3f68bd23a987d26b6f099 (patch)
tree3f7f4ad5722d55c7e8b2f33b90ac0195ea3be192 /cpu/mpc85xx
parente568fd99ab26a469646b9ad670443923174919c1 (diff)
downloadu-boot-imx-176c84efc5760a78deb3f68bd23a987d26b6f099.zip
u-boot-imx-176c84efc5760a78deb3f68bd23a987d26b6f099.tar.gz
u-boot-imx-176c84efc5760a78deb3f68bd23a987d26b6f099.tar.bz2
ppc/85xx: Add a simple function to search the TLB
Allow us to search the TLB array based on an address. This is useful if we want to change an entry but dont know where it happens to be located. For example, the boot page mapping we use on MP or the flash TLB that we change the WIMGE settings for after we've relocated. Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'cpu/mpc85xx')
-rw-r--r--cpu/mpc85xx/tlb.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/cpu/mpc85xx/tlb.c b/cpu/mpc85xx/tlb.c
index f3d3080..0497a29 100644
--- a/cpu/mpc85xx/tlb.c
+++ b/cpu/mpc85xx/tlb.c
@@ -106,6 +106,33 @@ void init_tlbs(void)
return ;
}
+static void tlbsx (const volatile unsigned *addr)
+{
+ __asm__ __volatile__ ("tlbsx 0,%0" : : "r" (addr), "m" (*addr));
+}
+
+/* return -1 if we didn't find anything */
+int find_tlb_idx(void *addr, u8 tlbsel)
+{
+ u32 _mas0, _mas1;
+
+ /* zero out Search PID, AS */
+ mtspr(MAS6, 0);
+
+ tlbsx(addr);
+
+ _mas0 = mfspr(MAS0);
+ _mas1 = mfspr(MAS1);
+
+ /* we found something, and its in the TLB we expect */
+ if ((MAS1_VALID & _mas1) &&
+ (MAS0_TLBSEL(tlbsel) == (_mas0 & MAS0_TLBSEL_MSK))) {
+ return ((_mas0 & MAS0_ESEL_MSK) >> 16);
+ }
+
+ return -1;
+}
+
#ifdef CONFIG_ADDR_MAP
void init_addr_map(void)
{