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>
This commit is contained in:
parent
d45011c9c6
commit
c714137d95
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#include <arch/ebda.h>
|
#include <arch/ebda.h>
|
||||||
#include <intelblocks/ebda.h>
|
#include <intelblocks/ebda.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mainboard Override function
|
* Mainboard Override function
|
||||||
|
@ -47,3 +48,11 @@ void fill_ebda_area(void)
|
||||||
create_mainboard_ebda(cfg);
|
create_mainboard_ebda(cfg);
|
||||||
write_ebda_data(cfg, sizeof(*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));
|
||||||
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
#include <soc/ebda.h>
|
#include <soc/ebda.h>
|
||||||
|
|
||||||
#define EBDA_SIGNATURE 0xebda
|
#define EBDA_SIGNATURE 0xebdaebda
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mainboard Override function
|
* Mainboard Override function
|
||||||
|
@ -45,6 +45,10 @@ void fill_soc_memmap_ebda(struct ebda_config *cfg);
|
||||||
*/
|
*/
|
||||||
void fill_ebda_area(void);
|
void fill_ebda_area(void);
|
||||||
|
|
||||||
|
/* Fill the ebda object pointed to by cfg. Object will be zero filled
|
||||||
|
* if signature check fails. */
|
||||||
|
void retrieve_ebda_object(struct ebda_config *cfg);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* EBDA structure
|
* EBDA structure
|
||||||
*
|
*
|
||||||
|
|
|
@ -348,7 +348,7 @@ void *cbmem_top(void)
|
||||||
if (sa_get_tseg_base() == 0)
|
if (sa_get_tseg_base() == 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
read_ebda_data(cfg, sizeof(*cfg));
|
retrieve_ebda_object(cfg);
|
||||||
|
|
||||||
return (void *)(uintptr_t)cfg->tolum_base;
|
return (void *)(uintptr_t)cfg->tolum_base;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue