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