aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/powerpc/mm/fsl_booke_mmu.c14
2 files changed, 14 insertions, 2 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 74cc312c347c..b408e352198c 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -794,7 +794,7 @@ config PHYSICAL_START
794 794
795config PHYSICAL_ALIGN 795config PHYSICAL_ALIGN
796 hex 796 hex
797 default "0x10000000" if FSL_BOOKE 797 default "0x04000000" if FSL_BOOKE
798 help 798 help
799 This value puts the alignment restrictions on physical address 799 This value puts the alignment restrictions on physical address
800 where kernel is loaded and run from. Kernel is compiled for an 800 where kernel is loaded and run from. Kernel is compiled for an
diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
index 1dabe1a1751b..dfd292748e6e 100644
--- a/arch/powerpc/mm/fsl_booke_mmu.c
+++ b/arch/powerpc/mm/fsl_booke_mmu.c
@@ -179,9 +179,14 @@ void __init
179adjust_total_lowmem(void) 179adjust_total_lowmem(void)
180{ 180{
181 phys_addr_t ram; 181 phys_addr_t ram;
182 unsigned int max_cam = 28; /* 2^28 = 256 Mb */ 182 unsigned int max_cam = (mfspr(SPRN_TLB1CFG) >> 16) & 0xff;
183 char buf[ARRAY_SIZE(cam) * 5 + 1], *p = buf; 183 char buf[ARRAY_SIZE(cam) * 5 + 1], *p = buf;
184 int i; 184 int i;
185 unsigned long virt = PAGE_OFFSET & 0xffffffffUL;
186 unsigned long phys = memstart_addr & 0xffffffffUL;
187
188 /* Convert (4^max) kB to (2^max) bytes */
189 max_cam = max_cam * 2 + 10;
185 190
186 /* adjust lowmem size to __max_low_memory */ 191 /* adjust lowmem size to __max_low_memory */
187 ram = min((phys_addr_t)__max_low_memory, (phys_addr_t)total_lowmem); 192 ram = min((phys_addr_t)__max_low_memory, (phys_addr_t)total_lowmem);
@@ -190,11 +195,18 @@ adjust_total_lowmem(void)
190 __max_low_memory = 0; 195 __max_low_memory = 0;
191 for (i = 0; ram && i < ARRAY_SIZE(cam); i++) { 196 for (i = 0; ram && i < ARRAY_SIZE(cam); i++) {
192 unsigned int camsize = __ilog2(ram) & ~1U; 197 unsigned int camsize = __ilog2(ram) & ~1U;
198 unsigned int align = __ffs(virt | phys) & ~1U;
199
200 if (camsize > align)
201 camsize = align;
193 if (camsize > max_cam) 202 if (camsize > max_cam)
194 camsize = max_cam; 203 camsize = max_cam;
204
195 cam[i] = 1UL << camsize; 205 cam[i] = 1UL << camsize;
196 ram -= cam[i]; 206 ram -= cam[i];
197 __max_low_memory += cam[i]; 207 __max_low_memory += cam[i];
208 virt += cam[i];
209 phys += cam[i];
198 210
199 p += sprintf(p, "%lu/", cam[i] >> 20); 211 p += sprintf(p, "%lu/", cam[i] >> 20);
200 } 212 }