[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1206601746.3067.21.camel@caritas-dev.intel.com>
Date: Thu, 27 Mar 2008 15:09:06 +0800
From: "Huang, Ying" <ying.huang@...el.com>
To: "H. Peter Anvin" <hpa@...or.com>, andi@...stfloor.org,
mingo@...hat.com, tglx@...utronix.de, Paul Jackson <pj@....com>
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH -mm 1/4] x86_64 boot: Add free_early to early reservation
machanism
Add free_early to early reservation mechanism.
Signed-off-by: Huang Ying <ying.huang@...el.com>
---
arch/x86/kernel/e820_64.c | 17 +++++++++++++++++
include/asm-x86/e820_64.h | 1 +
2 files changed, 18 insertions(+)
--- a/arch/x86/kernel/e820_64.c
+++ b/arch/x86/kernel/e820_64.c
@@ -84,6 +84,23 @@ void __init reserve_early(unsigned long
strncpy(r->name, name, sizeof(r->name) - 1);
}
+void __init free_early(unsigned long start, unsigned long end)
+{
+ int i, j;
+ struct early_res *r;
+ for (i = 0; i < MAX_EARLY_RES && early_res[i].end; i++) {
+ r = &early_res[i];
+ if (start == r->start && end == r->end)
+ break;
+ }
+ if (i >= MAX_EARLY_RES || !early_res[i].end)
+ panic("free_early on not reserved area: %lx-%lx!", start, end);
+ for (j = i+1; j < MAX_EARLY_RES && early_res[j].end; j++) ;
+ memcpy(&early_res[i], &early_res[i+1],
+ (j-1-i) * sizeof(struct early_res));
+ early_res[j-1].end = 0;
+}
+
void __init early_res_to_bootmem(void)
{
int i;
--- a/include/asm-x86/e820_64.h
+++ b/include/asm-x86/e820_64.h
@@ -41,6 +41,7 @@ extern struct e820map e820;
extern void update_e820(void);
extern void reserve_early(unsigned long start, unsigned long end, char *name);
+extern void free_early(unsigned long start, unsigned long end);
extern void early_res_to_bootmem(void);
#endif/*!__ASSEMBLY__*/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists