diff options
author | Yinghai Lu <yhlu.kernel@gmail.com> | 2008-06-24 15:18:58 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-08 07:10:32 -0400 |
commit | cfb0e53b05402f1ce65053677409a819c1798d34 (patch) | |
tree | c168638e03c6ea67fef6c60f3032929835f46822 /arch | |
parent | 4e29684c40f2a332ba4d05f6482d5807725d5624 (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>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/setup_32.c | 22 | ||||
-rw-r--r-- | arch/x86/mm/init_32.c | 3 |
2 files changed, 7 insertions, 18 deletions
diff --git a/arch/x86/kernel/setup_32.c b/arch/x86/kernel/setup_32.c index 03007cada0d1..4b953dc93883 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) | |||
186 | 186 | ||
187 | #ifdef CONFIG_BLK_DEV_INITRD | 187 | #ifdef CONFIG_BLK_DEV_INITRD |
188 | 188 | ||
189 | static bool do_relocate_initrd = false; | 189 | static void __init relocate_initrd(void); |
190 | 190 | ||
191 | static void __init reserve_initrd(void) | 191 | static void __init reserve_initrd(void) |
192 | { | 192 | { |
@@ -195,7 +195,6 @@ static void __init reserve_initrd(void) | |||
195 | u64 ramdisk_end = ramdisk_image + ramdisk_size; | 195 | u64 ramdisk_end = ramdisk_image + ramdisk_size; |
196 | u64 end_of_lowmem = max_low_pfn << PAGE_SHIFT; | 196 | u64 end_of_lowmem = max_low_pfn << PAGE_SHIFT; |
197 | u64 ramdisk_here; | 197 | u64 ramdisk_here; |
198 | u64 ramdisk_target; | ||
199 | 198 | ||
200 | if (!boot_params.hdr.type_of_loader || | 199 | if (!boot_params.hdr.type_of_loader || |
201 | !ramdisk_image || !ramdisk_size) | 200 | !ramdisk_image || !ramdisk_size) |
@@ -242,12 +241,12 @@ static void __init reserve_initrd(void) | |||
242 | printk(KERN_INFO "Allocated new RAMDISK: %08llx - %08llx\n", | 241 | printk(KERN_INFO "Allocated new RAMDISK: %08llx - %08llx\n", |
243 | ramdisk_here, ramdisk_here + ramdisk_size); | 242 | ramdisk_here, ramdisk_here + ramdisk_size); |
244 | 243 | ||
245 | do_relocate_initrd = true; | 244 | relocate_initrd(); |
246 | } | 245 | } |
247 | 246 | ||
248 | #define MAX_MAP_CHUNK (NR_FIX_BTMAPS << PAGE_SHIFT) | 247 | #define MAX_MAP_CHUNK (NR_FIX_BTMAPS << PAGE_SHIFT) |
249 | 248 | ||
250 | void __init post_reserve_initrd(void) | 249 | static void __init relocate_initrd(void) |
251 | { | 250 | { |
252 | u64 ramdisk_image = boot_params.hdr.ramdisk_image; | 251 | u64 ramdisk_image = boot_params.hdr.ramdisk_image; |
253 | u64 ramdisk_size = boot_params.hdr.ramdisk_size; | 252 | u64 ramdisk_size = boot_params.hdr.ramdisk_size; |
@@ -256,9 +255,6 @@ void __init post_reserve_initrd(void) | |||
256 | unsigned long slop, clen, mapaddr; | 255 | unsigned long slop, clen, mapaddr; |
257 | char *p, *q; | 256 | char *p, *q; |
258 | 257 | ||
259 | if (!do_relocate_initrd) | ||
260 | return; | ||
261 | |||
262 | ramdisk_here = initrd_start - PAGE_OFFSET; | 258 | ramdisk_here = initrd_start - PAGE_OFFSET; |
263 | 259 | ||
264 | q = (char *)initrd_start; | 260 | q = (char *)initrd_start; |
@@ -269,10 +265,6 @@ void __init post_reserve_initrd(void) | |||
269 | p = (char *)__va(ramdisk_image); | 265 | p = (char *)__va(ramdisk_image); |
270 | memcpy(q, p, clen); | 266 | memcpy(q, p, clen); |
271 | q += clen; | 267 | q += clen; |
272 | /* need to free these low pages...*/ | ||
273 | printk(KERN_INFO "Freeing old partial RAMDISK %08llx-%08llx\n", | ||
274 | ramdisk_image, ramdisk_image + clen - 1); | ||
275 | free_bootmem(ramdisk_image, clen); | ||
276 | ramdisk_image += clen; | 268 | ramdisk_image += clen; |
277 | ramdisk_size -= clen; | 269 | ramdisk_size -= clen; |
278 | } | 270 | } |
@@ -298,16 +290,16 @@ void __init post_reserve_initrd(void) | |||
298 | ramdisk_image, ramdisk_image + ramdisk_size - 1, | 290 | ramdisk_image, ramdisk_image + ramdisk_size - 1, |
299 | ramdisk_here, ramdisk_here + ramdisk_size - 1); | 291 | ramdisk_here, ramdisk_here + ramdisk_size - 1); |
300 | 292 | ||
301 | /* need to free that, otherwise init highmem will reserve it again */ | 293 | /* |
294 | * need to free old one, otherwise init cross max_low_pfn could be | ||
295 | * converted to bootmem | ||
296 | */ | ||
302 | free_early(ramdisk_image, ramdisk_image+ramdisk_size); | 297 | free_early(ramdisk_image, ramdisk_image+ramdisk_size); |
303 | } | 298 | } |
304 | #else | 299 | #else |
305 | void __init reserve_initrd(void) | 300 | void __init reserve_initrd(void) |
306 | { | 301 | { |
307 | } | 302 | } |
308 | void __init post_reserve_initrd(void) | ||
309 | { | ||
310 | } | ||
311 | #endif /* CONFIG_BLK_DEV_INITRD */ | 303 | #endif /* CONFIG_BLK_DEV_INITRD */ |
312 | 304 | ||
313 | #ifdef CONFIG_MCA | 305 | #ifdef CONFIG_MCA |
diff --git a/arch/x86/mm/init_32.c b/arch/x86/mm/init_32.c index 619058e6bff8..ecccb055b085 100644 --- a/arch/x86/mm/init_32.c +++ b/arch/x86/mm/init_32.c | |||
@@ -831,9 +831,6 @@ void __init paging_init(void) | |||
831 | /* | 831 | /* |
832 | * NOTE: at this point the bootmem allocator is fully available. | 832 | * NOTE: at this point the bootmem allocator is fully available. |
833 | */ | 833 | */ |
834 | |||
835 | post_reserve_initrd(); | ||
836 | |||
837 | remapped_pgdat_init(); | 834 | remapped_pgdat_init(); |
838 | sparse_init(); | 835 | sparse_init(); |
839 | zone_sizes_init(); | 836 | zone_sizes_init(); |