Tan, Lean Sheng | 05dfe31 | 2020-08-25 20:40:17 -0700 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
Tan, Lean Sheng | 05dfe31 | 2020-08-25 20:40:17 -0700 | [diff] [blame] | 3 | #include <bootstate.h> |
| 4 | #include <console/console.h> |
Ricardo Quesada | 470ca571 | 2021-07-16 16:39:28 -0700 | [diff] [blame] | 5 | #include <commonlib/console/post_codes.h> |
Tan, Lean Sheng | 05dfe31 | 2020-08-25 20:40:17 -0700 | [diff] [blame] | 6 | #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 Banik | 0359d9d | 2020-09-28 18:43:47 +0530 | [diff] [blame] | 11 | #include <intelblocks/pmclib.h> |
Tim Wawrzynczak | 26a77eb | 2021-08-26 09:20:44 -0600 | [diff] [blame] | 12 | #include <intelblocks/systemagent.h> |
Tan, Lean Sheng | 05dfe31 | 2020-08-25 20:40:17 -0700 | [diff] [blame] | 13 | #include <intelblocks/tco.h> |
Tim Wawrzynczak | 26a77eb | 2021-08-26 09:20:44 -0600 | [diff] [blame] | 14 | #include <intelpch/lockdown.h> |
Tan, Lean Sheng | 05dfe31 | 2020-08-25 20:40:17 -0700 | [diff] [blame] | 15 | #include <soc/p2sb.h> |
| 16 | #include <soc/pci_devs.h> |
| 17 | #include <soc/pcr_ids.h> |
| 18 | #include <soc/pm.h> |
| 19 | #include <soc/smbus.h> |
| 20 | #include <soc/soc_chip.h> |
| 21 | #include <soc/systemagent.h> |
| 22 | #include <spi-generic.h> |
| 23 | |
| 24 | static void pch_finalize(void) |
| 25 | { |
Tan, Lean Sheng | 05dfe31 | 2020-08-25 20:40:17 -0700 | [diff] [blame] | 26 | /* TCO Lock down */ |
| 27 | tco_lockdown(); |
| 28 | |
| 29 | /* TODO: Add Thermal Configuration */ |
| 30 | |
Tan, Lean Sheng | 05dfe31 | 2020-08-25 20:40:17 -0700 | [diff] [blame] | 31 | pmc_clear_pmcon_sts(); |
| 32 | } |
| 33 | |
Tim Wawrzynczak | 26a77eb | 2021-08-26 09:20:44 -0600 | [diff] [blame] | 34 | static void sa_finalize(void) |
| 35 | { |
| 36 | if (get_lockdown_config() == CHIPSET_LOCKDOWN_COREBOOT) |
| 37 | sa_lock_pam(); |
| 38 | } |
| 39 | |
Tan, Lean Sheng | 05dfe31 | 2020-08-25 20:40:17 -0700 | [diff] [blame] | 40 | static void soc_finalize(void *unused) |
| 41 | { |
| 42 | printk(BIOS_DEBUG, "Finalizing chipset.\n"); |
| 43 | |
| 44 | pch_finalize(); |
| 45 | apm_control(APM_CNT_FINALIZE); |
Tim Wawrzynczak | 26a77eb | 2021-08-26 09:20:44 -0600 | [diff] [blame] | 46 | sa_finalize(); |
Tan, Lean Sheng | 05dfe31 | 2020-08-25 20:40:17 -0700 | [diff] [blame] | 47 | |
| 48 | /* Indicate finalize step with post code */ |
| 49 | post_code(POST_OS_BOOT); |
| 50 | } |
| 51 | |
| 52 | BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, soc_finalize, NULL); |
| 53 | BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_EXIT, soc_finalize, NULL); |