2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2014-12-17 07:50:36 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#include <asm/post.h>
|
|
|
|
|
|
|
|
.globl car_init
|
|
|
|
car_init:
|
|
|
|
/*
|
|
|
|
* Note: ebp holds the BIST value (built-in self test) so far, but ebp
|
|
|
|
* will be destroyed through the FSP call, thus we have to test the
|
|
|
|
* BIST value here before we call into FSP.
|
|
|
|
*/
|
|
|
|
test %ebp, %ebp
|
|
|
|
jz car_init_start
|
|
|
|
post_code(POST_BIST_FAILURE)
|
|
|
|
jmp die
|
|
|
|
|
|
|
|
car_init_start:
|
|
|
|
post_code(POST_CAR_START)
|
2019-09-25 14:11:25 +00:00
|
|
|
lea fsp_find_header_romstack, %esp
|
|
|
|
jmp fsp_find_header
|
2014-12-17 07:50:36 +00:00
|
|
|
|
2019-09-25 14:11:25 +00:00
|
|
|
fsp_find_header_ret:
|
2014-12-17 07:50:36 +00:00
|
|
|
/* EAX points to FSP_INFO_HEADER */
|
|
|
|
mov %eax, %ebp
|
|
|
|
|
|
|
|
/* sanity test */
|
2014-12-17 07:50:42 +00:00
|
|
|
cmp $CONFIG_FSP_ADDR, %eax
|
2014-12-17 07:50:36 +00:00
|
|
|
jb die
|
|
|
|
|
|
|
|
/* calculate TempRamInitEntry address */
|
|
|
|
mov 0x30(%ebp), %eax
|
|
|
|
add 0x1c(%ebp), %eax
|
|
|
|
|
|
|
|
/* call FSP TempRamInitEntry to setup temporary stack */
|
|
|
|
lea temp_ram_init_romstack, %esp
|
|
|
|
jmp *%eax
|
|
|
|
|
|
|
|
temp_ram_init_ret:
|
|
|
|
addl $4, %esp
|
|
|
|
cmp $0, %eax
|
|
|
|
jnz car_init_fail
|
|
|
|
|
|
|
|
post_code(POST_CAR_CPU_CACHE)
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The FSP TempRamInit initializes the ecx and edx registers to
|
|
|
|
* point to a temporary but writable memory range (Cache-As-RAM).
|
|
|
|
* ecx: the start of this temporary memory range,
|
|
|
|
* edx: the end of this range.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* stack grows down from top of CAR */
|
|
|
|
movl %edx, %esp
|
2015-06-07 03:33:14 +00:00
|
|
|
subl $4, %esp
|
2014-12-17 07:50:36 +00:00
|
|
|
|
2015-06-07 03:33:14 +00:00
|
|
|
xor %esi, %esi
|
|
|
|
jmp car_init_done
|
2014-12-17 07:50:36 +00:00
|
|
|
|
|
|
|
.global fsp_init_done
|
|
|
|
fsp_init_done:
|
|
|
|
/*
|
2015-08-20 13:40:20 +00:00
|
|
|
* We come here from fsp_continue() with eax pointing to the HOB list.
|
2014-12-17 07:50:36 +00:00
|
|
|
* Save eax to esi temporarily.
|
|
|
|
*/
|
|
|
|
movl %eax, %esi
|
2015-06-07 03:33:14 +00:00
|
|
|
|
|
|
|
car_init_done:
|
2014-12-17 07:50:36 +00:00
|
|
|
/*
|
|
|
|
* Re-initialize the ebp (BIST) to zero, as we already reach here
|
|
|
|
* which means we passed BIST testing before.
|
|
|
|
*/
|
|
|
|
xorl %ebp, %ebp
|
|
|
|
jmp car_init_ret
|
|
|
|
|
|
|
|
car_init_fail:
|
|
|
|
post_code(POST_CAR_FAILURE)
|
|
|
|
|
|
|
|
die:
|
|
|
|
hlt
|
|
|
|
jmp die
|
|
|
|
hlt
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The function call before CAR initialization is tricky. It cannot
|
|
|
|
* be called using the 'call' instruction but only the 'jmp' with
|
|
|
|
* the help of a handcrafted stack in the ROM. The stack needs to
|
|
|
|
* contain the function return address as well as the parameters.
|
|
|
|
*/
|
|
|
|
.balign 4
|
2019-09-25 14:11:25 +00:00
|
|
|
fsp_find_header_romstack:
|
|
|
|
.long fsp_find_header_ret
|
2014-12-17 07:50:36 +00:00
|
|
|
|
|
|
|
.balign 4
|
|
|
|
temp_ram_init_romstack:
|
|
|
|
.long temp_ram_init_ret
|
|
|
|
.long temp_ram_init_params
|
|
|
|
temp_ram_init_params:
|
2014-12-17 07:50:37 +00:00
|
|
|
_dt_ucode_base_size:
|
2019-04-26 03:58:44 +00:00
|
|
|
/* These next two fields are filled in by binman */
|
2016-03-12 05:07:11 +00:00
|
|
|
.globl ucode_base
|
2018-06-22 04:16:16 +00:00
|
|
|
ucode_base: /* Declared in microcode.h */
|
2014-12-17 07:50:37 +00:00
|
|
|
.long 0 /* microcode base */
|
2018-06-22 04:16:16 +00:00
|
|
|
.globl ucode_size
|
|
|
|
ucode_size: /* Declared in microcode.h */
|
2014-12-17 07:50:37 +00:00
|
|
|
.long 0 /* microcode size */
|
2014-12-17 07:50:36 +00:00
|
|
|
.long CONFIG_SYS_MONITOR_BASE /* code region base */
|
|
|
|
.long CONFIG_SYS_MONITOR_LEN /* code region size */
|