Merge changes I44537ba2,Ia12d3577,I06b3012c,Iec885405,Idab8013a into integration

* changes:
  feat(imx8mp): optionally take params from BL2
  feat(imx8mn): optionally take params from BL2
  feat(imx8mm): optionally take params from BL2
  feat(imx93): optionally take params from BL2
  feat(imx): add helper to take params from BL2
This commit is contained in:
Madhukar Pappireddy 2024-05-28 16:27:53 +02:00 committed by TrustedFirmware Code Review
commit 278b0885eb
14 changed files with 118 additions and 6 deletions

View file

@ -0,0 +1,48 @@
/*
* Copyright (c) 2024, Pengutronix, Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <errno.h>
#include <stdint.h>
#include <common/bl_common.h>
#include <common/desc_image_load.h>
#include <plat_common.h>
/*
* This function checks if @arg0 can safely be accessed as a pointer
* and if it does, it fills in @bl32_info and @bl33_info with data
* found in @arg0.
*
* Returns 0 when @arg0 can be used as entry point info and a negative
* error code otherwise.
*/
int imx_bl31_params_parse(uintptr_t arg0, uintptr_t ocram_base,
uintptr_t ocram_size,
entry_point_info_t *bl32_info,
entry_point_info_t *bl33_info)
{
bl_params_t *v2 = (void *)(uintptr_t)arg0;
if (arg0 & 0x3) {
return -EINVAL;
}
if (arg0 < ocram_base || arg0 >= ocram_base + ocram_size) {
return -EINVAL;
}
if (v2->h.version != PARAM_VERSION_2) {
return -EINVAL;
}
if (v2->h.type != PARAM_BL_PARAMS) {
return -EINVAL;
}
bl31_params_parse_helper(arg0, bl32_info, bl33_info);
return 0;
}

View file

@ -0,0 +1,17 @@
/*
* Copyright (c) 2024, Pengutronix, Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef PLAT_COMMON_H
#define PLAT_COMMON_H
#include <stdint.h>
#include <common/bl_common.h>
int imx_bl31_params_parse(uintptr_t arg0, uintptr_t ocram_base,
uintptr_t ocram_size,
entry_point_info_t *bl32_info,
entry_point_info_t *bl33_info);
#endif /* PLAT_COMMON_H */

View file

