Skip to content

Commit

Permalink
x86: use brk allocation for DMI
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jeremy Fitzhardinge authored and H. Peter Anvin committed Mar 15, 2009
1 parent ccf3fe0 commit 6de6cb4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 18 deletions.
14 changes: 2 additions & 12 deletions arch/x86/include/asm/dmi.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
6 changes: 0 additions & 6 deletions arch/x86/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 6de6cb4

Please sign in to comment.