xref: /linux/kernel/liveupdate/kexec_handover_internal.h (revision de008c9ba5684f14e83bcf86cd45fb0e4e6c4d82)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef LINUX_KEXEC_HANDOVER_INTERNAL_H
3 #define LINUX_KEXEC_HANDOVER_INTERNAL_H
4 
5 #include <linux/kexec_handover.h>
6 #include <linux/list.h>
7 #include <linux/types.h>
8 
9 #ifdef CONFIG_KEXEC_HANDOVER_DEBUGFS
10 #include <linux/debugfs.h>
11 
12 struct kho_debugfs {
13 	struct dentry *dir;
14 	struct dentry *sub_fdt_dir;
15 	struct list_head fdt_list;
16 };
17 
18 #else
19 struct kho_debugfs {};
20 #endif
21 
22 extern struct kho_scratch *kho_scratch;
23 extern unsigned int kho_scratch_cnt;
24 
25 #ifdef CONFIG_KEXEC_HANDOVER_DEBUGFS
26 int kho_debugfs_init(void);
27 void kho_in_debugfs_init(struct kho_debugfs *dbg, const void *fdt);
28 int kho_out_debugfs_init(struct kho_debugfs *dbg);
29 int kho_debugfs_fdt_add(struct kho_debugfs *dbg, const char *name,
30 			const void *fdt, bool root);
31 void kho_debugfs_fdt_remove(struct kho_debugfs *dbg, void *fdt);
32 #else
33 static inline int kho_debugfs_init(void) { return 0; }
34 static inline void kho_in_debugfs_init(struct kho_debugfs *dbg,
35 				       const void *fdt) { }
36 static inline int kho_out_debugfs_init(struct kho_debugfs *dbg) { return 0; }
37 static inline int kho_debugfs_fdt_add(struct kho_debugfs *dbg, const char *name,
38 				      const void *fdt, bool root) { return 0; }
39 static inline void kho_debugfs_fdt_remove(struct kho_debugfs *dbg,
40 					  void *fdt) { }
41 #endif /* CONFIG_KEXEC_HANDOVER_DEBUGFS */
42 
43 #ifdef CONFIG_KEXEC_HANDOVER_DEBUG
44 bool kho_scratch_overlap(phys_addr_t phys, size_t size);
45 #else
46 static inline bool kho_scratch_overlap(phys_addr_t phys, size_t size)
47 {
48 	return false;
49 }
50 #endif /* CONFIG_KEXEC_HANDOVER_DEBUG */
51 
52 #endif /* LINUX_KEXEC_HANDOVER_INTERNAL_H */
53