From c714137d9519c12d2b951abf3c335fb1d6912029 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Thu, 12 Oct 2017 11:23:58 -0600 Subject: 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 Reviewed-on: https://review.coreboot.org/21995 Tested-by: build bot (Jenkins) Reviewed-by: Subrata Banik Reviewed-by: Matt DeVillier --- src/soc/intel/common/block/ebda/ebda.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/soc/intel/common/block/ebda') 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 #include +#include /* * 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)); +} -- cgit v1.2.3