[coreboot-gerrit] New patch to review for coreboot: HACK/RFC: Make cbmem_find() fail cleanly before cbmem_initialize()
Julius Werner (jwerner@chromium.org)
gerrit at coreboot.org
Sat Aug 20 03:17:22 CEST 2016
Julius Werner (jwerner at chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16273
-gerrit
commit ad3eadf18968d409c87717c9aab54f9c12650168
Author: Julius Werner <jwerner at chromium.org>
Date: Fri Aug 19 16:20:40 2016 -0700
HACK/RFC: Make cbmem_find() fail cleanly before cbmem_initialize()
Right now, calling cbmem_find() on my ARM64 system in romstage before
DRAM has been initialized will cause the IMD/CBMEM code to immediately
initialize CBMEM (which hangs the system). The code from
vb2_selected_region() suggests that this is not intended and it's
supposed to cleanly return NULL instead.
There is probably a more appropriate way to do this than just adding a
global (and it would need to be a CAR_GLOBAL, at least), but I'm not
really familiar enough with this code. Can somebody point me in the
right direction?
Alternatively, we can declare that cbmem_find() is not allowed before
cbmem_initialize() and instead add an extra CAR_GLOBAL to the vboot code
to keep track of whether the CBMEM handoff has been initialized.
Change-Id: Ia6c1db00ae01dee485d5e96e4315cb399dc63696
Signed-off-by: Julius Werner <jwerner at chromium.org>
---
src/lib/imd_cbmem.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/lib/imd_cbmem.c b/src/lib/imd_cbmem.c
index 3e3e2b0..538756b 100644
--- a/src/lib/imd_cbmem.c
+++ b/src/lib/imd_cbmem.c
@@ -26,6 +26,8 @@
#include <arch/acpi.h>
#endif
+static int haxxor = 0;
+
static inline struct imd *cbmem_get_imd(void)
{
/* Only supply a backing store for imd in ramstage. */
@@ -75,6 +77,7 @@ static struct imd *imd_init_backing(struct imd *backing)
static struct imd *imd_init_backing_with_recover(struct imd *backing)
{
struct imd *imd;
+ haxxor = 1;
imd = imd_init_backing(backing);
if (!ENV_RAMSTAGE) {
@@ -221,6 +224,9 @@ void *cbmem_find(u32 id)
struct imd imd_backing;
const struct imd_entry *e;
+ if (!haxxor)
+ return NULL;
+
imd = imd_init_backing_with_recover(&imd_backing);
e = imd_entry_find(imd, id);
More information about the coreboot-gerrit
mailing list