blob: 4edf7514a75033d8173428e1ce1640995a87f154 [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
Thomas Gleixner327c21b2007-10-15 23:28:20 +02008#define dmi_alloc alloc_bootmem
9
10#else /* CONFIG_X86_32 */
11
12#define DMI_MAX_DATA 2048
13
14extern int dmi_alloc_index;
15extern char dmi_alloc_data[DMI_MAX_DATA];
16
17/* This is so early that there is no good way to allocate dynamic memory.
18 Allocate data in an BSS array. */
19static inline void *dmi_alloc(unsigned len)
20{
21 int idx = dmi_alloc_index;
Parag Warudkarbca25ba2008-01-30 13:31:59 +010022 if ((dmi_alloc_index + len) > DMI_MAX_DATA)
Thomas Gleixner327c21b2007-10-15 23:28:20 +020023 return NULL;
Parag Warudkarbca25ba2008-01-30 13:31:59 +010024 dmi_alloc_index += len;
Thomas Gleixner327c21b2007-10-15 23:28:20 +020025 return dmi_alloc_data + idx;
26}
27
Huang, Yingbeacfaa2008-01-30 13:33:44 +010028#endif
29
Jean Delvareef3fb662008-05-01 04:35:01 -070030/* Use early IO mappings for DMI because it's initialized early */
Thomas Gleixner327c21b2007-10-15 23:28:20 +020031#define dmi_ioremap early_ioremap
32#define dmi_iounmap early_iounmap
33
34#endif