plat: zynqmp: Let fsbl_atf_handover() return an error status
Instead of calling panic() in fsbl_atf_handover() return the error
status so that bl31_early_platform_setup() can act accordingly.
Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
diff --git a/plat/xilinx/zynqmp/bl31_zynqmp_setup.c b/plat/xilinx/zynqmp/bl31_zynqmp_setup.c
index 1edbd0f..6dc1c2d 100644
--- a/plat/xilinx/zynqmp/bl31_zynqmp_setup.c
+++ b/plat/xilinx/zynqmp/bl31_zynqmp_setup.c
@@ -77,7 +77,10 @@
DISABLE_ALL_EXCEPTIONS);
} else {
/* use parameters from FSBL */
- fsbl_atf_handover(&bl32_image_ep_info, &bl33_image_ep_info);
+ enum fsbl_handoff ret = fsbl_atf_handover(&bl32_image_ep_info,
+ &bl33_image_ep_info);
+ if (ret != FSBL_HANDOFF_SUCCESS)
+ panic();
}
NOTICE("BL31: Secure code at 0x%lx\n", bl32_image_ep_info.pc);
diff --git a/plat/xilinx/zynqmp/plat_startup.c b/plat/xilinx/zynqmp/plat_startup.c
index 18d150c..32c2db7 100644
--- a/plat/xilinx/zynqmp/plat_startup.c
+++ b/plat/xilinx/zynqmp/plat_startup.c
@@ -9,6 +9,7 @@
#include <debug.h>
#include <mmio.h>
#include "zynqmp_def.h"
+#include "zynqmp_private.h"
/*
* ATFHandoffParams
@@ -147,8 +148,11 @@
*
* Process the handoff paramters from the FSBL and populate the BL32 and BL33
* image info structures accordingly.
+ *
+ * Return: Return the status of the handoff. The value will be from the
+ * fsbl_handoff enum.
*/
-void fsbl_atf_handover(entry_point_info_t *bl32, entry_point_info_t *bl33)
+enum fsbl_handoff fsbl_atf_handover(entry_point_info_t *bl32, entry_point_info_t *bl33)
{
uint64_t atf_handoff_addr;
const struct xfsbl_atf_handoff_params *ATFHandoffParams;
@@ -158,7 +162,7 @@
(atf_handoff_addr > (uint64_t)&__BL31_END__));
if (!atf_handoff_addr) {
ERROR("BL31: No ATF handoff structure passed\n");
- panic();
+ return FSBL_HANDOFF_NO_STRUCT;
}
ATFHandoffParams = (struct xfsbl_atf_handoff_params *)atf_handoff_addr;
@@ -168,7 +172,7 @@
(ATFHandoffParams->magic[3] != 'X')) {
ERROR("BL31: invalid ATF handoff structure at %llx\n",
atf_handoff_addr);
- panic();
+ return FSBL_HANDOFF_INVAL_STRUCT;
}
VERBOSE("BL31: ATF handoff params at:0x%llx, entries:%u\n",
@@ -176,7 +180,7 @@
if (ATFHandoffParams->num_entries > FSBL_MAX_PARTITIONS) {
ERROR("BL31: ATF handoff params: too many partitions (%u/%u)\n",
ATFHandoffParams->num_entries, FSBL_MAX_PARTITIONS);
- panic();
+ return FSBL_HANDOFF_TOO_MANY_PARTS;
}
/*
@@ -261,4 +265,6 @@
else
EP_SET_EE(image->h.attr, EP_EE_LITTLE);
}
+
+ return FSBL_HANDOFF_SUCCESS;
}
diff --git a/plat/xilinx/zynqmp/zynqmp_private.h b/plat/xilinx/zynqmp/zynqmp_private.h
index aa650ac..3575b53 100644
--- a/plat/xilinx/zynqmp/zynqmp_private.h
+++ b/plat/xilinx/zynqmp/zynqmp_private.h
@@ -18,7 +18,14 @@
unsigned int zynqmp_get_bootmode(void);
/* For FSBL handover */
-void fsbl_atf_handover(entry_point_info_t *bl32_image_ep_info,
+enum fsbl_handoff {
+ FSBL_HANDOFF_SUCCESS = 0,
+ FSBL_HANDOFF_NO_STRUCT,
+ FSBL_HANDOFF_INVAL_STRUCT,
+ FSBL_HANDOFF_TOO_MANY_PARTS,
+};
+
+enum fsbl_handoff fsbl_atf_handover(entry_point_info_t *bl32_image_ep_info,
entry_point_info_t *bl33_image_ep_info);
#endif /* __ZYNQMP_PRIVATE_H__ */