blob: d415a1d2b838b7a55f2ebd751453d5d262e0920b [file] [log] [blame]
Tan, Lean Sheng05dfe312020-08-25 20:40:17 -07001/* SPDX-License-Identifier: GPL-2.0-only */
2
Tan, Lean Sheng05dfe312020-08-25 20:40:17 -07003#include <bootstate.h>
4#include <console/console.h>
Ricardo Quesada470ca5712021-07-16 16:39:28 -07005#include <commonlib/console/post_codes.h>
Tan, Lean Sheng05dfe312020-08-25 20:40:17 -07006#include <cpu/x86/smm.h>
7#include <device/mmio.h>
8#include <device/pci.h>
9#include <intelblocks/lpc_lib.h>
10#include <intelblocks/pcr.h>
Subrata Banik0359d9d2020-09-28 18:43:47 +053011#include <intelblocks/pmclib.h>
Tim Wawrzynczak26a77eb2021-08-26 09:20:44 -060012#include <intelblocks/systemagent.h>
Tan, Lean Sheng05dfe312020-08-25 20:40:17 -070013#include <intelblocks/tco.h>
14#include <intelblocks/thermal.h>
Tim Wawrzynczak26a77eb2021-08-26 09:20:44 -060015#include <intelpch/lockdown.h>
Tan, Lean Sheng05dfe312020-08-25 20:40:17 -070016#include <soc/p2sb.h>
17#include <soc/pci_devs.h>
18#include <soc/pcr_ids.h>
19#include <soc/pm.h>
20#include <soc/smbus.h>
21#include <soc/soc_chip.h>
22#include <soc/systemagent.h>
23#include <spi-generic.h>
24
25static void pch_finalize(void)
26{
Tan, Lean Sheng05dfe312020-08-25 20:40:17 -070027 /* TCO Lock down */
28 tco_lockdown();
29
30 /* TODO: Add Thermal Configuration */
31
Tan, Lean Sheng05dfe312020-08-25 20:40:17 -070032 pmc_clear_pmcon_sts();
33}
34
Tim Wawrzynczak26a77eb2021-08-26 09:20:44 -060035static void sa_finalize(void)
36{
37 if (get_lockdown_config() == CHIPSET_LOCKDOWN_COREBOOT)
38 sa_lock_pam();
39}
40
Tan, Lean Sheng05dfe312020-08-25 20:40:17 -070041static void soc_finalize(void *unused)
42{
43 printk(BIOS_DEBUG, "Finalizing chipset.\n");
44
45 pch_finalize();
46 apm_control(APM_CNT_FINALIZE);
Tim Wawrzynczak26a77eb2021-08-26 09:20:44 -060047 sa_finalize();
Tan, Lean Sheng05dfe312020-08-25 20:40:17 -070048
49 /* Indicate finalize step with post code */
50 post_code(POST_OS_BOOT);
51}
52
53BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, soc_finalize, NULL);
54BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_EXIT, soc_finalize, NULL);