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>
Reviewed-on: https://review.coreboot.org/14548
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins)
Reviewed-by: Andrey Petrov <andrey.petrov@intel.com>
Reviewed-by: Leroy P Leahy <leroy.p.leahy@intel.com>
This commit is contained in:
Aaron Durbin 2016-04-29 12:34:01 -05:00
parent 800b0173c9
commit aef586548a
1 changed files with 20 additions and 6 deletions

View File

@ -14,21 +14,35 @@
* GNU General Public License for more details.
*/
#if IS_ENABLED(CONFIG_C_ENVIRONMENT_BOOTBLOCK)
#include <rules.h>
/*
* 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