Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
[firefly-linux-kernel-4.4.55.git] / include / linux / kexec.h
index 8e80901e466f3454e495451c1dfac6ddaab3f5fc..9d957b7ae095ed7f2980db140a9c21a6aae70084 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/ioport.h>
 #include <linux/elfcore.h>
 #include <linux/elf.h>
+#include <linux/module.h>
 #include <asm/kexec.h>
 
 /* Verify architecture specific macros are defined */
@@ -95,6 +96,27 @@ struct compat_kexec_segment {
 };
 #endif
 
+struct kexec_sha_region {
+       unsigned long start;
+       unsigned long len;
+};
+
+struct purgatory_info {
+       /* Pointer to elf header of read only purgatory */
+       Elf_Ehdr *ehdr;
+
+       /* Pointer to purgatory sechdrs which are modifiable */
+       Elf_Shdr *sechdrs;
+       /*
+        * Temporary buffer location where purgatory is loaded and relocated
+        * This memory can be freed post image load
+        */
+       void *purgatory_buf;
+
+       /* Address where purgatory is finally loaded and is executed from */
+       unsigned long purgatory_load_addr;
+};
+
 struct kimage {
        kimage_entry_t head;
        kimage_entry_t *entry;
@@ -143,6 +165,9 @@ struct kimage {
 
        /* Image loader handling the kernel can store a pointer here */
        void *image_loader_data;
+
+       /* Information for loading purgatory */
+       struct purgatory_info purgatory_info;
 };
 
 /*
@@ -153,6 +178,7 @@ struct kexec_buf {
        struct kimage *image;
        char *buffer;
        unsigned long bufsz;
+       unsigned long mem;
        unsigned long memsz;
        unsigned long buf_align;
        unsigned long buf_min;
@@ -165,12 +191,15 @@ typedef void *(kexec_load_t)(struct kimage *image, char *kernel_buf,
                             unsigned long kernel_len, char *initrd,
                             unsigned long initrd_len, char *cmdline,
                             unsigned long cmdline_len);
-typedef int (kexec_cleanup_t)(struct kimage *image);
+typedef int (kexec_cleanup_t)(void *loader_data);
+typedef int (kexec_verify_sig_t)(const char *kernel_buf,
+                                unsigned long kernel_len);
 
 struct kexec_file_ops {
        kexec_probe_t *probe;
        kexec_load_t *load;
        kexec_cleanup_t *cleanup;
+       kexec_verify_sig_t *verify_sig;
 };
 
 /* kexec interface functions */
@@ -189,6 +218,14 @@ extern int kexec_add_buffer(struct kimage *image, char *buffer,
                            unsigned long *load_addr);
 extern struct page *kimage_alloc_control_pages(struct kimage *image,
                                                unsigned int order);
+extern int kexec_load_purgatory(struct kimage *image, unsigned long min,
+                               unsigned long max, int top_down,
+                               unsigned long *load_addr);
+extern int kexec_purgatory_get_set_symbol(struct kimage *image,
+                                         const char *name, void *buf,
+                                         unsigned int size, bool get_value);
+extern void *kexec_purgatory_get_symbol_addr(struct kimage *image,
+                                            const char *name);
 extern void crash_kexec(struct pt_regs *);
 int kexec_should_crash(struct task_struct *);
 void crash_save_cpu(struct pt_regs *regs, int cpu);