diff options
Diffstat (limited to 'arch/x86/mm/memtest.c')
-rw-r--r-- | arch/x86/mm/memtest.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/arch/x86/mm/memtest.c b/arch/x86/mm/memtest.c index 827f94044cfc..01a72d6825be 100644 --- a/arch/x86/mm/memtest.c +++ b/arch/x86/mm/memtest.c | |||
@@ -16,6 +16,15 @@ static u64 patterns[] __initdata = { | |||
16 | 0xaaaaaaaaaaaaaaaaULL, | 16 | 0xaaaaaaaaaaaaaaaaULL, |
17 | }; | 17 | }; |
18 | 18 | ||
19 | static void __init reserve_bad_mem(u64 pattern, unsigned long start_bad, | ||
20 | unsigned long end_bad) | ||
21 | { | ||
22 | printk(KERN_CONT "\n %016llx bad mem addr " | ||
23 | "%010lx - %010lx reserved", | ||
24 | (unsigned long long) pattern, start_bad, end_bad); | ||
25 | reserve_early(start_bad, end_bad, "BAD RAM"); | ||
26 | } | ||
27 | |||
19 | static void __init memtest(unsigned long start_phys, unsigned long size, | 28 | static void __init memtest(unsigned long start_phys, unsigned long size, |
20 | u64 pattern) | 29 | u64 pattern) |
21 | { | 30 | { |
@@ -37,26 +46,18 @@ static void __init memtest(unsigned long start_phys, unsigned long size, | |||
37 | for (i = 0; i < count; i++) | 46 | for (i = 0; i < count; i++) |
38 | start[i] = pattern; | 47 | start[i] = pattern; |
39 | for (i = 0; i < count; i++, start++, start_phys_aligned += incr) { | 48 | for (i = 0; i < count; i++, start++, start_phys_aligned += incr) { |
40 | if (*start != pattern) { | 49 | if (*start == pattern) |
41 | if (start_phys_aligned == last_bad + incr) { | 50 | continue; |
42 | last_bad += incr; | 51 | if (start_phys_aligned == last_bad + incr) { |
43 | } else { | 52 | last_bad += incr; |
44 | if (start_bad) { | 53 | continue; |
45 | printk(KERN_CONT "\n %016llx bad mem addr %010lx - %010lx reserved", | ||
46 | (unsigned long long) pattern, | ||
47 | start_bad, last_bad + incr); | ||
48 | reserve_early(start_bad, last_bad + incr, "BAD RAM"); | ||
49 | } | ||
50 | start_bad = last_bad = start_phys_aligned; | ||
51 | } | ||
52 | } | 54 | } |
55 | if (start_bad) | ||
56 | reserve_bad_mem(pattern, start_bad, last_bad + incr); | ||
57 | start_bad = last_bad = start_phys_aligned; | ||
53 | } | 58 | } |
54 | if (start_bad) { | 59 | if (start_bad) |
55 | printk(KERN_CONT "\n %016llx bad mem addr %010lx - %010lx reserved", | 60 | reserve_bad_mem(pattern, start_bad, last_bad + incr); |
56 | (unsigned long long) pattern, start_bad, | ||
57 | last_bad + incr); | ||
58 | reserve_early(start_bad, last_bad + incr, "BAD RAM"); | ||
59 | } | ||
60 | } | 61 | } |
61 | 62 | ||
62 | /* default is disabled */ | 63 | /* default is disabled */ |