Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6de6cb44 authored by Jeremy Fitzhardinge's avatar Jeremy Fitzhardinge Committed by H. Peter Anvin
Browse files

x86: use brk allocation for DMI



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: default avatarJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: default avatarH. Peter Anvin <hpa@zytor.com>
parent ccf3fe02
Loading
Loading
Loading
Loading
+2 −12
Original line number Original line Diff line number Diff line
@@ -2,21 +2,11 @@
#define _ASM_X86_DMI_H
#define _ASM_X86_DMI_H


#include <asm/io.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)
static inline void *dmi_alloc(unsigned len)
{
{
	int idx = dmi_alloc_index;
	return extend_brk(len, sizeof(int));
	if ((dmi_alloc_index + len) > DMI_MAX_DATA)
		return NULL;
	dmi_alloc_index += len;
	return dmi_alloc_data + idx;
}
}


/* Use early IO mappings for DMI because it's initialized early */
/* Use early IO mappings for DMI because it's initialized early */
+0 −6
Original line number Original line Diff line number Diff line
@@ -215,12 +215,6 @@ unsigned long mmu_cr4_features = X86_CR4_PAE;
/* Boot loader ID as an integer, for the benefit of proc_dointvec */
/* Boot loader ID as an integer, for the benefit of proc_dointvec */
int bootloader_type;
int bootloader_type;


/*
 * Early DMI memory
 */
int dmi_alloc_index;
char dmi_alloc_data[DMI_MAX_DATA];

/*
/*
 * Setup options
 * Setup options
 */
 */