Thomas Gleixner | 327c21b | 2007-10-15 23:28:20 +0200 | [diff] [blame] | 1 | #ifndef _ASM_X86_DMI_H |
| 2 | #define _ASM_X86_DMI_H |
| 3 | |
| 4 | #include <asm/io.h> |
| 5 | |
Thomas Gleixner | 96a388d | 2007-10-11 11:20:03 +0200 | [diff] [blame] | 6 | #ifdef CONFIG_X86_32 |
Thomas Gleixner | 327c21b | 2007-10-15 23:28:20 +0200 | [diff] [blame] | 7 | |
Thomas Gleixner | 327c21b | 2007-10-15 23:28:20 +0200 | [diff] [blame] | 8 | #define dmi_alloc alloc_bootmem |
| 9 | |
| 10 | #else /* CONFIG_X86_32 */ |
| 11 | |
| 12 | #define DMI_MAX_DATA 2048 |
| 13 | |
| 14 | extern int dmi_alloc_index; |
| 15 | extern 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. */ |
| 19 | static inline void *dmi_alloc(unsigned len) |
| 20 | { |
| 21 | int idx = dmi_alloc_index; |
Parag Warudkar | bca25ba | 2008-01-30 13:31:59 +0100 | [diff] [blame] | 22 | if ((dmi_alloc_index + len) > DMI_MAX_DATA) |
Thomas Gleixner | 327c21b | 2007-10-15 23:28:20 +0200 | [diff] [blame] | 23 | return NULL; |
Parag Warudkar | bca25ba | 2008-01-30 13:31:59 +0100 | [diff] [blame] | 24 | dmi_alloc_index += len; |
Thomas Gleixner | 327c21b | 2007-10-15 23:28:20 +0200 | [diff] [blame] | 25 | return dmi_alloc_data + idx; |
| 26 | } |
| 27 | |
Huang, Ying | beacfaa | 2008-01-30 13:33:44 +0100 | [diff] [blame] | 28 | #endif |
| 29 | |
Jean Delvare | ef3fb66 | 2008-05-01 04:35:01 -0700 | [diff] [blame] | 30 | /* Use early IO mappings for DMI because it's initialized early */ |
Thomas Gleixner | 327c21b | 2007-10-15 23:28:20 +0200 | [diff] [blame] | 31 | #define dmi_ioremap early_ioremap |
| 32 | #define dmi_iounmap early_iounmap |
| 33 | |
| 34 | #endif |