x86: use brk allocation for DMI
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Fri, 27 Feb 2009 21:35:45 +0000 (13:35 -0800)
committerH. Peter Anvin <hpa@zytor.com>
Sun, 15 Mar 2009 00:23:47 +0000 (17:23 -0700)
Impact: use new interface instead of previous ad hoc implementation

Use extend_brk() to allocate memory for DMI rather than having an
ad-hoc allocator.

Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
arch/x86/include/asm/dmi.h
arch/x86/kernel/setup.c

index bc68212c6bc0097f66ae21b936c0af59e4c3f705..aa32f7e6c197485c709670f00cbfe66ae873b65b 100644 (file)
@@ -2,21 +2,11 @@
 #define _ASM_X86_DMI_H
 
 #include <asm/io.h>
+#include <asm/setup.h>
 
-#define DMI_MAX_DATA 2048
-
-extern int dmi_alloc_index;
-extern char dmi_alloc_data[DMI_MAX_DATA];
-
-/* This is so early that there is no good way to allocate dynamic memory.
-   Allocate data in an BSS array. */
 static inline void *dmi_alloc(unsigned len)
 {
-       int idx = dmi_alloc_index;
-       if ((dmi_alloc_index + len) > DMI_MAX_DATA)
-               return NULL;
-       dmi_alloc_index += len;
-       return dmi_alloc_data + idx;
+       return extend_brk(len, sizeof(int));
 }
 
 /* Use early IO mappings for DMI because it's initialized early */
index 3ac2aa7b9eaf507434041763c2beef76df20c3de..e894f36335f21e54151b48e277cc431e1ae57f70 100644 (file)
@@ -215,12 +215,6 @@ unsigned long mmu_cr4_features = X86_CR4_PAE;
 /* Boot loader ID as an integer, for the benefit of proc_dointvec */
 int bootloader_type;
 
-/*
- * Early DMI memory
- */
-int dmi_alloc_index;
-char dmi_alloc_data[DMI_MAX_DATA];
-
 /*
  * Setup options
  */