summaryrefslogtreecommitdiff
path: root/plat/imx/imx8qx/imx8qx_bl31_setup.c
diff options
context:
space:
mode:
authorPeng Fan <peng.fan@nxp.com>2018-06-26 20:33:01 +0800
committerAnson Huang <Anson.Huang@nxp.com>2019-12-13 10:41:30 +0800
commit9b8cf58deee79eccde5c129b0aec9b4deaacb1ab (patch)
treeb0b67d56cc3aab84cc4be5a8a027fbe74d0e8abe /plat/imx/imx8qx/imx8qx_bl31_setup.c
parent6c03b183c37e476075367e63de5a6d3f245541af (diff)
imx8: postpone moving resources to non-secure partition
With flash_uboot_cm4ddr in imx-mkimage, the m4 code will access ddr. However after m4 core moved to non-secure partition, the ddr memory is still in secure partition. Then m4 core will fault. So postpone moving resources including m4 core, until other resources, such as memory/pin moved to non-secure partition. Signed-off-by: Peng Fan <peng.fan@nxp.com> (cherry picked from commit 1c8ce0ad5f583ec41026d4ab5bef622f1b45aecd) (cherry picked from commit 5b026e05b8f71b3d86da0953c5ca196d5ba5cc66)
Diffstat (limited to 'plat/imx/imx8qx/imx8qx_bl31_setup.c')
-rw-r--r--plat/imx/imx8qx/imx8qx_bl31_setup.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/plat/imx/imx8qx/imx8qx_bl31_setup.c b/plat/imx/imx8qx/imx8qx_bl31_setup.c
index f9f3b1a2..f71a7bb5 100644
--- a/plat/imx/imx8qx/imx8qx_bl31_setup.c
+++ b/plat/imx/imx8qx/imx8qx_bl31_setup.c
@@ -179,40 +179,6 @@ void imx8_partition_resources(void)
secure_rsrcs[i], err);
}
- owned = sc_rm_is_resource_owned(ipc_handle, SC_R_M4_0_PID0);
- if (owned) {
- err = sc_rm_set_resource_movable(ipc_handle, SC_R_M4_0_PID0,
- SC_R_M4_0_PID0, false);
- if (err)
- ERROR("sc_rm_set_resource_movable: rsrc %u, ret %u\n",
- SC_R_M4_0_PID0, err);
- }
-
- /* move all movable resources and pins to non-secure partition */
- err = sc_rm_move_all(ipc_handle, secure_part, os_part, true, true);
- if (err)
- ERROR("sc_rm_move_all: %u\n", err);
- if (owned) {
- err = sc_rm_set_resource_movable(ipc_handle, SC_R_M4_0_PID0,
- SC_R_M4_0_PID0, true);
- if (err)
- ERROR("sc_rm_set_resource_movable: rsrc %u, ret %u\n",
- SC_R_M4_0_PID0, err);
- err = sc_rm_assign_resource(ipc_handle, os_part, SC_R_M4_0_PID0);
- if (err)
- ERROR("sc_rm_assign_resource: rsrc %u, ret %u\n",
- SC_R_M4_0_PID0, err);
- }
-
- /* iterate through peripherals to give NS OS part access */
- for (i = 0; i < ARRAY_SIZE(ns_access_allowed); i++) {
- err = sc_rm_set_peripheral_permissions(ipc_handle,
- ns_access_allowed[i], os_part, SC_RM_PERM_FULL);
- if (err)
- ERROR("sc_rm_set_peripheral_permissions: rsrc %u, \
- ret %u\n", ns_access_allowed[i], err);
- }
-
/*
* sc_rm_set_peripheral_permissions
* sc_rm_set_memreg_permissions
@@ -264,6 +230,40 @@ void imx8_partition_resources(void)
}
}
+ owned = sc_rm_is_resource_owned(ipc_handle, SC_R_M4_0_PID0);
+ if (owned) {
+ err = sc_rm_set_resource_movable(ipc_handle, SC_R_M4_0_PID0,
+ SC_R_M4_0_PID0, false);
+ if (err)
+ ERROR("sc_rm_set_resource_movable: rsrc %u, ret %u\n",
+ SC_R_M4_0_PID0, err);
+ }
+
+ /* move all movable resources and pins to non-secure partition */
+ err = sc_rm_move_all(ipc_handle, secure_part, os_part, true, true);
+ if (err)
+ ERROR("sc_rm_move_all: %u\n", err);
+ if (owned) {
+ err = sc_rm_set_resource_movable(ipc_handle, SC_R_M4_0_PID0,
+ SC_R_M4_0_PID0, true);
+ if (err)
+ ERROR("sc_rm_set_resource_movable: rsrc %u, ret %u\n",
+ SC_R_M4_0_PID0, err);
+ err = sc_rm_assign_resource(ipc_handle, os_part, SC_R_M4_0_PID0);
+ if (err)
+ ERROR("sc_rm_assign_resource: rsrc %u, ret %u\n",
+ SC_R_M4_0_PID0, err);
+ }
+
+ /* iterate through peripherals to give NS OS part access */
+ for (i = 0; i < ARRAY_SIZE(ns_access_allowed); i++) {
+ err = sc_rm_set_peripheral_permissions(ipc_handle,
+ ns_access_allowed[i], os_part, SC_RM_PERM_FULL);
+ if (err)
+ ERROR("sc_rm_set_peripheral_permissions: rsrc %u, \
+ ret %u\n", ns_access_allowed[i], err);
+ }
+
if (err)
NOTICE("Partitioning Failed\n");
else