diff options
author | Huang, Ying <ying.huang@intel.com> | 2008-03-27 22:49:42 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-26 15:34:42 -0400 |
commit | 50eae2a7c9862afe263a2003c12f457ecfc9e6a2 (patch) | |
tree | 96e8e53c168c4c4cc983f629151091c17014be3b /arch/x86/kernel/e820_64.c | |
parent | 4a27214d7be31e122db4102166f49ec15958e8e9 (diff) |
x86, boot: add free_early to early reservation machanism
Add free_early to early reservation mechanism - this way early bootup
failure paths can stop wasting memory.
Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/kernel/e820_64.c')
-rw-r--r-- | arch/x86/kernel/e820_64.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/arch/x86/kernel/e820_64.c b/arch/x86/kernel/e820_64.c index cbd42e51cb08..79f0d52fa99a 100644 --- a/arch/x86/kernel/e820_64.c +++ b/arch/x86/kernel/e820_64.c | |||
@@ -84,6 +84,28 @@ void __init reserve_early(unsigned long start, unsigned long end, char *name) | |||
84 | strncpy(r->name, name, sizeof(r->name) - 1); | 84 | strncpy(r->name, name, sizeof(r->name) - 1); |
85 | } | 85 | } |
86 | 86 | ||
87 | void __init free_early(unsigned long start, unsigned long end) | ||
88 | { | ||
89 | struct early_res *r; | ||
90 | int i, j; | ||
91 | |||
92 | for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) { | ||
93 | r = &early_res[i]; | ||
94 | if (start == r->start && end == r->end) | ||
95 | break; | ||
96 | } | ||
97 | if (i >= MAX_EARLY_RES || !early_res[i].end) | ||
98 | panic("free_early on not reserved area: %lx-%lx!", start, end); | ||
99 | |||
100 | for (j = i + 1; j < MAX_EARLY_RES && early_res[j].end; j++) | ||
101 | ; | ||
102 | |||
103 | memcpy(&early_res[i], &early_res[i + 1], | ||
104 | (j - 1 - i) * sizeof(struct early_res)); | ||
105 | |||
106 | early_res[j - 1].end = 0; | ||
107 | } | ||
108 | |||
87 | void __init early_res_to_bootmem(void) | 109 | void __init early_res_to_bootmem(void) |
88 | { | 110 | { |
89 | int i; | 111 | int i; |