]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
Improve debug output of the translation tables
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>
Mon, 13 Feb 2017 11:35:49 +0000 (11:35 +0000)
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>
Wed, 8 Mar 2017 14:40:27 +0000 (14:40 +0000)
The printed output has been improved in two ways:

- Whenever multiple invalid descriptors are found, only the first one
  is printed, and a line is added to inform about how many descriptors
  have been omitted.

- At the beginning of each line there is an indication of the table
  level the entry belongs to. Example of the new output:
  `[LV3] VA:0x1000 PA:0x1000 size:0x1000 MEM-RO-S-EXEC`

Change-Id: Ib6f1cd8dbd449452f09258f4108241eb11f8d445
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
lib/xlat_tables_v2/xlat_tables_internal.c

index 9d4c8379530968d6946f457535a8b9ef0e9b1d56..fc4345b9746f382a4f7931e31194d0f9f3718ce2 100644 (file)
@@ -563,12 +563,15 @@ static void xlat_desc_print(uint64_t desc)
 }
 
 static const char * const level_spacers[] = {
-       "",
-       "  ",
-       "    ",
-       "      "
+       "[LV0] ",
+       "  [LV1] ",
+       "    [LV2] ",
+       "      [LV3] "
 };
 
+static const char *invalid_descriptors_ommited =
+               "%s(%d invalid descriptors omitted)\n";
+
 /*
  * Recursive function that reads the translation tables passed as an argument
  * and prints their status.
@@ -585,18 +588,36 @@ static void xlat_tables_print_internal(const uintptr_t table_base_va,
 
        size_t level_size = XLAT_BLOCK_SIZE(level);
 
+       /*
+        * Keep track of how many invalid descriptors are counted in a row.
+        * Whenever multiple invalid descriptors are found, only the first one
+        * is printed, and a line is added to inform about how many descriptors
+        * have been omitted.
+        */
+       int invalid_row_count = 0;
+
        while (table_idx < table_entries) {
 
                desc = table_base[table_idx];
 
                if ((desc & DESC_MASK) == INVALID_DESC) {
 
-                       tf_printf("%sVA:%p size:0x%zx\n",
-                                 level_spacers[level],
-                                 (void *)table_idx_va, level_size);
+                       if (invalid_row_count == 0) {
+                               tf_printf("%sVA:%p size:0x%zx\n",
+                                         level_spacers[level],
+                                         (void *)table_idx_va, level_size);
+                       }
+                       invalid_row_count++;
 
                } else {
 
+                       if (invalid_row_count > 1) {
+                               tf_printf(invalid_descriptors_ommited,
+                                         level_spacers[level],
+                                         invalid_row_count - 1);
+                       }
+                       invalid_row_count = 0;
+
                        /*
                         * Check if this is a table or a block. Tables are only
                         * allowed in levels other than 3, but DESC_PAGE has the
@@ -633,6 +654,11 @@ static void xlat_tables_print_internal(const uintptr_t table_base_va,
                table_idx++;
                table_idx_va += level_size;
        }
+
+       if (invalid_row_count > 1) {
+               tf_printf(invalid_descriptors_ommited,
+                         level_spacers[level], invalid_row_count - 1);
+       }
 }
 
 #endif /* LOG_LEVEL >= LOG_LEVEL_VERBOSE */