aboutsummaryrefslogtreecommitdiffstats
path: root/arch/parisc/mm
diff options
context:
space:
mode:
authorKyle McMartin <kyle@mako.i.cabal.ca>2006-10-16 20:34:00 -0400
committerKyle McMartin <kyle@ubuntu.com>2006-12-08 00:33:57 -0500
commit53faf2910d3539a963d171674ad6364ff2854eea (patch)
tree9b0c83c8d5ee608cfe1b2b1419efa987b530e50a /arch/parisc/mm
parentce8420bb65d25335c3b48ddfb1b5a244f53bfb75 (diff)
[PARISC] Unbreak discontigmem mem_init()
The `simple' way of walking and checking PageReserved is broken on discontigmem, instead we need to check each range explicitly. (Also rename a few things so they make more sense.) Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
Diffstat (limited to 'arch/parisc/mm')
-rw-r--r--arch/parisc/mm/init.c50
1 files changed, 32 insertions, 18 deletions
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index d9e4ab545b38..1c5fe8f5037b 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -455,7 +455,6 @@ unsigned long pcxl_dma_start __read_mostly;
455void __init mem_init(void) 455void __init mem_init(void)
456{ 456{
457 int codesize, reservedpages, datasize, initsize; 457 int codesize, reservedpages, datasize, initsize;
458 int tmp;
459 458
460 high_memory = __va((max_pfn << PAGE_SHIFT)); 459 high_memory = __va((max_pfn << PAGE_SHIFT));
461 460
@@ -470,17 +469,33 @@ void __init mem_init(void)
470 totalram_pages += free_all_bootmem_node(NODE_DATA(i)); 469 totalram_pages += free_all_bootmem_node(NODE_DATA(i));
471 } 470 }
472#endif 471#endif
473 codesize = (unsigned long) &_etext - (unsigned long) &_text; 472
474 datasize = (unsigned long) &_edata - (unsigned long) &_etext; 473 codesize = (unsigned long)_etext - (unsigned long)_text;
475 initsize = (unsigned long) &__init_end - (unsigned long) &__init_begin; 474 datasize = (unsigned long)_edata - (unsigned long)_etext;
475 initsize = (unsigned long)__init_end - (unsigned long)__init_begin;
476 476
477 reservedpages = 0; 477 reservedpages = 0;
478 for (tmp = 0; tmp < max_low_pfn; tmp++) 478{
479 unsigned long pfn;
480#ifdef CONFIG_DISCONTIGMEM
481 int i;
482
483 for (i = 0; i < npmem_ranges; i++) {
484 for (pfn = node_start_pfn(i); pfn < node_end_pfn(i); pfn++) {
485 if (PageReserved(pfn_to_page(pfn)))
486 reservedpages++;
487 }
488 }
489#else /* !CONFIG_DISCONTIGMEM */
490 for (pfn = 0; pfn < max_pfn; pfn++) {
479 /* 491 /*
480 * Only count reserved RAM pages 492 * Only count reserved RAM pages
481 */ 493 */
482 if (PageReserved(pfn_to_page(tmp))) 494 if (PageReserved(pfn_to_page(pfn)))
483 reservedpages++; 495 reservedpages++;
496 }
497#endif
498}
484 499
485#ifdef CONFIG_PA11 500#ifdef CONFIG_PA11
486 if (hppa_dma_ops == &pcxl_dma_ops) { 501 if (hppa_dma_ops == &pcxl_dma_ops) {
@@ -494,20 +509,19 @@ void __init mem_init(void)
494 vmalloc_start = SET_MAP_OFFSET(MAP_START); 509 vmalloc_start = SET_MAP_OFFSET(MAP_START);
495#endif 510#endif
496 511
497 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init, %ldk highmem)\n", 512 printk(KERN_INFO "Memory: %luk/%luk available (%dk kernel code, %dk reserved, %dk data, %dk init)\n",
498 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10), 513 (unsigned long)nr_free_pages() << (PAGE_SHIFT-10),
499 num_physpages << (PAGE_SHIFT-10), 514 num_physpages << (PAGE_SHIFT-10),
500 codesize >> 10, 515 codesize >> 10,
501 reservedpages << (PAGE_SHIFT-10), 516 reservedpages << (PAGE_SHIFT-10),
502 datasize >> 10, 517 datasize >> 10,
503 initsize >> 10, 518 initsize >> 10
504 (unsigned long) (totalhigh_pages << (PAGE_SHIFT-10)) 519 );
505 );
506 520
507#ifdef CONFIG_DEBUG_KERNEL /* double-sanity-check paranoia */ 521#ifdef CONFIG_DEBUG_KERNEL /* double-sanity-check paranoia */
508 printk("virtual kernel memory layout:\n" 522 printk("virtual kernel memory layout:\n"
509 " vmalloc : 0x%p - 0x%p (%4ld MB)\n" 523 " vmalloc : 0x%p - 0x%p (%4ld MB)\n"
510 " lowmem : 0x%p - 0x%p (%4ld MB)\n" 524 " memory : 0x%p - 0x%p (%4ld MB)\n"
511 " .init : 0x%p - 0x%p (%4ld kB)\n" 525 " .init : 0x%p - 0x%p (%4ld kB)\n"
512 " .data : 0x%p - 0x%p (%4ld kB)\n" 526 " .data : 0x%p - 0x%p (%4ld kB)\n"
513 " .text : 0x%p - 0x%p (%4ld kB)\n", 527 " .text : 0x%p - 0x%p (%4ld kB)\n",
@@ -518,14 +532,14 @@ void __init mem_init(void)
518 __va(0), high_memory, 532 __va(0), high_memory,
519 ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20, 533 ((unsigned long)high_memory - (unsigned long)__va(0)) >> 20,
520 534
521 &__init_begin, &__init_end, 535 __init_begin, __init_end,
522 ((unsigned long)&__init_end - (unsigned long)&__init_begin) >> 10, 536 ((unsigned long)__init_end - (unsigned long)__init_begin) >> 10,
523 537
524 &_etext, &_edata, 538 _etext, _edata,
525 ((unsigned long)&_edata - (unsigned long)&_etext) >> 10, 539 ((unsigned long)_edata - (unsigned long)_etext) >> 10,
526 540
527 &_text, &_etext, 541 _text, _etext,
528 ((unsigned long)&_etext - (unsigned long)&_text) >> 10); 542 ((unsigned long)_etext - (unsigned long)_text) >> 10);
529#endif 543#endif
530} 544}
531 545