diff options
author | Paul Mackerras <paulus@samba.org> | 2008-01-23 23:29:14 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-01-23 23:29:14 -0500 |
commit | dcb571be2019ae677bc5ed64437dbc87ae1eb67f (patch) | |
tree | 1b93f9ea3568be4dcc49ffb2adc0d3ab0a02b47f /arch/powerpc/mm | |
parent | 9156ad48338e0306e508ead5c0d9986050744475 (diff) | |
parent | 96f39c1718091d63dc1c5012d566737ea0d2a20c (diff) |
Merge branch 'for-2.6.25' of master.kernel.org:/pub/scm/linux/kernel/git/galak/powerpc into for-2.6.25
Diffstat (limited to 'arch/powerpc/mm')
-rw-r--r-- | arch/powerpc/mm/fsl_booke_mmu.c | 6 | ||||
-rw-r--r-- | arch/powerpc/mm/lmb.c | 13 | ||||
-rw-r--r-- | arch/powerpc/mm/mem.c | 21 |
3 files changed, 35 insertions, 5 deletions
diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c index 17139daeaff4..c93a966b7e4b 100644 --- a/arch/powerpc/mm/fsl_booke_mmu.c +++ b/arch/powerpc/mm/fsl_booke_mmu.c | |||
@@ -165,15 +165,15 @@ void invalidate_tlbcam_entry(int index) | |||
165 | void __init cam_mapin_ram(unsigned long cam0, unsigned long cam1, | 165 | void __init cam_mapin_ram(unsigned long cam0, unsigned long cam1, |
166 | unsigned long cam2) | 166 | unsigned long cam2) |
167 | { | 167 | { |
168 | settlbcam(0, KERNELBASE, PPC_MEMSTART, cam0, _PAGE_KERNEL, 0); | 168 | settlbcam(0, PAGE_OFFSET, PPC_MEMSTART, cam0, _PAGE_KERNEL, 0); |
169 | tlbcam_index++; | 169 | tlbcam_index++; |
170 | if (cam1) { | 170 | if (cam1) { |
171 | tlbcam_index++; | 171 | tlbcam_index++; |
172 | settlbcam(1, KERNELBASE+cam0, PPC_MEMSTART+cam0, cam1, _PAGE_KERNEL, 0); | 172 | settlbcam(1, PAGE_OFFSET+cam0, PPC_MEMSTART+cam0, cam1, _PAGE_KERNEL, 0); |
173 | } | 173 | } |
174 | if (cam2) { | 174 | if (cam2) { |
175 | tlbcam_index++; | 175 | tlbcam_index++; |
176 | settlbcam(2, KERNELBASE+cam0+cam1, PPC_MEMSTART+cam0+cam1, cam2, _PAGE_KERNEL, 0); | 176 | settlbcam(2, PAGE_OFFSET+cam0+cam1, PPC_MEMSTART+cam0+cam1, cam2, _PAGE_KERNEL, 0); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | 179 | ||
diff --git a/arch/powerpc/mm/lmb.c b/arch/powerpc/mm/lmb.c index 8f4d2dc4cafb..4ce23bcf8a57 100644 --- a/arch/powerpc/mm/lmb.c +++ b/arch/powerpc/mm/lmb.c | |||
@@ -342,3 +342,16 @@ void __init lmb_enforce_memory_limit(unsigned long memory_limit) | |||
342 | } | 342 | } |
343 | } | 343 | } |
344 | } | 344 | } |
345 | |||
346 | int __init lmb_is_reserved(unsigned long addr) | ||
347 | { | ||
348 | int i; | ||
349 | |||
350 | for (i = 0; i < lmb.reserved.cnt; i++) { | ||
351 | unsigned long upper = lmb.reserved.region[i].base + | ||
352 | lmb.reserved.region[i].size - 1; | ||
353 | if ((addr >= lmb.reserved.region[i].base) && (addr <= upper)) | ||
354 | return 1; | ||
355 | } | ||
356 | return 0; | ||
357 | } | ||
diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c index 5402fb6b3aae..e8122447f019 100644 --- a/arch/powerpc/mm/mem.c +++ b/arch/powerpc/mm/mem.c | |||
@@ -213,15 +213,30 @@ void __init do_init_bootmem(void) | |||
213 | */ | 213 | */ |
214 | #ifdef CONFIG_HIGHMEM | 214 | #ifdef CONFIG_HIGHMEM |
215 | free_bootmem_with_active_regions(0, total_lowmem >> PAGE_SHIFT); | 215 | free_bootmem_with_active_regions(0, total_lowmem >> PAGE_SHIFT); |
216 | |||
217 | /* reserve the sections we're already using */ | ||
218 | for (i = 0; i < lmb.reserved.cnt; i++) { | ||
219 | unsigned long addr = lmb.reserved.region[i].base + | ||
220 | lmb_size_bytes(&lmb.reserved, i) - 1; | ||
221 | if (addr < total_lowmem) | ||
222 | reserve_bootmem(lmb.reserved.region[i].base, | ||
223 | lmb_size_bytes(&lmb.reserved, i)); | ||
224 | else if (lmb.reserved.region[i].base < total_lowmem) { | ||
225 | unsigned long adjusted_size = total_lowmem - | ||
226 | lmb.reserved.region[i].base; | ||
227 | reserve_bootmem(lmb.reserved.region[i].base, | ||
228 | adjusted_size); | ||
229 | } | ||
230 | } | ||
216 | #else | 231 | #else |
217 | free_bootmem_with_active_regions(0, max_pfn); | 232 | free_bootmem_with_active_regions(0, max_pfn); |
218 | #endif | ||
219 | 233 | ||
220 | /* reserve the sections we're already using */ | 234 | /* reserve the sections we're already using */ |
221 | for (i = 0; i < lmb.reserved.cnt; i++) | 235 | for (i = 0; i < lmb.reserved.cnt; i++) |
222 | reserve_bootmem(lmb.reserved.region[i].base, | 236 | reserve_bootmem(lmb.reserved.region[i].base, |
223 | lmb_size_bytes(&lmb.reserved, i)); | 237 | lmb_size_bytes(&lmb.reserved, i)); |
224 | 238 | ||
239 | #endif | ||
225 | /* XXX need to clip this if using highmem? */ | 240 | /* XXX need to clip this if using highmem? */ |
226 | sparse_memory_present_with_active_regions(0); | 241 | sparse_memory_present_with_active_regions(0); |
227 | 242 | ||
@@ -334,11 +349,13 @@ void __init mem_init(void) | |||
334 | highmem_mapnr = total_lowmem >> PAGE_SHIFT; | 349 | highmem_mapnr = total_lowmem >> PAGE_SHIFT; |
335 | for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) { | 350 | for (pfn = highmem_mapnr; pfn < max_mapnr; ++pfn) { |
336 | struct page *page = pfn_to_page(pfn); | 351 | struct page *page = pfn_to_page(pfn); |
337 | 352 | if (lmb_is_reserved(pfn << PAGE_SHIFT)) | |
353 | continue; | ||
338 | ClearPageReserved(page); | 354 | ClearPageReserved(page); |
339 | init_page_count(page); | 355 | init_page_count(page); |
340 | __free_page(page); | 356 | __free_page(page); |
341 | totalhigh_pages++; | 357 | totalhigh_pages++; |
358 | reservedpages--; | ||
342 | } | 359 | } |
343 | totalram_pages += totalhigh_pages; | 360 | totalram_pages += totalhigh_pages; |
344 | printk(KERN_DEBUG "High memory: %luk\n", | 361 | printk(KERN_DEBUG "High memory: %luk\n", |