aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYinghai Lu <yhlu.kernel@gmail.com>2008-06-24 12:18:58 -0700
committerIngo Molnar <mingo@elte.hu>2008-07-08 13:10:32 +0200
commitcfb0e53b05402f1ce65053677409a819c1798d34 (patch)
treec168638e03c6ea67fef6c60f3032929835f46822
parent4e29684c40f2a332ba4d05f6482d5807725d5624 (diff)
x86: introduce init_memory_mapping for 32bit #2
moving relocate_initrd early Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/setup_32.c22
-rw-r--r--arch/x86/mm/init_32.c3
-rw-r--r--include/asm-x86/setup.h1
3 files changed, 7 insertions, 19 deletions
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c
index 03007cada0d..4b953dc9388 100644
--- a/arch/x86/kernel/setup_32.c
+++ b/arch/x86/kernel/setup_32.c
@@ -186,7 +186,7 @@ static inline void copy_edd(void)
#ifdef CONFIG_BLK_DEV_INITRD
-static bool do_relocate_initrd = false;
+static void __init relocate_initrd(void);
static void __init reserve_initrd(void)
{
@@ -195,7 +195,6 @@ static void __init reserve_initrd(void)
u64 ramdisk_end = ramdisk_image + ramdisk_size;
u64 end_of_lowmem = max_low_pfn << PAGE_SHIFT;
u64 ramdisk_here;
- u64 ramdisk_target;
if (!boot_params.hdr.type_of_loader ||
!ramdisk_image || !ramdisk_size)
@@ -242,12 +241,12 @@ static void __init reserve_initrd(void)
printk(KERN_INFO "Allocated new RAMDISK: %08llx - %08llx\n",
ramdisk_here, ramdisk_here + ramdisk_size);
- do_relocate_initrd = true;
+ relocate_initrd();
}
#define MAX_MAP_CHUNK (NR_FIX_BTMAPS << PAGE_SHIFT)
-void __init post_reserve_initrd(void)
+static void __init relocate_initrd(void)
{
u64 ramdisk_image = boot_params.hdr.ramdisk_image;
u64 ramdisk_size = boot_params.hdr.ramdisk_size;
@@ -256,9 +255,6 @@ void __init post_reserve_initrd(void)
unsigned long slop, clen, mapaddr;
char *p, *q;
- if (!do_relocate_initrd)
- return;
-
ramdisk_here = initrd_start - PAGE_OFFSET;
q = (char *)initrd_start;
@@ -269,10 +265,6 @@ void __init post_reserve_initrd(void)
p = (char *)__va(ramdisk_image);
memcpy(q, p, clen);
q += clen;
- /* need to free these low pages...*/
- printk(KERN_INFO "Freeing old partial RAMDISK %08llx-%08llx\n",
- ramdisk_image, ramdisk_image + clen - 1);
- free_bootmem(ramdisk_image, clen);
ramdisk_image += clen;
ramdisk_size -= clen;
}
@@ -298,16 +290,16 @@ void __init post_reserve_initrd(void)
ramdisk_image, ramdisk_image + ramdisk_size - 1,
ramdisk_here, ramdisk_here + ramdisk_size - 1);
- /* need to free that, otherwise init highmem will reserve it again */
+ /*
+ * need to free old one, otherwise init cross max_low_pfn could be
+ * converted to bootmem
+ */
free_early(ramdisk_image, ramdisk_image+ramdisk_size);
}
#else
void __init reserve_initrd(void)
{
}
-void __init post_reserve_initrd(void)
-{
-}
#endif /* CONFIG_BLK_DEV_INITRD */
#ifdef CONFIG_MCA
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c
index 619058e6bff..ecccb055b08 100644
--- a/arch/x86/mm/init_32.c
+++ b/arch/x86/mm/init_32.c
@@ -831,9 +831,6 @@ void __init paging_init(void)
/*
* NOTE: at this point the bootmem allocator is fully available.
*/
-
- post_reserve_initrd();
-
remapped_pgdat_init();
sparse_init();
zone_sizes_init();
diff --git a/include/asm-x86/setup.h b/include/asm-x86/setup.h
index 4ebb4ef14c0..bb12a1619c1 100644
--- a/include/asm-x86/setup.h
+++ b/include/asm-x86/setup.h
@@ -39,7 +39,6 @@ void reserve_crashkernel(void);
#include <asm/bootparam.h>
void reserve_standard_io_resources(void);
-extern void post_reserve_initrd(void);
#ifndef _SETUP