Yu-Ping Wu has submitted this change. ( https://review.coreboot.org/c/coreboot/+/73176 )
Change subject: soc/mediatek: Add config to control DRAM scramble ......................................................................
soc/mediatek: Add config to control DRAM scramble
The DRAM scramble feature enhances DRAM data protection. When it's enabled, the written DRAM data will be scrambled and hence can prevent the data from being hacked.
This feature would make debugging more difficult (for example ramoops would be lost after reset). Therefore, add a new config to allow enabling or disabling the feature from coreboot, without having to maintain two versions of the DRAM calibration blob.
BUG=b:269049451 TEST=build pass and check scramble enable or disable successfully
Signed-off-by: Xi Chen xixi.chen@mediatek.corp-partner.google.com Change-Id: Ib4279bc1cc960fae9c9f5da39f4448a5627288d4 Reviewed-on: https://review.coreboot.org/c/coreboot/+/73176 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Yidi Lin yidilin@google.com Reviewed-by: Yu-Ping Wu yupingso@google.com --- M src/soc/mediatek/common/Kconfig M src/soc/mediatek/common/include/soc/dramc_param_common.h M src/soc/mediatek/common/memory.c 3 files changed, 37 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified Yu-Ping Wu: Looks good to me, approved Yidi Lin: Looks good to me, but someone else must approve
diff --git a/src/soc/mediatek/common/Kconfig b/src/soc/mediatek/common/Kconfig index 2fdeda9..1ca0b98 100644 --- a/src/soc/mediatek/common/Kconfig +++ b/src/soc/mediatek/common/Kconfig @@ -30,6 +30,13 @@ This option allows performing fast calibration through different open-source policy.
+config MEDIATEK_DRAM_SCRAMBLE + bool + default y + help + This option enables DRAM data scramble, which can prevent DRAM data from + being hacked. + config MEMORY_TEST bool default y diff --git a/src/soc/mediatek/common/include/soc/dramc_param_common.h b/src/soc/mediatek/common/include/soc/dramc_param_common.h index 09b89cb..429f3c6 100644 --- a/src/soc/mediatek/common/include/soc/dramc_param_common.h +++ b/src/soc/mediatek/common/include/soc/dramc_param_common.h @@ -31,6 +31,8 @@ DRAMC_CONFIG_EMCP = 0x0001, DRAMC_CONFIG_DVFS = 0x0002, DRAMC_CONFIG_FAST_K = 0x0004, + /* Security configs */ + DRAMC_CONFIG_SCRAMBLE = 0x0100, };
struct dramc_param_header { diff --git a/src/soc/mediatek/common/memory.c b/src/soc/mediatek/common/memory.c index fc559e2..b6f7dde 100644 --- a/src/soc/mediatek/common/memory.c +++ b/src/soc/mediatek/common/memory.c @@ -244,6 +244,8 @@
if (CONFIG(MEDIATEK_DRAM_DVFS)) dparam->dramc_datas.ddr_info.config_dvfs = DRAMC_ENABLE_DVFS; + if (CONFIG(MEDIATEK_DRAM_SCRAMBLE)) + dparam->header.config |= DRAMC_CONFIG_SCRAMBLE;
dparam->dramc_datas.ddr_info.sdram.ddr_geometry = geometry;