Merge pull request #421 from sandrine-bailleux/sb/improve-display_boot_progress

Improve images transitions debugging messages
diff --git a/bl1/aarch64/bl1_exceptions.S b/bl1/aarch64/bl1_exceptions.S
index ef390d4..0bd0485 100644
--- a/bl1/aarch64/bl1_exceptions.S
+++ b/bl1/aarch64/bl1_exceptions.S
@@ -195,7 +195,7 @@
 	b.ne	unexpected_sync_exception
 
 	mov	x0, x20
-	bl	display_boot_progress
+	bl	bl1_print_bl31_ep_info
 
 	ldp	x0, x1, [x20, #ENTRY_POINT_INFO_PC_OFFSET]
 	msr	elr_el3, x0
diff --git a/bl1/bl1_main.c b/bl1/bl1_main.c
index 50cf4e0..f62f31d 100644
--- a/bl1/bl1_main.c
+++ b/bl1/bl1_main.c
@@ -57,6 +57,9 @@
 	write_spsr_el3(bl2_ep->spsr);
 	write_elr_el3(bl2_ep->pc);
 
+	NOTICE("BL1: Booting BL2\n");
+	print_entry_point_info(bl2_ep);
+
 	eret(bl2_ep->args.arg0,
 		bl2_ep->args.arg1,
 		bl2_ep->args.arg2,
@@ -190,31 +193,18 @@
 
 	bl1_plat_set_bl2_ep_info(&bl2_image_info, &bl2_ep);
 	bl2_ep.args.arg1 = (unsigned long)bl2_tzram_layout;
-	NOTICE("BL1: Booting BL2\n");
-	INFO("BL1: BL2 address = 0x%llx\n",
-		(unsigned long long) bl2_ep.pc);
-	INFO("BL1: BL2 spsr = 0x%x\n", bl2_ep.spsr);
-	VERBOSE("BL1: BL2 memory layout address = 0x%llx\n",
-		(unsigned long long) bl2_tzram_layout);
-
 	bl1_run_bl2(&bl2_ep);
 
 	return;
 }
 
 /*******************************************************************************
- * Temporary function to print the fact that BL2 has done its job and BL31 is
- * about to be loaded. This is needed as long as printfs cannot be used
+ * Function called just before handing over to BL31 to inform the user about
+ * the boot progress. In debug mode, also print details about the BL31 image's
+ * execution context.
  ******************************************************************************/
-void display_boot_progress(entry_point_info_t *bl31_ep_info)
+void bl1_print_bl31_ep_info(const entry_point_info_t *bl31_ep_info)
 {
 	NOTICE("BL1: Booting BL3-1\n");
-	INFO("BL1: BL3-1 address = 0x%llx\n",
-		(unsigned long long)bl31_ep_info->pc);
-	INFO("BL1: BL3-1 spsr = 0x%llx\n",
-		(unsigned long long)bl31_ep_info->spsr);
-	INFO("BL1: BL3-1 params address = 0x%llx\n",
-		(unsigned long long)bl31_ep_info->args.arg0);
-	INFO("BL1: BL3-1 plat params address = 0x%llx\n",
-		(unsigned long long)bl31_ep_info->args.arg1);
+	print_entry_point_info(bl31_ep_info);
 }
diff --git a/bl31/bl31_main.c b/bl31/bl31_main.c
index a244a5c..9abc395 100644
--- a/bl31/bl31_main.c
+++ b/bl31/bl31_main.c
@@ -149,9 +149,7 @@
 
 	INFO("BL3-1: Preparing for EL3 exit to %s world\n",
 		(image_type == SECURE) ? "secure" : "normal");
-	INFO("BL3-1: Next image address = 0x%llx\n",
-		(unsigned long long) next_image_info->pc);
-	INFO("BL3-1: Next image spsr = 0x%x\n", next_image_info->spsr);
+	print_entry_point_info(next_image_info);
 	cm_init_my_context(next_image_info);
 	cm_prepare_el3_exit(image_type);
 }
diff --git a/common/bl_common.c b/common/bl_common.c
index 91a0ae8..1cf0b23 100644
--- a/common/bl_common.c
+++ b/common/bl_common.c
@@ -352,3 +352,27 @@
 
 	return 0;
 }
+
+/*******************************************************************************
+ * Print the content of an entry_point_info_t structure.
+ ******************************************************************************/
+void print_entry_point_info(const entry_point_info_t *ep_info)
+{
+	INFO("Entry point address = 0x%llx\n",
+		(unsigned long long) ep_info->pc);
+	INFO("SPSR = 0x%lx\n", (unsigned long) ep_info->spsr);
+
+#define PRINT_IMAGE_ARG(n)					\
+	VERBOSE("Argument #" #n " = 0x%llx\n",			\
+		(unsigned long long) ep_info->args.arg##n)
+
+	PRINT_IMAGE_ARG(0);
+	PRINT_IMAGE_ARG(1);
+	PRINT_IMAGE_ARG(2);
+	PRINT_IMAGE_ARG(3);
+	PRINT_IMAGE_ARG(4);
+	PRINT_IMAGE_ARG(5);
+	PRINT_IMAGE_ARG(6);
+	PRINT_IMAGE_ARG(7);
+#undef PRINT_IMAGE_ARG
+}
diff --git a/include/common/bl_common.h b/include/common/bl_common.h
index c687b35..c9a7a3d 100644
--- a/include/common/bl_common.h
+++ b/include/common/bl_common.h
@@ -242,6 +242,8 @@
 void reserve_mem(uint64_t *free_base, size_t *free_size,
 		uint64_t addr, size_t size);
 
+void print_entry_point_info(const entry_point_info_t *ep_info);
+
 #endif /*__ASSEMBLY__*/
 
 #endif /* __BL_COMMON_H__ */