2020-04-05 15:47:17 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2015-05-13 03:19:47 +02:00
|
|
|
|
2019-03-03 07:01:05 +01:00
|
|
|
#include <device/mmio.h>
|
2019-03-01 12:43:02 +01:00
|
|
|
#include <device/pci_ops.h>
|
2015-05-13 03:19:47 +02:00
|
|
|
#include <bootstate.h>
|
|
|
|
#include <console/console.h>
|
|
|
|
#include <console/post_codes.h>
|
2019-09-22 21:56:17 +02:00
|
|
|
#include <cpu/x86/mp.h>
|
2015-05-13 03:19:47 +02:00
|
|
|
#include <cpu/x86/smm.h>
|
2017-03-08 13:29:40 +01:00
|
|
|
#include <device/pci.h>
|
2018-05-19 03:07:25 +02:00
|
|
|
#include <intelblocks/cpulib.h>
|
2017-09-29 02:06:01 +02:00
|
|
|
#include <intelblocks/lpc_lib.h>
|
2018-05-08 08:28:01 +02:00
|
|
|
#include <intelblocks/p2sb.h>
|
2017-03-08 13:29:40 +01:00
|
|
|
#include <intelblocks/pcr.h>
|
2020-09-28 15:13:47 +02:00
|
|
|
#include <intelblocks/pmclib.h>
|
2019-09-17 16:03:18 +02:00
|
|
|
#include <intelblocks/tco.h>
|
2019-08-01 07:20:35 +02:00
|
|
|
#include <intelblocks/thermal.h>
|
2015-05-13 03:19:47 +02:00
|
|
|
#include <spi-generic.h>
|
2016-01-18 12:58:20 +01:00
|
|
|
#include <soc/me.h>
|
2016-08-04 16:31:12 +02:00
|
|
|
#include <soc/p2sb.h>
|
2015-05-13 03:19:47 +02:00
|
|
|
#include <soc/pci_devs.h>
|
2017-03-08 13:29:40 +01:00
|
|
|
#include <soc/pcr_ids.h>
|
2015-05-13 03:23:27 +02:00
|
|
|
#include <soc/pm.h>
|
2016-08-02 14:19:56 +02:00
|
|
|
#include <soc/smbus.h>
|
2015-05-13 03:19:47 +02:00
|
|
|
#include <soc/systemagent.h>
|
2017-03-08 13:29:40 +01:00
|
|
|
|
2019-03-21 15:38:06 +01:00
|
|
|
#include "chip.h"
|
|
|
|
|
2017-03-08 13:29:40 +01:00
|
|
|
#define PSF_BASE_ADDRESS 0xA00
|
|
|
|
#define PCR_PSFX_T0_SHDW_PCIEN 0x1C
|
|
|
|
#define PCR_PSFX_T0_SHDW_PCIEN_FUNDIS (1 << 8)
|
2015-11-10 20:59:23 +01:00
|
|
|
|
2017-08-11 15:08:38 +02:00
|
|
|
static void pch_disable_heci(void)
|
|
|
|
{
|
2015-11-10 20:59:23 +01:00
|
|
|
/* unhide p2sb device */
|
2018-05-08 08:28:01 +02:00
|
|
|
p2sb_unhide();
|
2015-11-10 20:59:23 +01:00
|
|
|
|
|
|
|
/* disable heci */
|
2017-03-08 13:29:40 +01:00
|
|
|
pcr_or32(PID_PSF1, PSF_BASE_ADDRESS + PCR_PSFX_T0_SHDW_PCIEN,
|
|
|
|
PCR_PSFX_T0_SHDW_PCIEN_FUNDIS);
|
2015-11-10 20:59:23 +01:00
|
|
|
|
2019-09-26 14:00:14 +02:00
|
|
|
p2sb_disable_sideband_access();
|
2015-11-10 20:59:23 +01:00
|
|
|
}
|
2015-05-13 03:19:47 +02:00
|
|
|
|
2018-05-08 08:28:01 +02:00
|
|
|
static void pch_finalize_script(struct device *dev)
|
2015-05-13 03:23:27 +02:00
|
|
|
{
|
2015-11-10 20:59:23 +01:00
|
|
|
config_t *config;
|
2015-05-13 03:19:47 +02:00
|
|
|
|
2019-09-17 16:03:18 +02:00
|
|
|
tco_lockdown();
|
|
|
|
|
2016-01-18 12:58:20 +01:00
|
|
|
/* Display me status before we hide it */
|
|
|
|
intel_me_status();
|
|
|
|
|
2019-07-13 21:16:25 +02:00
|
|
|
config = config_of(dev);
|
2015-12-18 19:08:21 +01:00
|
|
|
|
2017-11-29 11:47:13 +01:00
|
|
|
/*
|
|
|
|
* Set low maximum temp value used for dynamic thermal sensor
|
|
|
|
* shutdown consideration.
|
|
|
|
*
|
|
|
|
* If Dynamic Thermal Shutdown is enabled then PMC logic shuts down the
|
|
|
|
* thermal sensor when CPU is in a C-state and DTS Temp <= LTT.
|
|
|
|
*/
|
|
|
|
pch_thermal_configuration();
|
|
|
|
|
2015-12-18 19:08:21 +01:00
|
|
|
/* we should disable Heci1 based on the devicetree policy */
|
2015-11-10 20:59:23 +01:00
|
|
|
if (config->HeciEnabled == 0)
|
|
|
|
pch_disable_heci();
|
2019-09-26 14:00:14 +02:00
|
|
|
|
|
|
|
/* Hide p2sb device as the OS must not change BAR0. */
|
|
|
|
p2sb_hide();
|
2015-05-13 03:23:27 +02:00
|
|
|
}
|
2015-05-13 03:19:47 +02:00
|
|
|
|
2018-05-08 08:28:01 +02:00
|
|
|
static void soc_lockdown(struct device *dev)
|
2015-11-19 11:31:54 +01:00
|
|
|
{
|
2017-08-17 08:22:39 +02:00
|
|
|
struct soc_intel_skylake_config *config;
|
2015-11-19 11:31:54 +01:00
|
|
|
u8 reg8;
|
2017-08-17 08:22:39 +02:00
|
|
|
|
2019-07-13 21:16:25 +02:00
|
|
|
config = config_of(dev);
|
2015-11-19 11:31:54 +01:00
|
|
|
|
|
|
|
/* Global SMI Lock */
|
|
|
|
if (config->LockDownConfigGlobalSmi == 0) {
|
|
|
|
reg8 = pci_read_config8(dev, GEN_PMCON_A);
|
|
|
|
reg8 |= SMI_LOCK;
|
|
|
|
pci_write_config8(dev, GEN_PMCON_A, reg8);
|
|
|
|
}
|
2019-09-22 21:56:17 +02:00
|
|
|
|
|
|
|
/* Lock chipset memory registers to protect SMM */
|
|
|
|
mp_run_on_all_cpus(cpu_lt_lock_memory, NULL);
|
2015-11-19 11:31:54 +01:00
|
|
|
}
|
|
|
|
|
2015-05-13 03:23:27 +02:00
|
|
|
static void soc_finalize(void *unused)
|
2015-05-13 03:19:47 +02:00
|
|
|
{
|
2018-05-08 08:28:01 +02:00
|
|
|
struct device *dev;
|
|
|
|
|
|
|
|
dev = PCH_DEV_PMC;
|
|
|
|
|
|
|
|
/* Check if PMC is enabled, else return */
|
2019-07-13 21:16:25 +02:00
|
|
|
if (dev == NULL)
|
2018-05-08 08:28:01 +02:00
|
|
|
return;
|
|
|
|
|
2015-05-13 03:19:47 +02:00
|
|
|
printk(BIOS_DEBUG, "Finalizing chipset.\n");
|
2015-11-19 11:31:54 +01:00
|
|
|
|
2018-05-08 08:28:01 +02:00
|
|
|
pch_finalize_script(dev);
|
2015-05-13 03:19:47 +02:00
|
|
|
|
2018-05-08 08:28:01 +02:00
|
|
|
soc_lockdown(dev);
|
2020-06-01 14:11:14 +02:00
|
|
|
apm_control(APM_CNT_FINALIZE);
|
2016-02-09 18:40:39 +01:00
|
|
|
|
2015-05-13 03:19:47 +02:00
|
|
|
/* Indicate finalize step with post code */
|
|
|
|
post_code(POST_OS_BOOT);
|
|
|
|
}
|
|
|
|
|
2015-05-13 03:23:27 +02:00
|
|
|
BOOT_STATE_INIT_ENTRY(BS_OS_RESUME, BS_ON_ENTRY, soc_finalize, NULL);
|
|
|
|
BOOT_STATE_INIT_ENTRY(BS_PAYLOAD_LOAD, BS_ON_EXIT, soc_finalize, NULL);
|