aboutsummaryrefslogtreecommitdiff
path: root/src/soc/intel/common/block/ebda/ebda.c
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2017-10-12 11:23:58 -0600
committerAaron Durbin <adurbin@chromium.org>2017-10-16 16:56:15 +0000
commitc714137d9519c12d2b951abf3c335fb1d6912029 (patch)
tree3139ed56326f5f3fa3735893de0fc37b3cd4b623 /src/soc/intel/common/block/ebda/ebda.c
parentd45011c9c63afb6f4b25b8ae92d7b74cc873b15c (diff)
soc/intel/common: sanity check ebda signature
It's possible for chipsets utilizing ebda to cache the cbmem_top() value to be called prior to the object being entirely setup. As such it's important to check the signature to ensure the object has been initialized. Do that in a newly introduced function, retrieve_ebda_object(), which will zero out the object if the signature doesn't match. Change-Id: I66b07c36f46ed9112bc39b44914c860ba68677ae Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/21995 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Subrata Banik <subrata.banik@intel.com> Reviewed-by: Matt DeVillier <matt.devillier@gmail.com>
Diffstat (limited to 'src/soc/intel/common/block/ebda/ebda.c')
-rw-r--r--src/soc/intel/common/block/ebda/ebda.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/ebda/ebda.c b/src/soc/intel/common/block/ebda/ebda.c
index 87c18d9bc5..4f60490824 100644
--- a/src/soc/intel/common/block/ebda/ebda.c
+++ b/src/soc/intel/common/block/ebda/ebda.c
@@ -15,6 +15,7 @@
#include <arch/ebda.h>
#include <intelblocks/ebda.h>
+#include <string.h>
/*
* Mainboard Override function
@@ -47,3 +48,11 @@ void fill_ebda_area(void)
create_mainboard_ebda(cfg);
write_ebda_data(cfg, sizeof(*cfg));
}
+
+void retrieve_ebda_object(struct ebda_config *cfg)
+{
+ read_ebda_data(cfg, sizeof(*cfg));
+
+ if (cfg->signature != EBDA_SIGNATURE)
+ memset(cfg, 0, sizeof(*cfg));
+}