diff options
author | Andreas Herrmann <andreas.herrmann3@amd.com> | 2009-02-25 05:30:04 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-02-25 06:19:46 -0500 |
commit | bfb4dc0da45f8fddc76eba7e62919420c7d6dae2 (patch) | |
tree | aedeea6811513e157babbfd591695413f635a68f /arch/x86/mm/memtest.c | |
parent | 570c9e69aaa84689fb8ed2a3a4af39ca54ba7a47 (diff) |
x86: memtest: wipe out test pattern from memory
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/mm/memtest.c')
-rw-r--r-- | arch/x86/mm/memtest.c | 56 |
1 files changed, 33 insertions, 23 deletions
diff --git a/arch/x86/mm/memtest.c b/arch/x86/mm/memtest.c index 3232397783ae..9c52ef19e6f2 100644 --- a/arch/x86/mm/memtest.c +++ b/arch/x86/mm/memtest.c | |||
@@ -57,6 +57,29 @@ static void __init memtest(u64 pattern, u64 start_phys, u64 size) | |||
57 | reserve_bad_mem(pattern, start_bad, last_bad + incr); | 57 | reserve_bad_mem(pattern, start_bad, last_bad + incr); |
58 | } | 58 | } |
59 | 59 | ||
60 | static void __init do_one_pass(u64 pattern, u64 start, u64 end) | ||
61 | { | ||
62 | u64 size = 0; | ||
63 | |||
64 | while (start < end) { | ||
65 | start = find_e820_area_size(start, &size, 1); | ||
66 | |||
67 | /* done ? */ | ||
68 | if (start >= end) | ||
69 | break; | ||
70 | if (start + size > end) | ||
71 | size = end - start; | ||
72 | |||
73 | printk(KERN_INFO " %010llx - %010llx pattern %016llx\n", | ||
74 | (unsigned long long) start, | ||
75 | (unsigned long long) start + size, | ||
76 | (unsigned long long) cpu_to_be64(pattern)); | ||
77 | memtest(pattern, start, size); | ||
78 | |||
79 | start += size; | ||
80 | } | ||
81 | } | ||
82 | |||
60 | /* default is disabled */ | 83 | /* default is disabled */ |
61 | static int memtest_pattern __initdata; | 84 | static int memtest_pattern __initdata; |
62 | 85 | ||
@@ -71,35 +94,22 @@ early_param("memtest", parse_memtest); | |||
71 | 94 | ||
72 | void __init early_memtest(unsigned long start, unsigned long end) | 95 | void __init early_memtest(unsigned long start, unsigned long end) |
73 | { | 96 | { |
74 | u64 t_start, t_size; | ||
75 | unsigned int i; | 97 | unsigned int i; |
76 | u64 pattern; | 98 | unsigned int idx = 0; |
77 | 99 | ||
78 | if (!memtest_pattern) | 100 | if (!memtest_pattern) |
79 | return; | 101 | return; |
80 | 102 | ||
81 | printk(KERN_INFO "early_memtest: # of tests: %d\n", memtest_pattern); | 103 | printk(KERN_INFO "early_memtest: # of tests: %d\n", memtest_pattern); |
82 | for (i = 0; i < memtest_pattern; i++) { | 104 | for (i = 0; i < memtest_pattern; i++) { |
83 | unsigned int idx = i % ARRAY_SIZE(patterns); | 105 | idx = i % ARRAY_SIZE(patterns); |
84 | pattern = patterns[idx]; | 106 | do_one_pass(patterns[idx], start, end); |
85 | t_start = start; | 107 | } |
86 | t_size = 0; | 108 | |
87 | while (t_start < end) { | 109 | if (idx > 0) { |
88 | t_start = find_e820_area_size(t_start, &t_size, 1); | 110 | printk(KERN_INFO "early_memtest: wipe out " |
89 | 111 | "test pattern from memory\n"); | |
90 | /* done ? */ | 112 | /* additional test with pattern 0 will do this */ |
91 | if (t_start >= end) | 113 | do_one_pass(0, start, end); |
92 | break; | ||
93 | if (t_start + t_size > end) | ||
94 | t_size = end - t_start; | ||
95 | |||
96 | printk(KERN_INFO " %010llx - %010llx pattern %016llx\n", | ||
97 | (unsigned long long) t_start, | ||
98 | (unsigned long long) t_start + t_size, | ||
99 | (unsigned long long) cpu_to_be64(pattern)); | ||
100 | memtest(pattern, t_start, t_size); | ||
101 | |||
102 | t_start += t_size; | ||
103 | } | ||
104 | } | 114 | } |
105 | } | 115 | } |