diff options
author | Kumar Gala <galak@kernel.crashing.org> | 2008-04-15 15:52:23 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-04-16 17:46:13 -0400 |
commit | 0aef996b37d08757562ecf0bb0c1f6998e634c8b (patch) | |
tree | aaf590eeabc3c6bf0bcfa4ea1402e9c27a164213 /arch/powerpc/kernel/head_fsl_booke.S | |
parent | d7917ba7051e3fd12ebe2d5a09b29fb3a2b38190 (diff) |
[POWERPC] 85xx: Cleanup TLB initialization
* Determine the RPN we are running the kernel at runtime rather
than using compile time constant for initial TLB
* Cleanup adjust_total_lowmem() to respect memstart_addr and
be a bit more clear on variables that are sizes vs addresses.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/kernel/head_fsl_booke.S')
-rw-r--r-- | arch/powerpc/kernel/head_fsl_booke.S | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/arch/powerpc/kernel/head_fsl_booke.S b/arch/powerpc/kernel/head_fsl_booke.S index d9cc2c288d9e..9f40b3e77100 100644 --- a/arch/powerpc/kernel/head_fsl_booke.S +++ b/arch/powerpc/kernel/head_fsl_booke.S | |||
@@ -68,7 +68,9 @@ _ENTRY(_start); | |||
68 | mr r29,r5 | 68 | mr r29,r5 |
69 | mr r28,r6 | 69 | mr r28,r6 |
70 | mr r27,r7 | 70 | mr r27,r7 |
71 | li r25,0 /* phys kernel start (low) */ | ||
71 | li r24,0 /* CPU number */ | 72 | li r24,0 /* CPU number */ |
73 | li r23,0 /* phys kernel start (high) */ | ||
72 | 74 | ||
73 | /* We try to not make any assumptions about how the boot loader | 75 | /* We try to not make any assumptions about how the boot loader |
74 | * setup or used the TLBs. We invalidate all mappings from the | 76 | * setup or used the TLBs. We invalidate all mappings from the |
@@ -167,7 +169,28 @@ skpinv: addi r6,r6,1 /* Increment */ | |||
167 | mtspr SPRN_MAS0,r7 | 169 | mtspr SPRN_MAS0,r7 |
168 | tlbre | 170 | tlbre |
169 | 171 | ||
170 | /* Just modify the entry ID, EPN and RPN for the temp mapping */ | 172 | /* grab and fixup the RPN */ |
173 | mfspr r6,SPRN_MAS1 /* extract MAS1[SIZE] */ | ||
174 | rlwinm r6,r6,25,27,30 | ||
175 | li r8,-1 | ||
176 | addi r6,r6,10 | ||
177 | slw r6,r8,r6 /* convert to mask */ | ||
178 | |||
179 | bl 1f /* Find our address */ | ||
180 | 1: mflr r7 | ||
181 | |||
182 | mfspr r8,SPRN_MAS3 | ||
183 | #ifdef CONFIG_PHYS_64BIT | ||
184 | mfspr r23,SPRN_MAS7 | ||
185 | #endif | ||
186 | and r8,r6,r8 | ||
187 | subfic r9,r6,-4096 | ||
188 | and r9,r9,r7 | ||
189 | |||
190 | or r25,r8,r9 | ||
191 | ori r8,r25,(MAS3_SX|MAS3_SW|MAS3_SR) | ||
192 | |||
193 | /* Just modify the entry ID and EPN for the temp mapping */ | ||
171 | lis r7,0x1000 /* Set MAS0(TLBSEL) = 1 */ | 194 | lis r7,0x1000 /* Set MAS0(TLBSEL) = 1 */ |
172 | rlwimi r7,r5,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r5) */ | 195 | rlwimi r7,r5,16,4,15 /* Setup MAS0 = TLBSEL | ESEL(r5) */ |
173 | mtspr SPRN_MAS0,r7 | 196 | mtspr SPRN_MAS0,r7 |
@@ -177,12 +200,10 @@ skpinv: addi r6,r6,1 /* Increment */ | |||
177 | ori r6,r6,(MAS1_TSIZE(BOOKE_PAGESZ_4K))@l | 200 | ori r6,r6,(MAS1_TSIZE(BOOKE_PAGESZ_4K))@l |
178 | mtspr SPRN_MAS1,r6 | 201 | mtspr SPRN_MAS1,r6 |
179 | mfspr r6,SPRN_MAS2 | 202 | mfspr r6,SPRN_MAS2 |
180 | lis r7,PHYSICAL_START@h | 203 | li r7,0 /* temp EPN = 0 */ |
181 | rlwimi r7,r6,0,20,31 | 204 | rlwimi r7,r6,0,20,31 |
182 | mtspr SPRN_MAS2,r7 | 205 | mtspr SPRN_MAS2,r7 |
183 | mfspr r6,SPRN_MAS3 | 206 | mtspr SPRN_MAS3,r8 |
184 | rlwimi r7,r6,0,20,31 | ||
185 | mtspr SPRN_MAS3,r7 | ||
186 | tlbwe | 207 | tlbwe |
187 | 208 | ||
188 | xori r6,r4,1 | 209 | xori r6,r4,1 |
@@ -232,8 +253,7 @@ skpinv: addi r6,r6,1 /* Increment */ | |||
232 | ori r6,r6,PAGE_OFFSET@l | 253 | ori r6,r6,PAGE_OFFSET@l |
233 | rlwimi r6,r7,0,20,31 | 254 | rlwimi r6,r7,0,20,31 |
234 | mtspr SPRN_MAS2,r6 | 255 | mtspr SPRN_MAS2,r6 |
235 | li r7,(MAS3_SX|MAS3_SW|MAS3_SR) | 256 | mtspr SPRN_MAS3,r8 |
236 | mtspr SPRN_MAS3,r7 | ||
237 | tlbwe | 257 | tlbwe |
238 | 258 | ||
239 | /* 7. Jump to KERNELBASE mapping */ | 259 | /* 7. Jump to KERNELBASE mapping */ |