From 13436e82671ac78a7322f7be47e13ec9520f2004 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Mon, 8 Dec 2008 19:34:59 -0800 Subject: [PATCH] --- yaml --- r: 138406 b: refs/heads/master c: c8f3570b7e2dd070ba6da41f3ed4ffb4e1d296af h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/powerpc/Kconfig | 2 +- trunk/arch/powerpc/mm/fsl_booke_mmu.c | 14 +++++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/[refs] b/[refs] index 7237b816354b..36cbe3081c5d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f88747e7f68866f2f82cef1363c5b8e7aa13b0a3 +refs/heads/master: c8f3570b7e2dd070ba6da41f3ed4ffb4e1d296af diff --git a/trunk/arch/powerpc/Kconfig b/trunk/arch/powerpc/Kconfig index 74cc312c347c..b408e352198c 100644 --- a/trunk/arch/powerpc/Kconfig +++ b/trunk/arch/powerpc/Kconfig @@ -794,7 +794,7 @@ config PHYSICAL_START config PHYSICAL_ALIGN hex - default "0x10000000" if FSL_BOOKE + default "0x04000000" if FSL_BOOKE help This value puts the alignment restrictions on physical address where kernel is loaded and run from. Kernel is compiled for an diff --git a/trunk/arch/powerpc/mm/fsl_booke_mmu.c b/trunk/arch/powerpc/mm/fsl_booke_mmu.c index 1dabe1a1751b..dfd292748e6e 100644 --- a/trunk/arch/powerpc/mm/fsl_booke_mmu.c +++ b/trunk/arch/powerpc/mm/fsl_booke_mmu.c @@ -179,9 +179,14 @@ void __init adjust_total_lowmem(void) { phys_addr_t ram; - unsigned int max_cam = 28; /* 2^28 = 256 Mb */ + unsigned int max_cam = (mfspr(SPRN_TLB1CFG) >> 16) & 0xff; char buf[ARRAY_SIZE(cam) * 5 + 1], *p = buf; int i; + unsigned long virt = PAGE_OFFSET & 0xffffffffUL; + unsigned long phys = memstart_addr & 0xffffffffUL; + + /* Convert (4^max) kB to (2^max) bytes */ + max_cam = max_cam * 2 + 10; /* adjust lowmem size to __max_low_memory */ ram = min((phys_addr_t)__max_low_memory, (phys_addr_t)total_lowmem); @@ -190,11 +195,18 @@ adjust_total_lowmem(void) __max_low_memory = 0; for (i = 0; ram && i < ARRAY_SIZE(cam); i++) { unsigned int camsize = __ilog2(ram) & ~1U; + unsigned int align = __ffs(virt | phys) & ~1U; + + if (camsize > align) + camsize = align; if (camsize > max_cam) camsize = max_cam; + cam[i] = 1UL << camsize; ram -= cam[i]; __max_low_memory += cam[i]; + virt += cam[i]; + phys += cam[i]; p += sprintf(p, "%lu/", cam[i] >> 20); }