summaryrefslogtreecommitdiff
path: root/plat/st
diff options
context:
space:
mode:
authorLionel Debieve <lionel.debieve@st.com>2019-09-16 12:17:09 +0200
committerLionel Debieve <lionel.debieve@st.com>2019-09-20 23:21:10 +0200
commitf700423c1f2426ca3c5ccb9ee4e765743424b074 (patch)
tree52c9c935db1b117e776437e65f905774617fc319 /plat/st
parentb1e0b11cc9e8a850a8e479927432068ce62a815a (diff)
bsec: move bsec_mode_is_closed_device() service to platform
This BSEC service is a platform specific service. Implementation moved to the platform part. Signed-off-by: Lionel Debieve <lionel.debieve@st.com> Change-Id: I1f70ed48a446860498ed111acce01187568538c9
Diffstat (limited to 'plat/st')
-rw-r--r--plat/st/common/include/stm32mp_common.h1
-rw-r--r--plat/st/stm32mp1/stm32mp1_private.c13
2 files changed, 14 insertions, 0 deletions
diff --git a/plat/st/common/include/stm32mp_common.h b/plat/st/common/include/stm32mp_common.h
index e20308ee..59657fdc 100644
--- a/plat/st/common/include/stm32mp_common.h
+++ b/plat/st/common/include/stm32mp_common.h
@@ -19,6 +19,7 @@ void stm32mp_save_boot_ctx_address(uintptr_t address);
uintptr_t stm32mp_get_boot_ctx_address(void);
bool stm32mp_is_single_core(void);
+bool stm32mp_is_closed_device(void);
/* Return the base address of the DDR controller */
uintptr_t stm32mp_ddrctrl_base(void);
diff --git a/plat/st/stm32mp1/stm32mp1_private.c b/plat/st/stm32mp1/stm32mp1_private.c
index 38ebcef6..e2dcd2af 100644
--- a/plat/st/stm32mp1/stm32mp1_private.c
+++ b/plat/st/stm32mp1/stm32mp1_private.c
@@ -278,6 +278,19 @@ bool stm32mp_is_single_core(void)
return ret;
}
+/* Return true when device is in closed state */
+bool stm32mp_is_closed_device(void)
+{
+ uint32_t value;
+
+ if ((bsec_shadow_register(DATA0_OTP) != BSEC_OK) ||
+ (bsec_read_otp(&value, DATA0_OTP) != BSEC_OK)) {
+ return true;
+ }
+
+ return (value & DATA0_OTP_SECURED) == DATA0_OTP_SECURED;
+}
+
uint32_t stm32_iwdg_get_instance(uintptr_t base)
{
switch (base) {