diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2007-10-22 10:56:19 +1000 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2007-10-23 15:49:47 +1000 |
commit | ee8e7cfe9d330d6f1ce0b9b1620d6df5d9cf6b70 (patch) | |
tree | a9534bac7060e546c0c3e6ea34d0469d8903bf0e /include/asm-x86 | |
parent | 9525ca0286afd54a5cd69d9ded741b4df8d0c554 (diff) |
Make asm-x86/bootparam.h includable from userspace.
To actually write a bootloader (or, say, the lguest launcher)
currently requires duplication of these structures. Making them
includable from userspace is much nicer.
We merge the common userspace-required definitions of e820_32/64.h
into e820.h for export.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/asm-x86')
-rw-r--r-- | include/asm-x86/Kbuild | 3 | ||||
-rw-r--r-- | include/asm-x86/bootparam.h | 108 | ||||
-rw-r--r-- | include/asm-x86/e820.h | 28 | ||||
-rw-r--r-- | include/asm-x86/e820_32.h | 21 | ||||
-rw-r--r-- | include/asm-x86/e820_64.h | 20 | ||||
-rw-r--r-- | include/asm-x86/ist.h | 12 |
6 files changed, 91 insertions, 101 deletions
diff --git a/include/asm-x86/Kbuild b/include/asm-x86/Kbuild index 559830ece755..5e3539c129b9 100644 --- a/include/asm-x86/Kbuild +++ b/include/asm-x86/Kbuild @@ -1,6 +1,7 @@ include include/asm-generic/Kbuild.asm header-y += boot.h +header-y += bootparam.h header-y += debugreg.h header-y += ldt.h header-y += msr-index.h @@ -14,8 +15,10 @@ unifdef-y += a.out_32.h unifdef-y += a.out_64.h unifdef-y += byteorder_32.h unifdef-y += byteorder_64.h +unifdef-y += e820.h unifdef-y += elf_32.h unifdef-y += elf_64.h +unifdef-y += ist.h unifdef-y += mce.h unifdef-y += msgbuf_32.h unifdef-y += msgbuf_64.h diff --git a/include/asm-x86/bootparam.h b/include/asm-x86/bootparam.h index dc031cf44633..19f3ddf2df4b 100644 --- a/include/asm-x86/bootparam.h +++ b/include/asm-x86/bootparam.h @@ -10,85 +10,85 @@ #include <video/edid.h> struct setup_header { - u8 setup_sects; - u16 root_flags; - u32 syssize; - u16 ram_size; + __u8 setup_sects; + __u16 root_flags; + __u32 syssize; + __u16 ram_size; #define RAMDISK_IMAGE_START_MASK 0x07FF #define RAMDISK_PROMPT_FLAG 0x8000 #define RAMDISK_LOAD_FLAG 0x4000 - u16 vid_mode; - u16 root_dev; - u16 boot_flag; - u16 jump; - u32 header; - u16 version; - u32 realmode_swtch; - u16 start_sys; - u16 kernel_version; - u8 type_of_loader; - u8 loadflags; + __u16 vid_mode; + __u16 root_dev; + __u16 boot_flag; + __u16 jump; + __u32 header; + __u16 version; + __u32 realmode_swtch; + __u16 start_sys; + __u16 kernel_version; + __u8 type_of_loader; + __u8 loadflags; #define LOADED_HIGH (1<<0) #define KEEP_SEGMENTS (1<<6) #define CAN_USE_HEAP (1<<7) - u16 setup_move_size; - u32 code32_start; - u32 ramdisk_image; - u32 ramdisk_size; - u32 bootsect_kludge; - u16 heap_end_ptr; - u16 _pad1; - u32 cmd_line_ptr; - u32 initrd_addr_max; - u32 kernel_alignment; - u8 relocatable_kernel; - u8 _pad2[3]; - u32 cmdline_size; - u32 hardware_subarch; - u64 hardware_subarch_data; + __u16 setup_move_size; + __u32 code32_start; + __u32 ramdisk_image; + __u32 ramdisk_size; + __u32 bootsect_kludge; + __u16 heap_end_ptr; + __u16 _pad1; + __u32 cmd_line_ptr; + __u32 initrd_addr_max; + __u32 kernel_alignment; + __u8 relocatable_kernel; + __u8 _pad2[3]; + __u32 cmdline_size; + __u32 hardware_subarch; + __u64 hardware_subarch_data; } __attribute__((packed)); struct sys_desc_table { - u16 length; - u8 table[14]; + __u16 length; + __u8 table[14]; }; struct efi_info { - u32 _pad1; - u32 efi_systab; - u32 efi_memdesc_size; - u32 efi_memdesc_version; - u32 efi_memmap; - u32 efi_memmap_size; - u32 _pad2[2]; + __u32 _pad1; + __u32 efi_systab; + __u32 efi_memdesc_size; + __u32 efi_memdesc_version; + __u32 efi_memmap; + __u32 efi_memmap_size; + __u32 _pad2[2]; }; /* The so-called "zeropage" */ struct boot_params { struct screen_info screen_info; /* 0x000 */ struct apm_bios_info apm_bios_info; /* 0x040 */ - u8 _pad2[12]; /* 0x054 */ + __u8 _pad2[12]; /* 0x054 */ struct ist_info ist_info; /* 0x060 */ - u8 _pad3[16]; /* 0x070 */ - u8 hd0_info[16]; /* obsolete! */ /* 0x080 */ - u8 hd1_info[16]; /* obsolete! */ /* 0x090 */ + __u8 _pad3[16]; /* 0x070 */ + __u8 hd0_info[16]; /* obsolete! */ /* 0x080 */ + __u8 hd1_info[16]; /* obsolete! */ /* 0x090 */ struct sys_desc_table sys_desc_table; /* 0x0a0 */ - u8 _pad4[144]; /* 0x0b0 */ + __u8 _pad4[144]; /* 0x0b0 */ struct edid_info edid_info; /* 0x140 */ struct efi_info efi_info; /* 0x1c0 */ - u32 alt_mem_k; /* 0x1e0 */ - u32 scratch; /* Scratch field! */ /* 0x1e4 */ - u8 e820_entries; /* 0x1e8 */ - u8 eddbuf_entries; /* 0x1e9 */ - u8 edd_mbr_sig_buf_entries; /* 0x1ea */ - u8 _pad6[6]; /* 0x1eb */ + __u32 alt_mem_k; /* 0x1e0 */ + __u32 scratch; /* Scratch field! */ /* 0x1e4 */ + __u8 e820_entries; /* 0x1e8 */ + __u8 eddbuf_entries; /* 0x1e9 */ + __u8 edd_mbr_sig_buf_entries; /* 0x1ea */ + __u8 _pad6[6]; /* 0x1eb */ struct setup_header hdr; /* setup header */ /* 0x1f1 */ - u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)]; - u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */ + __u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)]; + __u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */ struct e820entry e820_map[E820MAX]; /* 0x2d0 */ - u8 _pad8[48]; /* 0xcd0 */ + __u8 _pad8[48]; /* 0xcd0 */ struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */ - u8 _pad9[276]; /* 0xeec */ + __u8 _pad9[276]; /* 0xeec */ } __attribute__((packed)); #endif /* _ASM_BOOTPARAM_H */ diff --git a/include/asm-x86/e820.h b/include/asm-x86/e820.h index 5d4d2183e5db..3e214f39fad3 100644 --- a/include/asm-x86/e820.h +++ b/include/asm-x86/e820.h @@ -1,5 +1,33 @@ +#ifndef __ASM_E820_H +#define __ASM_E820_H +#define E820MAP 0x2d0 /* our map */ +#define E820MAX 128 /* number of entries in E820MAP */ +#define E820NR 0x1e8 /* # entries in E820MAP */ + +#define E820_RAM 1 +#define E820_RESERVED 2 +#define E820_ACPI 3 +#define E820_NVS 4 + +#ifndef __ASSEMBLY__ +struct e820entry { + __u64 addr; /* start of memory segment */ + __u64 size; /* size of memory segment */ + __u32 type; /* type of memory segment */ +} __attribute__((packed)); + +struct e820map { + __u32 nr_map; + struct e820entry map[E820MAX]; +}; +#endif /* __ASSEMBLY__ */ + +#ifdef __KERNEL__ #ifdef CONFIG_X86_32 # include "e820_32.h" #else # include "e820_64.h" #endif +#endif /* __KERNEL__ */ + +#endif /* __ASM_E820_H */ diff --git a/include/asm-x86/e820_32.h b/include/asm-x86/e820_32.h index cf67dbb1db79..03f60c690c8a 100644 --- a/include/asm-x86/e820_32.h +++ b/include/asm-x86/e820_32.h @@ -12,30 +12,10 @@ #ifndef __E820_HEADER #define __E820_HEADER -#define E820MAP 0x2d0 /* our map */ -#define E820MAX 128 /* number of entries in E820MAP */ -#define E820NR 0x1e8 /* # entries in E820MAP */ - -#define E820_RAM 1 -#define E820_RESERVED 2 -#define E820_ACPI 3 -#define E820_NVS 4 - #define HIGH_MEMORY (1024*1024) #ifndef __ASSEMBLY__ -struct e820entry { - u64 addr; /* start of memory segment */ - u64 size; /* size of memory segment */ - u32 type; /* type of memory segment */ -} __attribute__((packed)); - -struct e820map { - u32 nr_map; - struct e820entry map[E820MAX]; -}; - extern struct e820map e820; extern int e820_all_mapped(unsigned long start, unsigned long end, @@ -56,5 +36,4 @@ static inline void e820_mark_nosave_regions(void) #endif #endif/*!__ASSEMBLY__*/ - #endif/*__E820_HEADER*/ diff --git a/include/asm-x86/e820_64.h b/include/asm-x86/e820_64.h index 3486e701bd86..0bd4787a5d57 100644 --- a/include/asm-x86/e820_64.h +++ b/include/asm-x86/e820_64.h @@ -11,27 +11,7 @@ #ifndef __E820_HEADER #define __E820_HEADER -#define E820MAP 0x2d0 /* our map */ -#define E820MAX 128 /* number of entries in E820MAP */ -#define E820NR 0x1e8 /* # entries in E820MAP */ - -#define E820_RAM 1 -#define E820_RESERVED 2 -#define E820_ACPI 3 -#define E820_NVS 4 - #ifndef __ASSEMBLY__ -struct e820entry { - u64 addr; /* start of memory segment */ - u64 size; /* size of memory segment */ - u32 type; /* type of memory segment */ -} __attribute__((packed)); - -struct e820map { - u32 nr_map; - struct e820entry map[E820MAX]; -}; - extern unsigned long find_e820_area(unsigned long start, unsigned long end, unsigned size); extern void add_memory_region(unsigned long start, unsigned long size, diff --git a/include/asm-x86/ist.h b/include/asm-x86/ist.h index ef2003ebc6f9..6ec6ceed95a7 100644 --- a/include/asm-x86/ist.h +++ b/include/asm-x86/ist.h @@ -17,17 +17,17 @@ */ -#ifdef __KERNEL__ - #include <linux/types.h> struct ist_info { - u32 signature; - u32 command; - u32 event; - u32 perf_level; + __u32 signature; + __u32 command; + __u32 event; + __u32 perf_level; }; +#ifdef __KERNEL__ + extern struct ist_info ist_info; #endif /* __KERNEL__ */ |