diff options
-rw-r--r-- | src/arch/arm64/armv8/mmu.c | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/src/arch/arm64/armv8/mmu.c b/src/arch/arm64/armv8/mmu.c index 0f84146a2b..65d0f92e5d 100644 --- a/src/arch/arm64/armv8/mmu.c +++ b/src/arch/arm64/armv8/mmu.c @@ -11,6 +11,9 @@ #include <arch/mmu.h> #include <console/console.h> +/* 12 hex digits (48 bits VA) plus 1 for exclusive upper bound. */ +#define ADDR_FMT "0x%013lx" + /* This just caches the next free table slot (okay to do since they fill up from * bottom to top and can never be freed up again). It will reset to its initial * value on stage transition, so we still need to check it for UNUSED_DESC. */ @@ -54,6 +57,25 @@ static uint64_t get_block_attr(unsigned long tag) return attr; } +/* Func : table_level_name + * Desc : Get the descriptions table level name from the given size. + */ +static const char *table_level_name(size_t xlat_size) +{ + switch (xlat_size) { + case L0_XLAT_SIZE: + return "L0"; + case L1_XLAT_SIZE: + return "L1"; + case L2_XLAT_SIZE: + return "L2"; + case L3_XLAT_SIZE: + return "L3"; + default: + return ""; + } +} + /* Func : setup_new_table * Desc : Get next free table from TTB and set it up to match old parent entry. */ @@ -66,9 +88,12 @@ static uint64_t *setup_new_table(uint64_t desc, size_t xlat_size) } void *frame_base = (void *)(desc & XLAT_ADDR_MASK); - printk(BIOS_DEBUG, "Backing address range [%p:%p) with new page" - " table @%p\n", frame_base, frame_base + - (xlat_size << BITS_RESOLVED_PER_LVL), next_free_table); + const char *level_name = table_level_name(xlat_size); + printk(BIOS_DEBUG, + "Backing address range [" ADDR_FMT ":" ADDR_FMT ") with new %s table @%p\n", + (uintptr_t)frame_base, + (uintptr_t)frame_base + (xlat_size << BITS_RESOLVED_PER_LVL), + level_name, next_free_table); if (!desc) { memset(next_free_table, 0, GRANULE_SIZE); @@ -213,8 +238,8 @@ void mmu_config_range(void *start, size_t size, uint64_t tag) uint64_t base_addr = (uintptr_t)start; uint64_t temp_size = size; - printk(BIOS_INFO, "Mapping address range [%p:%p) as ", - start, start + size); + printk(BIOS_INFO, "Mapping address range [" ADDR_FMT ":" ADDR_FMT ") as ", + (uintptr_t)start, (uintptr_t)start + size); print_tag(BIOS_INFO, tag); sanity_check(base_addr, temp_size); |