mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-25 06:19:56 +00:00
feat(st): do not directly call BSEC functions in common code
When STM32MP2 boots on Cortex-M33, the Cortex-A35 do no more have access to BSEC peripheral. New static inline stm32_otp_* wrappers are added, which just redirect to BSEC functions. While at it remove a useless bsec.h include. Change-Id: Ie0f917c02e48acf456634f455dae41805bf6adbf Signed-off-by: Yann Gautier <yann.gautier@foss.st.com>
This commit is contained in:
parent
189db9486d
commit
3007c72844
5 changed files with 78 additions and 5 deletions
plat/st
common
stm32mp1/include
stm32mp2
|
@ -168,9 +168,9 @@ int stm32_get_otp_value_from_idx(const uint32_t otp_idx, uint32_t *otp_val)
|
|||
assert(otp_val != NULL);
|
||||
|
||||
#if defined(IMAGE_BL2)
|
||||
ret = bsec_shadow_read_otp(otp_val, otp_idx);
|
||||
ret = stm32_otp_shadow_read(otp_val, otp_idx);
|
||||
#elif defined(IMAGE_BL31) || defined(IMAGE_BL32)
|
||||
ret = bsec_read_otp(otp_val, otp_idx);
|
||||
ret = stm32_otp_read(otp_val, otp_idx);
|
||||
#else
|
||||
#error "Not supported"
|
||||
#endif
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#include <common/debug.h>
|
||||
#include <drivers/auth/crypto_mod.h>
|
||||
#include <drivers/io/io_storage.h>
|
||||
#include <drivers/st/bsec.h>
|
||||
#include <drivers/st/stm32_hash.h>
|
||||
#include <drivers/st/stm32_pka.h>
|
||||
#include <drivers/st/stm32_rng.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2015-2023, ARM Limited and Contributors. All rights reserved.
|
||||
* Copyright (c) 2015-2024, Arm Limited and Contributors. All rights reserved.
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -32,4 +32,31 @@ static inline void stm32mp1_syscfg_boot_mode_disable(void){}
|
|||
void stm32mp1_deconfigure_uart_pins(void);
|
||||
|
||||
void stm32mp1_init_scmi_server(void);
|
||||
|
||||
/* Wrappers for OTP / BSEC functions */
|
||||
static inline uint32_t stm32_otp_read(uint32_t *val, uint32_t otp)
|
||||
{
|
||||
return bsec_read_otp(val, otp);
|
||||
}
|
||||
|
||||
static inline uint32_t stm32_otp_shadow_read(uint32_t *val, uint32_t otp)
|
||||
{
|
||||
return bsec_shadow_read_otp(val, otp);
|
||||
}
|
||||
|
||||
static inline uint32_t stm32_otp_write(uint32_t val, uint32_t otp)
|
||||
{
|
||||
return bsec_write_otp(val, otp);
|
||||
}
|
||||
|
||||
static inline uint32_t stm32_otp_set_sr_lock(uint32_t otp)
|
||||
{
|
||||
return bsec_set_sr_lock(otp);
|
||||
}
|
||||
|
||||
static inline uint32_t stm32_otp_read_sw_lock(uint32_t otp, bool *value)
|
||||
{
|
||||
return bsec_read_sw_lock(otp, value);
|
||||
}
|
||||
|
||||
#endif /* STM32MP1_PRIVATE_H */
|
||||
|
|
46
plat/st/stm32mp2/include/stm32mp2_private.h
Normal file
46
plat/st/stm32mp2/include/stm32mp2_private.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Copyright (c) 2024, STMicroelectronics - All Rights Reserved
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
#ifndef STM32MP2_PRIVATE_H
|
||||
#define STM32MP2_PRIVATE_H
|
||||
|
||||
/* Wrappers for OTP / BSEC functions */
|
||||
static inline uint32_t stm32_otp_probe(void)
|
||||
{
|
||||
return bsec_probe();
|
||||
}
|
||||
|
||||
static inline uint32_t stm32_otp_read(uint32_t *val, uint32_t otp)
|
||||
{
|
||||
return bsec_read_otp(val, otp);
|
||||
}
|
||||
|
||||
static inline uint32_t stm32_otp_shadow_read(uint32_t *val, uint32_t otp)
|
||||
{
|
||||
return bsec_shadow_read_otp(val, otp);
|
||||
}
|
||||
|
||||
static inline uint32_t stm32_otp_write(uint32_t val, uint32_t otp)
|
||||
{
|
||||
return bsec_write_otp(val, otp);
|
||||
}
|
||||
|
||||
static inline uint32_t stm32_otp_set_sr_lock(uint32_t otp)
|
||||
{
|
||||
return bsec_set_sr_lock(otp);
|
||||
}
|
||||
|
||||
static inline uint32_t stm32_otp_read_sw_lock(uint32_t otp, bool *value)
|
||||
{
|
||||
return bsec_read_sw_lock(otp, value);
|
||||
}
|
||||
|
||||
static inline bool stm32_otp_is_closed_device(void)
|
||||
{
|
||||
return bsec_mode_is_closed_device();
|
||||
}
|
||||
|
||||
#endif /* STM32MP2_PRIVATE_H */
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2023, STMicroelectronics - All Rights Reserved
|
||||
* Copyright (c) 2023-2024, STMicroelectronics - All Rights Reserved
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
@ -18,6 +18,7 @@
|
|||
|
||||
#ifndef __ASSEMBLER__
|
||||
#include <boot_api.h>
|
||||
#include <stm32mp2_private.h>
|
||||
#include <stm32mp_common.h>
|
||||
#include <stm32mp_dt.h>
|
||||
#include <stm32mp_shared_resources.h>
|
||||
|
|
Loading…
Add table
Reference in a new issue