@ -30,6 +30,7 @@
#include <imx8m_ccm.h> #include <imx8m_ccm.h>
#include <imx8m_csu.h> #include <imx8m_csu.h>
#include <imx8m_snvs.h> #include <imx8m_snvs.h>
#include <plat_common.h>
#include <plat_imx8.h> #include <plat_imx8.h>
#define TRUSTY_PARAMS_LEN_BYTES (4096*2) #define TRUSTY_PARAMS_LEN_BYTES (4096*2)
@ -154,7 +155,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
{ {
unsigned int console_base = IMX_BOOT_UART_BASE; unsigned int console_base = IMX_BOOT_UART_BASE;
static console_t console; static console_t console;
int i; int i, ret;
/* Enable CSU NS access permission */ /* Enable CSU NS access permission */
for (i = 0; i < 64; i++) { for (i = 0; i < 64; i++) {
@ -207,6 +208,13 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
bl32_image_ep_info.args.arg3 = BL32_FDT_OVERLAY_ADDR; bl32_image_ep_info.args.arg3 = BL32_FDT_OVERLAY_ADDR;
#endif #endif
#endif #endif
ret = imx_bl31_params_parse(arg0, IMX_NS_OCRAM_SIZE, IMX_NS_OCRAM_BASE,
&bl32_image_ep_info, &bl33_image_ep_info);
if (ret != 0) {
ret = imx_bl31_params_parse(arg0, IMX_TCM_BASE, IMX_TCM_SIZE,
&bl32_image_ep_info,
&bl33_image_ep_info);
}
#if !defined(SPD_opteed) && !defined(SPD_trusty) #if !defined(SPD_opteed) && !defined(SPD_trusty)
enable_snvs_privileged_access(); enable_snvs_privileged_access();

View file

@ -118,6 +118,8 @@
#define IMX_ROM_SIZE U(0x40000) #define IMX_ROM_SIZE U(0x40000)
#define IMX_NS_OCRAM_BASE U(0x900000) #define IMX_NS_OCRAM_BASE U(0x900000)
#define IMX_NS_OCRAM_SIZE U(0x20000) #define IMX_NS_OCRAM_SIZE U(0x20000)
#define IMX_TCM_BASE U(0x7E0000)
#define IMX_TCM_SIZE U(0x40000)
#define IMX_CAAM_RAM_BASE U(0x100000) #define IMX_CAAM_RAM_BASE U(0x100000)
#define IMX_CAAM_RAM_SIZE U(0x10000) #define IMX_CAAM_RAM_SIZE U(0x10000)
#define IMX_DRAM_BASE U(0x40000000) #define IMX_DRAM_BASE U(0x40000000)

View file

@ -30,7 +30,8 @@ IMX_GIC_SOURCES := ${GICV3_SOURCES} \
plat/common/plat_psci_common.c \ plat/common/plat_psci_common.c \
plat/imx/common/plat_imx8_gic.c plat/imx/common/plat_imx8_gic.c
BL31_SOURCES += plat/imx/common/imx8_helpers.S \ BL31_SOURCES += common/desc_image_load.c \
plat/imx/common/imx8_helpers.S \
plat/imx/imx8m/gpc_common.c \ plat/imx/imx8m/gpc_common.c \
plat/imx/imx8m/imx_hab.c \ plat/imx/imx8m/imx_hab.c \
plat/imx/imx8m/imx_aipstz.c \ plat/imx/imx8m/imx_aipstz.c \
@ -46,6 +47,7 @@ BL31_SOURCES += plat/imx/common/imx8_helpers.S \
plat/imx/common/imx8_topology.c \ plat/imx/common/imx8_topology.c \
plat/imx/common/imx_sip_handler.c \ plat/imx/common/imx_sip_handler.c \
plat/imx/common/imx_sip_svc.c \ plat/imx/common/imx_sip_svc.c \
plat/imx/common/imx_common.c \
plat/imx/common/imx_uart_console.S \ plat/imx/common/imx_uart_console.S \
lib/cpus/aarch64/cortex_a53.S \ lib/cpus/aarch64/cortex_a53.S \
drivers/arm/tzc/tzc380.c \ drivers/arm/tzc/tzc380.c \

View file

@ -29,6 +29,7 @@
#include <imx8m_csu.h> #include <imx8m_csu.h>
#include <imx8m_snvs.h> #include <imx8m_snvs.h>
#include <platform_def.h> #include <platform_def.h>
#include <plat_common.h>
#include <plat_imx8.h> #include <plat_imx8.h>
#define TRUSTY_PARAMS_LEN_BYTES (4096*2) #define TRUSTY_PARAMS_LEN_BYTES (4096*2)
@ -126,7 +127,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
unsigned int console_base = IMX_BOOT_UART_BASE; unsigned int console_base = IMX_BOOT_UART_BASE;
static console_t console; static console_t console;
unsigned int val; unsigned int val;
int i; int i, ret;
/* Enable CSU NS access permission */ /* Enable CSU NS access permission */
for (i = 0; i < 64; i++) { for (i = 0; i < 64; i++) {
@ -192,6 +193,13 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
#endif #endif
#endif #endif
ret = imx_bl31_params_parse(arg0, IMX_NS_OCRAM_SIZE, IMX_NS_OCRAM_BASE,
&bl32_image_ep_info, &bl33_image_ep_info);
if (ret != 0) {
imx_bl31_params_parse(arg0, IMX_TCM_BASE, IMX_TCM_SIZE,
&bl32_image_ep_info, &bl33_image_ep_info);
}
#if !defined(SPD_opteed) && !defined(SPD_trusty) #if !defined(SPD_opteed) && !defined(SPD_trusty)
enable_snvs_privileged_access(); enable_snvs_privileged_access();
#endif #endif

View file

@ -140,6 +140,8 @@
#define OCRAM_S_SIZE U(0x8000) #define OCRAM_S_SIZE U(0x8000)
#define OCRAM_S_LIMIT (OCRAM_S_BASE + OCRAM_S_SIZE) #define OCRAM_S_LIMIT (OCRAM_S_BASE + OCRAM_S_SIZE)
#define SAVED_DRAM_TIMING_BASE OCRAM_S_BASE #define SAVED_DRAM_TIMING_BASE OCRAM_S_BASE
#define IMX_TCM_BASE U(0x7E0000)
#define IMX_TCM_SIZE U(0x40000)
#define COUNTER_FREQUENCY 8000000 /* 8MHz */ #define COUNTER_FREQUENCY 8000000 /* 8MHz */

View file

@ -25,7 +25,8 @@ IMX_GIC_SOURCES := ${GICV3_SOURCES} \
plat/common/plat_psci_common.c \ plat/common/plat_psci_common.c \
plat/imx/common/plat_imx8_gic.c plat/imx/common/plat_imx8_gic.c
BL31_SOURCES += plat/imx/common/imx8_helpers.S \ BL31_SOURCES += common/desc_image_load.c \
plat/imx/common/imx8_helpers.S \
plat/imx/imx8m/gpc_common.c \ plat/imx/imx8m/gpc_common.c \
plat/imx/imx8m/imx_hab.c \ plat/imx/imx8m/imx_hab.c \
plat/imx/imx8m/imx_aipstz.c \ plat/imx/imx8m/imx_aipstz.c \
@ -41,6 +42,7 @@ BL31_SOURCES += plat/imx/common/imx8_helpers.S \
plat/imx/common/imx8_topology.c \ plat/imx/common/imx8_topology.c \
plat/imx/common/imx_sip_handler.c \ plat/imx/common/imx_sip_handler.c \
plat/imx/common/imx_sip_svc.c \ plat/imx/common/imx_sip_svc.c \
plat/imx/common/imx_common.c \
plat/imx/common/imx_uart_console.S \ plat/imx/common/imx_uart_console.S \
lib/cpus/aarch64/cortex_a53.S \ lib/cpus/aarch64/cortex_a53.S \
drivers/arm/tzc/tzc380.c \ drivers/arm/tzc/tzc380.c \

View file

@ -29,6 +29,7 @@
#include <imx8m_csu.h> #include <imx8m_csu.h>
#include <imx8m_snvs.h> #include <imx8m_snvs.h>
#include <platform_def.h> #include <platform_def.h>
#include <plat_common.h>
#include <plat_imx8.h> #include <plat_imx8.h>
#define TRUSTY_PARAMS_LEN_BYTES (4096*2) #define TRUSTY_PARAMS_LEN_BYTES (4096*2)
@ -156,6 +157,7 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
static console_t console; static console_t console;
unsigned int val; unsigned int val;
unsigned int i; unsigned int i;
int ret;
/* Enable CSU NS access permission */ /* Enable CSU NS access permission */
for (i = 0; i < 64; i++) { for (i = 0; i < 64; i++) {
@ -213,6 +215,13 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
bl32_image_ep_info.args.arg3 = BL32_FDT_OVERLAY_ADDR; bl32_image_ep_info.args.arg3 = BL32_FDT_OVERLAY_ADDR;
#endif #endif
#endif #endif
ret = imx_bl31_params_parse(arg0, IMX_NS_OCRAM_SIZE, IMX_NS_OCRAM_BASE,
&bl32_image_ep_info, &bl33_image_ep_info);
if (ret != 0) {
ret = imx_bl31_params_parse(arg0, IMX_TCM_BASE, IMX_TCM_SIZE,
&bl32_image_ep_info,
&bl33_image_ep_info);
}
#if !defined(SPD_opteed) && !defined(SPD_trusty) #if !defined(SPD_opteed) && !defined(SPD_trusty)
enable_snvs_privileged_access(); enable_snvs_privileged_access();

View file

@ -172,6 +172,9 @@
#define MAX_CSU_NUM U(64) #define MAX_CSU_NUM U(64)
#define IMX_TCM_BASE U(0x7E0000)
#define IMX_TCM_SIZE U(0x40000)
#define OCRAM_S_BASE U(0x00180000) #define OCRAM_S_BASE U(0x00180000)
#define OCRAM_S_SIZE U(0x8000) #define OCRAM_S_SIZE U(0x8000)
#define OCRAM_S_LIMIT (OCRAM_S_BASE + OCRAM_S_SIZE) #define OCRAM_S_LIMIT (OCRAM_S_BASE + OCRAM_S_SIZE)

View file

@ -26,7 +26,8 @@ IMX_GIC_SOURCES := ${GICV3_SOURCES} \
plat/common/plat_psci_common.c \ plat/common/plat_psci_common.c \
plat/imx/common/plat_imx8_gic.c plat/imx/common/plat_imx8_gic.c
BL31_SOURCES += plat/imx/common/imx8_helpers.S \ BL31_SOURCES += common/desc_image_load.c \
plat/imx/common/imx8_helpers.S \
plat/imx/imx8m/gpc_common.c \ plat/imx/imx8m/gpc_common.c \
plat/imx/imx8m/imx_hab.c \ plat/imx/imx8m/imx_hab.c \
plat/imx/imx8m/imx_aipstz.c \ plat/imx/imx8m/imx_aipstz.c \
@ -42,6 +43,7 @@ BL31_SOURCES += plat/imx/common/imx8_helpers.S \
plat/imx/common/imx8_topology.c \ plat/imx/common/imx8_topology.c \
plat/imx/common/imx_sip_handler.c \ plat/imx/common/imx_sip_handler.c \
plat/imx/common/imx_sip_svc.c \ plat/imx/common/imx_sip_svc.c \
plat/imx/common/imx_common.c \
plat/imx/common/imx_uart_console.S \ plat/imx/common/imx_uart_console.S \
lib/cpus/aarch64/cortex_a53.S \ lib/cpus/aarch64/cortex_a53.S \
drivers/arm/tzc/tzc380.c \ drivers/arm/tzc/tzc380.c \

View file

@ -20,6 +20,7 @@
#include <plat/common/platform.h> #include <plat/common/platform.h>
#include <imx8_lpuart.h> #include <imx8_lpuart.h>
#include <plat_common.h>
#include <plat_imx8.h> #include <plat_imx8.h>
#include <platform_def.h> #include <platform_def.h>
@ -90,6 +91,9 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
bl33_image_ep_info.args.arg3 = BL32_FDT_OVERLAY_ADDR; bl33_image_ep_info.args.arg3 = BL32_FDT_OVERLAY_ADDR;
bl32_image_ep_info.args.arg3 = BL32_FDT_OVERLAY_ADDR; bl32_image_ep_info.args.arg3 = BL32_FDT_OVERLAY_ADDR;
#endif #endif
imx_bl31_params_parse(arg0, OCRAM_BASE, OCRAM_SIZE,
&bl32_image_ep_info, &bl33_image_ep_info);
} }
void bl31_plat_arch_setup(void) void bl31_plat_arch_setup(void)

View file

@ -31,6 +31,9 @@
#define BL31_BASE U(0x204E0000) #define BL31_BASE U(0x204E0000)
#define BL31_LIMIT U(0x20520000) #define BL31_LIMIT U(0x20520000)
#define OCRAM_BASE U(0x20480000)
#define OCRAM_SIZE U(0xA0000)
/* non-secure uboot base */ /* non-secure uboot base */
/* TODO */ /* TODO */
#define PLAT_NS_IMAGE_OFFSET U(0x80200000) #define PLAT_NS_IMAGE_OFFSET U(0x80200000)

View file

@ -19,9 +19,11 @@ IMX_GIC_SOURCES := ${GICV3_SOURCES} \
plat/common/plat_psci_common.c \ plat/common/plat_psci_common.c \
plat/imx/common/plat_imx8_gic.c plat/imx/common/plat_imx8_gic.c
BL31_SOURCES += plat/common/aarch64/crash_console_helpers.S \ BL31_SOURCES += common/desc_image_load.c \
plat/common/aarch64/crash_console_helpers.S \
plat/imx/imx93/aarch64/plat_helpers.S \ plat/imx/imx93/aarch64/plat_helpers.S \
plat/imx/imx93/plat_topology.c \ plat/imx/imx93/plat_topology.c \
plat/imx/common/imx_common.c \
plat/imx/common/lpuart_console.S \ plat/imx/common/lpuart_console.S \
plat/imx/imx93/trdc.c \ plat/imx/imx93/trdc.c \
plat/imx/imx93/pwr_ctrl.c \ plat/imx/imx93/pwr_ctrl.c \