Debian Codegraph @

src/soc/intel/pantherlake/finalize.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <arch/io.h>
4 #include <bootstate.h>
5 #include <console/console.h>
6 #include <cpu/x86/smm.h>
7 #include <device/mmio.h>
8 #include <device/pci.h>
9 #include <intelblocks/cse.h>
10 #include <intelblocks/lpc_lib.h>
11 #include <intelblocks/pcr.h>
12 #include <intelblocks/pmclib.h>
13 #include <intelblocks/systemagent.h>
14 #include <intelblocks/tco.h>
15 #include <intelblocks/thermal.h>
16 #include <intelpch/lockdown.h>
17 #include <soc/p2sb.h>
18 #include <soc/pci_devs.h>
19 #include <soc/pcr_ids.h>
20 #include <soc/pm.h>
21 #include <soc/smbus.h>
22 #include <soc/soc_chip.h>
23 #include <soc/systemagent.h>
24 #include <spi-generic.h>
25 #include <timer.h>
26
27 static void pch_finalize(void)
28 {
29 /* TCO Lock down */
30 tco_lockdown();
31
32 pmc_clear_pmcon_sts();
33 }
34
35 static void tbt_finalize(void)
36 {
37 int i;
38 const struct device *dev;
39
40 /* Disable Thunderbolt PCIe root ports bus master */
41 for (i = 0; i < NUM_TBT_FUNCTIONS; i++) {
42 dev = pcidev_path_on_root(PCI_DEVFN_TBT(i));
43 if (dev)
44 pci_dev_disable_bus_master(dev);
45 }
46 }
47
48 static void sa_finalize(void)
49 {
50 if (get_lockdown_config() == CHIPSET_LOCKDOWN_COREBOOT)
51 sa_lock_pam();
52 }
53
54 static void heci_finalize(void)
55 {
56 heci_set_to_d0i3();
57 if (CONFIG(DISABLE_HECI1_AT_PRE_BOOT))
58 heci1_disable();
59 }
60
61 static void soc_finalize(void *unused)
62 {
63 printk(BIOS_DEBUG, "Finalizing chipset.\n");
64
65 pch_finalize();
66 apm_control(APM_CNT_FINALIZE);
67 tbt_finalize();
68 sa_finalize();
69 if (CONFIG(USE_FSP_NOTIFY_PHASE_READY_TO_BOOT) &&
70 CONFIG(USE_FSP_NOTIFY_PHASE_END_OF_FIRMWARE))
71 heci_finalize();
72
73 /* Indicate finalize step with post code */
74 post_code(POSTCODE_OS_BOOT);
75 }
76
77 BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, soc_finalize, NULL);
78 /*
79 * The purpose of this change is to accommodate more time to push out sending
80 * CSE EOP messages at post.
81 */
82 BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_BOOT, BS_ON_ENTRY, soc_finalize, NULL);