summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorGabe Black <gabeblack@chromium.org>2011-10-12 21:01:22 -0700
committerGabe Black (Do Not Use) <gabeblack@google.com>2011-10-14 11:29:53 -0700
commita383d751f8e6f71d64be79b50df1e247d20ce4a6 (patch)
treef5588e407e38aa11d740b4ae1e6fd74a53aaa36a /common
parent3bf56eb1dd57e34506c9dd39a9c884c3f44c631f (diff)
Implement wipe_unused_memory for x86
The implementation adds the e820 regions marked as RAM, removes the ones that aren't, manually removes an area that is incorrectly left out of the e820 map, and then uses the the protect_u_boot_memory function to protect the generic u-boot memory regions. BUG=chrome-os-partner:6194 BUG=chrome-os-partner:6195 TEST=Boot on Stumpy. Manually check the wipe areas reported during boot. Change-Id: Icaf7b9167282f9ab418d98491aa0493f020e287d Signed-off-by: Gabe Black <gabeblack@google.com> Reviewed-on: http://gerrit.chromium.org/gerrit/10007 Reviewed-by: Stefan Reinauer <reinauer@google.com> Reviewed-by: Che-Liang Chiou <clchiou@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/cmd_vboot_twostop.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/common/cmd_vboot_twostop.c b/common/cmd_vboot_twostop.c
index 09ea66af02a..55088d1aa80 100644
--- a/common/cmd_vboot_twostop.c
+++ b/common/cmd_vboot_twostop.c
@@ -181,6 +181,40 @@ static void setup_arch_unused_memory(memory_wipe_t *wipe,
(uintptr_t)gd->fb_base + fb_size);
}
+#elif defined(CONFIG_SYS_COREBOOT)
+
+static void setup_arch_unused_memory(memory_wipe_t *wipe,
+ crossystem_data_t *cdata, VbCommonParams *cparams)
+{
+ int i;
+
+ /* Add ranges that describe RAM. */
+ for (i = 0; i < lib_sysinfo.n_memranges; i++) {
+ struct memrange *range = &lib_sysinfo.memrange[i];
+ if (range->type == CB_MEM_RAM) {
+ memory_wipe_add(wipe, range->base,
+ range->base + range->size);
+ }
+ }
+ /*
+ * Remove ranges that don't. These should take precedence, so they're
+ * done last and in their own loop.
+ */
+ for (i = 0; i < lib_sysinfo.n_memranges; i++) {
+ struct memrange *range = &lib_sysinfo.memrange[i];
+ if (range->type != CB_MEM_RAM) {
+ memory_wipe_sub(wipe, range->base,
+ range->base + range->size);
+ }
+ }
+ /*
+ * FIXME This area isn't marked reserved in the e820 map like it should
+ * FIXME be. Once it is, we won't have to exclude it manually and this
+ * FIXME code can be removed.
+ */
+ memory_wipe_sub(wipe, 0xf0000, 0x100000);
+}
+
#else
static void setup_arch_unused_memory(memory_wipe_t *wipe,