diff options
author | Aaron Durbin <adurbin@chromium.org> | 2015-09-29 16:31:20 -0500 |
---|---|---|
committer | Aaron Durbin <adurbin@chromium.org> | 2015-10-14 17:07:52 +0000 |
commit | 75c51d9af15dfc599adaf7a8f6e892d452146f9c (patch) | |
tree | c4232740e4f08e94947dbe821bdccb0b43909b77 /src/arch/x86/include | |
parent | e3d2d6fd70ed932c98ac19f6294cb610d27fa7bf (diff) |
x86: add standalone verstage support
To support x86 verstage one needs a working buffer for
vboot. That buffer resides in the cache-as-ram region
which persists across verstage and romstage. The current
assumption is that verstage brings cache-as-ram up
and romstage tears cache-as-ram down. The timestamp,
cbmem console, and the vboot work buffer are persistent
through in both romstage and verstage. The vboot
work buffer as well as the cbmem console are permanently
destroyed once cache-as-ram is torn down. The timestamp
region is migrated. When verstage is enabled the assumption
is that _start is the romstage entry point. It's currently
expected that the chipset provides the entry point to
romstage when verstage is employed. Also, the car_var_*()
APIs use direct access when in verstage since its expected
verstage does not tear down cache-as-ram. Lastly, supporting
files were added to verstage-y such that an x86 verstage
will build and link.
BUG=chrome-os-partner:44827
BRANCH=None
TEST=Built and booted glados using separate verstage.
Change-Id: I097aa0b92f3bb95275205a3fd8b21362c67b97aa
Signed-off-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-on: http://review.coreboot.org/11822
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/arch/x86/include')
-rw-r--r-- | src/arch/x86/include/arch/early_variables.h | 17 | ||||
-rw-r--r-- | src/arch/x86/include/arch/header.ld | 23 | ||||
-rw-r--r-- | src/arch/x86/include/arch/memlayout.h | 4 |
3 files changed, 38 insertions, 6 deletions
diff --git a/src/arch/x86/include/arch/early_variables.h b/src/arch/x86/include/arch/early_variables.h index 7ccb340cf4..8a69fca9a0 100644 --- a/src/arch/x86/include/arch/early_variables.h +++ b/src/arch/x86/include/arch/early_variables.h @@ -21,6 +21,7 @@ #define ARCH_EARLY_VARIABLES_H #include <stdlib.h> +#include <rules.h> #if defined(__PRE_RAM__) && IS_ENABLED(CONFIG_CACHE_AS_RAM) asm(".section .car.global_data,\"w\",@nobits"); @@ -31,11 +32,27 @@ asm(".previous"); #define CAR_GLOBAL __attribute__((used,section(".car.global_data#"))) #endif /* __clang__ */ +/* + * On x86 verstage, all CAR_GLOBAL variables are accessed unconditionally + * because cbmem is never initialized until romstage when dram comes up. + */ +#if ENV_VERSTAGE +static inline void *car_get_var_ptr(void *var) +{ + return var; +} + +static inline void *car_sync_var_ptr(void *var) +{ + return var; +} +#else /* Get the correct pointer for the CAR global variable. */ void *car_get_var_ptr(void *var); /* Get and update a CAR_GLOBAL pointing elsewhere in car.global_data*/ void *car_sync_var_ptr(void *var); +#endif /* ENV_VERSTAGE */ /* Get and set a primitive type global variable. */ #define car_get_var(var) \ diff --git a/src/arch/x86/include/arch/header.ld b/src/arch/x86/include/arch/header.ld index 0262c9208d..ca9b50a326 100644 --- a/src/arch/x86/include/arch/header.ld +++ b/src/arch/x86/include/arch/header.ld @@ -24,8 +24,23 @@ PHDRS to_load PT_LOAD; } -#if ENV_RAMSTAGE || ENV_RMODULE -ENTRY(_start) -#elif ENV_ROMSTAGE -ENTRY(protected_start) +/* + * For CONFIG_SEPARATE_VERSTAGE romstage doesn't have the cache-as-ram setup. + * It only contains the teardown code. The verstage has the cache-as-ram setup + * code. Therefore, it needs the protected_start symbol as its entry point. + * The romstage entry will be named _start for consistency, but it's likely + * to be implemented in the chipset code in order to control the logic flow. + */ +#if IS_ENABLED(CONFIG_SEPARATE_VERSTAGE) + #if ENV_RAMSTAGE || ENV_RMODULE || ENV_ROMSTAGE + ENTRY(_start) + #elif ENV_VERSTAGE + ENTRY(protected_start) + #endif +#else + #if ENV_RAMSTAGE || ENV_RMODULE + ENTRY(_start) + #elif ENV_ROMSTAGE + ENTRY(protected_start) + #endif #endif diff --git a/src/arch/x86/include/arch/memlayout.h b/src/arch/x86/include/arch/memlayout.h index 91cfc8e064..18e10e2cf3 100644 --- a/src/arch/x86/include/arch/memlayout.h +++ b/src/arch/x86/include/arch/memlayout.h @@ -22,8 +22,8 @@ #include <rules.h> -#if ENV_ROMSTAGE -/* No .data or .bss in romstage. Cache as ram is handled separately. */ +#if ENV_ROMSTAGE || ENV_VERSTAGE +/* No .data or .bss sections. Cache as ram is handled separately. */ #define ARCH_STAGE_HAS_DATA_SECTION 0 #define ARCH_STAGE_HAS_BSS_SECTION 0 #endif |