diff options
-rw-r--r-- | arch/ppc/kernel/head_44x.S | 2 | ||||
-rw-r--r-- | arch/ppc/mm/44x_mmu.c | 51 | ||||
-rw-r--r-- | include/asm-ppc/mmu.h | 6 |
3 files changed, 23 insertions, 36 deletions
diff --git a/arch/ppc/kernel/head_44x.S b/arch/ppc/kernel/head_44x.S index 75bbc937ed73..ebb5a403829f 100644 --- a/arch/ppc/kernel/head_44x.S +++ b/arch/ppc/kernel/head_44x.S | |||
@@ -195,7 +195,7 @@ skpinv: addi r4,r4,1 /* Increment */ | |||
195 | li r5,0 | 195 | li r5,0 |
196 | ori r5,r5,(PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_I | PPC44x_TLB_G) | 196 | ori r5,r5,(PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_I | PPC44x_TLB_G) |
197 | 197 | ||
198 | li r0,0 /* TLB slot 0 */ | 198 | li r0,62 /* TLB slot 62 */ |
199 | 199 | ||
200 | tlbwe r3,r0,PPC44x_TLB_PAGEID /* Load the pageid fields */ | 200 | tlbwe r3,r0,PPC44x_TLB_PAGEID /* Load the pageid fields */ |
201 | tlbwe r4,r0,PPC44x_TLB_XLAT /* Load the translation fields */ | 201 | tlbwe r4,r0,PPC44x_TLB_XLAT /* Load the translation fields */ |
diff --git a/arch/ppc/mm/44x_mmu.c b/arch/ppc/mm/44x_mmu.c index 6536a25cfcb8..fbb577a0d165 100644 --- a/arch/ppc/mm/44x_mmu.c +++ b/arch/ppc/mm/44x_mmu.c | |||
@@ -60,38 +60,28 @@ extern char etext[], _stext[]; | |||
60 | * Just needed it declared someplace. | 60 | * Just needed it declared someplace. |
61 | */ | 61 | */ |
62 | unsigned int tlb_44x_index = 0; | 62 | unsigned int tlb_44x_index = 0; |
63 | unsigned int tlb_44x_hwater = 62; | 63 | unsigned int tlb_44x_hwater = PPC4XX_TLB_SIZE - 1 - PPC44x_EARLY_TLBS; |
64 | int icache_44x_need_flush; | 64 | int icache_44x_need_flush; |
65 | 65 | ||
66 | /* | 66 | /* |
67 | * "Pins" a 256MB TLB entry in AS0 for kernel lowmem | 67 | * "Pins" a 256MB TLB entry in AS0 for kernel lowmem |
68 | */ | 68 | */ |
69 | static void __init | 69 | static void __init ppc44x_pin_tlb(unsigned int virt, unsigned int phys) |
70 | ppc44x_pin_tlb(int slot, unsigned int virt, unsigned int phys) | ||
71 | { | 70 | { |
72 | unsigned long attrib = 0; | 71 | __asm__ __volatile__( |
73 | 72 | "tlbwe %2,%3,%4\n" | |
74 | __asm__ __volatile__("\ | 73 | "tlbwe %1,%3,%5\n" |
75 | clrrwi %2,%2,10\n\ | 74 | "tlbwe %0,%3,%6\n" |
76 | ori %2,%2,%4\n\ | ||
77 | clrrwi %1,%1,10\n\ | ||
78 | li %0,0\n\ | ||
79 | ori %0,%0,%5\n\ | ||
80 | tlbwe %2,%3,%6\n\ | ||
81 | tlbwe %1,%3,%7\n\ | ||
82 | tlbwe %0,%3,%8" | ||
83 | : | 75 | : |
84 | : "r" (attrib), "r" (phys), "r" (virt), "r" (slot), | 76 | : "r" (PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_SX | PPC44x_TLB_G), |
85 | "i" (PPC44x_TLB_VALID | PPC44x_TLB_256M), | 77 | "r" (phys), |
86 | "i" (PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_SX | PPC44x_TLB_G), | 78 | "r" (virt | PPC44x_TLB_VALID | PPC44x_TLB_256M), |
79 | "r" (tlb_44x_hwater--), /* slot for this TLB entry */ | ||
87 | "i" (PPC44x_TLB_PAGEID), | 80 | "i" (PPC44x_TLB_PAGEID), |
88 | "i" (PPC44x_TLB_XLAT), | 81 | "i" (PPC44x_TLB_XLAT), |
89 | "i" (PPC44x_TLB_ATTRIB)); | 82 | "i" (PPC44x_TLB_ATTRIB)); |
90 | } | 83 | } |
91 | 84 | ||
92 | /* | ||
93 | * MMU_init_hw does the chip-specific initialization of the MMU hardware. | ||
94 | */ | ||
95 | void __init MMU_init_hw(void) | 85 | void __init MMU_init_hw(void) |
96 | { | 86 | { |
97 | flush_instruction_cache(); | 87 | flush_instruction_cache(); |
@@ -99,22 +89,13 @@ void __init MMU_init_hw(void) | |||
99 | 89 | ||
100 | unsigned long __init mmu_mapin_ram(void) | 90 | unsigned long __init mmu_mapin_ram(void) |
101 | { | 91 | { |
102 | unsigned int pinned_tlbs = 1; | 92 | unsigned long addr; |
103 | int i; | ||
104 | |||
105 | /* Determine number of entries necessary to cover lowmem */ | ||
106 | pinned_tlbs = (unsigned int) | ||
107 | (_ALIGN(total_lowmem, PPC_PIN_SIZE) >> PPC44x_PIN_SHIFT); | ||
108 | |||
109 | /* Write upper watermark to save location */ | ||
110 | tlb_44x_hwater = PPC44x_LOW_SLOT - pinned_tlbs; | ||
111 | 93 | ||
112 | /* If necessary, set additional pinned TLBs */ | 94 | /* Pin in enough TLBs to cover any lowmem not covered by the |
113 | if (pinned_tlbs > 1) | 95 | * initial 256M mapping established in head_44x.S */ |
114 | for (i = (PPC44x_LOW_SLOT-(pinned_tlbs-1)); i < PPC44x_LOW_SLOT; i++) { | 96 | for (addr = PPC_PIN_SIZE; addr < total_lowmem; |
115 | unsigned int phys_addr = (PPC44x_LOW_SLOT-i) * PPC_PIN_SIZE; | 97 | addr += PPC_PIN_SIZE) |
116 | ppc44x_pin_tlb(i, phys_addr+PAGE_OFFSET, phys_addr); | 98 | ppc44x_pin_tlb(addr + PAGE_OFFSET, addr); |
117 | } | ||
118 | 99 | ||
119 | return total_lowmem; | 100 | return total_lowmem; |
120 | } | 101 | } |
diff --git a/include/asm-ppc/mmu.h b/include/asm-ppc/mmu.h index 14584e505ed5..d46b57b589ae 100644 --- a/include/asm-ppc/mmu.h +++ b/include/asm-ppc/mmu.h | |||
@@ -383,6 +383,12 @@ typedef struct _P601_BAT { | |||
383 | #define BOOKE_PAGESZ_256GB 14 | 383 | #define BOOKE_PAGESZ_256GB 14 |
384 | #define BOOKE_PAGESZ_1TB 15 | 384 | #define BOOKE_PAGESZ_1TB 15 |
385 | 385 | ||
386 | #ifndef CONFIG_SERIAL_TEXT_DEBUG | ||
387 | #define PPC44x_EARLY_TLBS 1 | ||
388 | #else | ||
389 | #define PPC44x_EARLY_TLBS 2 | ||
390 | #endif | ||
391 | |||
386 | /* | 392 | /* |
387 | * Freescale Book-E MMU support | 393 | * Freescale Book-E MMU support |
388 | */ | 394 | */ |