1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun * Copyright (C) 2016, Bin Meng <bmeng.cn@gmail.com>
3*4882a593Smuzhiyun *
4*4882a593Smuzhiyun * SPDX-License-Identifier: GPL-2.0+
5*4882a593Smuzhiyun */
6*4882a593Smuzhiyun
7*4882a593Smuzhiyun #include <common.h>
8*4882a593Smuzhiyun #include <fdtdec.h>
9*4882a593Smuzhiyun #include <asm/fsp/fsp_support.h>
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun DECLARE_GLOBAL_DATA_PTR;
12*4882a593Smuzhiyun
update_fsp_configs(struct fsp_config_data * config,struct fspinit_rtbuf * rt_buf)13*4882a593Smuzhiyun void update_fsp_configs(struct fsp_config_data *config,
14*4882a593Smuzhiyun struct fspinit_rtbuf *rt_buf)
15*4882a593Smuzhiyun {
16*4882a593Smuzhiyun struct platform_config *plat_config = &config->plat_config;
17*4882a593Smuzhiyun struct memory_config *mem_config = &config->mem_config;
18*4882a593Smuzhiyun const void *blob = gd->fdt_blob;
19*4882a593Smuzhiyun int node;
20*4882a593Smuzhiyun
21*4882a593Smuzhiyun node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_IVYBRIDGE_FSP);
22*4882a593Smuzhiyun if (node < 0) {
23*4882a593Smuzhiyun debug("%s: Cannot find FSP node\n", __func__);
24*4882a593Smuzhiyun return;
25*4882a593Smuzhiyun }
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun plat_config->enable_ht =
28*4882a593Smuzhiyun fdtdec_get_bool(blob, node, "fsp,enable-ht");
29*4882a593Smuzhiyun plat_config->enable_turbo =
30*4882a593Smuzhiyun fdtdec_get_bool(blob, node, "fsp,enable-turbo");
31*4882a593Smuzhiyun plat_config->enable_memory_down =
32*4882a593Smuzhiyun fdtdec_get_bool(blob, node, "fsp,enable-memory-down");
33*4882a593Smuzhiyun plat_config->enable_fast_boot =
34*4882a593Smuzhiyun fdtdec_get_bool(blob, node, "fsp,enable-fast-boot");
35*4882a593Smuzhiyun
36*4882a593Smuzhiyun /* Initialize runtime buffer for fsp_init() */
37*4882a593Smuzhiyun rt_buf->stack_top = config->common.stack_top - 32;
38*4882a593Smuzhiyun rt_buf->boot_mode = config->common.boot_mode;
39*4882a593Smuzhiyun rt_buf->plat_config = plat_config;
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun if (plat_config->enable_memory_down)
42*4882a593Smuzhiyun rt_buf->mem_config = mem_config;
43*4882a593Smuzhiyun else
44*4882a593Smuzhiyun rt_buf->mem_config = NULL;
45*4882a593Smuzhiyun }
46