aboutsummaryrefslogtreecommitdiff
path: root/plat/st/stm32mp1/services/bsec_svc.c
diff options
context:
space:
mode:
Diffstat (limited to 'plat/st/stm32mp1/services/bsec_svc.c')
-rw-r--r--plat/st/stm32mp1/services/bsec_svc.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/plat/st/stm32mp1/services/bsec_svc.c b/plat/st/stm32mp1/services/bsec_svc.c
index 2a60e43393..7cc0013826 100644
--- a/plat/st/stm32mp1/services/bsec_svc.c
+++ b/plat/st/stm32mp1/services/bsec_svc.c
@@ -1,14 +1,15 @@
/*
- * Copyright (c) 2016-2019, STMicroelectronics - All Rights Reserved
+ * Copyright (c) 2016-2024, STMicroelectronics - All Rights Reserved
*
* SPDX-License-Identifier: BSD-3-Clause
*/
-#include <platform_def.h>
#include <common/debug.h>
#include <drivers/st/bsec.h>
+#include <drivers/st/bsec2_reg.h>
+#include <platform_def.h>
#include <stm32mp1_smc.h>
#include "bsec_svc.h"
@@ -28,22 +29,17 @@ uint32_t bsec_main(uint32_t x1, uint32_t x2, uint32_t x3,
result = bsec_program_otp(x3, x2);
break;
case STM32_SMC_WRITE_SHADOW:
- *ret_otp_value = 0;
+ *ret_otp_value = 0U;
result = bsec_write_otp(x3, x2);
break;
case STM32_SMC_READ_OTP:
- *ret_otp_value = 0;
+ *ret_otp_value = 0U;
result = bsec_read_otp(&tmp_data, x2);
if (result != BSEC_OK) {
break;
}
- result = bsec_shadow_register(x2);
- if (result != BSEC_OK) {
- break;
- }
-
- result = bsec_read_otp(ret_otp_value, x2);
+ result = bsec_shadow_read_otp(ret_otp_value, x2);
if (result != BSEC_OK) {
break;
}
@@ -52,9 +48,8 @@ uint32_t bsec_main(uint32_t x1, uint32_t x2, uint32_t x3,
break;
default:
- result = BSEC_ERROR;
- break;
+ return STM32_SMC_INVALID_PARAMS;
}
- return result;
+ return (result == BSEC_OK) ? STM32_SMC_OK : STM32_SMC_FAILED;
}