diff options
author | Gabe Black <gabeblack@chromium.org> | 2012-01-18 15:46:08 -0800 |
---|---|---|
committer | Gabe Black (Do Not Use) <gabeblack@google.com> | 2012-01-18 21:55:04 -0800 |
commit | 8e5c7395a763b90d82369b9949af1225fd6fb228 (patch) | |
tree | 117770023cec70007351a6c44848996757b51d63 /lib/chromeos | |
parent | eb590c995bbcf054ae7a5fe825d1049fb02562fd (diff) |
Make the memory wiping code use arch_phys_memset
By using arch_phys_memset, the wiping code doesn't need to worry about what
addresses can be accessed by memset or how to actually get at them.
BUG=chrome-os-partner:7579
TEST=From the original, larger patch:
Built and booted on Lumpy, Stumpy, and Kaen. Looked at the log to see
that the regions in high memory are listed as cleared. Artificially injected
a range to "clear" with 0xA5 and then 0x5A which was over the framebuffer and
covered part or all of the screen on Lumpy. Verified that the screen was
partially or completely filled with an appropriate looking color. Had U-Boot
print the PDTs it was generating to verify that the high address bits were
preserved. Identity mapped only some of memory and verified that things that
should be mapped were accessible and things that shouldn't be weren't.
Signed-off-by: Gabe Black <gabeblack@google.com>
Change-Id: Ia1859e8df5a0bbe41839a697829dfc775e1b1e48
Reviewed-on: https://gerrit.chromium.org/gerrit/14419
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Gabe Black (Do Not Use) <gabeblack@google.com>
Tested-by: Gabe Black (Do Not Use) <gabeblack@google.com>
Diffstat (limited to 'lib/chromeos')
-rw-r--r-- | lib/chromeos/memory_wipe.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/chromeos/memory_wipe.c b/lib/chromeos/memory_wipe.c index 7823ece0315..00f133f599f 100644 --- a/lib/chromeos/memory_wipe.c +++ b/lib/chromeos/memory_wipe.c @@ -12,6 +12,7 @@ #include <chromeos/common.h> #include <chromeos/memory_wipe.h> #include <malloc.h> +#include <physmem.h> #include <vboot_api.h> @@ -112,7 +113,6 @@ void memory_wipe_sub(memory_wipe_t *wipe, phys_addr_t start, phys_addr_t end) void memory_wipe_execute(memory_wipe_t *wipe) { memory_wipe_edge_t *cur; - const phys_addr_t max_addr = (phys_addr_t)~(uintptr_t)0; VBDEBUG(PREFIX "Wipe memory regions:\n"); for (cur = wipe->head.next; cur; cur = cur->next->next) { @@ -124,12 +124,12 @@ void memory_wipe_execute(memory_wipe_t *wipe) } start = cur->pos; - if ((start & max_addr) != start) - break; end = cur->next->pos; - if ((end & max_addr) != end) - end = 0; - VBDEBUG(PREFIX "\t[%#08x, 0x%08x)\n", start, end); - memset((void *)(uintptr_t)start, 0, end - start); + + VBDEBUG(sizeof(phys_addr_t) == 8 ? + PREFIX "\t[%#016llx, %#016llx)\n" : + PREFIX "\t[%#08x, %#08x)\n", + start, end); + arch_phys_memset(start, 0, end - start); } } |