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