forked from Minki/linux
x86: Move back find_e820_area to e820.c
Makes early_res.c more clean, so later could move it to /kernel. Signed-off-by: Yinghai Lu <yinghai@kernel.org> LKML-Reference: <1265793639-15071-23-git-send-email-yinghai@kernel.org> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
7da657d1f1
commit
efdd0e81df
@ -109,6 +109,8 @@ static inline void early_memtest(unsigned long start, unsigned long end)
|
||||
|
||||
extern unsigned long end_user_pfn;
|
||||
|
||||
extern u64 find_e820_area(u64 start, u64 end, u64 size, u64 align);
|
||||
extern u64 find_e820_area_size(u64 start, u64 *sizep, u64 align);
|
||||
extern u64 early_reserve_e820(u64 startt, u64 sizet, u64 align);
|
||||
#include <asm/early_res.h>
|
||||
|
||||
|
@ -2,8 +2,6 @@
|
||||
#define _ASM_X86_EARLY_RES_H
|
||||
#ifdef __KERNEL__
|
||||
|
||||
extern u64 find_e820_area(u64 start, u64 end, u64 size, u64 align);
|
||||
extern u64 find_e820_area_size(u64 start, u64 *sizep, u64 align);
|
||||
extern void reserve_early(u64 start, u64 end, char *name);
|
||||
extern void reserve_early_overlap_ok(u64 start, u64 end, char *name);
|
||||
extern void free_early(u64 start, u64 end);
|
||||
@ -12,6 +10,8 @@ extern void early_res_to_bootmem(u64 start, u64 end);
|
||||
void reserve_early_without_check(u64 start, u64 end, char *name);
|
||||
u64 find_early_area(u64 ei_start, u64 ei_last, u64 start, u64 end,
|
||||
u64 size, u64 align);
|
||||
u64 find_early_area_size(u64 ei_start, u64 ei_last, u64 start,
|
||||
u64 *sizep, u64 align);
|
||||
#include <linux/range.h>
|
||||
int get_free_all_memory_range(struct range **rangep, int nodeid);
|
||||
|
||||
|
@ -722,6 +722,59 @@ static int __init e820_mark_nvs_memory(void)
|
||||
core_initcall(e820_mark_nvs_memory);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Find a free area with specified alignment in a specific range.
|
||||
*/
|
||||
u64 __init find_e820_area(u64 start, u64 end, u64 size, u64 align)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < e820.nr_map; i++) {
|
||||
struct e820entry *ei = &e820.map[i];
|
||||
u64 addr;
|
||||
u64 ei_start, ei_last;
|
||||
|
||||
if (ei->type != E820_RAM)
|
||||
continue;
|
||||
|
||||
ei_last = ei->addr + ei->size;
|
||||
ei_start = ei->addr;
|
||||
addr = find_early_area(ei_start, ei_last, start, end,
|
||||
size, align);
|
||||
|
||||
if (addr != -1ULL)
|
||||
return addr;
|
||||
}
|
||||
return -1ULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find next free range after *start
|
||||
*/
|
||||
u64 __init find_e820_area_size(u64 start, u64 *sizep, u64 align)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < e820.nr_map; i++) {
|
||||
struct e820entry *ei = &e820.map[i];
|
||||
u64 addr;
|
||||
u64 ei_start, ei_last;
|
||||
|
||||
if (ei->type != E820_RAM)
|
||||
continue;
|
||||
|
||||
ei_last = ei->addr + ei->size;
|
||||
ei_start = ei->addr;
|
||||
addr = find_early_area_size(ei_start, ei_last, start,
|
||||
sizep, align);
|
||||
|
||||
if (addr != -1ULL)
|
||||
return addr;
|
||||
}
|
||||
|
||||
return -1ULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* pre allocated 4k and reserved it in e820
|
||||
*/
|
||||
|
@ -498,60 +498,3 @@ u64 __init find_early_area_size(u64 ei_start, u64 ei_last, u64 start,
|
||||
out:
|
||||
return -1ULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find a free area with specified alignment in a specific range.
|
||||
*/
|
||||
u64 __init find_e820_area(u64 start, u64 end, u64 size, u64 align)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < e820.nr_map; i++) {
|
||||
struct e820entry *ei = &e820.map[i];
|
||||
u64 addr;
|
||||
u64 ei_start, ei_last;
|
||||
|
||||
if (ei->type != E820_RAM)
|
||||
continue;
|
||||
|
||||
ei_last = ei->addr + ei->size;
|
||||
ei_start = ei->addr;
|
||||
addr = find_early_area(ei_start, ei_last, start, end,
|
||||
size, align);
|
||||
|
||||
if (addr == -1ULL)
|
||||
continue;
|
||||
|
||||
return addr;
|
||||
}
|
||||
return -1ULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find next free range after *start
|
||||
*/
|
||||
u64 __init find_e820_area_size(u64 start, u64 *sizep, u64 align)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < e820.nr_map; i++) {
|
||||
struct e820entry *ei = &e820.map[i];
|
||||
u64 addr;
|
||||
u64 ei_start, ei_last;
|
||||
|
||||
if (ei->type != E820_RAM)
|
||||
continue;
|
||||
|
||||
ei_last = ei->addr + ei->size;
|
||||
ei_start = ei->addr;
|
||||
addr = find_early_area_size(ei_start, ei_last, start,
|
||||
sizep, align);
|
||||
|
||||
if (addr == -1ULL)
|
||||
continue;
|
||||
|
||||
return addr;
|
||||
}
|
||||
|
||||
return -1ULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user