diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2007-10-21 20:56:19 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2007-10-23 01:49:47 -0400 |
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 @@ | |||
1 | include include/asm-generic/Kbuild.asm | 1 | include include/asm-generic/Kbuild.asm |
2 | 2 | ||
3 | header-y += boot.h | 3 | header-y += boot.h |
4 | header-y += bootparam.h | ||
4 | header-y += debugreg.h | 5 | header-y += debugreg.h |
5 | header-y += ldt.h | 6 | header-y += ldt.h |
6 | header-y += msr-index.h | 7 | header-y += msr-index.h |
@@ -14,8 +15,10 @@ unifdef-y += a.out_32.h | |||
14 | unifdef-y += a.out_64.h | 15 | unifdef-y += a.out_64.h |
15 | unifdef-y += byteorder_32.h | 16 | unifdef-y += byteorder_32.h |
16 | unifdef-y += byteorder_64.h | 17 | unifdef-y += byteorder_64.h |
18 | unifdef-y += e820.h | ||
17 | unifdef-y += elf_32.h | 19 | unifdef-y += elf_32.h |
18 | unifdef-y += elf_64.h | 20 | unifdef-y += elf_64.h |
21 | unifdef-y += ist.h | ||
19 | unifdef-y += mce.h | 22 | unifdef-y += mce.h |
20 | unifdef-y += msgbuf_32.h | 23 | unifdef-y += msgbuf_32.h |
21 | unifdef-y += msgbuf_64.h | 24 | 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 @@ | |||
10 | #include <video/edid.h> | 10 | #include <video/edid.h> |
11 | 11 | ||
12 | struct setup_header { | 12 | struct setup_header { |
13 | u8 setup_sects; | 13 | __u8 setup_sects; |
14 | u16 root_flags; | 14 | __u16 root_flags; |
15 | u32 syssize; | 15 | __u32 syssize; |
16 | u16 ram_size; | 16 | __u16 ram_size; |
17 | #define RAMDISK_IMAGE_START_MASK 0x07FF | 17 | #define RAMDISK_IMAGE_START_MASK 0x07FF |
18 | #define RAMDISK_PROMPT_FLAG 0x8000 | 18 | #define RAMDISK_PROMPT_FLAG 0x8000 |
19 | #define RAMDISK_LOAD_FLAG 0x4000 | 19 | #define RAMDISK_LOAD_FLAG 0x4000 |
20 | u16 vid_mode; | 20 | __u16 vid_mode; |
21 | u16 root_dev; | 21 | __u16 root_dev; |
22 | u16 boot_flag; | 22 | __u16 boot_flag; |
23 | u16 jump; | 23 | __u16 jump; |
24 | u32 header; | 24 | __u32 header; |
25 | u16 version; | 25 | __u16 version; |
26 | u32 realmode_swtch; | 26 | __u32 realmode_swtch; |
27 | u16 start_sys; | 27 | __u16 start_sys; |
28 | u16 kernel_version; | 28 | __u16 kernel_version; |
29 | u8 type_of_loader; | 29 | __u8 type_of_loader; |
30 | u8 loadflags; | 30 | __u8 loadflags; |
31 | #define LOADED_HIGH (1<<0) | 31 | #define LOADED_HIGH (1<<0) |
32 | #define KEEP_SEGMENTS (1<<6) | 32 | #define KEEP_SEGMENTS (1<<6) |
33 | #define CAN_USE_HEAP (1<<7) | 33 | #define CAN_USE_HEAP (1<<7) |
34 | u16 setup_move_size; | 34 | __u16 setup_move_size; |
35 | u32 code32_start; | 35 | __u32 code32_start; |
36 | u32 ramdisk_image; | 36 | __u32 ramdisk_image; |
37 | u32 ramdisk_size; | 37 | __u32 ramdisk_size; |
38 | u32 bootsect_kludge; | 38 | __u32 bootsect_kludge; |
39 | u16 heap_end_ptr; | 39 | __u16 heap_end_ptr; |
40 | u16 _pad1; | 40 | __u16 _pad1; |
41 | u32 cmd_line_ptr; | 41 | __u32 cmd_line_ptr; |
42 | u32 initrd_addr_max; | 42 | __u32 initrd_addr_max; |
43 | u32 kernel_alignment; | 43 | __u32 kernel_alignment; |
44 | u8 relocatable_kernel; | 44 | __u8 relocatable_kernel; |
45 | u8 _pad2[3]; | 45 | __u8 _pad2[3]; |
46 | u32 cmdline_size; | 46 | __u32 cmdline_size; |
47 | u32 hardware_subarch; | 47 | __u32 hardware_subarch; |
48 | u64 hardware_subarch_data; | 48 | __u64 hardware_subarch_data; |
49 | } __attribute__((packed)); | 49 | } __attribute__((packed)); |
50 | 50 | ||
51 | struct sys_desc_table { | 51 | struct sys_desc_table { |
52 | u16 length; | 52 | __u16 length; |
53 | u8 table[14]; | 53 | __u8 table[14]; |
54 | }; | 54 | }; |
55 | 55 | ||
56 | struct efi_info { | 56 | struct efi_info { |
57 | u32 _pad1; | 57 | __u32 _pad1; |
58 | u32 efi_systab; | 58 | __u32 efi_systab; |
59 | u32 efi_memdesc_size; | 59 | __u32 efi_memdesc_size; |
60 | u32 efi_memdesc_version; | 60 | __u32 efi_memdesc_version; |
61 | u32 efi_memmap; | 61 | __u32 efi_memmap; |
62 | u32 efi_memmap_size; | 62 | __u32 efi_memmap_size; |
63 | u32 _pad2[2]; | 63 | __u32 _pad2[2]; |
64 | }; | 64 | }; |
65 | 65 | ||
66 | /* The so-called "zeropage" */ | 66 | /* The so-called "zeropage" */ |
67 | struct boot_params { | 67 | struct boot_params { |
68 | struct screen_info screen_info; /* 0x000 */ | 68 | struct screen_info screen_info; /* 0x000 */ |
69 | struct apm_bios_info apm_bios_info; /* 0x040 */ | 69 | struct apm_bios_info apm_bios_info; /* 0x040 */ |
70 | u8 _pad2[12]; /* 0x054 */ | 70 | __u8 _pad2[12]; /* 0x054 */ |
71 | struct ist_info ist_info; /* 0x060 */ | 71 | struct ist_info ist_info; /* 0x060 */ |
72 | u8 _pad3[16]; /* 0x070 */ | 72 | __u8 _pad3[16]; /* 0x070 */ |
73 | u8 hd0_info[16]; /* obsolete! */ /* 0x080 */ | 73 | __u8 hd0_info[16]; /* obsolete! */ /* 0x080 */ |
74 | u8 hd1_info[16]; /* obsolete! */ /* 0x090 */ | 74 | __u8 hd1_info[16]; /* obsolete! */ /* 0x090 */ |
75 | struct sys_desc_table sys_desc_table; /* 0x0a0 */ | 75 | struct sys_desc_table sys_desc_table; /* 0x0a0 */ |
76 | u8 _pad4[144]; /* 0x0b0 */ | 76 | __u8 _pad4[144]; /* 0x0b0 */ |
77 | struct edid_info edid_info; /* 0x140 */ | 77 | struct edid_info edid_info; /* 0x140 */ |
78 | struct efi_info efi_info; /* 0x1c0 */ | 78 | struct efi_info efi_info; /* 0x1c0 */ |
79 | u32 alt_mem_k; /* 0x1e0 */ | 79 | __u32 alt_mem_k; /* 0x1e0 */ |
80 | u32 scratch; /* Scratch field! */ /* 0x1e4 */ | 80 | __u32 scratch; /* Scratch field! */ /* 0x1e4 */ |
81 | u8 e820_entries; /* 0x1e8 */ | 81 | __u8 e820_entries; /* 0x1e8 */ |
82 | u8 eddbuf_entries; /* 0x1e9 */ | 82 | __u8 eddbuf_entries; /* 0x1e9 */ |
83 | u8 edd_mbr_sig_buf_entries; /* 0x1ea */ | 83 | __u8 edd_mbr_sig_buf_entries; /* 0x1ea */ |
84 | u8 _pad6[6]; /* 0x1eb */ | 84 | __u8 _pad6[6]; /* 0x1eb */ |
85 | struct setup_header hdr; /* setup header */ /* 0x1f1 */ | 85 | struct setup_header hdr; /* setup header */ /* 0x1f1 */ |
86 | u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)]; | 86 | __u8 _pad7[0x290-0x1f1-sizeof(struct setup_header)]; |
87 | u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */ | 87 | __u32 edd_mbr_sig_buffer[EDD_MBR_SIG_MAX]; /* 0x290 */ |
88 | struct e820entry e820_map[E820MAX]; /* 0x2d0 */ | 88 | struct e820entry e820_map[E820MAX]; /* 0x2d0 */ |
89 | u8 _pad8[48]; /* 0xcd0 */ | 89 | __u8 _pad8[48]; /* 0xcd0 */ |
90 | struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */ | 90 | struct edd_info eddbuf[EDDMAXNR]; /* 0xd00 */ |
91 | u8 _pad9[276]; /* 0xeec */ | 91 | __u8 _pad9[276]; /* 0xeec */ |
92 | } __attribute__((packed)); | 92 | } __attribute__((packed)); |
93 | 93 | ||
94 | #endif /* _ASM_BOOTPARAM_H */ | 94 | #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 @@ | |||
1 | #ifndef __ASM_E820_H | ||
2 | #define __ASM_E820_H | ||
3 | #define E820MAP 0x2d0 /* our map */ | ||
4 | #define E820MAX 128 /* number of entries in E820MAP */ | ||
5 | #define E820NR 0x1e8 /* # entries in E820MAP */ | ||
6 | |||
7 | #define E820_RAM 1 | ||
8 | #define E820_RESERVED 2 | ||
9 | #define E820_ACPI 3 | ||
10 | #define E820_NVS 4 | ||
11 | |||
12 | #ifndef __ASSEMBLY__ | ||
13 | struct e820entry { | ||
14 | __u64 addr; /* start of memory segment */ | ||
15 | __u64 size; /* size of memory segment */ | ||
16 | __u32 type; /* type of memory segment */ | ||
17 | } __attribute__((packed)); | ||
18 | |||
19 | struct e820map { | ||
20 | __u32 nr_map; | ||
21 | struct e820entry map[E820MAX]; | ||
22 | }; | ||
23 | #endif /* __ASSEMBLY__ */ | ||
24 | |||
25 | #ifdef __KERNEL__ | ||
1 | #ifdef CONFIG_X86_32 | 26 | #ifdef CONFIG_X86_32 |
2 | # include "e820_32.h" | 27 | # include "e820_32.h" |
3 | #else | 28 | #else |
4 | # include "e820_64.h" | 29 | # include "e820_64.h" |
5 | #endif | 30 | #endif |
31 | #endif /* __KERNEL__ */ | ||
32 | |||
33 | #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 @@ | |||
12 | #ifndef __E820_HEADER | 12 | #ifndef __E820_HEADER |
13 | #define __E820_HEADER | 13 | #define __E820_HEADER |
14 | 14 | ||
15 | #define E820MAP 0x2d0 /* our map */ | ||
16 | #define E820MAX 128 /* number of entries in E820MAP */ | ||
17 | #define E820NR 0x1e8 /* # entries in E820MAP */ | ||
18 | |||
19 | #define E820_RAM 1 | ||
20 | #define E820_RESERVED 2 | ||
21 | #define E820_ACPI 3 | ||
22 | #define E820_NVS 4 | ||
23 | |||
24 | #define HIGH_MEMORY (1024*1024) | 15 | #define HIGH_MEMORY (1024*1024) |
25 | 16 | ||
26 | #ifndef __ASSEMBLY__ | 17 | #ifndef __ASSEMBLY__ |
27 | 18 | ||
28 | struct e820entry { | ||
29 | u64 addr; /* start of memory segment */ | ||
30 | u64 size; /* size of memory segment */ | ||
31 | u32 type; /* type of memory segment */ | ||
32 | } __attribute__((packed)); | ||
33 | |||
34 | struct e820map { | ||
35 | u32 nr_map; | ||
36 | struct e820entry map[E820MAX]; | ||
37 | }; | ||
38 | |||
39 | extern struct e820map e820; | 19 | extern struct e820map e820; |
40 | 20 | ||
41 | extern int e820_all_mapped(unsigned long start, unsigned long end, | 21 | extern int e820_all_mapped(unsigned long start, unsigned long end, |
@@ -56,5 +36,4 @@ static inline void e820_mark_nosave_regions(void) | |||
56 | #endif | 36 | #endif |
57 | 37 | ||
58 | #endif/*!__ASSEMBLY__*/ | 38 | #endif/*!__ASSEMBLY__*/ |
59 | |||
60 | #endif/*__E820_HEADER*/ | 39 | #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 @@ | |||
11 | #ifndef __E820_HEADER | 11 | #ifndef __E820_HEADER |
12 | #define __E820_HEADER | 12 | #define __E820_HEADER |
13 | 13 | ||
14 | #define E820MAP 0x2d0 /* our map */ | ||
15 | #define E820MAX 128 /* number of entries in E820MAP */ | ||
16 | #define E820NR 0x1e8 /* # entries in E820MAP */ | ||
17 | |||
18 | #define E820_RAM 1 | ||
19 | #define E820_RESERVED 2 | ||
20 | #define E820_ACPI 3 | ||
21 | #define E820_NVS 4 | ||
22 | |||
23 | #ifndef __ASSEMBLY__ | 14 | #ifndef __ASSEMBLY__ |
24 | struct e820entry { | ||
25 | u64 addr; /* start of memory segment */ | ||
26 | u64 size; /* size of memory segment */ | ||
27 | u32 type; /* type of memory segment */ | ||
28 | } __attribute__((packed)); | ||
29 | |||
30 | struct e820map { | ||
31 | u32 nr_map; | ||
32 | struct e820entry map[E820MAX]; | ||
33 | }; | ||
34 | |||
35 | extern unsigned long find_e820_area(unsigned long start, unsigned long end, | 15 | extern unsigned long find_e820_area(unsigned long start, unsigned long end, |
36 | unsigned size); | 16 | unsigned size); |
37 | extern void add_memory_region(unsigned long start, unsigned long size, | 17 | 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 @@ | |||
17 | */ | 17 | */ |
18 | 18 | ||
19 | 19 | ||
20 | #ifdef __KERNEL__ | ||
21 | |||
22 | #include <linux/types.h> | 20 | #include <linux/types.h> |
23 | 21 | ||
24 | struct ist_info { | 22 | struct ist_info { |
25 | u32 signature; | 23 | __u32 signature; |
26 | u32 command; | 24 | __u32 command; |
27 | u32 event; | 25 | __u32 event; |
28 | u32 perf_level; | 26 | __u32 perf_level; |
29 | }; | 27 | }; |
30 | 28 | ||
29 | #ifdef __KERNEL__ | ||
30 | |||
31 | extern struct ist_info ist_info; | 31 | extern struct ist_info ist_info; |
32 | 32 | ||
33 | #endif /* __KERNEL__ */ | 33 | #endif /* __KERNEL__ */ |