sw_apps:zynqmp_fsbl: Fix to handle invalid cluster id

Added check to detect invalid cluster id and throw error accordingly.

Signed-off-by: Sarat Chand Savitala <saratcha@xilinx.com>
Acked-by: Krishna Chaitanya Patakamuri <kpataka@xilinx.com>
This commit is contained in:
Sarat Chand Savitala 2015-08-08 15:44:24 +05:30 committed by Nava kishore Manne
parent 22f0a46409
commit 1b1368305f
2 changed files with 18 additions and 5 deletions

View file

@ -168,6 +168,7 @@ extern "C" {
#define XFSBL_ERROR_R5_0_TCM_POWER_UP (0x46U)
#define XFSBL_ERROR_R5_1_TCM_POWER_UP (0x47U)
#define XFSBL_ERROR_R5_L_TCM_POWER_UP (0x48U)
#define XFSBL_ERROR_UNSUPPORTED_CLUSTER_ID (0x49U)
#define XFSBL_FAILURE (0x3FFU)

View file

@ -257,13 +257,18 @@ static u32 XFsbl_ProcessorInit(XFsblPs * FsblInstancePtr)
*/
if (ClusterId == 0x80000004U) {
ClusterId = 0xC0000100U;
} else if (ClusterId == 0x80000005U) {
/* this corresponds to R5-1 */
Status = XFSBL_ERROR_UNSUPPORTED_CLUSTER_ID;
XFsbl_Printf(DEBUG_GENERAL,
"XFSBL_ERROR_UNSUPPORTED_CLUSTER_ID\n\r");
goto END;
} else {
/* For MISRA C compliance */
}
}
/**
* store the processor ID based on the cluster ID
* Need a check for unsupported Cluster ID
*/
/* store the processor ID based on the cluster ID */
if ((ClusterId & XFSBL_CLUSTER_ID_MASK) == XFSBL_A53_PROCESSOR) {
XFsbl_Printf(DEBUG_GENERAL,"Running on A53-0 ");
FsblInstancePtr->ProcessorID =
@ -278,7 +283,7 @@ static u32 XFsbl_ProcessorInit(XFsblPs * FsblInstancePtr)
FsblInstancePtr->A53ExecState = XIH_PH_ATTRB_A53_EXEC_ST_AA32;
#endif
} else {
} else if ((ClusterId & XFSBL_CLUSTER_ID_MASK) == XFSBL_R5_PROCESSOR) {
/* A53ExecState is not valid for R5 */
FsblInstancePtr->A53ExecState = XIH_INVALID_EXEC_ST;
@ -304,12 +309,19 @@ static u32 XFsbl_ProcessorInit(XFsblPs * FsblInstancePtr)
Index += 4;
}
} else {
Status = XFSBL_ERROR_UNSUPPORTED_CLUSTER_ID;
XFsbl_Printf(DEBUG_GENERAL,
"XFSBL_ERROR_UNSUPPORTED_CLUSTER_ID\n\r");
goto END;
}
/**
* Register the exception handlers
*/
XFsbl_RegisterHandlers();
END:
return Status;
}