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 bool kho_finalized(void);
26 int kho_finalize(void);
27
28 #ifdef CONFIG_KEXEC_HANDOVER_DEBUGFS
29 int kho_debugfs_init(void);
30 void kho_in_debugfs_init(struct kho_debugfs *dbg, const void *fdt);
31 int kho_out_debugfs_init(struct kho_debugfs *dbg);
32 int kho_debugfs_fdt_add(struct kho_debugfs *dbg, const char *name,
33 const void *fdt, bool root);
34 void kho_debugfs_fdt_remove(struct kho_debugfs *dbg, void *fdt);
35 #else
kho_debugfs_init(void)36 static inline int kho_debugfs_init(void) { return 0; }
kho_in_debugfs_init(struct kho_debugfs * dbg,const void * fdt)37 static inline void kho_in_debugfs_init(struct kho_debugfs *dbg,
38 const void *fdt) { }
kho_out_debugfs_init(struct kho_debugfs * dbg)39 static inline int kho_out_debugfs_init(struct kho_debugfs *dbg) { return 0; }
kho_debugfs_fdt_add(struct kho_debugfs * dbg,const char * name,const void * fdt,bool root)40 static inline int kho_debugfs_fdt_add(struct kho_debugfs *dbg, const char *name,
41 const void *fdt, bool root) { return 0; }
kho_debugfs_fdt_remove(struct kho_debugfs * dbg,void * fdt)42 static inline void kho_debugfs_fdt_remove(struct kho_debugfs *dbg,
43 void *fdt) { }
44 #endif /* CONFIG_KEXEC_HANDOVER_DEBUGFS */
45
46 #ifdef CONFIG_KEXEC_HANDOVER_DEBUG
47 bool kho_scratch_overlap(phys_addr_t phys, size_t size);
48 #else
kho_scratch_overlap(phys_addr_t phys,size_t size)49 static inline bool kho_scratch_overlap(phys_addr_t phys, size_t size)
50 {
51 return false;
52 }
53 #endif /* CONFIG_KEXEC_HANDOVER_DEBUG */
54
55 #endif /* LINUX_KEXEC_HANDOVER_INTERNAL_H */
56