Introduce print_entry_point_info() function
authorSandrine Bailleux <sandrine.bailleux@arm.com>
Mon, 28 Sep 2015 16:03:06 +0000 (17:03 +0100)
committerSandrine Bailleux <sandrine.bailleux@arm.com>
Mon, 2 Nov 2015 09:23:05 +0000 (09:23 +0000)
This patch introduces a new function called 'print_entry_point_info'
that prints an entry_point_t structure for debugging purposes.
As such, it can be used to display the entry point address, SPSR and
arguments passed from a firmware image to the next one.

This function is now called in the following images transitions:
 - BL1 to BL2
 - BL1 to BL31
 - BL31 to the next image (typically BL32 or BL33)

The following changes have been introduced:

 - Fix the output format of the SPSR value : SPSR is a 32-bit value,
   not a 64-bit one.

 - Print all arguments values.
   The entry_point_info_t structure allows to pass up to 8 arguments.
   In most cases, only the first 2 arguments were printed.
   print_entry_point_info() now prints all of them as 'VERBOSE'
   traces.

Change-Id: Ieb384bffaa7849e6cb95a01a47c0b7fc2308653a

bl1/bl1_main.c
bl31/bl31_main.c
common/bl_common.c
include/common/bl_common.h

index 50cf4e0d858bd0d2c2802a8096ead74db63f1c1d..50aed60010725521ff2ecd824a3c781833ef6186 100644 (file)
@@ -57,6 +57,9 @@ static void __dead2 bl1_run_bl2(entry_point_info_t *bl2_ep)
        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,13 +193,6 @@ void bl1_main(void)
 
        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;
@@ -209,12 +205,5 @@ void bl1_main(void)
 void display_boot_progress(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);
 }
index a244a5cc968a9799f2f1c7087b91e69653e04734..9abc395bf08450b7adb382c44a53c1dcdb7c634a 100644 (file)
@@ -149,9 +149,7 @@ void bl31_prepare_next_image_entry(void)
 
        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);
 }
index 91a0ae8c43f31414112badb533af5bf94cf96d3d..1cf0b23bbb3d15063ef5d8deb70f3651dcc45dd8 100644 (file)
@@ -352,3 +352,27 @@ int load_auth_image(meminfo_t *mem_layout,
 
        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
+}
index c687b3543c11ccd7af565cd0f1970d1ac6375a7f..c9a7a3dabc3d6da0feb9956acd136ab1068f9795 100644 (file)
@@ -242,6 +242,8 @@ extern const char version_string[];
 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__ */