Coverage Report

Created: 2017-10-25 09:10

/root/src/xen/xen/include/xen/kexec.h
Line
Count
Source (jump to first uncovered line)
1
#ifndef __XEN_KEXEC_H__
2
#define __XEN_KEXEC_H__
3
4
#ifdef CONFIG_KEXEC
5
6
#include <public/kexec.h>
7
#include <asm/percpu.h>
8
#include <xen/elfcore.h>
9
#include <xen/kimage.h>
10
11
typedef struct xen_kexec_reserve {
12
    unsigned long size;
13
    paddr_t start;
14
} xen_kexec_reserve_t;
15
16
extern xen_kexec_reserve_t kexec_crash_area;
17
extern paddr_t kexec_crash_area_limit;
18
19
extern bool_t kexecing;
20
21
void set_kexec_crash_area_size(u64 system_ram);
22
23
/* We have space for 4 images to support atomic update
24
 * of images. This is important for CRASH images since
25
 * a panic can happen at any time...
26
 */
27
28
0
#define KEXEC_IMAGE_DEFAULT_BASE 0
29
0
#define KEXEC_IMAGE_CRASH_BASE   2
30
0
#define KEXEC_IMAGE_NR           4
31
32
enum low_crashinfo {
33
    LOW_CRASHINFO_INVALID = 0,
34
    LOW_CRASHINFO_NONE = 1,
35
    LOW_CRASHINFO_MIN = 2,
36
    LOW_CRASHINFO_ALL = 3
37
};
38
39
/* Low crashinfo mode.  Start as INVALID so serveral codepaths can set up
40
 * defaults without needing to know the state of the others. */
41
extern enum low_crashinfo low_crashinfo_mode;
42
extern unsigned int crashinfo_maxaddr_bits;
43
void kexec_early_calculations(void);
44
45
int machine_kexec_add_page(struct kexec_image *image, unsigned long vaddr,
46
                           unsigned long maddr);
47
int machine_kexec_load(struct kexec_image *image);
48
void machine_kexec_unload(struct kexec_image *image);
49
void machine_kexec_reserved(xen_kexec_reserve_t *reservation);
50
void machine_reboot_kexec(struct kexec_image *image);
51
void machine_kexec(struct kexec_image *image);
52
void kexec_crash(void);
53
void kexec_crash_save_cpu(void);
54
crash_xen_info_t *kexec_crash_save_info(void);
55
void machine_crash_shutdown(void);
56
int machine_kexec_get(xen_kexec_range_t *range);
57
int machine_kexec_get_xen(xen_kexec_range_t *range);
58
59
/* vmcoreinfo stuff */
60
0
#define VMCOREINFO_BYTES           (4096)
61
0
#define VMCOREINFO_NOTE_NAME       "VMCOREINFO_XEN"
62
void arch_crash_save_vmcoreinfo(void);
63
void vmcoreinfo_append_str(const char *fmt, ...)
64
       __attribute__ ((format (printf, 1, 2)));
65
#define VMCOREINFO_PAGESIZE(value) \
66
0
       vmcoreinfo_append_str("PAGESIZE=%ld\n", value)
67
#define VMCOREINFO_SYMBOL(name) \
68
0
       vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #name, (unsigned long)&name)
69
#define VMCOREINFO_SYMBOL_ALIAS(alias, name) \
70
0
       vmcoreinfo_append_str("SYMBOL(%s)=%lx\n", #alias, (unsigned long)&name)
71
#define VMCOREINFO_STRUCT_SIZE(name) \
72
0
       vmcoreinfo_append_str("SIZE(%s)=%zu\n", #name, sizeof(struct name))
73
#define VMCOREINFO_OFFSET(name, field) \
74
0
       vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \
75
0
                             (unsigned long)offsetof(struct name, field))
76
#define VMCOREINFO_OFFSET_SUB(name, sub, field) \
77
0
       vmcoreinfo_append_str("OFFSET(%s.%s)=%lu\n", #name, #field, \
78
0
                             (unsigned long)offsetof(struct name, sub.field))
79
80
#else /* !CONFIG_KEXEC */
81
82
#define crashinfo_maxaddr_bits 0
83
#define kexecing 0
84
85
static inline void kexec_early_calculations(void) {}
86
static inline void kexec_crash(void) {}
87
static inline void kexec_crash_save_cpu(void) {}
88
static inline void set_kexec_crash_area_size(u64 system_ram) {}
89
90
#endif
91
92
#endif /* __XEN_KEXEC_H__ */
93
94
/*
95
 * Local variables:
96
 * mode: C
97
 * c-file-style: "BSD"
98
 * c-basic-offset: 4
99
 * tab-width: 4
100
 * indent-tabs-mode: nil
101
 * End:
102
 */