blob: 5008c365e6e4977aa8a99e13344087f42c8de99a [file] [log] [blame]
Thomas Gleixner327c21b2007-10-15 23:28:20 +02001#ifndef _ASM_X86_DMI_H
2#define _ASM_X86_DMI_H
3
4#include <asm/io.h>
5
Thomas Gleixner96a388d2007-10-11 11:20:03 +02006#ifdef CONFIG_X86_32
Thomas Gleixner327c21b2007-10-15 23:28:20 +02007
8/* Use early IO mappings for DMI because it's initialized early */
9#define dmi_ioremap bt_ioremap
10#define dmi_iounmap bt_iounmap
11#define dmi_alloc alloc_bootmem
12
13#else /* CONFIG_X86_32 */
14
15#define DMI_MAX_DATA 2048
16
17extern int dmi_alloc_index;
18extern char dmi_alloc_data[DMI_MAX_DATA];
19
20/* This is so early that there is no good way to allocate dynamic memory.
21 Allocate data in an BSS array. */
22static inline void *dmi_alloc(unsigned len)
23{
24 int idx = dmi_alloc_index;
Parag Warudkarbca25ba2008-01-30 13:31:59 +010025 if ((dmi_alloc_index + len) > DMI_MAX_DATA)
Thomas Gleixner327c21b2007-10-15 23:28:20 +020026 return NULL;
Parag Warudkarbca25ba2008-01-30 13:31:59 +010027 dmi_alloc_index += len;
Thomas Gleixner327c21b2007-10-15 23:28:20 +020028 return dmi_alloc_data + idx;
29}
30
31#define dmi_ioremap early_ioremap
32#define dmi_iounmap early_iounmap
33
34#endif
35
Thomas Gleixner96a388d2007-10-11 11:20:03 +020036#endif