Aaron Durbin (adurbin@chromium.org) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/14548
-gerrit
commit 3560ed70e30977f9f329fbcdc0747368f57b735c Author: Aaron Durbin adurbin@chromium.org Date: Fri Apr 29 12:34:01 2016 -0500
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 adurbin@chromium.org --- src/arch/x86/assembly_entry.S | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-)
diff --git a/src/arch/x86/assembly_entry.S b/src/arch/x86/assembly_entry.S index ec3888f..32640fa 100644 --- a/src/arch/x86/assembly_entry.S +++ b/src/arch/x86/assembly_entry.S @@ -14,21 +14,33 @@ * GNU General Public License for more details. */
-#if IS_ENABLED(CONFIG_C_ENVIRONMENT_BOOTBLOCK) +#include <rules.h> + +/* 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 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. + * 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