Skip to content
Snippets Groups Projects
Commit b6e39684 authored by Yann Gautier's avatar Yann Gautier Committed by Sebastien Pasdeloup
Browse files

stm32mp1: remove USB and UART flags in BSEC services


The STM32MP_USB_PROGRAMMER and STM32MP_UART_PROGRAMMER flags are no more
used when compiling BL32.
The services STM32_SMC_READ_ALL and STM32_SMC_WRITE_ALL should then be
always present in the code. They can only be used when booting from serial
device, so a dedicated check is added.
This adds 1.6kB of code.

Change-Id: Ib6ac227a0b451d26b454fef42310665fada90a34
Signed-off-by: default avatarYann Gautier <yann.gautier@st.com>
Reviewed-on: https://gerrit.st.com/c/mpu/oe/st/tf-a/+/188321


Reviewed-by: default avatarCITOOLS <smet-aci-reviews@lists.codex.cro.st.com>
Reviewed-by: default avatarLionel DEBIEVE <lionel.debieve@st.com>
parent 9d948eeb
No related branches found
No related tags found
No related merge requests found
......@@ -104,7 +104,6 @@ static enum bsec_ssp_status bsec_check_ssp(uint32_t otp, uint32_t update)
return BSEC_NO_SSP;
}
#if STM32MP_USB_PROGRAMMER || STM32MP_UART_PROGRAMMER
static uint32_t bsec_read_all_bsec(struct otp_exchange *exchange)
{
uint32_t i;
......@@ -390,7 +389,6 @@ static uint32_t bsec_write_all_bsec(struct otp_exchange *exchange,
return BSEC_OK;
}
#endif /* STM32MP_USB_PROGRAMMER || STM32MP_UART_PROGRAMMER */
uint32_t bsec_main(uint32_t x1, uint32_t x2, uint32_t x3,
uint32_t *ret_otp_value)
......@@ -407,11 +405,14 @@ uint32_t bsec_main(uint32_t x1, uint32_t x2, uint32_t x3,
return STM32_SMC_INVALID_PARAMS;
}
#if STM32MP_USB_PROGRAMMER || STM32MP_UART_PROGRAMMER
otp_exch = NULL;
map_begin = 0U;
if ((x1 == STM32_SMC_READ_ALL) || (x1 == STM32_SMC_WRITE_ALL)) {
if (!stm32_boot_is_serial()) {
return STM32_SMC_FAILED;
}
map_begin = round_down(x2, PAGE_SIZE);
if (round_down(x2 + sizeof(struct otp_exchange), PAGE_SIZE) !=
......@@ -438,7 +439,6 @@ uint32_t bsec_main(uint32_t x1, uint32_t x2, uint32_t x3,
otp_exch = (struct otp_exchange *)(uintptr_t)x2;
}
#endif
switch (x1) {
case STM32_SMC_READ_SHADOW:
......@@ -483,14 +483,12 @@ uint32_t bsec_main(uint32_t x1, uint32_t x2, uint32_t x3,
result = bsec_write_otp(tmp_data, x2);
break;
#if STM32MP_USB_PROGRAMMER || STM32MP_UART_PROGRAMMER
case STM32_SMC_READ_ALL:
result = bsec_read_all_bsec(otp_exch);
break;
case STM32_SMC_WRITE_ALL:
result = bsec_write_all_bsec(otp_exch, ret_otp_value);
break;
#endif
case STM32_SMC_WRLOCK_OTP:
result = bsec_permanent_lock_otp(x2);
break;
......@@ -498,12 +496,10 @@ uint32_t bsec_main(uint32_t x1, uint32_t x2, uint32_t x3,
return STM32_SMC_INVALID_PARAMS;
}
#if STM32MP_USB_PROGRAMMER || STM32MP_UART_PROGRAMMER
if ((x1 == STM32_SMC_READ_ALL) || (x1 == STM32_SMC_WRITE_ALL)) {
ret = mmap_remove_dynamic_region(map_begin, map_size);
assert(ret == 0);
}
#endif
return (result == BSEC_OK) ? STM32_SMC_OK : STM32_SMC_FAILED;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment