aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/setup.c
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2006-12-08 09:56:10 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2006-12-08 09:56:10 -0500
commit39b742f957a287a7514a8a35c9f516cdf30b9ff5 (patch)
tree4b4e9c0747bb047e906fed6c04919c00ccfa2b35 /arch/s390/kernel/setup.c
parentf4eb07c17df2e6cf9bd58bfcd9cc9e05e9489d07 (diff)
[S390] Use add_active_range() and free_area_init_nodes().
Size zones and holes in an architecture independent manner for s390. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kernel/setup.c')
-rw-r--r--arch/s390/kernel/setup.c53
1 files changed, 12 insertions, 41 deletions
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index b8a1ce21514..49ef206ec88 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -66,7 +66,6 @@ unsigned long machine_flags = 0;
66 66
67struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS]; 67struct mem_chunk __initdata memory_chunk[MEMORY_CHUNKS];
68volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */ 68volatile int __cpu_logical_map[NR_CPUS]; /* logical cpu to cpu address */
69unsigned long __initdata zholes_size[MAX_NR_ZONES];
70static unsigned long __initdata memory_end; 69static unsigned long __initdata memory_end;
71 70
72/* 71/*
@@ -354,21 +353,6 @@ void machine_power_off(void)
354 */ 353 */
355void (*pm_power_off)(void) = machine_power_off; 354void (*pm_power_off)(void) = machine_power_off;
356 355
357static void __init
358add_memory_hole(unsigned long start, unsigned long end)
359{
360 unsigned long dma_pfn = MAX_DMA_ADDRESS >> PAGE_SHIFT;
361
362 if (end <= dma_pfn)
363 zholes_size[ZONE_DMA] += end - start + 1;
364 else if (start > dma_pfn)
365 zholes_size[ZONE_NORMAL] += end - start + 1;
366 else {
367 zholes_size[ZONE_DMA] += dma_pfn - start + 1;
368 zholes_size[ZONE_NORMAL] += end - dma_pfn;
369 }
370}
371
372static int __init early_parse_mem(char *p) 356static int __init early_parse_mem(char *p)
373{ 357{
374 memory_end = memparse(p, &p); 358 memory_end = memparse(p, &p);
@@ -521,7 +505,6 @@ setup_memory(void)
521{ 505{
522 unsigned long bootmap_size; 506 unsigned long bootmap_size;
523 unsigned long start_pfn, end_pfn, init_pfn; 507 unsigned long start_pfn, end_pfn, init_pfn;
524 unsigned long last_rw_end;
525 int i; 508 int i;
526 509
527 /* 510 /*
@@ -577,39 +560,27 @@ setup_memory(void)
577 /* 560 /*
578 * Register RAM areas with the bootmem allocator. 561 * Register RAM areas with the bootmem allocator.
579 */ 562 */
580 last_rw_end = start_pfn;
581 563
582 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) { 564 for (i = 0; i < MEMORY_CHUNKS && memory_chunk[i].size > 0; i++) {
583 unsigned long start_chunk, end_chunk; 565 unsigned long start_chunk, end_chunk, pfn;
584 566
585 if (memory_chunk[i].type != CHUNK_READ_WRITE) 567 if (memory_chunk[i].type != CHUNK_READ_WRITE)
586 continue; 568 continue;
587 start_chunk = (memory_chunk[i].addr + PAGE_SIZE - 1); 569 start_chunk = PFN_DOWN(memory_chunk[i].addr);
588 start_chunk >>= PAGE_SHIFT; 570 end_chunk = start_chunk + PFN_DOWN(memory_chunk[i].size) - 1;
589 end_chunk = (memory_chunk[i].addr + memory_chunk[i].size); 571 end_chunk = min(end_chunk, end_pfn);
590 end_chunk >>= PAGE_SHIFT; 572 if (start_chunk >= end_chunk)
591 if (start_chunk < start_pfn) 573 continue;
592 start_chunk = start_pfn; 574 add_active_range(0, start_chunk, end_chunk);
593 if (end_chunk > end_pfn) 575 pfn = max(start_chunk, start_pfn);
594 end_chunk = end_pfn; 576 for (; pfn <= end_chunk; pfn++)
595 if (start_chunk < end_chunk) { 577 page_set_storage_key(PFN_PHYS(pfn), PAGE_DEFAULT_KEY);
596 /* Initialize storage key for RAM pages */
597 for (init_pfn = start_chunk ; init_pfn < end_chunk;
598 init_pfn++)
599 page_set_storage_key(init_pfn << PAGE_SHIFT,
600 PAGE_DEFAULT_KEY);
601 free_bootmem(start_chunk << PAGE_SHIFT,
602 (end_chunk - start_chunk) << PAGE_SHIFT);
603 if (last_rw_end < start_chunk)
604 add_memory_hole(last_rw_end, start_chunk - 1);
605 last_rw_end = end_chunk;
606 }
607 } 578 }
608 579
609 psw_set_key(PAGE_DEFAULT_KEY); 580 psw_set_key(PAGE_DEFAULT_KEY);
610 581
611 if (last_rw_end < end_pfn - 1) 582 free_bootmem_with_active_regions(0, max_pfn);
612 add_memory_hole(last_rw_end, end_pfn - 1); 583 reserve_bootmem(0, PFN_PHYS(start_pfn));
613 584
614 /* 585 /*
615 * Reserve the bootmem bitmap itself as well. We do this in two 586 * Reserve the bootmem bitmap itself as well. We do this in two