aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2008-04-15 15:52:22 -0400
committerPaul Mackerras <paulus@samba.org>2008-04-16 17:46:13 -0400
commitd7917ba7051e3fd12ebe2d5a09b29fb3a2b38190 (patch)
tree339d273aee5eb2cb83e226945f0319b51f4bdf3c /arch/powerpc
parent99c62dd773797b68f3b1ca6bb3274725d1852fa2 (diff)
[POWERPC] Introduce lowmem_end_addr to distinguish from total_lowmem
total_lowmem represents the amount of low memory, not the physical address that low memory ends at. If the start of memory is at 0 it happens that total_lowmem can be used as both the size and the address that lowmem ends at (or more specifically one byte beyond the end). To make the code a bit more clear and deal with the case when the start of memory isn't at physical 0, we introduce lowmem_end_addr that represents one byte beyond the last physical address in the lowmem region. Signed-off-by: Kumar Gala <galak@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/mm/44x_mmu.c2
-rw-r--r--arch/powerpc/mm/init_32.c4
-rw-r--r--arch/powerpc/mm/init_64.c2
-rw-r--r--arch/powerpc/mm/mem.c16
-rw-r--r--arch/powerpc/mm/mmu_decl.h1
5 files changed, 16 insertions, 9 deletions
diff --git a/arch/powerpc/mm/44x_mmu.c b/arch/powerpc/mm/44x_mmu.c
index 04dc08798d3d..953fb919eb06 100644
--- a/arch/powerpc/mm/44x_mmu.c
+++ b/arch/powerpc/mm/44x_mmu.c
@@ -67,7 +67,7 @@ unsigned long __init mmu_mapin_ram(void)
67 67
68 /* Pin in enough TLBs to cover any lowmem not covered by the 68 /* Pin in enough TLBs to cover any lowmem not covered by the
69 * initial 256M mapping established in head_44x.S */ 69 * initial 256M mapping established in head_44x.S */
70 for (addr = PPC_PIN_SIZE; addr < total_lowmem; 70 for (addr = PPC_PIN_SIZE; addr < lowmem_end_addr;
71 addr += PPC_PIN_SIZE) 71 addr += PPC_PIN_SIZE)
72 ppc44x_pin_tlb(addr + PAGE_OFFSET, addr); 72 ppc44x_pin_tlb(addr + PAGE_OFFSET, addr);
73 73
diff --git a/arch/powerpc/mm/init_32.c b/arch/powerpc/mm/init_32.c
index 1d7e5b8ade6a..ba61d088d2a2 100644
--- a/arch/powerpc/mm/init_32.c
+++ b/arch/powerpc/mm/init_32.c
@@ -146,6 +146,7 @@ void __init MMU_init(void)
146 } 146 }
147 147
148 total_lowmem = total_memory = lmb_end_of_DRAM() - memstart_addr; 148 total_lowmem = total_memory = lmb_end_of_DRAM() - memstart_addr;
149 lowmem_end_addr = memstart_addr + total_lowmem;
149 150
150#ifdef CONFIG_FSL_BOOKE 151#ifdef CONFIG_FSL_BOOKE
151 /* Freescale Book-E parts expect lowmem to be mapped by fixed TLB 152 /* Freescale Book-E parts expect lowmem to be mapped by fixed TLB
@@ -156,9 +157,10 @@ void __init MMU_init(void)
156 157
157 if (total_lowmem > __max_low_memory) { 158 if (total_lowmem > __max_low_memory) {
158 total_lowmem = __max_low_memory; 159 total_lowmem = __max_low_memory;
160 lowmem_end_addr = memstart_addr + total_lowmem;
159#ifndef CONFIG_HIGHMEM 161#ifndef CONFIG_HIGHMEM
160 total_memory = total_lowmem; 162 total_memory = total_lowmem;
161 lmb_enforce_memory_limit(total_lowmem); 163 lmb_enforce_memory_limit(lowmem_end_addr);
162 lmb_analyze(); 164 lmb_analyze();
163#endif /* CONFIG_HIGHMEM */ 165#endif /* CONFIG_HIGHMEM */
164 } 166 }
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
index 5f553991698b..9ea65d978685 100644
--- a/arch/powerpc/mm/init_64.c
+++ b/arch/powerpc/mm/init_64.c
@@ -75,6 +75,8 @@
75/* max amount of RAM to use */ 75/* max amount of RAM to use */
76unsigned long __max_memory; 76unsigned long __max_memory;
77 77
78phys_addr_t memstart_addr;
79
78void free_initmem(void) 80void free_initmem(void)
79{ 81{
80 unsigned long addr; 82 unsigned long addr;
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index e3349ead3959..16def4dcff6d 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -216,9 +216,11 @@ void __init do_init_bootmem(void)
216 unsigned long total_pages; 216 unsigned long total_pages;
217 int boot_mapsize; 217 int boot_mapsize;
218 218
219 max_pfn = total_pages = lmb_end_of_DRAM() >> PAGE_SHIFT; 219 max_pfn = lmb_end_of_DRAM() >> PAGE_SHIFT;
220 total_pages = (lmb_end_of_DRAM() - memstart_addr) >> PAGE_SHIFT;
220#ifdef CONFIG_HIGHMEM 221#ifdef CONFIG_HIGHMEM
221 total_pages = total_lowmem >> PAGE_SHIFT; 222 total_pages = total_lowmem >> PAGE_SHIFT;
223 max_low_pfn = lowmem_end_addr >> PAGE_SHIFT;
222#endif 224#endif
223 225
224 /* 226 /*
@@ -244,18 +246,18 @@ void __init do_init_bootmem(void)
244 * present. 246 * present.
245 */ 247 */
246#ifdef CONFIG_HIGHMEM 248#ifdef CONFIG_HIGHMEM
247 free_bootmem_with_active_regions(0, total_lowmem >> PAGE_SHIFT); 249 free_bootmem_with_active_regions(0, lowmem_end_addr >> PAGE_SHIFT);
248 250
249 /* reserve the sections we're already using */ 251 /* reserve the sections we're already using */
250 for (i = 0; i < lmb.reserved.cnt; i++) { 252 for (i = 0; i < lmb.reserved.cnt; i++) {
251 unsigned long addr = lmb.reserved.region[i].base + 253 unsigned long addr = lmb.reserved.region[i].base +
252 lmb_size_bytes(&lmb.reserved, i) - 1; 254 lmb_size_bytes(&lmb.reserved, i) - 1;
253 if (addr < total_lowmem) 255 if (addr < lowmem_end_addr)
254 reserve_bootmem(lmb.reserved.region[i].base, 256 reserve_bootmem(lmb.reserved.region[i].base,
255 lmb_size_bytes(&lmb.reserved, i), 257 lmb_size_bytes(&lmb.reserved, i),
256 BOOTMEM_DEFAULT); 258 BOOTMEM_DEFAULT);
257 else if (lmb.reserved.region[i].base < total_lowmem) { 259 else if (lmb.reserved.region[i].base < lowmem_end_addr) {
258 unsigned long adjusted_size = total_lowmem - 260 unsigned long adjusted_size = lowmem_end_addr -
259 lmb.reserved.region[i].base; 261 lmb.reserved.region[i].base;
260 reserve_bootmem(lmb.reserved.region[i].base, 262 reserve_bootmem(lmb.reserved.region[i].base,
261 adjusted_size, BOOTMEM_DEFAULT); 263 adjusted_size, BOOTMEM_DEFAULT);
@@ -325,7 +327,7 @@ void __init paging_init(void)
325 (top_of_ram - total_ram) >> 20); 327 (top_of_ram - total_ram) >> 20);
326 memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); 328 memset(max_zone_pfns, 0, sizeof(max_zone_pfns));
327#ifdef CONFIG_HIGHMEM 329#ifdef CONFIG_HIGHMEM
328 max_zone_pfns[ZONE_DMA] = total_lowmem >> PAGE_SHIFT; 330 max_zone_pfns[ZONE_DMA] = lowmem_end_addr >> PAGE_SHIFT;
329 max_zone_pfns[ZONE_HIGHMEM] = top_of_ram >> PAGE_SHIFT; 331 max_zone_pfns[ZONE_HIGHMEM] = top_of_ram >> PAGE_SHIFT;
330#else 332#else
331 max_zone_pfns[ZONE_DMA] = top_of_ram >> PAGE_SHIFT; 333 max_zone_pfns[ZONE_DMA] = top_of_ram >> PAGE_SHIFT;
@@ -380,7 +382,7 @@ void __init mem_init(void)
380 { 382 {
381 unsigned long pfn, highmem_mapnr; 383 unsigned long pfn, highmem_mapnr;
382 384
383 highmem_mapnr = total_lowmem >> PAGE_SHIFT; 385 highmem_mapnr = lowmem_end_addr >> PAGE_SHIFT;
384 for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) { 386 for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) {
385 struct page *page = pfn_to_page(pfn); 387 struct page *page = pfn_to_page(pfn);
386 if (lmb_is_reserved(pfn << PAGE_SHIFT)) 388 if (lmb_is_reserved(pfn << PAGE_SHIFT))
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index 5bc11f5933a9..67477e772958 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -52,6 +52,7 @@ extern unsigned long __initial_memory_limit;
52extern unsigned long total_memory; 52extern unsigned long total_memory;
53extern unsigned long total_lowmem; 53extern unsigned long total_lowmem;
54extern phys_addr_t memstart_addr; 54extern phys_addr_t memstart_addr;
55extern phys_addr_t lowmem_end_addr;
55 56
56/* ...and now those things that may be slightly different between processor 57/* ...and now those things that may be slightly different between processor
57 * architectures. -- Dan 58 * architectures. -- Dan