1
2#ifndef LINUX_CRASH_DUMP_H
3#define LINUX_CRASH_DUMP_H
4
5#include <linux/kexec.h>
6#include <linux/proc_fs.h>
7#include <linux/elf.h>
8
9#include <asm/pgtable.h>
10
11#ifdef CONFIG_CRASH_DUMP
12#define ELFCORE_ADDR_MAX (-1ULL)
13#define ELFCORE_ADDR_ERR (-2ULL)
14
15extern unsigned long long elfcorehdr_addr;
16extern unsigned long long elfcorehdr_size;
17
18extern int elfcorehdr_alloc(unsigned long long *addr, unsigned long long *size);
19extern void elfcorehdr_free(unsigned long long addr);
20extern ssize_t elfcorehdr_read(char *buf, size_t count, u64 *ppos);
21extern ssize_t elfcorehdr_read_notes(char *buf, size_t count, u64 *ppos);
22extern int remap_oldmem_pfn_range(struct vm_area_struct *vma,
23 unsigned long from, unsigned long pfn,
24 unsigned long size, pgprot_t prot);
25
26extern ssize_t copy_oldmem_page(unsigned long, char *, size_t,
27 unsigned long, int);
28void vmcore_cleanup(void);
29
30
31
32#ifndef vmcore_elf_check_arch_cross
33#define vmcore_elf_check_arch_cross(x) 0
34#endif
35
36
37
38
39
40
41#ifndef vmcore_elf32_check_arch
42#define vmcore_elf32_check_arch(x) elf_check_arch(x)
43#endif
44
45#ifndef vmcore_elf64_check_arch
46#define vmcore_elf64_check_arch(x) (elf_check_arch(x) || vmcore_elf_check_arch_cross(x))
47#endif
48
49
50
51
52
53
54
55
56
57
58
59static inline bool is_kdump_kernel(void)
60{
61 return elfcorehdr_addr != ELFCORE_ADDR_MAX;
62}
63
64
65
66
67
68
69
70
71
72static inline int is_vmcore_usable(void)
73{
74 return is_kdump_kernel() && elfcorehdr_addr != ELFCORE_ADDR_ERR ? 1 : 0;
75}
76
77
78
79
80
81static inline void vmcore_unusable(void)
82{
83 if (is_kdump_kernel())
84 elfcorehdr_addr = ELFCORE_ADDR_ERR;
85}
86
87#define HAVE_OLDMEM_PFN_IS_RAM 1
88extern int register_oldmem_pfn_is_ram(int (*fn)(unsigned long pfn));
89extern void unregister_oldmem_pfn_is_ram(void);
90
91#else
92static inline bool is_kdump_kernel(void) { return 0; }
93#endif
94
95extern unsigned long saved_max_pfn;
96#endif
97