mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-20 11:34:20 +00:00
Use tf_printf() for debug logs from xlat_tables.c
The debug prints used to debug translation table setup in xlat_tables.c used the `printf()` standard library function instead of the stack optimized `tf_printf()` API. DEBUG_XLAT_TABLE option was used to enable debug logs within xlat_tables.c and it configured a much larger stack size for the platform in case it was enabled. This patch modifies these debug prints within xlat_tables.c to use tf_printf() and modifies the format specifiers to be compatible with tf_printf(). The debug prints are now enabled if the VERBOSE prints are enabled in Trusted Firmware via LOG_LEVEL build option. The much larger stack size definition when DEBUG_XLAT_TABLE is defined is no longer required and the platform ports are modified to remove this stack size definition. Change-Id: I2f7d77ea12a04b827fa15e2adc3125b1175e4c23
This commit is contained in:
parent
870d881ced
commit
d30ac1c36f
4 changed files with 19 additions and 22 deletions
|
@ -39,9 +39,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Size of cacheable stacks */
|
/* Size of cacheable stacks */
|
||||||
#if DEBUG_XLAT_TABLE
|
#if IMAGE_BL1
|
||||||
# define PLATFORM_STACK_SIZE 0x800
|
|
||||||
#elif IMAGE_BL1
|
|
||||||
#if TRUSTED_BOARD_BOOT
|
#if TRUSTED_BOARD_BOOT
|
||||||
# define PLATFORM_STACK_SIZE 0x1000
|
# define PLATFORM_STACK_SIZE 0x1000
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -33,17 +33,21 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <bl_common.h>
|
#include <bl_common.h>
|
||||||
#include <cassert.h>
|
#include <cassert.h>
|
||||||
|
#include <debug.h>
|
||||||
#include <platform_def.h>
|
#include <platform_def.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <xlat_tables.h>
|
#include <xlat_tables.h>
|
||||||
|
|
||||||
|
#if LOG_LEVEL >= LOG_LEVEL_VERBOSE
|
||||||
#ifndef DEBUG_XLAT_TABLE
|
#define LVL0_SPACER ""
|
||||||
#define DEBUG_XLAT_TABLE 0
|
#define LVL1_SPACER " "
|
||||||
#endif
|
#define LVL2_SPACER " "
|
||||||
|
#define LVL3_SPACER " "
|
||||||
#if DEBUG_XLAT_TABLE
|
#define get_level_spacer(level) \
|
||||||
#define debug_print(...) printf(__VA_ARGS__)
|
(((level) == 0) ? LVL0_SPACER : \
|
||||||
|
(((level) == 1) ? LVL1_SPACER : \
|
||||||
|
(((level) == 2) ? LVL2_SPACER : LVL3_SPACER)))
|
||||||
|
#define debug_print(...) tf_printf(__VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define debug_print(...) ((void)0)
|
#define debug_print(...) ((void)0)
|
||||||
#endif
|
#endif
|
||||||
|
@ -74,12 +78,12 @@ static mmap_region_t mmap[MAX_MMAP_REGIONS + 1];
|
||||||
|
|
||||||
static void print_mmap(void)
|
static void print_mmap(void)
|
||||||
{
|
{
|
||||||
#if DEBUG_XLAT_TABLE
|
#if LOG_LEVEL >= LOG_LEVEL_VERBOSE
|
||||||
debug_print("mmap:\n");
|
debug_print("mmap:\n");
|
||||||
mmap_region_t *mm = mmap;
|
mmap_region_t *mm = mmap;
|
||||||
while (mm->size) {
|
while (mm->size) {
|
||||||
debug_print(" %010lx %010lx %10lx %x\n", mm->base_va,
|
debug_print(" VA:0x%lx PA:0x%lx size:0x%lx attr:0x%x\n",
|
||||||
mm->base_pa, mm->size, mm->attr);
|
mm->base_va, mm->base_pa, mm->size, mm->attr);
|
||||||
++mm;
|
++mm;
|
||||||
};
|
};
|
||||||
debug_print("\n");
|
debug_print("\n");
|
||||||
|
@ -209,8 +213,8 @@ static mmap_region_t *init_xlation_table(mmap_region_t *mm,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_print(" %010lx %8lx " + 6 - 2 * level, base_va,
|
debug_print("%s VA:0x%lx size:0x%x ", get_level_spacer(level),
|
||||||
level_size);
|
base_va, level_size);
|
||||||
|
|
||||||
if (mm->base_va >= base_va + level_size) {
|
if (mm->base_va >= base_va + level_size) {
|
||||||
/* Next region is after area so nothing to map yet */
|
/* Next region is after area so nothing to map yet */
|
||||||
|
|
|
@ -31,7 +31,6 @@
|
||||||
#ifndef __PLATFORM_DEF_H__
|
#ifndef __PLATFORM_DEF_H__
|
||||||
#define __PLATFORM_DEF_H__
|
#define __PLATFORM_DEF_H__
|
||||||
|
|
||||||
#define DEBUG_XLAT_TABLE 0
|
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Platform binary types for linking
|
* Platform binary types for linking
|
||||||
|
@ -44,9 +43,7 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
/* Size of cacheable stacks */
|
/* Size of cacheable stacks */
|
||||||
#if DEBUG_XLAT_TABLE
|
#if IMAGE_BL1
|
||||||
#define PLATFORM_STACK_SIZE 0x800
|
|
||||||
#elif IMAGE_BL1
|
|
||||||
#define PLATFORM_STACK_SIZE 0x440
|
#define PLATFORM_STACK_SIZE 0x440
|
||||||
#elif IMAGE_BL2
|
#elif IMAGE_BL2
|
||||||
#define PLATFORM_STACK_SIZE 0x400
|
#define PLATFORM_STACK_SIZE 0x400
|
||||||
|
|
|
@ -40,9 +40,7 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
/* Size of cacheable stacks */
|
/* Size of cacheable stacks */
|
||||||
#if DEBUG_XLAT_TABLE
|
#if IMAGE_BL31
|
||||||
#define PLATFORM_STACK_SIZE 0x800
|
|
||||||
#elif IMAGE_BL31
|
|
||||||
#define PLATFORM_STACK_SIZE 0x400
|
#define PLATFORM_STACK_SIZE 0x400
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue