-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
soc/intel/lockdown: Allow locking down SPI and LPC in SMM
Heads payload uses APM_CNT_FINALIZE SMI to set and lock down the SPI controller with PR0 flash protection. Add new option to skip LPC and FAST SPI lock down in coreboot and move it to APM_CNT_FINALIZE SMI handler. Signed-off-by: Michał Żygowski <[email protected]>
- Loading branch information
Showing
17 changed files
with
123 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
config SOC_INTEL_COMMON_PCH_LOCKDOWN | ||
bool | ||
default n | ||
select HAVE_INTEL_CHIPSET_LOCKDOWN | ||
help | ||
This option allows to have chipset lockdown for DMI, FAST_SPI and | ||
soc_lockdown_config() to implement any additional lockdown as PMC, | ||
LPC for supported PCH. | ||
|
||
config SOC_INTEL_COMMON_SPI_LOCKDOWN_SMM | ||
bool "Lock down SPI controller in SMM" | ||
default n | ||
depends on HAVE_SMI_HANDLER | ||
select SPI_FLASH_SMM | ||
help | ||
This option allows to have chipset lockdown for FAST_SPI and LPC for | ||
supported PCH. If selected, coreboot will skip locking down the SPI | ||
and LPC controller. The payload or OS is responsible for locking it | ||
using APM_CNT_FINALIZE SMI. Used by heads to set and lock PR0 flash | ||
protection. | ||
|
||
If unsure, say N. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
## SPDX-License-Identifier: GPL-2.0-only | ||
ramstage-$(CONFIG_SOC_INTEL_COMMON_PCH_LOCKDOWN) += lockdown.c | ||
ramstage-$(CONFIG_SOC_INTEL_COMMON_PCH_LOCKDOWN) += lockdown_lpc.c | ||
ramstage-$(CONFIG_SOC_INTEL_COMMON_PCH_LOCKDOWN) += lockdown_spi.c | ||
|
||
smm-$(CONFIG_SOC_INTEL_COMMON_SPI_LOCKDOWN_SMM) += lockdown_lpc.c | ||
smm-$(CONFIG_SOC_INTEL_COMMON_SPI_LOCKDOWN_SMM) += lockdown_spi.c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only */ | ||
|
||
#include <intelblocks/cfg.h> | ||
#include <intelblocks/lpc_lib.h> | ||
#include <intelpch/lockdown.h> | ||
|
||
void lpc_lockdown_config(int chipset_lockdown) | ||
{ | ||
/* Set BIOS Interface Lock, BIOS Lock */ | ||
if (chipset_lockdown == CHIPSET_LOCKDOWN_COREBOOT) { | ||
/* BIOS Interface Lock */ | ||
lpc_set_bios_interface_lock_down(); | ||
|
||
/* Only allow writes in SMM */ | ||
if (CONFIG(BOOTMEDIA_SMM_BWP)) { | ||
lpc_set_eiss(); | ||
lpc_enable_wp(); | ||
} | ||
|
||
/* BIOS Lock */ | ||
lpc_set_lock_enable(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* SPDX-License-Identifier: GPL-2.0-only */ | ||
|
||
#include <intelblocks/cfg.h> | ||
#include <intelblocks/fast_spi.h> | ||
#include <intelpch/lockdown.h> | ||
|
||
void fast_spi_lockdown_bios(int chipset_lockdown) | ||
{ | ||
if (!CONFIG(SOC_INTEL_COMMON_BLOCK_FAST_SPI)) | ||
return; | ||
|
||
/* Discrete Lock Flash PR registers */ | ||
fast_spi_pr_dlock(); | ||
|
||
/* Lock FAST_SPIBAR */ | ||
fast_spi_lock_bar(); | ||
|
||
/* Set BIOS Interface Lock, BIOS Lock */ | ||
if (chipset_lockdown == CHIPSET_LOCKDOWN_COREBOOT) { | ||
/* BIOS Interface Lock */ | ||
fast_spi_set_bios_interface_lock_down(); | ||
|
||
/* Only allow writes in SMM */ | ||
if (CONFIG(BOOTMEDIA_SMM_BWP)) { | ||
fast_spi_set_eiss(); | ||
fast_spi_enable_wp(); | ||
} | ||
|
||
/* BIOS Lock */ | ||
fast_spi_set_lock_enable(); | ||
|
||
/* EXT BIOS Lock */ | ||
fast_spi_set_ext_bios_lock_enable(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters