Vegard Nossum | 77ef50a | 2008-06-18 17:08:48 +0200 | [diff] [blame] | 1 | #ifndef ASM_X86__DMI_H |
| 2 | #define ASM_X86__DMI_H |
Thomas Gleixner | 327c21b | 2007-10-15 23:28:20 +0200 | [diff] [blame] | 3 | |
| 4 | #include <asm/io.h> |
| 5 | |
Thomas Gleixner | 327c21b | 2007-10-15 23:28:20 +0200 | [diff] [blame] | 6 | #define DMI_MAX_DATA 2048 |
| 7 | |
| 8 | extern int dmi_alloc_index; |
| 9 | extern 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. */ |
| 13 | static inline void *dmi_alloc(unsigned len) |
| 14 | { |
| 15 | int idx = dmi_alloc_index; |
Parag Warudkar | bca25ba | 2008-01-30 13:31:59 +0100 | [diff] [blame] | 16 | if ((dmi_alloc_index + len) > DMI_MAX_DATA) |
Thomas Gleixner | 327c21b | 2007-10-15 23:28:20 +0200 | [diff] [blame] | 17 | return NULL; |
Parag Warudkar | bca25ba | 2008-01-30 13:31:59 +0100 | [diff] [blame] | 18 | dmi_alloc_index += len; |
Thomas Gleixner | 327c21b | 2007-10-15 23:28:20 +0200 | [diff] [blame] | 19 | return dmi_alloc_data + idx; |
| 20 | } |
| 21 | |
Jean Delvare | ef3fb66 | 2008-05-01 04:35:01 -0700 | [diff] [blame] | 22 | /* Use early IO mappings for DMI because it's initialized early */ |
Thomas Gleixner | 327c21b | 2007-10-15 23:28:20 +0200 | [diff] [blame] | 23 | #define dmi_ioremap early_ioremap |
| 24 | #define dmi_iounmap early_iounmap |
| 25 | |
Vegard Nossum | 77ef50a | 2008-06-18 17:08:48 +0200 | [diff] [blame] | 26 | #endif /* ASM_X86__DMI_H */ |