summaryrefslogtreecommitdiff
path: root/src/arch/x86/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch/x86/include')
-rw-r--r--src/arch/x86/include/arch/early_variables.h17
-rw-r--r--src/arch/x86/include/arch/header.ld23
-rw-r--r--src/arch/x86/include/arch/memlayout.h4
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