瀏覽代碼

secure_boot: change error handler for esbc_validate

In case of error while executing esbc_validate command, SNVS
transition and issue of reset is required only for secure-boot.
If boot mode is non-secure, this is not required.

Similarly, esbc_halt command which puts the core in Spin Loop
is applicable only for Secure Boot.

Signed-off-by: Aneesh Bansal <aneesh.bansal@nxp.com>
Acked-by: Ruchika Gupta <ruchika.gupta@nxp.com>
Reviewed-by: York Sun <york.sun@nxp.com>
Aneesh Bansal 9 年之前
父節點
當前提交
856b284617
共有 2 個文件被更改,包括 13 次插入1 次删除
  1. 6 1
      board/freescale/common/cmd_esbc_validate.c
  2. 7 0
      board/freescale/common/fsl_validate.c

+ 6 - 1
board/freescale/common/cmd_esbc_validate.c

@@ -11,6 +11,11 @@
 static int do_esbc_halt(cmd_tbl_t *cmdtp, int flag, int argc,
 static int do_esbc_halt(cmd_tbl_t *cmdtp, int flag, int argc,
 				char * const argv[])
 				char * const argv[])
 {
 {
+	if (fsl_check_boot_mode_secure() == 0) {
+		printf("Boot Mode is Non-Secure. Not entering spin loop.\n");
+		return 0;
+	}
+
 	printf("Core is entering spin loop.\n");
 	printf("Core is entering spin loop.\n");
 loop:
 loop:
 	goto loop;
 	goto loop;
@@ -64,6 +69,6 @@ U_BOOT_CMD(
 
 
 U_BOOT_CMD(
 U_BOOT_CMD(
 	esbc_halt,	1,	0,	do_esbc_halt,
 	esbc_halt,	1,	0,	do_esbc_halt,
-	"Put the core in spin loop ",
+	"Put the core in spin loop (Secure Boot Only)",
 	""
 	""
 );
 );

+ 7 - 0
board/freescale/common/fsl_validate.c

@@ -370,6 +370,13 @@ void fsl_secboot_handle_error(int error)
 			printf("ERROR :: %x :: %s\n", error, e->name);
 			printf("ERROR :: %x :: %s\n", error, e->name);
 	}
 	}
 
 
+	/* If Boot Mode is secure, transition the SNVS state and issue
+	 * reset based on type of failure and ITS setting.
+	 * If Boot mode is non-secure, return from this function.
+	 */
+	if (fsl_check_boot_mode_secure() == 0)
+		return;
+
 	switch (error) {
 	switch (error) {
 	case ERROR_ESBC_CLIENT_HEADER_BARKER:
 	case ERROR_ESBC_CLIENT_HEADER_BARKER:
 	case ERROR_ESBC_CLIENT_HEADER_IMG_SIZE:
 	case ERROR_ESBC_CLIENT_HEADER_IMG_SIZE: