Commit b1160480 authored by Siva Durga Prasad Paladugu's avatar Siva Durga Prasad Paladugu
Browse files

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: default avatarAlistair Francis <alistair.francis@xilinx.com>
Signed-off-by: default avatarSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>
parent b88b0c9f
...@@ -77,7 +77,10 @@ void bl31_early_platform_setup(bl31_params_t *from_bl2, ...@@ -77,7 +77,10 @@ void bl31_early_platform_setup(bl31_params_t *from_bl2,
DISABLE_ALL_EXCEPTIONS); DISABLE_ALL_EXCEPTIONS);
} else { } else {
/* use parameters from FSBL */ /* 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); NOTICE("BL31: Secure code at 0x%lx\n", bl32_image_ep_info.pc);
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <debug.h> #include <debug.h>
#include <mmio.h> #include <mmio.h>
#include "zynqmp_def.h" #include "zynqmp_def.h"
#include "zynqmp_private.h"
/* /*
* ATFHandoffParams * ATFHandoffParams
...@@ -147,8 +148,11 @@ static int get_fsbl_estate(const struct xfsbl_partition *partition) ...@@ -147,8 +148,11 @@ static int get_fsbl_estate(const struct xfsbl_partition *partition)
* *
* Process the handoff paramters from the FSBL and populate the BL32 and BL33 * Process the handoff paramters from the FSBL and populate the BL32 and BL33
* image info structures accordingly. * 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; uint64_t atf_handoff_addr;
const struct xfsbl_atf_handoff_params *ATFHandoffParams; const struct xfsbl_atf_handoff_params *ATFHandoffParams;
...@@ -158,7 +162,7 @@ void fsbl_atf_handover(entry_point_info_t *bl32, entry_point_info_t *bl33) ...@@ -158,7 +162,7 @@ void fsbl_atf_handover(entry_point_info_t *bl32, entry_point_info_t *bl33)
(atf_handoff_addr > (uint64_t)&__BL31_END__)); (atf_handoff_addr > (uint64_t)&__BL31_END__));
if (!atf_handoff_addr) { if (!atf_handoff_addr) {
ERROR("BL31: No ATF handoff structure passed\n"); ERROR("BL31: No ATF handoff structure passed\n");
panic(); return FSBL_HANDOFF_NO_STRUCT;
} }
ATFHandoffParams = (struct xfsbl_atf_handoff_params *)atf_handoff_addr; ATFHandoffParams = (struct xfsbl_atf_handoff_params *)atf_handoff_addr;
...@@ -168,7 +172,7 @@ void fsbl_atf_handover(entry_point_info_t *bl32, entry_point_info_t *bl33) ...@@ -168,7 +172,7 @@ void fsbl_atf_handover(entry_point_info_t *bl32, entry_point_info_t *bl33)
(ATFHandoffParams->magic[3] != 'X')) { (ATFHandoffParams->magic[3] != 'X')) {
ERROR("BL31: invalid ATF handoff structure at %llx\n", ERROR("BL31: invalid ATF handoff structure at %llx\n",
atf_handoff_addr); atf_handoff_addr);
panic(); return FSBL_HANDOFF_INVAL_STRUCT;
} }
VERBOSE("BL31: ATF handoff params at:0x%llx, entries:%u\n", VERBOSE("BL31: ATF handoff params at:0x%llx, entries:%u\n",
...@@ -176,7 +180,7 @@ void fsbl_atf_handover(entry_point_info_t *bl32, entry_point_info_t *bl33) ...@@ -176,7 +180,7 @@ void fsbl_atf_handover(entry_point_info_t *bl32, entry_point_info_t *bl33)
if (ATFHandoffParams->num_entries > FSBL_MAX_PARTITIONS) { if (ATFHandoffParams->num_entries > FSBL_MAX_PARTITIONS) {
ERROR("BL31: ATF handoff params: too many partitions (%u/%u)\n", ERROR("BL31: ATF handoff params: too many partitions (%u/%u)\n",
ATFHandoffParams->num_entries, FSBL_MAX_PARTITIONS); ATFHandoffParams->num_entries, FSBL_MAX_PARTITIONS);
panic(); return FSBL_HANDOFF_TOO_MANY_PARTS;
} }
/* /*
...@@ -261,4 +265,6 @@ void fsbl_atf_handover(entry_point_info_t *bl32, entry_point_info_t *bl33) ...@@ -261,4 +265,6 @@ void fsbl_atf_handover(entry_point_info_t *bl32, entry_point_info_t *bl33)
else else
EP_SET_EE(image->h.attr, EP_EE_LITTLE); EP_SET_EE(image->h.attr, EP_EE_LITTLE);
} }
return FSBL_HANDOFF_SUCCESS;
} }
...@@ -18,7 +18,14 @@ int zynqmp_is_pmu_up(void); ...@@ -18,7 +18,14 @@ int zynqmp_is_pmu_up(void);
unsigned int zynqmp_get_bootmode(void); unsigned int zynqmp_get_bootmode(void);
/* For FSBL handover */ /* 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); entry_point_info_t *bl33_image_ep_info);
#endif /* __ZYNQMP_PRIVATE_H__ */ #endif /* __ZYNQMP_PRIVATE_H__ */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment