diff options
| -rw-r--r-- | arch/arm/kernel/machine_kexec.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c index dfcdb9f7c126..dee34efca748 100644 --- a/arch/arm/kernel/machine_kexec.c +++ b/arch/arm/kernel/machine_kexec.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <linux/io.h> | 9 | #include <linux/io.h> |
| 10 | #include <linux/irq.h> | 10 | #include <linux/irq.h> |
| 11 | #include <asm/pgtable.h> | 11 | #include <asm/pgtable.h> |
| 12 | #include <linux/of_fdt.h> | ||
| 12 | #include <asm/pgalloc.h> | 13 | #include <asm/pgalloc.h> |
| 13 | #include <asm/mmu_context.h> | 14 | #include <asm/mmu_context.h> |
| 14 | #include <asm/cacheflush.h> | 15 | #include <asm/cacheflush.h> |
| @@ -32,6 +33,24 @@ static atomic_t waiting_for_crash_ipi; | |||
| 32 | 33 | ||
| 33 | int machine_kexec_prepare(struct kimage *image) | 34 | int machine_kexec_prepare(struct kimage *image) |
| 34 | { | 35 | { |
| 36 | struct kexec_segment *current_segment; | ||
| 37 | __be32 header; | ||
| 38 | int i, err; | ||
| 39 | |||
| 40 | /* | ||
| 41 | * No segment at default ATAGs address. try to locate | ||
| 42 | * a dtb using magic. | ||
| 43 | */ | ||
| 44 | for (i = 0; i < image->nr_segments; i++) { | ||
| 45 | current_segment = &image->segment[i]; | ||
| 46 | |||
| 47 | err = get_user(header, (__be32*)current_segment->buf); | ||
| 48 | if (err) | ||
| 49 | return err; | ||
| 50 | |||
| 51 | if (be32_to_cpu(header) == OF_DT_HEADER) | ||
| 52 | kexec_boot_atags = current_segment->mem; | ||
| 53 | } | ||
| 35 | return 0; | 54 | return 0; |
| 36 | } | 55 | } |
| 37 | 56 | ||
| @@ -122,7 +141,9 @@ void machine_kexec(struct kimage *image) | |||
| 122 | kexec_start_address = image->start; | 141 | kexec_start_address = image->start; |
| 123 | kexec_indirection_page = page_list; | 142 | kexec_indirection_page = page_list; |
| 124 | kexec_mach_type = machine_arch_type; | 143 | kexec_mach_type = machine_arch_type; |
| 125 | kexec_boot_atags = image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET; | 144 | if (!kexec_boot_atags) |
| 145 | kexec_boot_atags = image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET; | ||
| 146 | |||
| 126 | 147 | ||
| 127 | /* copy our kernel relocation code to the control code page */ | 148 | /* copy our kernel relocation code to the control code page */ |
| 128 | memcpy(reboot_code_buffer, | 149 | memcpy(reboot_code_buffer, |
