blob: 3c4ea6c267f8900ef3f30034efedc0bc99d363d9 [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Bin Meng5dbe3042016-02-17 00:16:21 -08002/*
3 * Copyright (C) 2016, Bin Meng <bmeng.cn@gmail.com>
Bin Meng5dbe3042016-02-17 00:16:21 -08004 */
5
6#include <common.h>
7#include <fdtdec.h>
Simon Glass0f2af882020-05-10 11:40:05 -06008#include <log.h>
Simon Glass6c34fc12019-09-25 08:00:11 -06009#include <asm/fsp1/fsp_support.h>
Simon Glass3ba929a2020-10-30 21:38:53 -060010#include <asm/global_data.h>
Bin Meng5dbe3042016-02-17 00:16:21 -080011
12DECLARE_GLOBAL_DATA_PTR;
13
Simon Glass13724142019-09-25 08:11:25 -060014void fsp_update_configs(struct fsp_config_data *config,
Bin Meng5dbe3042016-02-17 00:16:21 -080015 struct fspinit_rtbuf *rt_buf)
16{
17 struct platform_config *plat_config = &config->plat_config;
18 struct memory_config *mem_config = &config->mem_config;
19 const void *blob = gd->fdt_blob;
20 int node;
21
22 node = fdtdec_next_compatible(blob, 0, COMPAT_INTEL_IVYBRIDGE_FSP);
23 if (node < 0) {
24 debug("%s: Cannot find FSP node\n", __func__);
25 return;
26 }
27
28 plat_config->enable_ht =
29 fdtdec_get_bool(blob, node, "fsp,enable-ht");
30 plat_config->enable_turbo =
31 fdtdec_get_bool(blob, node, "fsp,enable-turbo");
32 plat_config->enable_memory_down =
33 fdtdec_get_bool(blob, node, "fsp,enable-memory-down");
34 plat_config->enable_fast_boot =
35 fdtdec_get_bool(blob, node, "fsp,enable-fast-boot");
36
37 /* Initialize runtime buffer for fsp_init() */
38 rt_buf->stack_top = config->common.stack_top - 32;
39 rt_buf->boot_mode = config->common.boot_mode;
40 rt_buf->plat_config = plat_config;
41
42 if (plat_config->enable_memory_down)
43 rt_buf->mem_config = mem_config;
44 else
45 rt_buf->mem_config = NULL;
46}