Marc Jones | 352ca5b | 2021-03-18 17:01:06 -0600 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | |
| 3 | #include <bootstate.h> |
| 4 | #include <console/console.h> |
| 5 | #include <console/debug.h> |
| 6 | #include <cpu/x86/smm.h> |
Marc Jones | d77b97d | 2021-04-06 15:28:40 -0600 | [diff] [blame^] | 7 | #include <device/pci.h> |
| 8 | #include <intelpch/lockdown.h> |
| 9 | #include <soc/pci_devs.h> |
| 10 | #include <soc/util.h> |
| 11 | |
| 12 | #include "chip.h" |
| 13 | |
| 14 | static void lock_pam0123(void) |
| 15 | { |
| 16 | const struct device *dev; |
| 17 | |
| 18 | if (get_lockdown_config() != CHIPSET_LOCKDOWN_COREBOOT) |
| 19 | return; |
| 20 | |
| 21 | dev = pcidev_path_on_bus(get_stack_busno(1), PCI_DEVFN(SAD_ALL_DEV, SAD_ALL_FUNC)); |
| 22 | pci_or_config32(dev, SAD_ALL_PAM0123_CSR, PAM_LOCK); |
| 23 | } |
Marc Jones | 352ca5b | 2021-03-18 17:01:06 -0600 | [diff] [blame] | 24 | |
| 25 | static void soc_finalize(void *unused) |
| 26 | { |
| 27 | printk(BIOS_DEBUG, "Finalizing chipset.\n"); |
| 28 | |
| 29 | apm_control(APM_CNT_FINALIZE); |
Marc Jones | d77b97d | 2021-04-06 15:28:40 -0600 | [diff] [blame^] | 30 | lock_pam0123(); |
Marc Jones | 352ca5b | 2021-03-18 17:01:06 -0600 | [diff] [blame] | 31 | |
| 32 | post_code(POST_OS_BOOT); |
| 33 | } |
| 34 | |
| 35 | BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_ENTRY, soc_finalize, NULL); |