From aef586548a2443f40a49f9f1f5d99c522a89480f Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Fri, 29 Apr 2016 12:34:01 -0500 Subject: arch/x86/assembly_entry: allow early post CAR stages to use common code The skylake-based Chromebooks use a separate verstage which runs just after bootblock and prior to romstage. The normal path for romstage would be to reload the gdt, however in the previously described scenario has verstage performing that work. Therefore, provide that path under those conditions. The only difference from the C_ENVIRONMENT_BOOTBLOCK scenario is that the stack should not be reloaded since there's no way to know the top of the stack. Change-Id: Ic39ab52a856233d3042ac02a15ae4816ddfe07c7 Signed-off-by: Aaron Durbin Reviewed-on: https://review.coreboot.org/14548 Reviewed-by: Furquan Shaikh Tested-by: build bot (Jenkins) Reviewed-by: Andrey Petrov Reviewed-by: Leroy P Leahy --- src/arch/x86/assembly_entry.S | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/arch/x86/assembly_entry.S') diff --git a/src/arch/x86/assembly_entry.S b/src/arch/x86/assembly_entry.S index ec3888fa43..86dbba4668 100644 --- a/src/arch/x86/assembly_entry.S +++ b/src/arch/x86/assembly_entry.S @@ -14,21 +14,35 @@ * GNU General Public License for more details. */ -#if IS_ENABLED(CONFIG_C_ENVIRONMENT_BOOTBLOCK) +#include /* - * This path is for stages that post bootblock when employing - * CONFIG_C_ENVIRONMENT_BOOTBLOCK. There's no need to re-load the gdt, etc - * as all those settings are cached within the processor. In order to - * continue with C code execution one needs to set stack pointer and clear - * CAR_GLOBAL variables that are stage specific. + *Take the path where CAR_GLOBAL variables just need to be cleared when + * verstage runs directly after bootblock. + */ +#define ROMSTAGE_AFTER_VERSTAGE \ + (IS_ENABLED(CONFIG_SEPARATE_VERSTAGE) && \ + IS_ENABLED(CONFIG_VBOOT_STARTS_IN_BOOTBLOCK) && ENV_ROMSTAGE) + +#if IS_ENABLED(CONFIG_C_ENVIRONMENT_BOOTBLOCK) || ROMSTAGE_AFTER_VERSTAGE + +/* + * This path is for stages that are post bootblock when employing + * CONFIG_C_ENVIRONMENT_BOOTBLOCK or any intermediate stage succeeding + * the first stage to initialize protected mode. There's no need to re-load + * the gdt, etc as all those settings are cached within the processor. In + * order to continue with C code execution one needs to set stack pointer and + * clear CAR_GLOBAL variables that are stage specific. */ .section ".text._start", "ax", @progbits .global _start _start: +/* _car_stack_end symbol is only valid when bootblock does CAR setup. */ +#if IS_ENABLED(CONFIG_C_ENVIRONMENT_BOOTBLOCK) /* reset stack pointer to CAR stack */ mov $_car_stack_end, %esp +#endif /* clear CAR_GLOBAL area as it is not shared */ cld -- cgit v1.2.3