summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWANG Chao <chaowang@redhat.com>2014-05-15 11:28:23 +0800
committerSimon Horman <horms@verge.net.au>2014-05-22 14:50:37 +0900
commit9b026f78298e23875d0e510a6fbbeb0fd1dd09f8 (patch)
tree585e8714b3becce9986c5aa36eaae3835b360365
parent7bb7c2a4bae8510cfc898373e21007ac996432ec (diff)
downloadkexec-tools-9b026f78298e23875d0e510a6fbbeb0fd1dd09f8.tar.gz
x86, cleanup: remove cmdline_add_memmap_acpi
In kdump path, now we store all the 2nd kernel memory ranges in memmap_p. We could use just cmdline_add_memmap() to add all types of memory ranges to 2nd kernel cmdline. So clean up here, merge cmdline_add_memmap_acpi() into cmdline_add_memmap(). Signed-off-by: WANG Chao <chaowang@redhat.com> Acked-by: Dave Young <dyoung@redhat.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/arch/i386/crashdump-x86.c54
1 files changed, 23 insertions, 31 deletions
diff --git a/kexec/arch/i386/crashdump-x86.c b/kexec/arch/i386/crashdump-x86.c
index 15ac4b5..2168854 100644
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -667,18 +667,31 @@ static int cmdline_add_memmap(char *cmdline, struct memory_range *memmap_p)
strcat(cmdline, str_mmap);
for (i = 0; i < CRASH_MAX_MEMMAP_NR; i++) {
- unsigned long startk, endk;
- startk = (memmap_p[i].start/1024);
- endk = ((memmap_p[i].end + 1)/1024);
+ unsigned long startk, endk, type;
+
+ startk = memmap_p[i].start/1024;
+ endk = (memmap_p[i].end + 1)/1024;
+ type = memmap_p[i].type;
+
+ /* Only adding memory regions of RAM and ACPI */
+ if (type != RANGE_RAM &&
+ type != RANGE_ACPI &&
+ type != RANGE_ACPI_NVS)
+ continue;
+
+ if (type == RANGE_ACPI || type == RANGE_ACPI_NVS)
+ endk = _ALIGN_UP(memmap_p[i].end + 1, 1024)/1024;
+
if (!startk && !endk)
/* All regions traversed. */
break;
- /* A region is not worth adding if region size < 100K. It eats
- * up precious command line length. */
- if ((endk - startk) < min_sizek)
+ /* A RAM region is not worth adding if region size < 100K.
+ * It eats up precious command line length. */
+ if (type == RANGE_RAM && (endk - startk) < min_sizek)
continue;
- cmdline_add_memmap_internal(cmdline, startk, endk, RANGE_RAM);
+ /* And do not add e820 reserved region either */
+ cmdline_add_memmap_internal(cmdline, startk, endk, type);
}
dbgprintf("Command line after adding memmap\n");
@@ -767,26 +780,6 @@ static enum coretype get_core_type(struct crash_elf_info *elf_info,
}
}
-/* Appends memmap=X#Y commandline for ACPI to command line*/
-static int cmdline_add_memmap_acpi(char *cmdline, unsigned long start,
- unsigned long end)
-{
- int align = 1024;
- unsigned long startk, endk;
-
- if (!(end - start))
- return 0;
-
- startk = start/1024;
- endk = (end + align - 1)/1024;
- cmdline_add_memmap_internal(cmdline, startk, endk, RANGE_ACPI);
-
- dbgprintf("Command line after adding acpi memmap\n");
- dbgprintf("%s\n", cmdline);
-
- return 0;
-}
-
/* Appends 'acpi_rsdp=' commandline for efi boot crash dump */
static void cmdline_add_efi(char *cmdline)
{
@@ -981,8 +974,6 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
dbgprintf("Created elf header segment at 0x%lx\n", elfcorehdr);
if (delete_memmap(memmap_p, &nr_memmap, elfcorehdr, memsz) < 0)
return -1;
- if (arch_options.pass_memmap_cmdline)
- cmdline_add_memmap(mod_cmdline, memmap_p);
if (!bzImage_support_efi_boot)
cmdline_add_efi(mod_cmdline);
cmdline_add_elfcorehdr(mod_cmdline, elfcorehdr);
@@ -999,10 +990,11 @@ int load_crashdump_segments(struct kexec_info *info, char* mod_cmdline,
type = mem_range[i].type;
size = end - start + 1;
add_memmap(memmap_p, &nr_memmap, start, size, type);
- if (arch_options.pass_memmap_cmdline && type != RANGE_RESERVED)
- cmdline_add_memmap_acpi(mod_cmdline, start, end);
}
+ if (arch_options.pass_memmap_cmdline)
+ cmdline_add_memmap(mod_cmdline, memmap_p);
+
/* Store 2nd kernel boot memory ranges for later reference in
* x86-setup-linux.c: setup_linux_system_parameters() */
info->crash_range = memmap_p;