2015-01-28 05:13:39 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <asm/io.h>
|
2015-10-12 04:37:42 +00:00
|
|
|
#include <asm/mrccache.h>
|
2015-01-28 05:13:39 +00:00
|
|
|
#include <asm/post.h>
|
|
|
|
#include <asm/processor.h>
|
|
|
|
#include <asm/fsp/fsp_support.h>
|
|
|
|
|
2015-07-31 15:31:31 +00:00
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
2015-01-28 05:13:39 +00:00
|
|
|
int print_cpuinfo(void)
|
|
|
|
{
|
|
|
|
post_code(POST_CPU_INFO);
|
|
|
|
return default_print_cpuinfo();
|
|
|
|
}
|
|
|
|
|
2015-08-10 13:05:07 +00:00
|
|
|
int fsp_init_phase_pci(void)
|
2015-01-28 05:13:39 +00:00
|
|
|
{
|
|
|
|
u32 status;
|
|
|
|
|
|
|
|
/* call into FspNotify */
|
|
|
|
debug("Calling into FSP (notify phase INIT_PHASE_PCI): ");
|
|
|
|
status = fsp_notify(NULL, INIT_PHASE_PCI);
|
2015-08-10 13:05:07 +00:00
|
|
|
if (status)
|
2015-01-28 05:13:39 +00:00
|
|
|
debug("fail, error code %x\n", status);
|
|
|
|
else
|
|
|
|
debug("OK\n");
|
|
|
|
|
2015-08-10 13:05:07 +00:00
|
|
|
return status ? -EPERM : 0;
|
|
|
|
}
|
|
|
|
|
2015-01-28 05:13:39 +00:00
|
|
|
void board_final_cleanup(void)
|
|
|
|
{
|
|
|
|
u32 status;
|
|
|
|
|
|
|
|
/* call into FspNotify */
|
|
|
|
debug("Calling into FSP (notify phase INIT_PHASE_BOOT): ");
|
|
|
|
status = fsp_notify(NULL, INIT_PHASE_BOOT);
|
2015-08-13 01:33:07 +00:00
|
|
|
if (status)
|
2015-01-28 05:13:39 +00:00
|
|
|
debug("fail, error code %x\n", status);
|
|
|
|
else
|
|
|
|
debug("OK\n");
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2015-06-07 03:33:14 +00:00
|
|
|
|
2015-10-12 04:37:42 +00:00
|
|
|
static __maybe_unused void *fsp_prepare_mrc_cache(void)
|
|
|
|
{
|
|
|
|
struct mrc_data_container *cache;
|
|
|
|
struct mrc_region entry;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = mrccache_get_region(NULL, &entry);
|
|
|
|
if (ret)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
cache = mrccache_find_current(&entry);
|
|
|
|
if (!cache)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
debug("%s: mrc cache at %p, size %x checksum %04x\n", __func__,
|
|
|
|
cache->data, cache->data_size, cache->checksum);
|
|
|
|
|
|
|
|
return cache->data;
|
|
|
|
}
|
|
|
|
|
2017-03-28 16:27:18 +00:00
|
|
|
int arch_fsp_init(void)
|
2015-06-07 03:33:14 +00:00
|
|
|
{
|
2015-10-12 04:37:42 +00:00
|
|
|
void *nvs;
|
|
|
|
|
2015-08-20 13:40:19 +00:00
|
|
|
if (!gd->arch.hob_list) {
|
2015-10-12 04:37:42 +00:00
|
|
|
#ifdef CONFIG_ENABLE_MRC_CACHE
|
|
|
|
nvs = fsp_prepare_mrc_cache();
|
|
|
|
#else
|
|
|
|
nvs = NULL;
|
|
|
|
#endif
|
2015-08-20 13:40:19 +00:00
|
|
|
/*
|
|
|
|
* The first time we enter here, call fsp_init().
|
|
|
|
* Note the execution does not return to this function,
|
|
|
|
* instead it jumps to fsp_continue().
|
|
|
|
*/
|
2015-10-12 04:37:42 +00:00
|
|
|
fsp_init(CONFIG_FSP_TEMP_RAM_ADDR, BOOT_FULL_CONFIG, nvs);
|
2015-08-20 13:40:19 +00:00
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* The second time we enter here, adjust the size of malloc()
|
|
|
|
* pool before relocation. Given gd->malloc_base was adjusted
|
2015-11-25 16:56:32 +00:00
|
|
|
* after the call to board_init_f_init_reserve() in arch/x86/
|
|
|
|
* cpu/start.S, we should fix up gd->malloc_limit here.
|
2015-08-20 13:40:19 +00:00
|
|
|
*/
|
|
|
|
gd->malloc_limit += CONFIG_FSP_SYS_MALLOC_F_LEN;
|
|
|
|
}
|
2015-06-07 03:33:14 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|