Skip to contentSkip to conversation

ppc/85xx: Add tracking of TLB CAM usage

PATCH New Kumar Gala 1 participant 1 message Nov 18, 2009

lore
Share & tools
lore

Kumar Gala

author
#0 lore raw

PATCH 1/1 ppc/85xx: Add tracking of TLB CAM usage

We need to track which TLB CAM entries are used to allow us to "dynamically" allocate entries later in the code. For example the SPD DDR code today hard codes which TLB entries it uses. We can now make that pick entries that are free.

---
* Fix whitespace
* Fix find_free_tlbcam when used_tlb_cams array has more than one element.

 cpu/mpc85xx/cpu_init.c        |    1 +
 cpu/mpc85xx/tlb.c             |   64 +++++++++++++++++++++++++++++++++++++++++
 include/asm-ppc/config.h      |    7 ++++
 include/asm-ppc/global_data.h |    3 ++
 include/asm-ppc/mmu.h         |    2 +
 5 files changed, 77 insertions(+), 0 deletions(-)
cpu/mpc85xx/cpu_init.c +1 -0
index 16ce82c..e0126d3 100644
@@ -246,6 +246,7 @@ void cpu_init_f (void)
 #ifdef CONFIG_FSL_CORENET
 	corenet_tb_init();
 #endif
+	init_used_tlb_cams();
 }
 
 
cpu/mpc85xx/tlb.c +64 -0

82 lines not on this page · raw message

include/asm-ppc/config.h +7 -0
index d5f82b4..796707e 100644
@@ -63,6 +63,13 @@
 #define CONFIG_TSECV2
 #endif
 
+/* Number of TLB CAM entries we have on FSL Book-E chips */
+#if defined(CONFIG_E500MC)
+#define CONFIG_SYS_NUM_TLBCAMS	64
+#elif defined(CONFIG_E500)
+#define CONFIG_SYS_NUM_TLBCAMS	16
+#endif
+
 /* Relocation to SDRAM works on all PPC boards */
 #define CONFIG_RELOC_FIXUP_WORKS
 
include/asm-ppc/global_data.h +3 -0
index 55e7e20..3f11918 100644
@@ -107,6 +107,9 @@ typedef	struct	global_data {
 #if defined(CONFIG_FSL_LAW)
 	u32 used_laws;
 #endif
+#if defined(CONFIG_E500)
+	u32 used_tlb_cams[(CONFIG_SYS_NUM_TLBCAMS+31)/32];
+#endif
 #if defined(CONFIG_MPC5xxx)
 	unsigned long	ipb_clk;
 	unsigned long	pci_clk;
include/asm-ppc/mmu.h +2 -0
index ec22a50..fd10249 100644
@@ -479,6 +479,8 @@ extern void disable_tlb(u8 esel);
 extern void invalidate_tlb(u8 tlb);
 extern void init_tlbs(void);
 extern int find_tlb_idx(void *addr, u8 tlbsel);
+extern void init_used_tlb_cams(void);
+extern int find_free_tlbcam(void);
 
 extern unsigned int setup_ddr_tlbs(unsigned int memsize_in_meg);
 
Signature · 1 line
1.6.0.6