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