diff options
author | Teo Hall <teo.hall@nxp.com> | 2017-05-03 17:07:39 -0500 |
---|---|---|
committer | Abel Vesa <abel.vesa@nxp.com> | 2018-06-08 17:34:08 +0300 |
commit | 03883508dfbd6f6bb91951965d2d1f2f44e771ff (patch) | |
tree | 8e62768f1371407e9373b9af994264f0edf6ff6e /plat/imx/imx8qm/imx8qm_bl31_setup.c | |
parent | ec72038c80419cd8114dab4bf0af47595717f193 (diff) |
add RM scu svc and partition secure MU
add rm svc api and set aside separate MU for
secure api calls into SCU
Signed-off-by: Teo Hall <teo.hall@nxp.com>
Diffstat (limited to 'plat/imx/imx8qm/imx8qm_bl31_setup.c')
-rw-r--r-- | plat/imx/imx8qm/imx8qm_bl31_setup.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/plat/imx/imx8qm/imx8qm_bl31_setup.c b/plat/imx/imx8qm/imx8qm_bl31_setup.c index 7274d528..81d333e7 100644 --- a/plat/imx/imx8qm/imx8qm_bl31_setup.c +++ b/plat/imx/imx8qm/imx8qm_bl31_setup.c @@ -44,6 +44,7 @@ #include <sci/sci.h> #include <xlat_tables.h> #include <lpuart.h> +#include <sec_rsrc.h> /* linker defined symbols */ extern unsigned long __RO_START__; @@ -182,6 +183,45 @@ static int lpuart32_serial_init(unsigned int base) return 0; } +void mx8_partition_resources(void) +{ + sc_err_t err; + sc_rm_pt_t secure_part, os_part; + int i; + + err = sc_rm_get_partition(ipc_handle, &secure_part); + + err = sc_rm_partition_alloc(ipc_handle, &os_part, false, false, + false, false, false); + + err = sc_rm_set_parent(ipc_handle, os_part, secure_part); + + /* set secure resources to NOT-movable */ + for(i = 0; i<(sizeof(secure_rsrcs)/sizeof(sc_rsrc_t)); i++){ + err = sc_rm_set_resource_movable(ipc_handle, secure_rsrcs[i], + secure_rsrcs[i], false); + + } + + /* move all movable resources and pins to non-secure partition */ + err = sc_rm_move_all(ipc_handle, secure_part, os_part, true, true); + + /* + * sc_rm_set_peripheral_permissions + * + * sc_rm_set_memreg_permissions + * + * sc_rm_set_pin_movable + * + */ + + if(err) + NOTICE("Partitioning Failed\n"); + else + NOTICE("Non-secure Partitioning Succeeded\n"); + +} + void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3) { @@ -221,6 +261,12 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1, console_init(IMX_BOOT_UART_BASE, IMX_BOOT_UART_CLK_IN_HZ, IMX_CONSOLE_BAUDRATE); #endif + /* create new partition for non-secure OS/Hypervisor + * + * uses global structs defined in sec_rsrc.h */ + + mx8_partition_resources(); + /* * tell BL3-1 where the non-secure software image is located * and the entry state information. |