2020-04-05 15:47:17 +02:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2017-08-14 12:45:33 +02:00
|
|
|
|
2019-03-03 07:01:05 +01:00
|
|
|
#include <device/mmio.h>
|
2019-09-27 23:00:30 +02:00
|
|
|
#include <intelblocks/cfg.h>
|
2017-09-29 02:06:01 +02:00
|
|
|
#include <intelblocks/lpc_lib.h>
|
2019-09-17 18:48:00 +02:00
|
|
|
#include <intelblocks/pmclib.h>
|
2018-05-28 12:42:03 +02:00
|
|
|
#include <intelpch/lockdown.h>
|
2017-08-25 08:38:59 +02:00
|
|
|
#include <soc/pm.h>
|
2017-08-14 12:45:33 +02:00
|
|
|
|
2018-05-28 12:42:03 +02:00
|
|
|
static void lpc_lockdown_config(int chipset_lockdown)
|
2017-08-14 12:45:33 +02:00
|
|
|
{
|
2020-02-16 16:22:52 +01:00
|
|
|
/* Set BIOS Interface Lock, BIOS Lock */
|
2018-05-28 12:42:03 +02:00
|
|
|
if (chipset_lockdown == CHIPSET_LOCKDOWN_COREBOOT) {
|
2017-09-29 02:06:01 +02:00
|
|
|
lpc_set_bios_interface_lock_down();
|
|
|
|
lpc_set_lock_enable();
|
|
|
|
}
|
2017-08-14 12:45:33 +02:00
|
|
|
}
|
|
|
|
|
2017-08-25 08:38:59 +02:00
|
|
|
static void pmc_lockdown_config(void)
|
|
|
|
{
|
|
|
|
uint8_t *pmcbase;
|
|
|
|
u32 pmsyncreg;
|
|
|
|
|
|
|
|
/* PMSYNC */
|
|
|
|
pmcbase = pmc_mmio_regs();
|
|
|
|
pmsyncreg = read32(pmcbase + PMSYNC_TPR_CFG);
|
|
|
|
pmsyncreg |= PMSYNC_LOCK;
|
|
|
|
write32(pmcbase + PMSYNC_TPR_CFG, pmsyncreg);
|
2019-09-17 18:48:00 +02:00
|
|
|
|
|
|
|
/* Make sure payload/OS can't trigger global reset */
|
|
|
|
pmc_global_reset_disable_and_lock();
|
2017-08-25 08:38:59 +02:00
|
|
|
}
|
|
|
|
|
2018-05-28 12:42:03 +02:00
|
|
|
void soc_lockdown_config(int chipset_lockdown)
|
2017-08-16 15:08:54 +02:00
|
|
|
{
|
2017-08-14 12:45:33 +02:00
|
|
|
/* LPC lock down configuration */
|
2018-05-28 12:42:03 +02:00
|
|
|
lpc_lockdown_config(chipset_lockdown);
|
2017-08-16 15:08:54 +02:00
|
|
|
|
2017-08-25 08:38:59 +02:00
|
|
|
/* PMC lock down configuration */
|
|
|
|
pmc_lockdown_config();
|
2017-08-14 12:45:33 +02:00
|
|
|
}
|