blob: 658f32d583257a237a2390258896dd6e8ee941a4 [file] [log] [blame]
Simon Glass509805b2015-01-27 22:13:39 -07001/*
2 * Copyright (C) 2014, Bin Meng <bmeng.cn@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <common.h>
8#include <errno.h>
9#include <asm/io.h>
10#include <asm/post.h>
11#include <asm/processor.h>
12#include <asm/fsp/fsp_support.h>
13
Simon Glassdaa93d92015-07-31 09:31:31 -060014DECLARE_GLOBAL_DATA_PTR;
15
Simon Glass509805b2015-01-27 22:13:39 -070016int print_cpuinfo(void)
17{
18 post_code(POST_CPU_INFO);
19 return default_print_cpuinfo();
20}
21
Simon Glassfa912732015-08-10 07:05:07 -060022int fsp_init_phase_pci(void)
Simon Glass509805b2015-01-27 22:13:39 -070023{
24 u32 status;
25
26 /* call into FspNotify */
27 debug("Calling into FSP (notify phase INIT_PHASE_PCI): ");
28 status = fsp_notify(NULL, INIT_PHASE_PCI);
Simon Glassfa912732015-08-10 07:05:07 -060029 if (status)
Simon Glass509805b2015-01-27 22:13:39 -070030 debug("fail, error code %x\n", status);
31 else
32 debug("OK\n");
33
Simon Glassfa912732015-08-10 07:05:07 -060034 return status ? -EPERM : 0;
35}
36
37int board_pci_post_scan(struct pci_controller *hose)
38{
39 return fsp_init_phase_pci();
Simon Glass509805b2015-01-27 22:13:39 -070040}
41
42void board_final_cleanup(void)
43{
44 u32 status;
45
46 /* call into FspNotify */
47 debug("Calling into FSP (notify phase INIT_PHASE_BOOT): ");
48 status = fsp_notify(NULL, INIT_PHASE_BOOT);
Simon Glass38252292015-08-12 19:33:07 -060049 if (status)
Simon Glass509805b2015-01-27 22:13:39 -070050 debug("fail, error code %x\n", status);
51 else
52 debug("OK\n");
53
54 return;
55}
Bin Mengd560c5c2015-06-07 11:33:14 +080056
57int x86_fsp_init(void)
58{
Bin Meng12440cd2015-08-20 06:40:19 -070059 if (!gd->arch.hob_list) {
60 /*
61 * The first time we enter here, call fsp_init().
62 * Note the execution does not return to this function,
63 * instead it jumps to fsp_continue().
64 */
Bin Mengd560c5c2015-06-07 11:33:14 +080065 fsp_init(CONFIG_FSP_TEMP_RAM_ADDR, BOOT_FULL_CONFIG, NULL);
Bin Meng12440cd2015-08-20 06:40:19 -070066 } else {
67 /*
68 * The second time we enter here, adjust the size of malloc()
69 * pool before relocation. Given gd->malloc_base was adjusted
70 * after the call to board_init_f_mem() in arch/x86/cpu/start.S,
71 * we should fix up gd->malloc_limit here.
72 */
73 gd->malloc_limit += CONFIG_FSP_SYS_MALLOC_F_LEN;
74 }
Bin Mengd560c5c2015-06-07 11:33:14 +080075
76 return 0;
77}