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_blob_add(struct kho_debugfs *dbg, const char *name, 30 const void *blob, size_t size, bool root); 31 void kho_debugfs_blob_remove(struct kho_debugfs *dbg, void *blob); 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_blob_add(struct kho_debugfs *dbg, 38 const char *name, const void *blob, 39 size_t size, bool root) { return 0; } 40 static inline void kho_debugfs_blob_remove(struct kho_debugfs *dbg, 41 void *blob) { } 42 #endif /* CONFIG_KEXEC_HANDOVER_DEBUGFS */ 43 44 #ifdef CONFIG_KEXEC_HANDOVER_DEBUG 45 bool kho_scratch_overlap(phys_addr_t phys, size_t size); 46 #else 47 static inline bool kho_scratch_overlap(phys_addr_t phys, size_t size) 48 { 49 return false; 50 } 51 #endif /* CONFIG_KEXEC_HANDOVER_DEBUG */ 52 53 #endif /* LINUX_KEXEC_HANDOVER_INTERNAL_H */ 54