summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Daney <david.daney@cavium.com>2017-10-12 14:02:25 -0700
committerSimon Horman <horms@verge.net.au>2017-10-18 07:15:24 +0200
commit77e769bd1d1f8e2442bb9a62895e2de8f9cbb4b6 (patch)
treecb8d21864c2ca83d24d844e6f35bd0c82e74761f
parent508c7d45e270bfda0a68fd349070af873f0984bc (diff)
kexec-tools: mips: Merge adjacent memory ranges.
Some kernel versions running on MIPS split the System RAM memory regions reported in /proc/iomem. This may cause loading of the kexec kernel to fail if it crosses one of the splits. Fix by merging adjacent memory ranges that have the same type. Signed-off-by: David Daney <david.daney@cavium.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/arch/mips/kexec-mips.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/kexec/arch/mips/kexec-mips.c b/kexec/arch/mips/kexec-mips.c
index 2e5b700..415c2ed 100644
--- a/kexec/arch/mips/kexec-mips.c
+++ b/kexec/arch/mips/kexec-mips.c
@@ -60,10 +60,16 @@ int get_memory_ranges(struct memory_range **range, int *ranges,
} else {
continue;
}
- memory_range[memory_ranges].start = start;
- memory_range[memory_ranges].end = end;
- memory_range[memory_ranges].type = type;
- memory_ranges++;
+ if (memory_ranges > 0 &&
+ memory_range[memory_ranges - 1].end == start &&
+ memory_range[memory_ranges - 1].type == type) {
+ memory_range[memory_ranges - 1].end = end;
+ } else {
+ memory_range[memory_ranges].start = start;
+ memory_range[memory_ranges].end = end;
+ memory_range[memory_ranges].type = type;
+ memory_ranges++;
+ }
}
fclose(fp);
*range = memory_range;