Commit 4e33e065 authored by Yinghai Lu's avatar Yinghai Lu Committed by H. Peter Anvin

x86, mm: Split out split_mem_range from init_memory_mapping

So make init_memory_mapping smaller and readable.

-v2: use 0 instead of nr_range as input parameter found by Yasuaki Ishimatsu.
Suggested-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/1353123563-3103-3-git-send-email-yinghai@kernel.orgReviewed-by: default avatarPekka Enberg <penberg@kernel.org>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@linux.intel.com>
parent fa62aafe
...@@ -146,25 +146,13 @@ static int __meminit save_mr(struct map_range *mr, int nr_range, ...@@ -146,25 +146,13 @@ static int __meminit save_mr(struct map_range *mr, int nr_range,
return nr_range; return nr_range;
} }
/* static int __meminit split_mem_range(struct map_range *mr, int nr_range,
* Setup the direct mapping of the physical memory at PAGE_OFFSET. unsigned long start,
* This runs before bootmem is initialized and gets pages directly from unsigned long end)
* the physical memory. To access them they are temporarily mapped.
*/
unsigned long __init_refok init_memory_mapping(unsigned long start,
unsigned long end)
{ {
unsigned long start_pfn, end_pfn; unsigned long start_pfn, end_pfn;
unsigned long ret = 0;
unsigned long pos; unsigned long pos;
struct map_range mr[NR_RANGE_MR]; int i;
int nr_range, i;
printk(KERN_INFO "init_memory_mapping: [mem %#010lx-%#010lx]\n",
start, end - 1);
memset(mr, 0, sizeof(mr));
nr_range = 0;
/* head if not big page alignment ? */ /* head if not big page alignment ? */
start_pfn = start >> PAGE_SHIFT; start_pfn = start >> PAGE_SHIFT;
...@@ -258,6 +246,27 @@ unsigned long __init_refok init_memory_mapping(unsigned long start, ...@@ -258,6 +246,27 @@ unsigned long __init_refok init_memory_mapping(unsigned long start,
(mr[i].page_size_mask & (1<<PG_LEVEL_1G))?"1G":( (mr[i].page_size_mask & (1<<PG_LEVEL_1G))?"1G":(
(mr[i].page_size_mask & (1<<PG_LEVEL_2M))?"2M":"4k")); (mr[i].page_size_mask & (1<<PG_LEVEL_2M))?"2M":"4k"));
return nr_range;
}
/*
* Setup the direct mapping of the physical memory at PAGE_OFFSET.
* This runs before bootmem is initialized and gets pages directly from
* the physical memory. To access them they are temporarily mapped.
*/
unsigned long __init_refok init_memory_mapping(unsigned long start,
unsigned long end)
{
struct map_range mr[NR_RANGE_MR];
unsigned long ret = 0;
int nr_range, i;
pr_info("init_memory_mapping: [mem %#010lx-%#010lx]\n",
start, end - 1);
memset(mr, 0, sizeof(mr));
nr_range = split_mem_range(mr, 0, start, end);
/* /*
* Find space for the kernel direct mapping tables. * Find space for the kernel direct mapping tables.
* *
......
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