提交 7dad169e 编写于 作者: A Andreas Herrmann 提交者: Ingo Molnar

x86: memtest: cleanup memtest function

Impact: code cleanup
Signed-off-by: NAndreas Herrmann <andreas.herrmann3@amd.com>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 6d74171b
...@@ -16,6 +16,15 @@ static u64 patterns[] __initdata = { ...@@ -16,6 +16,15 @@ static u64 patterns[] __initdata = {
0xaaaaaaaaaaaaaaaaULL, 0xaaaaaaaaaaaaaaaaULL,
}; };
static void __init reserve_bad_mem(u64 pattern, unsigned long start_bad,
unsigned long end_bad)
{
printk(KERN_CONT "\n %016llx bad mem addr "
"%010lx - %010lx reserved",
(unsigned long long) pattern, start_bad, end_bad);
reserve_early(start_bad, end_bad, "BAD RAM");
}
static void __init memtest(unsigned long start_phys, unsigned long size, static void __init memtest(unsigned long start_phys, unsigned long size,
u64 pattern) u64 pattern)
{ {
...@@ -37,26 +46,18 @@ static void __init memtest(unsigned long start_phys, unsigned long size, ...@@ -37,26 +46,18 @@ static void __init memtest(unsigned long start_phys, unsigned long size,
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
start[i] = pattern; start[i] = pattern;
for (i = 0; i < count; i++, start++, start_phys_aligned += incr) { for (i = 0; i < count; i++, start++, start_phys_aligned += incr) {
if (*start != pattern) { if (*start == pattern)
if (start_phys_aligned == last_bad + incr) { continue;
last_bad += incr; if (start_phys_aligned == last_bad + incr) {
} else { last_bad += incr;
if (start_bad) { continue;
printk(KERN_CONT "\n %016llx bad mem addr %010lx - %010lx reserved",
(unsigned long long) pattern,
start_bad, last_bad + incr);
reserve_early(start_bad, last_bad + incr, "BAD RAM");
}
start_bad = last_bad = start_phys_aligned;
}
} }
if (start_bad)
reserve_bad_mem(pattern, start_bad, last_bad + incr);
start_bad = last_bad = start_phys_aligned;
} }
if (start_bad) { if (start_bad)
printk(KERN_CONT "\n %016llx bad mem addr %010lx - %010lx reserved", reserve_bad_mem(pattern, start_bad, last_bad + incr);
(unsigned long long) pattern, start_bad,
last_bad + incr);
reserve_early(start_bad, last_bad + incr, "BAD RAM");
}
} }
/* default is disabled */ /* default is disabled */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册