x86: fsp: Reinit the FPU after FSP meminit

The APL FSP appears to leave the FPU in a bad state in that it has
registers in use. This causes an error when the next FPU operation is
performed.

Work around this by re-resetting the FPU after calling FSP-M. This allows
the freetype console to work correctly.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
Simon Glass 2020-07-02 21:12:12 -06:00 committed by Bin Meng
parent 61608f395e
commit 3dada5a1a8
3 changed files with 14 additions and 0 deletions

View File

@ -363,6 +363,11 @@ static void setup_cpu_features(void)
: : "i" (em_rst), "i" (mp_ne_set) : "eax");
}
void cpu_reinit_fpu(void)
{
asm ("fninit\n");
}
static void setup_identity(void)
{
/* identify CPU via cpuid and store the decoded info into gd->arch */

View File

@ -43,6 +43,14 @@ int x86_cpu_reinit_f(void);
*/
int x86_cpu_init_tpl(void);
/**
* cpu_reinit_fpu() - Reinit the FPU if something is wrong with it
*
* The FSP-M code can leave registers in use in the FPU. This functions reinits
* it so that the FPU can be used safely
*/
void cpu_reinit_fpu(void);
int cpu_init_f(void);
void setup_gdt(struct global_data *id, u64 *gdt_addr);
/*

View File

@ -85,6 +85,7 @@ int fsp_memory_init(bool s3wake, bool use_spi_flash)
func = (fsp_memory_init_func)(hdr->img_base + hdr->fsp_mem_init);
ret = func(&upd, &hob);
bootstage_accum(BOOTSTAGE_ID_ACCUM_FSP_M);
cpu_reinit_fpu();
if (ret)
return log_msg_ret("SDRAM init fail\n", ret);