]> Git Repo - u-boot.git/blame - arch/x86/lib/fsp/fsp_common.c
common: Drop asm/global_data.h from common header
[u-boot.git] / arch / x86 / lib / fsp / fsp_common.c
CommitLineData
b2d544a1
SG
1// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright (C) 2014, Bin Meng <[email protected]>
4 */
5
6#include <common.h>
30c7c434 7#include <cpu_func.h>
b2d544a1
SG
8#include <dm.h>
9#include <errno.h>
691d719d 10#include <init.h>
f7ae49fc 11#include <log.h>
b2d544a1 12#include <rtc.h>
3cabcf96 13#include <acpi/acpi_s3.h>
b2d544a1
SG
14#include <asm/cmos_layout.h>
15#include <asm/early_cmos.h>
401d1c4f 16#include <asm/global_data.h>
b2d544a1
SG
17#include <asm/io.h>
18#include <asm/mrccache.h>
19#include <asm/post.h>
20#include <asm/processor.h>
21#include <asm/fsp/fsp_support.h>
22
23DECLARE_GLOBAL_DATA_PTR;
24
25int checkcpu(void)
26{
27 return 0;
28}
29
30int print_cpuinfo(void)
31{
32 post_code(POST_CPU_INFO);
33 return default_print_cpuinfo();
34}
35
36int fsp_init_phase_pci(void)
37{
38 u32 status;
39
40 /* call into FspNotify */
41 debug("Calling into FSP (notify phase INIT_PHASE_PCI): ");
42 status = fsp_notify(NULL, INIT_PHASE_PCI);
43 if (status)
44 debug("fail, error code %x\n", status);
45 else
46 debug("OK\n");
47
48 return status ? -EPERM : 0;
49}
50
4021ee63 51void board_final_init(void)
b2d544a1
SG
52{
53 u32 status;
54
55 /* call into FspNotify */
56 debug("Calling into FSP (notify phase INIT_PHASE_BOOT): ");
57 status = fsp_notify(NULL, INIT_PHASE_BOOT);
58 if (status)
59 debug("fail, error code %x\n", status);
60 else
61 debug("OK\n");
62}
63
7c73cea4
SG
64void board_final_cleanup(void)
65{
66 u32 status;
67
68 /* TODO([email protected]): This causes Linux to crash */
69 return;
70
71 /* call into FspNotify */
72 debug("Calling into FSP (notify phase INIT_PHASE_END_FIRMWARE): ");
73 status = fsp_notify(NULL, INIT_PHASE_END_FIRMWARE);
74 if (status)
75 debug("fail, error code %x\n", status);
76 else
77 debug("OK\n");
78}
79
b2d544a1
SG
80int fsp_save_s3_stack(void)
81{
82 struct udevice *dev;
83 int ret;
84
85 if (gd->arch.prev_sleep_state == ACPI_S3)
86 return 0;
87
88 ret = uclass_get_device(UCLASS_RTC, 0, &dev);
89 if (ret) {
90 debug("Cannot find RTC: err=%d\n", ret);
91 return -ENODEV;
92 }
93
94 /* Save the stack address to CMOS */
95 ret = rtc_write32(dev, CMOS_FSP_STACK_ADDR, gd->start_addr_sp);
96 if (ret) {
97 debug("Save stack address to CMOS: err=%d\n", ret);
98 return -EIO;
99 }
100
101 return 0;
102}
This page took 0.059396 seconds and 4 git commands to generate.