blob: bc68212c6bc0097f66ae21b936c0af59e4c3f705 [file] [log] [blame]
H. Peter Anvin1965aae2008-10-22 22:26:29 -07001#ifndef _ASM_X86_DMI_H
2#define _ASM_X86_DMI_H
Thomas Gleixner327c21b2007-10-15 23:28:20 +02003
4#include <asm/io.h>
5
Thomas Gleixner327c21b2007-10-15 23:28:20 +02006#define DMI_MAX_DATA 2048
7
8extern int dmi_alloc_index;
9extern char dmi_alloc_data[DMI_MAX_DATA];
10
11/* This is so early that there is no good way to allocate dynamic memory.
12 Allocate data in an BSS array. */
13static inline void *dmi_alloc(unsigned len)
14{
15 int idx = dmi_alloc_index;
Parag Warudkarbca25ba2008-01-30 13:31:59 +010016 if ((dmi_alloc_index + len) > DMI_MAX_DATA)
Thomas Gleixner327c21b2007-10-15 23:28:20 +020017 return NULL;
Parag Warudkarbca25ba2008-01-30 13:31:59 +010018 dmi_alloc_index += len;
Thomas Gleixner327c21b2007-10-15 23:28:20 +020019 return dmi_alloc_data + idx;
20}
21
Jean Delvareef3fb662008-05-01 04:35:01 -070022/* Use early IO mappings for DMI because it's initialized early */
Thomas Gleixner327c21b2007-10-15 23:28:20 +020023#define dmi_ioremap early_ioremap
24#define dmi_iounmap early_iounmap
25
H. Peter Anvin1965aae2008-10-22 22:26:29 -070026#endif /* _ASM_X86_DMI_H */