1 // SPDX-License-Identifier: Intel
3 * Copyright (C) 2015-2016 Intel Corp.
4 * (Written by Andrey Petrov <andrey.petrov@intel.com> for Intel Corp.)
6 * Mostly taken from coreboot fsp2_0/silicon_init.c
9 #define LOG_CATEGORY UCLASS_NORTHBRIDGE
14 #include <asm/arch/fsp/fsp_configs.h>
15 #include <asm/arch/fsp/fsp_s_upd.h>
16 #include <asm/fsp/fsp_infoheader.h>
17 #include <asm/fsp2/fsp_internal.h>
19 int fsp_silicon_init(bool s3wake, bool use_spi_flash)
21 struct fsps_upd upd, *fsp_upd;
22 fsp_silicon_init_func func;
23 struct fsp_header *hdr;
24 struct binman_entry entry;
29 ret = fsp_locate_fsp(FSP_S, &entry, use_spi_flash, &dev, &hdr,
32 return log_msg_ret("locate FSP", ret);
33 gd->arch.fsp_s_hdr = hdr;
35 /* Copy over the default config */
36 fsp_upd = (struct fsps_upd *)(hdr->img_base + hdr->cfg_region_off);
37 if (fsp_upd->header.signature != FSPS_UPD_SIGNATURE)
38 return log_msg_ret("Bad UPD signature", -EPERM);
39 memcpy(&upd, fsp_upd, sizeof(upd));
41 ret = fsps_update_config(dev, rom_offset, &upd);
43 return log_msg_ret("Could not setup config", ret);
44 log_debug("Silicon init...");
45 bootstage_start(BOOTSTATE_ID_ACCUM_FSP_S, "fsp-s");
46 func = (fsp_silicon_init_func)(hdr->img_base + hdr->fsp_silicon_init);
48 bootstage_accum(BOOTSTATE_ID_ACCUM_FSP_S);
50 return log_msg_ret("Silicon init fail\n", ret);