summaryrefslogtreecommitdiff
path: root/kexec/arch/mips/crashdump-mips.c
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2010-12-21 16:52:16 +0900
committerSimon Horman <horms@verge.net.au>2010-12-21 16:52:16 +0900
commitc0f83f3221a5af12f1d02c3d660170fa8f2233a1 (patch)
tree268e38f9ba8fa3a5567dd12d22c09fccbf73bd68 /kexec/arch/mips/crashdump-mips.c
parentcca4fa3921d549df984ee429756c4d6e882e5a74 (diff)
mips: kern_vaddr_start is now in crash_elf_info
Signed-off-by: Simon Horman <horms@verge.net.au>
Diffstat (limited to 'kexec/arch/mips/crashdump-mips.c')
-rw-r--r--kexec/arch/mips/crashdump-mips.c55
1 files changed, 23 insertions, 32 deletions
diff --git a/kexec/arch/mips/crashdump-mips.c b/kexec/arch/mips/crashdump-mips.c
index 5ea4f4f..b937ab5 100644
--- a/kexec/arch/mips/crashdump-mips.c
+++ b/kexec/arch/mips/crashdump-mips.c
@@ -51,7 +51,7 @@ unsigned long long saved_max_mem;
/* Read kernel physical load addr from the file returned by proc_iomem()
* (Kernel Code) and store in kexec_info */
-static int get_kernel_paddr(struct kexec_info *info)
+static int get_kernel_paddr(struct crash_elf_info *elf_info)
{
uint64_t start;
@@ -59,7 +59,7 @@ static int get_kernel_paddr(struct kexec_info *info)
return 0;
if (parse_iomem_single("Kernel code\n", &start, NULL) == 0) {
- info->kern_paddr_start = start;
+ elf_info->kern_paddr_start = start;
#ifdef DEBUG
printf("kernel load physical addr start = 0x%lx\n", start);
#endif
@@ -70,21 +70,22 @@ static int get_kernel_paddr(struct kexec_info *info)
return -1;
}
-static int get_kernel_vaddr_and_size(struct kexec_info *info)
+static int get_kernel_vaddr_and_size(struct crash_elf_info *elf_info)
{
uint64_t end;
- if (!info->kern_paddr_start)
+ if (!elf_info->kern_paddr_start)
return -1;
- info->kern_vaddr_start = info->kern_paddr_start | 0xffffffff80000000UL;
+ elf_info->kern_vaddr_start = elf_info->kern_paddr_start |
+ 0xffffffff80000000UL;
if (parse_iomem_single("Kernel data\n", NULL, &end) == 0) {
- info->kern_size = end - info->kern_paddr_start;
+ elf_info->kern_size = end - elf_info->kern_paddr_start;
#ifdef DEBUG
printf("kernel_vaddr= 0x%llx paddr %llx\n",
- info->kern_vaddr_start,
- info->kern_paddr_start);
- printf("kernel size = 0x%llx\n", info->kern_size);
+ elf_info->kern_vaddr_start,
+ elf_info->kern_paddr_start);
+ printf("kernel size = 0x%llx\n", elf_info->kern_size);
#endif
return 0;
}
@@ -355,11 +356,20 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
unsigned long sz, elfcorehdr;
int nr_ranges, align = 1024;
struct memory_range *mem_range;
+ crash_create_elf_headers_func crash_create = crash_create_elf32_headers;
+ struct crash_elf_info *elf_info = &elf_info32;
- if (get_kernel_paddr(info))
+#ifdef __mips64
+ if (arch_options.core_header_type == CORE_TYPE_ELF64) {
+ elf_info = &elf_info64;
+ crash_create = crash_create_elf64;
+ }
+#endif
+
+ if (get_kernel_paddr(elf_info))
return -1;
- if (get_kernel_vaddr_and_size(info))
+ if (get_kernel_vaddr_and_size(elf_info))
return -1;
if (get_crash_memory_ranges(&mem_range, &nr_ranges) < 0)
@@ -373,28 +383,9 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
crash_reserved_mem.start,
crash_reserved_mem.end, -1);
-#ifdef __mips64
- /* Create elf header segment and store crash image data. */
- if (arch_options.core_header_type == CORE_TYPE_ELF64) {
- if (crash_create_elf64_headers(info, &elf_info64,
- crash_memory_range, nr_ranges,
- &tmp, &sz,
- ELF_CORE_HEADER_ALIGN) < 0)
- return -1;
- } else {
- if (crash_create_elf32_headers(info, &elf_info32,
- crash_memory_range, nr_ranges,
- &tmp, &sz,
- ELF_CORE_HEADER_ALIGN) < 0)
- return -1;
- }
-#else
- if (crash_create_elf32_headers(info, &elf_info32,
- crash_memory_range, nr_ranges,
- &tmp, &sz,
- ELF_CORE_HEADER_ALIGN) < 0)
+ if (crash_create(info, elf_info, crash_memory_range, nr_ranges,
+ &tmp, &sz, ELF_CORE_HEADER_ALIGN) < 0)
return -1;
-#endif
elfcorehdr = add_buffer(info, tmp, sz, sz, align,
crash_reserved_mem.start,
crash_reserved_mem.end, -1);