提交 9dc5d569 编写于 作者: Y Yinghai Lu 提交者: H. Peter Anvin

x86, memblock: Add memblock_x86_reserve_range/memblock_x86_free_range

They are wrappers for core versions, which take start/end/name instead
of base/size.  This will make x86 conversion eaasier.

could add more debug print out

-v2: change get_max_mapped() to memblock.default_alloc_limit according to Michael
      Ellerman and Ben
     change to memblock_x86_reserve_range and memblock_x86_free_range according to Michael Ellerman
-v3: call check_and_double after reserve/free, so could avoid to use
      find_memblock_area. Suggested by Michael Ellerman
Signed-off-by: NYinghai Lu <yinghai@kernel.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: NH. Peter Anvin <hpa@zytor.com>
上级 27de7943
...@@ -6,4 +6,7 @@ ...@@ -6,4 +6,7 @@
u64 memblock_x86_find_in_range_size(u64 start, u64 *sizep, u64 align); u64 memblock_x86_find_in_range_size(u64 start, u64 *sizep, u64 align);
void memblock_x86_to_bootmem(u64 start, u64 end); void memblock_x86_to_bootmem(u64 start, u64 end);
void memblock_x86_reserve_range(u64 start, u64 end, char *name);
void memblock_x86_free_range(u64 start, u64 end);
#endif #endif
...@@ -114,3 +114,25 @@ void __init memblock_x86_to_bootmem(u64 start, u64 end) ...@@ -114,3 +114,25 @@ void __init memblock_x86_to_bootmem(u64 start, u64 end)
memblock_reserve_reserved_regions(); memblock_reserve_reserved_regions();
} }
#endif #endif
void __init memblock_x86_reserve_range(u64 start, u64 end, char *name)
{
if (start == end)
return;
if (WARN_ONCE(start > end, "memblock_x86_reserve_range: wrong range [%#llx, %#llx]\n", start, end))
return;
memblock_reserve(start, end - start);
}
void __init memblock_x86_free_range(u64 start, u64 end)
{
if (start == end)
return;
if (WARN_ONCE(start > end, "memblock_x86_free_range: wrong range [%#llx, %#llx]\n", start, end))
return;
memblock_free(start, end - start);
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册