1 #ifndef __XEN_KIMAGE_H__
2 #define __XEN_KIMAGE_H__
3 
4 #define IND_DESTINATION  0x1
5 #define IND_INDIRECTION  0x2
6 #define IND_DONE         0x4
7 #define IND_SOURCE       0x8
8 #define IND_ZERO        0x10
9 
10 #ifndef __ASSEMBLY__
11 
12 #include <xen/list.h>
13 #include <xen/mm.h>
14 #include <public/kexec.h>
15 
16 #define KEXEC_SEGMENT_MAX 16
17 
18 typedef paddr_t kimage_entry_t;
19 
20 struct kexec_image {
21     uint8_t type;
22     uint16_t arch;
23     uint64_t entry_maddr;
24     uint32_t nr_segments;
25     xen_kexec_segment_t *segments;
26 
27     kimage_entry_t head;
28     struct page_info *entry_page;
29     unsigned next_entry;
30 
31     struct page_info *control_code_page;
32     struct page_info *aux_page;
33 
34     struct page_list_head control_pages;
35     struct page_list_head dest_pages;
36     struct page_list_head unusable_pages;
37 
38     /* Address of next control page to allocate for crash kernels. */
39     paddr_t next_crash_page;
40 };
41 
42 int kimage_alloc(struct kexec_image **rimage, uint8_t type, uint16_t arch,
43                  uint64_t entry_maddr,
44                  uint32_t nr_segments, xen_kexec_segment_t *segment);
45 void kimage_free(struct kexec_image *image);
46 int kimage_load_segments(struct kexec_image *image);
47 struct page_info *kimage_alloc_control_page(struct kexec_image *image,
48                                             unsigned memflags);
49 
50 kimage_entry_t *kimage_entry_next(kimage_entry_t *entry, bool_t compat);
51 mfn_t kimage_entry_mfn(kimage_entry_t *entry, bool_t compat);
52 unsigned long kimage_entry_ind(kimage_entry_t *entry, bool_t compat);
53 int kimage_build_ind(struct kexec_image *image, mfn_t ind_mfn,
54                      bool_t compat);
55 
56 #endif /* __ASSEMBLY__ */
57 
58 #endif /* __XEN_KIMAGE_H__ */
59 
60 /*
61  * Local variables:
62  * mode: C
63  * c-file-style: "BSD"
64  * c-basic-offset: 4
65  * tab-width: 4
66  * indent-tabs-mode: nil
67  * End:
68  */
69