diff options
author | Dale Farnsworth <dale@farnsworth.org> | 2008-12-17 05:09:13 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-12-22 23:13:29 -0500 |
commit | ccdcef72c249c289898b164eada89a61855b9287 (patch) | |
tree | 4a60305aaaa89949b2f979226cc192d8d5a3eb2c | |
parent | 01695a9687e5a8d78589605037cc7828a5b67ac9 (diff) |
powerpc/32: Add the ability for a classic ppc kernel to be loaded at 32M
Add the ability for a classic ppc kernel to be loaded at an address
of 32MB. This done by fixing a few places that assume we are loaded
at address 0, and by changing several uses of KERNELBASE to use
PAGE_OFFSET, instead.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/include/asm/ppc_asm.h | 4 | ||||
-rw-r--r-- | arch/powerpc/kernel/head_32.S | 11 | ||||
-rw-r--r-- | arch/powerpc/mm/init_32.c | 2 | ||||
-rw-r--r-- | arch/powerpc/mm/pgtable_32.c | 4 | ||||
-rw-r--r-- | arch/powerpc/mm/ppc_mmu_32.c | 8 |
5 files changed, 15 insertions, 14 deletions
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h index c4a029ccb4d3..1a0d628eb114 100644 --- a/arch/powerpc/include/asm/ppc_asm.h +++ b/arch/powerpc/include/asm/ppc_asm.h | |||
@@ -425,14 +425,14 @@ END_FTR_SECTION_IFCLR(CPU_FTR_601) | |||
425 | #define fromreal(rd) tovirt(rd,rd) | 425 | #define fromreal(rd) tovirt(rd,rd) |
426 | 426 | ||
427 | #define tophys(rd,rs) \ | 427 | #define tophys(rd,rs) \ |
428 | 0: addis rd,rs,-KERNELBASE@h; \ | 428 | 0: addis rd,rs,-PAGE_OFFSET@h; \ |
429 | .section ".vtop_fixup","aw"; \ | 429 | .section ".vtop_fixup","aw"; \ |
430 | .align 1; \ | 430 | .align 1; \ |
431 | .long 0b; \ | 431 | .long 0b; \ |
432 | .previous | 432 | .previous |
433 | 433 | ||
434 | #define tovirt(rd,rs) \ | 434 | #define tovirt(rd,rs) \ |
435 | 0: addis rd,rs,KERNELBASE@h; \ | 435 | 0: addis rd,rs,PAGE_OFFSET@h; \ |
436 | .section ".ptov_fixup","aw"; \ | 436 | .section ".ptov_fixup","aw"; \ |
437 | .align 1; \ | 437 | .align 1; \ |
438 | .long 0b; \ | 438 | .long 0b; \ |
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S index 266061924654..a1c4cfd25ded 100644 --- a/arch/powerpc/kernel/head_32.S +++ b/arch/powerpc/kernel/head_32.S | |||
@@ -183,7 +183,8 @@ __after_mmu_off: | |||
183 | bl reloc_offset | 183 | bl reloc_offset |
184 | mr r26,r3 | 184 | mr r26,r3 |
185 | addis r4,r3,KERNELBASE@h /* current address of _start */ | 185 | addis r4,r3,KERNELBASE@h /* current address of _start */ |
186 | cmpwi 0,r4,0 /* are we already running at 0? */ | 186 | lis r5,PHYSICAL_START@h |
187 | cmplw 0,r4,r5 /* already running at PHYSICAL_START? */ | ||
187 | bne relocate_kernel | 188 | bne relocate_kernel |
188 | /* | 189 | /* |
189 | * we now have the 1st 16M of ram mapped with the bats. | 190 | * we now have the 1st 16M of ram mapped with the bats. |
@@ -811,13 +812,13 @@ giveup_altivec: | |||
811 | 812 | ||
812 | /* | 813 | /* |
813 | * This code is jumped to from the startup code to copy | 814 | * This code is jumped to from the startup code to copy |
814 | * the kernel image to physical address 0. | 815 | * the kernel image to physical address PHYSICAL_START. |
815 | */ | 816 | */ |
816 | relocate_kernel: | 817 | relocate_kernel: |
817 | addis r9,r26,klimit@ha /* fetch klimit */ | 818 | addis r9,r26,klimit@ha /* fetch klimit */ |
818 | lwz r25,klimit@l(r9) | 819 | lwz r25,klimit@l(r9) |
819 | addis r25,r25,-KERNELBASE@h | 820 | addis r25,r25,-KERNELBASE@h |
820 | li r3,0 /* Destination base address */ | 821 | lis r3,PHYSICAL_START@h /* Destination base address */ |
821 | li r6,0 /* Destination offset */ | 822 | li r6,0 /* Destination offset */ |
822 | li r5,0x4000 /* # bytes of memory to copy */ | 823 | li r5,0x4000 /* # bytes of memory to copy */ |
823 | bl copy_and_flush /* copy the first 0x4000 bytes */ | 824 | bl copy_and_flush /* copy the first 0x4000 bytes */ |
@@ -1188,11 +1189,11 @@ mmu_off: | |||
1188 | 1189 | ||
1189 | /* | 1190 | /* |
1190 | * Use the first pair of BAT registers to map the 1st 16MB | 1191 | * Use the first pair of BAT registers to map the 1st 16MB |
1191 | * of RAM to KERNELBASE. From this point on we can't safely | 1192 | * of RAM to PAGE_OFFSET. From this point on we can't safely |
1192 | * call OF any more. | 1193 | * call OF any more. |
1193 | */ | 1194 | */ |
1194 | initial_bats: | 1195 | initial_bats: |
1195 | lis r11,KERNELBASE@h | 1196 | lis r11,PAGE_OFFSET@h |
1196 | mfspr r9,SPRN_PVR | 1197 | mfspr r9,SPRN_PVR |
1197 | rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */ | 1198 | rlwinm r9,r9,16,16,31 /* r9 = 1 for 601, 4 for 604 */ |
1198 | cmpwi 0,r9,1 | 1199 | cmpwi 0,r9,1 |
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c index 578294c3b1ce..666a5e8a5be1 100644 --- a/arch/powerpc/mm/init_32.c +++ b/arch/powerpc/mm/init_32.c | |||
@@ -48,7 +48,7 @@ | |||
48 | 48 | ||
49 | #if defined(CONFIG_KERNEL_START_BOOL) || defined(CONFIG_LOWMEM_SIZE_BOOL) | 49 | #if defined(CONFIG_KERNEL_START_BOOL) || defined(CONFIG_LOWMEM_SIZE_BOOL) |
50 | /* The ammount of lowmem must be within 0xF0000000 - KERNELBASE. */ | 50 | /* The ammount of lowmem must be within 0xF0000000 - KERNELBASE. */ |
51 | #if (CONFIG_LOWMEM_SIZE > (0xF0000000 - KERNELBASE)) | 51 | #if (CONFIG_LOWMEM_SIZE > (0xF0000000 - PAGE_OFFSET)) |
52 | #error "You must adjust CONFIG_LOWMEM_SIZE or CONFIG_START_KERNEL" | 52 | #error "You must adjust CONFIG_LOWMEM_SIZE or CONFIG_START_KERNEL" |
53 | #endif | 53 | #endif |
54 | #endif | 54 | #endif |
diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c index cd5609759d44..8cba46fc9e3b 100644 --- a/arch/powerpc/mm/pgtable_32.c +++ b/arch/powerpc/mm/pgtable_32.c | |||
@@ -269,7 +269,7 @@ int map_page(unsigned long va, phys_addr_t pa, int flags) | |||
269 | } | 269 | } |
270 | 270 | ||
271 | /* | 271 | /* |
272 | * Map in a big chunk of physical memory starting at KERNELBASE. | 272 | * Map in a big chunk of physical memory starting at PAGE_OFFSET. |
273 | */ | 273 | */ |
274 | void __init mapin_ram(void) | 274 | void __init mapin_ram(void) |
275 | { | 275 | { |
@@ -278,7 +278,7 @@ void __init mapin_ram(void) | |||
278 | int ktext; | 278 | int ktext; |
279 | 279 | ||
280 | s = mmu_mapin_ram(); | 280 | s = mmu_mapin_ram(); |
281 | v = KERNELBASE + s; | 281 | v = PAGE_OFFSET + s; |
282 | p = memstart_addr + s; | 282 | p = memstart_addr + s; |
283 | for (; s < total_lowmem; s += PAGE_SIZE) { | 283 | for (; s < total_lowmem; s += PAGE_SIZE) { |
284 | ktext = ((char *) v >= _stext && (char *) v < etext); | 284 | ktext = ((char *) v >= _stext && (char *) v < etext); |
diff --git a/arch/powerpc/mm/ppc_mmu_32.c b/arch/powerpc/mm/ppc_mmu_32.c index 9d97db7b7cf7..45d925360b89 100644 --- a/arch/powerpc/mm/ppc_mmu_32.c +++ b/arch/powerpc/mm/ppc_mmu_32.c | |||
@@ -95,16 +95,16 @@ unsigned long __init mmu_mapin_ram(void) | |||
95 | break; | 95 | break; |
96 | } | 96 | } |
97 | 97 | ||
98 | setbat(2, KERNELBASE, 0, bl, _PAGE_RAM); | 98 | setbat(2, PAGE_OFFSET, 0, bl, _PAGE_RAM); |
99 | done = (unsigned long)bat_addrs[2].limit - KERNELBASE + 1; | 99 | done = (unsigned long)bat_addrs[2].limit - PAGE_OFFSET + 1; |
100 | if ((done < tot) && !bat_addrs[3].limit) { | 100 | if ((done < tot) && !bat_addrs[3].limit) { |
101 | /* use BAT3 to cover a bit more */ | 101 | /* use BAT3 to cover a bit more */ |
102 | tot -= done; | 102 | tot -= done; |
103 | for (bl = 128<<10; bl < max_size; bl <<= 1) | 103 | for (bl = 128<<10; bl < max_size; bl <<= 1) |
104 | if (bl * 2 > tot) | 104 | if (bl * 2 > tot) |
105 | break; | 105 | break; |
106 | setbat(3, KERNELBASE+done, done, bl, _PAGE_RAM); | 106 | setbat(3, PAGE_OFFSET+done, done, bl, _PAGE_RAM); |
107 | done = (unsigned long)bat_addrs[3].limit - KERNELBASE + 1; | 107 | done = (unsigned long)bat_addrs[3].limit - PAGE_OFFSET + 1; |
108 | } | 108 | } |
109 | 109 | ||
110 | return done; | 110 | return done; |