]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
85xx: Add support to populate addr map based on TLB settings
authorKumar Gala <galak@kernel.crashing.org>
Tue, 16 Dec 2008 20:59:20 +0000 (14:59 -0600)
committerAndrew Fleming-AFLEMING <afleming@freescale.com>
Sat, 20 Dec 2008 00:20:08 +0000 (18:20 -0600)
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
cpu/mpc85xx/tlb.c
include/asm-ppc/mmu.h
lib_ppc/board.c

index a2d16ae2fa1017470c91363ea43b2fe7618a074a..5b5f7914f2ce0d4f788e5b4329717f443a7a765a 100644 (file)
 #include <common.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
+#ifdef CONFIG_ADDR_MAP
+#include <addr_map.h>
+#endif
+
+DECLARE_GLOBAL_DATA_PTR;
 
 void set_tlb(u8 tlb, u32 epn, u64 rpn,
             u8 perms, u8 wimge,
@@ -47,6 +52,11 @@ void set_tlb(u8 tlb, u32 epn, u64 rpn,
        mtspr(MAS7, _mas7);
 #endif
        asm volatile("isync;msync;tlbwe;isync");
+
+#ifdef CONFIG_ADDR_MAP
+       if ((tlb == 1) && (gd->flags & GD_FLG_RELOC))
+               addrmap_set_entry(epn, rpn, (1UL << ((tsize * 2) + 10)), esel);
+#endif
 }
 
 void disable_tlb(u8 esel)
@@ -67,6 +77,11 @@ void disable_tlb(u8 esel)
        mtspr(MAS7, _mas7);
 #endif
        asm volatile("isync;msync;tlbwe;isync");
+
+#ifdef CONFIG_ADDR_MAP
+       if (gd->flags & GD_FLG_RELOC)
+               addrmap_set_entry(0, 0, 0, esel);
+#endif
 }
 
 void invalidate_tlb(u8 tlb)
@@ -91,6 +106,25 @@ void init_tlbs(void)
        return ;
 }
 
+#ifdef CONFIG_ADDR_MAP
+void init_addr_map(void)
+{
+       int i;
+
+       for (i = 0; i < num_tlb_entries; i++) {
+               if (tlb_table[i].tlb == 0)
+                       continue;
+
+               addrmap_set_entry(tlb_table[i].epn,
+                       tlb_table[i].rpn,
+                       (1UL << ((tlb_table[i].tsize * 2) + 10)),
+                       tlb_table[i].esel);
+       }
+
+       return ;
+}
+#endif
+
 unsigned int setup_ddr_tlbs(unsigned int memsize_in_meg)
 {
        unsigned int tlb_size;
index 8975e6c90a8586e708f2770be77fa48bcf15a525..6d942d083a0675a1ba8d2394a2436e9f5014935f 100644 (file)
@@ -431,6 +431,9 @@ extern void set_tlb(u8 tlb, u32 epn, u64 rpn,
 extern void disable_tlb(u8 esel);
 extern void invalidate_tlb(u8 tlb);
 extern void init_tlbs(void);
+#ifdef CONFIG_ADDR_MAP
+extern void init_addr_map(void);
+#endif
 extern unsigned int setup_ddr_tlbs(unsigned int memsize_in_meg);
 
 #define SET_TLB_ENTRY(_tlb, _epn, _rpn, _perms, _wimge, _ts, _esel, _sz, _iprot) \
index 289a32a644169d0947f432d89c14a90fa22be330..61c29b563d077a6cdba43604df6c7feb196bd4a7 100644 (file)
 #include <keyboard.h>
 #endif
 
+#ifdef CONFIG_ADDR_MAP
+#include <asm/mmu.h>
+#endif
+
 #ifdef CONFIG_SYS_UPDATE_FLASH_SIZE
 extern int update_flash_size (int flash_size);
 #endif
@@ -694,6 +698,10 @@ void board_init_r (gd_t *id, ulong dest_addr)
         */
        trap_init (dest_addr);
 
+#if defined(CONFIG_ADDR_MAP) && defined(CONFIG_E500)
+       init_addr_map();
+#endif
+
 #if defined(CONFIG_BOARD_EARLY_INIT_R)
        board_early_init_r ();
 #endif