[coreboot-gerrit] Patch set updated for coreboot: car: Make CAR_GLOBALs work in romstage-linked libverstage

Julius Werner (jwerner@chromium.org) gerrit at coreboot.org
Tue Feb 7 00:43:42 CET 2017


Julius Werner (jwerner at chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18302

-gerrit

commit 789f55284928ff877c64d14702e568e6e2d8550f
Author: Julius Werner <jwerner at chromium.org>
Date:   Mon Feb 6 14:24:58 2017 -0800

    car: Make CAR_GLOBALs work in romstage-linked libverstage
    
    Our verstage code can currently be linked in four different ways, as
    controlled by chipset-selected Kconfig (excluding the extra complication
    from RETURN_FROM_VERSTAGE):
    
    1. as libverstage linked directly into the bootblock
    2. as a standalone stage between bootblock and romstage
    3. as libverstage linked directly into the romstage
    4. as a standalone stage between romstage and ramstage
    
    Unfortunately, <rules.h> defines ENV_VERSTAGE in all these cases
    (including 1 and 3, where it doesn't define ENV_BOOTBLOCK or
    ENV_ROMSTAGE, respectively), which makes it tricky to use when trying to
    draw any conclusions about the execution environment. The CAR_GLOBAL
    code seems to have only considered options 1 and 2, and unconditionally
    counts ENV_VERSTAGE as a pre-CAR-migration stage. This currently breaks
    vboot on Haswell platforms like Falco because tlcl_lib_init() never
    really runs.
    
    This patch fixes case 3 for those platforms. Case 4 might still be
    broken since it looks like vboot/Makefile.inc would incorrectly define
    __PRE_RAM__ for that undeniably post-RAM stage. However, I don't think
    any platforms actually use that configuration right now and I am not
    sure if it was really ever considered an intended execution mode
    (despite receiving some consideration in vboot_loader.c). (If it was
    not, it should probably be explicitly prevented by Kconfig dependencies
    and respective code should be removed.)
    
    Change-Id: I6bb84a9bf1cd54f2e02ca1f665740a9c88d88df4
    Signed-off-by: Julius Werner <jwerner at chromium.org>
---
 src/arch/x86/include/arch/early_variables.h | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/arch/x86/include/arch/early_variables.h b/src/arch/x86/include/arch/early_variables.h
index e78b846..ca64c59 100644
--- a/src/arch/x86/include/arch/early_variables.h
+++ b/src/arch/x86/include/arch/early_variables.h
@@ -30,11 +30,12 @@ asm(".previous");
 #endif /* __clang__ */
 
 /*
- * In stages that use CAR (verstage, C bootblock) all CAR_GLOBAL variables are
- * accessed unconditionally because cbmem is never initialized until romstage
- * when dram comes up.
+ * In stages that use CAR (early-style verstage, C bootblock) all CAR_GLOBAL
+ * variables are accessed unconditionally because cbmem is never initialized
+ * until romstage when dram comes up.
  */
-#if ENV_VERSTAGE || ENV_BOOTBLOCK
+#if ENV_BOOTBLOCK || \
+   (ENV_VERSTAGE && IS_ENABLED(CONFIG_VBOOT_STARTS_IN_BOOTBLOCK))
 static inline void *car_get_var_ptr(void *var)
 {
 	return var;



More information about the coreboot-gerrit mailing list