Angel Pons | 16f6aa8 | 2020-04-05 15:47:21 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Subrata Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 2 | |
| 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 Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 9 | #include <bootstate.h> |
Ricardo Quesada | 470ca571 | 2021-07-16 16:39:28 -0700 | [diff] [blame] | 10 | #include <commonlib/console/post_codes.h> |
Subrata Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 11 | #include <console/console.h> |
Subrata Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 12 | #include <cpu/x86/smm.h> |
Ricardo Quesada | 470ca571 | 2021-07-16 16:39:28 -0700 | [diff] [blame] | 13 | #include <device/mmio.h> |
Subrata Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 14 | #include <device/pci.h> |
Subrata Banik | 7ef471c | 2022-01-28 23:40:00 +0530 | [diff] [blame] | 15 | #include <intelblocks/cse.h> |
Subrata Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 16 | #include <intelblocks/lpc_lib.h> |
| 17 | #include <intelblocks/pcr.h> |
Subrata Banik | 0359d9d | 2020-09-28 18:43:47 +0530 | [diff] [blame] | 18 | #include <intelblocks/pmclib.h> |
Tim Wawrzynczak | 5896608 | 2021-08-25 09:32:19 -0600 | [diff] [blame] | 19 | #include <intelblocks/systemagent.h> |
Subrata Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 20 | #include <intelblocks/tco.h> |
Subrata Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 21 | #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 Quesada | 470ca571 | 2021-07-16 16:39:28 -0700 | [diff] [blame] | 28 | #include <spi-generic.h> |
Subrata Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 29 | |
Subrata Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 30 | static void pch_finalize(void) |
| 31 | { |
Subrata Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 32 | /* TCO Lock down */ |
| 33 | tco_lockdown(); |
| 34 | |
Subrata Banik | 2fff391 | 2020-01-16 10:13:28 +0530 | [diff] [blame] | 35 | /* TODO: Add Thermal Configuration */ |
Subrata Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 36 | |
Subrata Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 37 | pmc_clear_pmcon_sts(); |
| 38 | } |
| 39 | |
John Zhao | 5d16a25 | 2020-05-01 22:04:00 -0700 | [diff] [blame] | 40 | static 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 Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 53 | static void soc_finalize(void *unused) |
| 54 | { |
| 55 | printk(BIOS_DEBUG, "Finalizing chipset.\n"); |
| 56 | |
| 57 | pch_finalize(); |
Kyösti Mälkki | b658548 | 2020-06-01 15:11:14 +0300 | [diff] [blame] | 58 | apm_control(APM_CNT_FINALIZE); |
John Zhao | 5d16a25 | 2020-05-01 22:04:00 -0700 | [diff] [blame] | 59 | tbt_finalize(); |
Subrata Banik | 7ef471c | 2022-01-28 23:40:00 +0530 | [diff] [blame] | 60 | if (CONFIG(DISABLE_HECI1_AT_PRE_BOOT)) |
| 61 | heci1_disable(); |
Subrata Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 62 | |
| 63 | /* Indicate finalize step with post code */ |
lilacious | 40cb3fe | 2023-06-21 23:24:14 +0200 | [diff] [blame^] | 64 | post_code(POSTCODE_OS_BOOT); |
Subrata Banik | 91e89c5 | 2019-11-01 18:30:01 +0530 | [diff] [blame] | 65 | } |
| 66 | |
| 67 | BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, soc_finalize, NULL); |
| 68 | BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_EXIT, soc_finalize, NULL); |