diff options
-rw-r--r-- | arch/x86/kernel/setup_32.c | 94 | ||||
-rw-r--r-- | arch/x86/mm/discontig_32.c | 4 | ||||
-rw-r--r-- | arch/x86/mm/init_32.c | 90 | ||||
-rw-r--r-- | include/asm-x86/page_32.h | 5 |
4 files changed, 99 insertions, 94 deletions
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c index d24ac268523f..190546bd3bd3 100644 --- a/arch/x86/kernel/setup_32.c +++ b/arch/x86/kernel/setup_32.c | |||
@@ -300,71 +300,11 @@ unsigned long __init find_max_low_pfn(void) | |||
300 | return max_low_pfn; | 300 | return max_low_pfn; |
301 | } | 301 | } |
302 | 302 | ||
303 | #ifndef CONFIG_NEED_MULTIPLE_NODES | ||
304 | static void __init setup_bootmem_allocator(void); | ||
305 | static unsigned long __init setup_memory(void) | ||
306 | { | ||
307 | /* | ||
308 | * partially used pages are not usable - thus | ||
309 | * we are rounding upwards: | ||
310 | */ | ||
311 | min_low_pfn = PFN_UP(init_pg_tables_end); | ||
312 | |||
313 | max_low_pfn = find_max_low_pfn(); | ||
314 | |||
315 | #ifdef CONFIG_HIGHMEM | ||
316 | highstart_pfn = highend_pfn = max_pfn; | ||
317 | if (max_pfn > max_low_pfn) { | ||
318 | highstart_pfn = max_low_pfn; | ||
319 | } | ||
320 | memory_present(0, 0, highend_pfn); | ||
321 | printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", | ||
322 | pages_to_mb(highend_pfn - highstart_pfn)); | ||
323 | num_physpages = highend_pfn; | ||
324 | high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; | ||
325 | #else | ||
326 | memory_present(0, 0, max_low_pfn); | ||
327 | num_physpages = max_low_pfn; | ||
328 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; | ||
329 | #endif | ||
330 | #ifdef CONFIG_FLATMEM | ||
331 | max_mapnr = num_physpages; | ||
332 | #endif | ||
333 | printk(KERN_NOTICE "%ldMB LOWMEM available.\n", | ||
334 | pages_to_mb(max_low_pfn)); | ||
335 | |||
336 | setup_bootmem_allocator(); | ||
337 | |||
338 | return max_low_pfn; | ||
339 | } | ||
340 | |||
341 | static void __init zone_sizes_init(void) | ||
342 | { | ||
343 | unsigned long max_zone_pfns[MAX_NR_ZONES]; | ||
344 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); | ||
345 | max_zone_pfns[ZONE_DMA] = | ||
346 | virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; | ||
347 | max_zone_pfns[ZONE_NORMAL] = max_low_pfn; | ||
348 | remove_all_active_ranges(); | ||
349 | #ifdef CONFIG_HIGHMEM | ||
350 | max_zone_pfns[ZONE_HIGHMEM] = highend_pfn; | ||
351 | e820_register_active_regions(0, 0, highend_pfn); | ||
352 | #else | ||
353 | e820_register_active_regions(0, 0, max_low_pfn); | ||
354 | #endif | ||
355 | |||
356 | free_area_init_nodes(max_zone_pfns); | ||
357 | } | ||
358 | #else | ||
359 | extern unsigned long __init setup_memory(void); | ||
360 | extern void zone_sizes_init(void); | ||
361 | #endif /* !CONFIG_NEED_MULTIPLE_NODES */ | ||
362 | |||
363 | #ifdef CONFIG_BLK_DEV_INITRD | 303 | #ifdef CONFIG_BLK_DEV_INITRD |
364 | 304 | ||
365 | static bool do_relocate_initrd = false; | 305 | static bool do_relocate_initrd = false; |
366 | 306 | ||
367 | static void __init reserve_initrd(void) | 307 | void __init reserve_initrd(void) |
368 | { | 308 | { |
369 | u64 ramdisk_image = boot_params.hdr.ramdisk_image; | 309 | u64 ramdisk_image = boot_params.hdr.ramdisk_image; |
370 | u64 ramdisk_size = boot_params.hdr.ramdisk_size; | 310 | u64 ramdisk_size = boot_params.hdr.ramdisk_size; |
@@ -480,36 +420,6 @@ static void __init relocate_initrd(void) | |||
480 | 420 | ||
481 | #endif /* CONFIG_BLK_DEV_INITRD */ | 421 | #endif /* CONFIG_BLK_DEV_INITRD */ |
482 | 422 | ||
483 | void __init setup_bootmem_allocator(void) | ||
484 | { | ||
485 | int i; | ||
486 | unsigned long bootmap_size, bootmap; | ||
487 | /* | ||
488 | * Initialize the boot-time allocator (with low memory only): | ||
489 | */ | ||
490 | bootmap_size = bootmem_bootmap_pages(max_low_pfn)<<PAGE_SHIFT; | ||
491 | bootmap = find_e820_area(min_low_pfn<<PAGE_SHIFT, | ||
492 | max_pfn_mapped<<PAGE_SHIFT, bootmap_size, | ||
493 | PAGE_SIZE); | ||
494 | if (bootmap == -1L) | ||
495 | panic("Cannot find bootmem map of size %ld\n", bootmap_size); | ||
496 | reserve_early(bootmap, bootmap + bootmap_size, "BOOTMAP"); | ||
497 | #ifdef CONFIG_BLK_DEV_INITRD | ||
498 | reserve_initrd(); | ||
499 | #endif | ||
500 | bootmap_size = init_bootmem(bootmap >> PAGE_SHIFT, max_low_pfn); | ||
501 | printk(KERN_INFO " mapped low ram: 0 - %08lx\n", | ||
502 | max_pfn_mapped<<PAGE_SHIFT); | ||
503 | printk(KERN_INFO " low ram: %08lx - %08lx\n", | ||
504 | min_low_pfn<<PAGE_SHIFT, max_low_pfn<<PAGE_SHIFT); | ||
505 | printk(KERN_INFO " bootmap %08lx - %08lx\n", | ||
506 | bootmap, bootmap + bootmap_size); | ||
507 | for_each_online_node(i) | ||
508 | free_bootmem_with_active_regions(i, max_low_pfn); | ||
509 | early_res_to_bootmem(0, max_low_pfn<<PAGE_SHIFT); | ||
510 | |||
511 | } | ||
512 | |||
513 | /* | 423 | /* |
514 | * The node 0 pgdat is initialized before all of these because | 424 | * The node 0 pgdat is initialized before all of these because |
515 | * it's needed for bootmem. node>0 pgdats have their virtual | 425 | * it's needed for bootmem. node>0 pgdats have their virtual |
@@ -666,7 +576,7 @@ void __init setup_arch(char **cmdline_p) | |||
666 | acpi_numa_init(); | 576 | acpi_numa_init(); |
667 | #endif | 577 | #endif |
668 | 578 | ||
669 | max_low_pfn = setup_memory(); | 579 | max_low_pfn = initmem_init(0, max_pfn); |
670 | 580 | ||
671 | #ifdef CONFIG_ACPI_SLEEP | 581 | #ifdef CONFIG_ACPI_SLEEP |
672 | /* | 582 | /* |
diff --git a/arch/x86/mm/discontig_32.c b/arch/x86/mm/discontig_32.c index a2f73ba42b8b..3e75be46c4f2 100644 --- a/arch/x86/mm/discontig_32.c +++ b/arch/x86/mm/discontig_32.c | |||
@@ -309,8 +309,8 @@ static void init_remap_allocator(int nid) | |||
309 | (ulong) node_remap_end_vaddr[nid]); | 309 | (ulong) node_remap_end_vaddr[nid]); |
310 | } | 310 | } |
311 | 311 | ||
312 | extern void setup_bootmem_allocator(void); | 312 | unsigned long __init initmem_init(unsigned long start_pfn, |
313 | unsigned long __init setup_memory(void) | 313 | unsigned long end_pfn) |
314 | { | 314 | { |
315 | int nid; | 315 | int nid; |
316 | unsigned long system_start_pfn, system_max_low_pfn; | 316 | unsigned long system_start_pfn, system_max_low_pfn; |
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index a0484adbf59d..9bc8607d7980 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -540,6 +540,96 @@ static void __init set_nx(void) | |||
540 | } | 540 | } |
541 | #endif | 541 | #endif |
542 | 542 | ||
543 | #ifndef CONFIG_NEED_MULTIPLE_NODES | ||
544 | extern unsigned long find_max_low_pfn(void); | ||
545 | unsigned long __init initmem_init(unsigned long start_pfn, | ||
546 | unsigned long end_pfn) | ||
547 | { | ||
548 | /* | ||
549 | * partially used pages are not usable - thus | ||
550 | * we are rounding upwards: | ||
551 | */ | ||
552 | min_low_pfn = PFN_UP(init_pg_tables_end); | ||
553 | |||
554 | max_low_pfn = find_max_low_pfn(); | ||
555 | |||
556 | #ifdef CONFIG_HIGHMEM | ||
557 | highstart_pfn = highend_pfn = max_pfn; | ||
558 | if (max_pfn > max_low_pfn) | ||
559 | highstart_pfn = max_low_pfn; | ||
560 | memory_present(0, 0, highend_pfn); | ||
561 | printk(KERN_NOTICE "%ldMB HIGHMEM available.\n", | ||
562 | pages_to_mb(highend_pfn - highstart_pfn)); | ||
563 | num_physpages = highend_pfn; | ||
564 | high_memory = (void *) __va(highstart_pfn * PAGE_SIZE - 1) + 1; | ||
565 | #else | ||
566 | memory_present(0, 0, max_low_pfn); | ||
567 | num_physpages = max_low_pfn; | ||
568 | high_memory = (void *) __va(max_low_pfn * PAGE_SIZE - 1) + 1; | ||
569 | #endif | ||
570 | #ifdef CONFIG_FLATMEM | ||
571 | max_mapnr = num_physpages; | ||
572 | #endif | ||
573 | printk(KERN_NOTICE "%ldMB LOWMEM available.\n", | ||
574 | pages_to_mb(max_low_pfn)); | ||
575 | |||
576 | setup_bootmem_allocator(); | ||
577 | |||
578 | return max_low_pfn; | ||
579 | } | ||
580 | |||
581 | void __init zone_sizes_init(void) | ||
582 | { | ||
583 | unsigned long max_zone_pfns[MAX_NR_ZONES]; | ||
584 | memset(max_zone_pfns, 0, sizeof(max_zone_pfns)); | ||
585 | max_zone_pfns[ZONE_DMA] = | ||
586 | virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; | ||
587 | max_zone_pfns[ZONE_NORMAL] = max_low_pfn; | ||
588 | remove_all_active_ranges(); | ||
589 | #ifdef CONFIG_HIGHMEM | ||
590 | max_zone_pfns[ZONE_HIGHMEM] = highend_pfn; | ||
591 | e820_register_active_regions(0, 0, highend_pfn); | ||
592 | #else | ||
593 | e820_register_active_regions(0, 0, max_low_pfn); | ||
594 | #endif | ||
595 | |||
596 | free_area_init_nodes(max_zone_pfns); | ||
597 | } | ||
598 | #endif /* !CONFIG_NEED_MULTIPLE_NODES */ | ||
599 | |||
600 | extern void reserve_initrd(void); | ||
601 | |||
602 | void __init setup_bootmem_allocator(void) | ||
603 | { | ||
604 | int i; | ||
605 | unsigned long bootmap_size, bootmap; | ||
606 | /* | ||
607 | * Initialize the boot-time allocator (with low memory only): | ||
608 | */ | ||
609 | bootmap_size = bootmem_bootmap_pages(max_low_pfn)<<PAGE_SHIFT; | ||
610 | bootmap = find_e820_area(min_low_pfn<<PAGE_SHIFT, | ||
611 | max_pfn_mapped<<PAGE_SHIFT, bootmap_size, | ||
612 | PAGE_SIZE); | ||
613 | if (bootmap == -1L) | ||
614 | panic("Cannot find bootmem map of size %ld\n", bootmap_size); | ||
615 | reserve_early(bootmap, bootmap + bootmap_size, "BOOTMAP"); | ||
616 | #ifdef CONFIG_BLK_DEV_INITRD | ||
617 | reserve_initrd(); | ||
618 | #endif | ||
619 | bootmap_size = init_bootmem(bootmap >> PAGE_SHIFT, max_low_pfn); | ||
620 | printk(KERN_INFO " mapped low ram: 0 - %08lx\n", | ||
621 | max_pfn_mapped<<PAGE_SHIFT); | ||
622 | printk(KERN_INFO " low ram: %08lx - %08lx\n", | ||
623 | min_low_pfn<<PAGE_SHIFT, max_low_pfn<<PAGE_SHIFT); | ||
624 | printk(KERN_INFO " bootmap %08lx - %08lx\n", | ||
625 | bootmap, bootmap + bootmap_size); | ||
626 | for_each_online_node(i) | ||
627 | free_bootmem_with_active_regions(i, max_low_pfn); | ||
628 | early_res_to_bootmem(0, max_low_pfn<<PAGE_SHIFT); | ||
629 | |||
630 | } | ||
631 | |||
632 | |||
543 | /* | 633 | /* |
544 | * paging_init() sets up the page tables - note that the first 8MB are | 634 | * paging_init() sets up the page tables - note that the first 8MB are |
545 | * already mapped by head.S. | 635 | * already mapped by head.S. |
diff --git a/include/asm-x86/page_32.h b/include/asm-x86/page_32.h index 73ed2e4ebf95..a0713d175f45 100644 --- a/include/asm-x86/page_32.h +++ b/include/asm-x86/page_32.h | |||
@@ -92,6 +92,11 @@ extern int sysctl_legacy_va_layout; | |||
92 | #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE) | 92 | #define VMALLOC_RESERVE ((unsigned long)__VMALLOC_RESERVE) |
93 | #define MAXMEM (-__PAGE_OFFSET - __VMALLOC_RESERVE) | 93 | #define MAXMEM (-__PAGE_OFFSET - __VMALLOC_RESERVE) |
94 | 94 | ||
95 | extern unsigned long initmem_init(unsigned long, unsigned long); | ||
96 | extern void zone_sizes_init(void); | ||
97 | extern void setup_bootmem_allocator(void); | ||
98 | |||
99 | |||
95 | #ifdef CONFIG_X86_USE_3DNOW | 100 | #ifdef CONFIG_X86_USE_3DNOW |
96 | #include <asm/mmx.h> | 101 | #include <asm/mmx.h> |
97 | 102 | ||