Commit d2dbf343 authored by Yinghai Lu's avatar Yinghai Lu Committed by Ingo Molnar

x86: clean up reserve_bootmem_generic() and port it to 32-bit

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: default avatarYinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent b1f006b6
...@@ -635,7 +635,7 @@ void __init early_res_to_bootmem(u64 start, u64 end) ...@@ -635,7 +635,7 @@ void __init early_res_to_bootmem(u64 start, u64 end)
continue; continue;
printk(KERN_INFO " early res: %d [%llx-%llx] %s\n", i, printk(KERN_INFO " early res: %d [%llx-%llx] %s\n", i,
final_start, final_end - 1, r->name); 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); BOOTMEM_DEFAULT);
} }
} }
......
...@@ -859,10 +859,11 @@ static int __init smp_scan_config(unsigned long base, unsigned long length, ...@@ -859,10 +859,11 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
if (!reserve) if (!reserve)
return 1; return 1;
#ifdef CONFIG_X86_32 reserve_bootmem_generic(virt_to_phys(mpf), PAGE_SIZE,
reserve_bootmem(virt_to_phys(mpf), PAGE_SIZE,
BOOTMEM_DEFAULT); BOOTMEM_DEFAULT);
if (mpf->mpf_physptr) { if (mpf->mpf_physptr) {
unsigned long size = PAGE_SIZE;
#ifdef CONFIG_X86_32
/* /*
* We cannot access to MPC table to compute * We cannot access to MPC table to compute
* table size yet, as only few megabytes from * table size yet, as only few megabytes from
...@@ -872,21 +873,14 @@ static int __init smp_scan_config(unsigned long base, unsigned long length, ...@@ -872,21 +873,14 @@ static int __init smp_scan_config(unsigned long base, unsigned long length,
* PAGE_SIZE from mpg->mpf_physptr yields BUG() * PAGE_SIZE from mpg->mpf_physptr yields BUG()
* in reserve_bootmem. * in reserve_bootmem.
*/ */
unsigned long size = PAGE_SIZE;
unsigned long end = max_low_pfn * PAGE_SIZE; unsigned long end = max_low_pfn * PAGE_SIZE;
if (mpf->mpf_physptr + size > end) if (mpf->mpf_physptr + size > end)
size = end - mpf->mpf_physptr; size = end - mpf->mpf_physptr;
reserve_bootmem(mpf->mpf_physptr, size, #endif
reserve_bootmem_generic(mpf->mpf_physptr, size,
BOOTMEM_DEFAULT); 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; bp += 4;
......
...@@ -785,3 +785,9 @@ void free_initrd_mem(unsigned long start, unsigned long end) ...@@ -785,3 +785,9 @@ void free_initrd_mem(unsigned long start, unsigned long end)
free_init_pages("initrd memory", start, end); free_init_pages("initrd memory", start, end);
} }
#endif #endif
int __init reserve_bootmem_generic(unsigned long phys, unsigned long len,
int flags)
{
return reserve_bootmem(phys, len, flags);
}
...@@ -799,7 +799,8 @@ void free_initrd_mem(unsigned long start, unsigned long end) ...@@ -799,7 +799,8 @@ void free_initrd_mem(unsigned long start, unsigned long end)
} }
#endif #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 #ifdef CONFIG_NUMA
int nid, next_nid; int nid, next_nid;
......
...@@ -14,8 +14,6 @@ extern void ia32_syscall(void); ...@@ -14,8 +14,6 @@ extern void ia32_syscall(void);
extern void ia32_cstar_target(void); extern void ia32_cstar_target(void);
extern void ia32_sysenter_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 syscall32_cpu_init(void);
extern void check_efer(void); extern void check_efer(void);
......
...@@ -84,6 +84,8 @@ extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags); ...@@ -84,6 +84,8 @@ extern int reserve_bootmem(unsigned long addr, unsigned long size, int flags);
__alloc_bootmem_low(x, PAGE_SIZE, 0) __alloc_bootmem_low(x, PAGE_SIZE, 0)
#endif /* !CONFIG_HAVE_ARCH_BOOTMEM_NODE */ #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(void);
extern unsigned long free_all_bootmem_node(pg_data_t *pgdat); extern unsigned long free_all_bootmem_node(pg_data_t *pgdat);
extern void *__alloc_bootmem_node(pg_data_t *pgdat, extern void *__alloc_bootmem_node(pg_data_t *pgdat,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment