]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
x86: clean up reserve_bootmem_generic() and port it to 32-bit
authorYinghai Lu <yhlu.kernel@gmail.com>
Fri, 13 Jun 2008 09:00:56 +0000 (02:00 -0700)
committerIngo Molnar <mingo@elte.hu>
Tue, 8 Jul 2008 08:36:17 +0000 (10:36 +0200)
1. add reserve_bootmem_generic for 32bit
2. change len to unsigned long
3. make early_res_to_bootmem to use it

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/e820.c
arch/x86/kernel/mpparse.c
arch/x86/mm/init_32.c
arch/x86/mm/init_64.c
include/asm-x86/proto.h
include/linux/bootmem.h

index 4f2cd5d179e2cf2ad691837c3699c65f4e728f62..774063f11be023bd2b1f60c48bbdcc301d913e13 100644 (file)
@@ -635,7 +635,7 @@ void __init early_res_to_bootmem(u64 start, u64 end)
                        continue;
                printk(KERN_INFO "  early res: %d [%llx-%llx] %s\n", i,
                        final_start, final_end - 1, r->name);
-               reserve_bootmem(final_start, final_end - final_start,
+               reserve_bootmem_generic(final_start, final_end - final_start,
                                BOOTMEM_DEFAULT);
        }
 }
index 7ac1b689b70ad23bee24ded01bd2afd081372e15..b62ac6ba1410e439e7e49d0abfb8eff9f57458bb 100644 (file)
@@ -859,10 +859,11 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
 
                        if (!reserve)
                                return 1;
-#ifdef CONFIG_X86_32
-                       reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE,
+                       reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE,
                                        BOOTMEM_DEFAULT);
                        if (mpf->mpf_physptr) {
+                               unsigned long size = PAGE_SIZE;
+#ifdef CONFIG_X86_32
                                /*
                                 * We cannot access to MPC table to compute
                                 * table size yet, as only few megabytes from
@@ -872,22 +873,15 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
                                 * PAGE_SIZE from mpg->mpf_physptr yields BUG()
                                 * in reserve_bootmem.
                                 */
-                               unsigned long size = PAGE_SIZE;
                                unsigned long end = max_low_pfn * PAGE_SIZE;
                                if (mpf->mpf_physptr + size > end)
                                        size = end - mpf->mpf_physptr;
-                               reserve_bootmem(mpf->mpf_physptr, size,
+#endif
+                               reserve_bootmem_generic(mpf->mpf_physptr, size,
                                                BOOTMEM_DEFAULT);
                        }
 
-#else
-                       reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE,
-                               BOOTMEM_DEFAULT);
-                       if (mpf->mpf_physptr)
-                               reserve_bootmem_generic(mpf->mpf_physptr,
-                                       PAGE_SIZE, BOOTMEM_DEFAULT);
-#endif
-               return 1;
+                       return 1;
                }
                bp += 4;
                length -= 16;
index 0e7bb5e81670e577de9ab19a9e5a350fb4d55d6b..abadb1da70df63f574594a39f28e51cb794df301 100644 (file)
@@ -785,3 +785,9 @@ void free_initrd_mem(unsigned long start, unsigned long end)
        free_init_pages("initrd memory", start, end);
 }
 #endif
+
+int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
+                                  int flags)
+{
+       return reserve_bootmem(phys, len, flags);
+}
index bf7bf1de6c25aa1a6b461474b762718bb9c73dca..b8c2c1ef7ad55ad9286f2a38b7d73d805a1098fc 100644 (file)
@@ -799,7 +799,8 @@ void free_initrd_mem(unsigned long start, unsigned long end)
 }
 #endif
 
-int __init reserve_bootmem_generic(unsigned long phys, unsigned len, int flags)
+int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
+                                  int flags)
 {
 #ifdef CONFIG_NUMA
        int nid, next_nid;
index a9f51472521e9c8bfb621aa86882811d71e62a2d..3dd458c385c0532b59ce3aac67386ad215665dc9 100644 (file)
@@ -14,8 +14,6 @@ extern void ia32_syscall(void);
 extern void ia32_cstar_target(void);
 extern void ia32_sysenter_target(void);
 
-extern int reserve_bootmem_generic(unsigned long phys, unsigned len, int flags);
-
 extern void syscall32_cpu_init(void);
 
 extern void check_efer(void);
index 686895bacd9dcc8500518d4bddc3629ec9533dd4..a1d9b79078ea03425cb1ce4ae8746daf01c46fd5 100644 (file)
@@ -84,6 +84,8 @@ extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags);
        __alloc_bootmem_low(x, PAGE_SIZE, 0)
 #endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */
 
+extern int reserve_bootmem_generic(unsigned long addr, unsigned long size,
+                                  int flags);
 extern unsigned long free_all_bootmem(void);
 extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
 extern void *__alloc_bootmem_node(pg_data_t *pgdat,