Gary Morrison | 3d7f654 | 2021-01-27 13:08:47 -0600 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2021, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <assert.h> |
| 8 | #include <errno.h> |
| 9 | #include <stdbool.h> |
| 10 | #include <stdint.h> |
| 11 | #include <stdio.h> |
| 12 | |
| 13 | #include <common/debug.h> |
| 14 | #include <lib/utils_def.h> |
| 15 | #include <lib/xlat_tables/xlat_tables_defs.h> |
| 16 | #include <lib/xlat_tables/xlat_tables_v2.h> |
| 17 | #include "xlat_mpu_private.h" |
| 18 | |
| 19 | #include <fvp_r_arch_helpers.h> |
| 20 | #include <platform_def.h> |
| 21 | |
| 22 | #warning "xlat_mpu library is currently experimental and its API may change in future." |
| 23 | |
| 24 | |
| 25 | #if LOG_LEVEL < LOG_LEVEL_VERBOSE |
| 26 | |
| 27 | void xlat_mmap_print(__unused const mmap_region_t *mmap) |
| 28 | { |
| 29 | /* Empty */ |
| 30 | } |
| 31 | |
| 32 | void xlat_tables_print(__unused xlat_ctx_t *ctx) |
| 33 | { |
| 34 | /* Empty */ |
| 35 | } |
| 36 | |
| 37 | #else /* if LOG_LEVEL >= LOG_LEVEL_VERBOSE */ |
| 38 | |
| 39 | static const char *invalid_descriptors_ommited = |
| 40 | "%s(%d invalid descriptors omitted)\n"; |
| 41 | |
| 42 | void xlat_tables_print(xlat_ctx_t *ctx) |
| 43 | { |
| 44 | const char *xlat_regime_str; |
| 45 | int used_page_tables; |
| 46 | |
| 47 | if (ctx->xlat_regime == EL1_EL0_REGIME) { |
| 48 | xlat_regime_str = "1&0"; |
| 49 | } else if (ctx->xlat_regime == EL2_REGIME) { |
| 50 | xlat_regime_str = "2"; |
| 51 | } else { |
| 52 | assert(ctx->xlat_regime == EL3_REGIME); |
| 53 | xlat_regime_str = "3"; |
| 54 | /* If no EL3 and EL3 tables generated, then need to know. */ |
| 55 | } |
| 56 | VERBOSE("Translation tables state:\n"); |
| 57 | VERBOSE(" Xlat regime: EL%s\n", xlat_regime_str); |
| 58 | VERBOSE(" Max allowed PA: 0x%llx\n", ctx->pa_max_address); |
| 59 | VERBOSE(" Max allowed VA: 0x%lx\n", ctx->va_max_address); |
| 60 | VERBOSE(" Max mapped PA: 0x%llx\n", ctx->max_pa); |
| 61 | VERBOSE(" Max mapped VA: 0x%lx\n", ctx->max_va); |
| 62 | |
| 63 | VERBOSE(" Initial lookup level: %u\n", ctx->base_level); |
| 64 | VERBOSE(" Entries @initial lookup level: %u\n", |
| 65 | ctx->base_table_entries); |
| 66 | |
| 67 | xlat_tables_print_internal(ctx, 0U, ctx->base_table, |
| 68 | ctx->base_table_entries, ctx->base_level); |
| 69 | } |
| 70 | |
| 71 | #endif /* LOG_LEVEL >= LOG_LEVEL_VERBOSE */ |