blob: cd02745a9e6bc09f701069c94cdf062f6ba542a4 [file] [log] [blame]
Angel Pons16f6aa82020-04-05 15:47:21 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Subrata Banik91e89c52019-11-01 18:30:01 +05302
3/*
4 * This file is created based on Intel Tiger Lake Processor PCH Datasheet
5 * Document number: 575857
6 * Chapter number: 4, 29
7 */
8
Subrata Banik91e89c52019-11-01 18:30:01 +05309#include <bootstate.h>
Ricardo Quesada470ca5712021-07-16 16:39:28 -070010#include <commonlib/console/post_codes.h>
Subrata Banik91e89c52019-11-01 18:30:01 +053011#include <console/console.h>
Subrata Banik91e89c52019-11-01 18:30:01 +053012#include <cpu/x86/smm.h>
Ricardo Quesada470ca5712021-07-16 16:39:28 -070013#include <device/mmio.h>
Subrata Banik91e89c52019-11-01 18:30:01 +053014#include <device/pci.h>
Subrata Banik7ef471c2022-01-28 23:40:00 +053015#include <intelblocks/cse.h>
Subrata Banik91e89c52019-11-01 18:30:01 +053016#include <intelblocks/lpc_lib.h>
17#include <intelblocks/pcr.h>
Subrata Banik0359d9d2020-09-28 18:43:47 +053018#include <intelblocks/pmclib.h>
Tim Wawrzynczak58966082021-08-25 09:32:19 -060019#include <intelblocks/systemagent.h>
Subrata Banik91e89c52019-11-01 18:30:01 +053020#include <intelblocks/tco.h>
Subrata Banik91e89c52019-11-01 18:30:01 +053021#include <soc/p2sb.h>
22#include <soc/pci_devs.h>
23#include <soc/pcr_ids.h>
24#include <soc/pm.h>
25#include <soc/smbus.h>
26#include <soc/soc_chip.h>
27#include <soc/systemagent.h>
Ricardo Quesada470ca5712021-07-16 16:39:28 -070028#include <spi-generic.h>
Subrata Banik91e89c52019-11-01 18:30:01 +053029
Subrata Banik91e89c52019-11-01 18:30:01 +053030static void pch_finalize(void)
31{
Subrata Banik91e89c52019-11-01 18:30:01 +053032 /* TCO Lock down */
33 tco_lockdown();
34
Subrata Banik2fff3912020-01-16 10:13:28 +053035 /* TODO: Add Thermal Configuration */
Subrata Banik91e89c52019-11-01 18:30:01 +053036
Subrata Banik91e89c52019-11-01 18:30:01 +053037 pmc_clear_pmcon_sts();
38}
39
John Zhao5d16a252020-05-01 22:04:00 -070040static void tbt_finalize(void)
41{
42 int i;
43 const struct device *dev;
44
45 /* Disable Thunderbolt PCIe root ports bus master */
46 for (i = 0; i < NUM_TBT_FUNCTIONS; i++) {
47 dev = pcidev_path_on_root(SA_DEVFN_TBT(i));
48 if (dev)
49 pci_dev_disable_bus_master(dev);
50 }
51}
52
Subrata Banik91e89c52019-11-01 18:30:01 +053053static void soc_finalize(void *unused)
54{
55 printk(BIOS_DEBUG, "Finalizing chipset.\n");
56
57 pch_finalize();
Kyösti Mälkkib6585482020-06-01 15:11:14 +030058 apm_control(APM_CNT_FINALIZE);
John Zhao5d16a252020-05-01 22:04:00 -070059 tbt_finalize();
Subrata Banik7ef471c2022-01-28 23:40:00 +053060 if (CONFIG(DISABLE_HECI1_AT_PRE_BOOT))
61 heci1_disable();
Subrata Banik91e89c52019-11-01 18:30:01 +053062
63 /* Indicate finalize step with post code */
lilacious40cb3fe2023-06-21 23:24:14 +020064 post_code(POSTCODE_OS_BOOT);
Subrata Banik91e89c52019-11-01 18:30:01 +053065}
66
67BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, soc_finalize, NULL);
68BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_EXIT, soc_finalize, NULL);