Commit aa61368e authored by Antonio Nino Diaz's avatar Antonio Nino Diaz
Browse files

Control inclusion of helper code used for asserts



Many asserts depend on code that is conditionally compiled based on the
DEBUG define. This patch modifies the conditional inclusion of such code
so that it is based on the ENABLE_ASSERTIONS build option.

Change-Id: I6406674788aa7e1ad7c23d86ce94482ad3c382bd
Signed-off-by: default avatarAntonio Nino Diaz <antonio.ninodiaz@arm.com>
parent 044bb2fa
...@@ -114,7 +114,7 @@ void bl1_main(void) ...@@ -114,7 +114,7 @@ void bl1_main(void)
print_errata_status(); print_errata_status();
#if DEBUG #if ENABLE_ASSERTIONS
u_register_t val; u_register_t val;
/* /*
* Ensure that MMU/Caches and coherency are turned on * Ensure that MMU/Caches and coherency are turned on
...@@ -141,7 +141,7 @@ void bl1_main(void) ...@@ -141,7 +141,7 @@ void bl1_main(void)
assert(CACHE_WRITEBACK_GRANULE == SIZE_FROM_LOG2_WORDS(val)); assert(CACHE_WRITEBACK_GRANULE == SIZE_FROM_LOG2_WORDS(val));
else else
assert(CACHE_WRITEBACK_GRANULE <= MAX_CACHE_LINE_SIZE); assert(CACHE_WRITEBACK_GRANULE <= MAX_CACHE_LINE_SIZE);
#endif #endif /* ENABLE_ASSERTIONS */
/* Perform remaining generic architectural setup from EL3 */ /* Perform remaining generic architectural setup from EL3 */
bl1_arch_setup(); bl1_arch_setup();
......
/* /*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2015-2017, ARM Limited and Contributors. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
...@@ -39,7 +39,7 @@ static uintptr_t g_cci_base; ...@@ -39,7 +39,7 @@ static uintptr_t g_cci_base;
static unsigned int g_max_master_id; static unsigned int g_max_master_id;
static const int *g_cci_slave_if_map; static const int *g_cci_slave_if_map;
#if DEBUG #if ENABLE_ASSERTIONS
static int validate_cci_map(const int *map) static int validate_cci_map(const int *map)
{ {
unsigned int valid_cci_map = 0; unsigned int valid_cci_map = 0;
...@@ -73,7 +73,7 @@ static int validate_cci_map(const int *map) ...@@ -73,7 +73,7 @@ static int validate_cci_map(const int *map)
return 1; return 1;
} }
#endif /* DEBUG */ #endif /* ENABLE_ASSERTIONS */
void cci_init(uintptr_t cci_base, void cci_init(uintptr_t cci_base,
const int *map, const int *map,
......
...@@ -81,7 +81,7 @@ static inline void ccn_reg_write(uintptr_t periphbase, ...@@ -81,7 +81,7 @@ static inline void ccn_reg_write(uintptr_t periphbase,
mmio_write_64(region_base + register_offset, value); mmio_write_64(region_base + register_offset, value);
} }
#if DEBUG #if ENABLE_ASSERTIONS
typedef struct rn_info { typedef struct rn_info {
unsigned char node_desc[MAX_RN_NODES]; unsigned char node_desc[MAX_RN_NODES];
...@@ -224,7 +224,7 @@ static void ccn_validate_plat_params(const ccn_desc_t *plat_desc) ...@@ -224,7 +224,7 @@ static void ccn_validate_plat_params(const ccn_desc_t *plat_desc)
info.node_desc[node_id]--; info.node_desc[node_id]--;
} }
} }
#endif /* DEBUG */ #endif /* ENABLE_ASSERTIONS */
/******************************************************************************* /*******************************************************************************
* This function validates parameters passed by the platform (in a debug build) * This function validates parameters passed by the platform (in a debug build)
...@@ -234,7 +234,7 @@ static void ccn_validate_plat_params(const ccn_desc_t *plat_desc) ...@@ -234,7 +234,7 @@ static void ccn_validate_plat_params(const ccn_desc_t *plat_desc)
******************************************************************************/ ******************************************************************************/
void ccn_init(const ccn_desc_t *plat_desc) void ccn_init(const ccn_desc_t *plat_desc)
{ {
#if DEBUG #if ENABLE_ASSERTIONS
ccn_validate_plat_params(plat_desc); ccn_validate_plat_params(plat_desc);
#endif #endif
......
...@@ -193,7 +193,8 @@ ...@@ -193,7 +193,8 @@
nsaid_permissions); \ nsaid_permissions); \
} }
#if DEBUG #if ENABLE_ASSERTIONS
static inline unsigned int _tzc_read_peripheral_id(uintptr_t base) static inline unsigned int _tzc_read_peripheral_id(uintptr_t base)
{ {
unsigned int id; unsigned int id;
...@@ -235,6 +236,6 @@ static inline unsigned long long _tzc_get_max_top_addr(int addr_width) ...@@ -235,6 +236,6 @@ static inline unsigned long long _tzc_get_max_top_addr(int addr_width)
(UINT64_MAX >> (64 - (addr_width))) (UINT64_MAX >> (64 - (addr_width)))
#endif /* AARCH32 */ #endif /* AARCH32 */
#endif #endif /* ENABLE_ASSERTIONS */
#endif /* __TZC_COMMON_PRIVATE_H__ */ #endif /* __TZC_COMMON_PRIVATE_H__ */
...@@ -257,7 +257,7 @@ void tzc_dmc500_set_action(tzc_action_t action) ...@@ -257,7 +257,7 @@ void tzc_dmc500_set_action(tzc_action_t action)
static void validate_plat_driver_data( static void validate_plat_driver_data(
const tzc_dmc500_driver_data_t *plat_driver_data) const tzc_dmc500_driver_data_t *plat_driver_data)
{ {
#if DEBUG #if ENABLE_ASSERTIONS
int i; int i;
unsigned int dmc_id; unsigned int dmc_id;
uintptr_t dmc_base; uintptr_t dmc_base;
...@@ -273,7 +273,7 @@ static void validate_plat_driver_data( ...@@ -273,7 +273,7 @@ static void validate_plat_driver_data(
dmc_id = _tzc_read_peripheral_id(dmc_base); dmc_id = _tzc_read_peripheral_id(dmc_base);
assert(dmc_id == DMC500_PERIPHERAL_ID); assert(dmc_id == DMC500_PERIPHERAL_ID);
} }
#endif /* DEBUG */ #endif /* ENABLE_ASSERTIONS */
} }
......
/* /*
* Copyright (c) 2014, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2014-2017, ARM Limited and Contributors. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
...@@ -51,8 +51,8 @@ static const io_dev_info_t *devices[MAX_IO_DEVICES]; ...@@ -51,8 +51,8 @@ static const io_dev_info_t *devices[MAX_IO_DEVICES];
/* Number of currently registered devices */ /* Number of currently registered devices */
static unsigned int dev_count; static unsigned int dev_count;
/* Extra validation functions only used when asserts are enabled */
#if DEBUG /* Extra validation functions only used in debug builds */ #if ENABLE_ASSERTIONS
/* Return a boolean value indicating whether a device connector is valid */ /* Return a boolean value indicating whether a device connector is valid */
static int is_valid_dev_connector(const io_dev_connector_t *dev_con) static int is_valid_dev_connector(const io_dev_connector_t *dev_con)
...@@ -89,7 +89,8 @@ static int is_valid_seek_mode(io_seek_mode_t mode) ...@@ -89,7 +89,8 @@ static int is_valid_seek_mode(io_seek_mode_t mode)
return ((mode != IO_SEEK_INVALID) && (mode < IO_SEEK_MAX)); return ((mode != IO_SEEK_INVALID) && (mode < IO_SEEK_MAX));
} }
#endif /* End of debug-only validation functions */ #endif /* ENABLE_ASSERTIONS */
/* End of extra validation functions only used when asserts are enabled */
/* Open a connection to a specific device */ /* Open a connection to a specific device */
......
...@@ -87,7 +87,7 @@ void cm_set_context_by_mpidr(uint64_t mpidr, ...@@ -87,7 +87,7 @@ void cm_set_context_by_mpidr(uint64_t mpidr,
******************************************************************************/ ******************************************************************************/
static inline void cm_set_next_context(void *context) static inline void cm_set_next_context(void *context)
{ {
#if DEBUG #if ENABLE_ASSERTIONS
uint64_t sp_mode; uint64_t sp_mode;
/* /*
...@@ -98,7 +98,7 @@ static inline void cm_set_next_context(void *context) ...@@ -98,7 +98,7 @@ static inline void cm_set_next_context(void *context)
: "=r" (sp_mode)); : "=r" (sp_mode));
assert(sp_mode == MODE_SP_EL0); assert(sp_mode == MODE_SP_EL0);
#endif #endif /* ENABLE_ASSERTIONS */
__asm__ volatile("msr spsel, #1\n" __asm__ volatile("msr spsel, #1\n"
"mov sp, %0\n" "mov sp, %0\n"
......
/* /*
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
...@@ -85,13 +85,13 @@ ...@@ -85,13 +85,13 @@
static uint64_t base_xlation_table[NUM_BASE_LEVEL_ENTRIES] static uint64_t base_xlation_table[NUM_BASE_LEVEL_ENTRIES]
__aligned(NUM_BASE_LEVEL_ENTRIES * sizeof(uint64_t)); __aligned(NUM_BASE_LEVEL_ENTRIES * sizeof(uint64_t));
#if DEBUG #if ENABLE_ASSERTIONS
static unsigned long long get_max_supported_pa(void) static unsigned long long get_max_supported_pa(void)
{ {
/* Physical address space size for long descriptor format. */ /* Physical address space size for long descriptor format. */
return (1ULL << 40) - 1ULL; return (1ULL << 40) - 1ULL;
} }
#endif #endif /* ENABLE_ASSERTIONS */
void init_xlat_tables(void) void init_xlat_tables(void)
{ {
......
...@@ -127,7 +127,7 @@ static unsigned long long calc_physical_addr_size_bits( ...@@ -127,7 +127,7 @@ static unsigned long long calc_physical_addr_size_bits(
return TCR_PS_BITS_4GB; return TCR_PS_BITS_4GB;
} }
#if DEBUG #if ENABLE_ASSERTIONS
/* Physical Address ranges supported in the AArch64 Memory Model */ /* Physical Address ranges supported in the AArch64 Memory Model */
static const unsigned int pa_range_bits_arr[] = { static const unsigned int pa_range_bits_arr[] = {
PARANGE_0000, PARANGE_0001, PARANGE_0010, PARANGE_0011, PARANGE_0100, PARANGE_0000, PARANGE_0001, PARANGE_0010, PARANGE_0011, PARANGE_0100,
...@@ -144,7 +144,7 @@ static unsigned long long get_max_supported_pa(void) ...@@ -144,7 +144,7 @@ static unsigned long long get_max_supported_pa(void)
return (1ULL << pa_range_bits_arr[pa_range]) - 1ULL; return (1ULL << pa_range_bits_arr[pa_range]) - 1ULL;
} }
#endif #endif /* ENABLE_ASSERTIONS */
void init_xlat_tables(void) void init_xlat_tables(void)
{ {
......
/* /*
* Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. * Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met: * modification, are permitted provided that the following conditions are met:
...@@ -109,7 +109,7 @@ void mmap_add_region(unsigned long long base_pa, uintptr_t base_va, ...@@ -109,7 +109,7 @@ void mmap_add_region(unsigned long long base_pa, uintptr_t base_va,
assert((base_pa + (unsigned long long)size - 1ULL) <= assert((base_pa + (unsigned long long)size - 1ULL) <=
(PLAT_PHY_ADDR_SPACE_SIZE - 1)); (PLAT_PHY_ADDR_SPACE_SIZE - 1));
#if DEBUG #if ENABLE_ASSERTIONS
/* Check for PAs and VAs overlaps with all other regions */ /* Check for PAs and VAs overlaps with all other regions */
for (mm = mmap; mm->size; ++mm) { for (mm = mmap; mm->size; ++mm) {
...@@ -154,7 +154,7 @@ void mmap_add_region(unsigned long long base_pa, uintptr_t base_va, ...@@ -154,7 +154,7 @@ void mmap_add_region(unsigned long long base_pa, uintptr_t base_va,
mm = mmap; /* Restore pointer to the start of the array */ mm = mmap; /* Restore pointer to the start of the array */
#endif /* DEBUG */ #endif /* ENABLE_ASSERTIONS */
/* Find correct place in mmap to insert new region */ /* Find correct place in mmap to insert new region */
while (mm->base_va < base_va && mm->size) while (mm->base_va < base_va && mm->size)
......
...@@ -37,13 +37,13 @@ ...@@ -37,13 +37,13 @@
#include <xlat_tables_v2.h> #include <xlat_tables_v2.h>
#include "../xlat_tables_private.h" #include "../xlat_tables_private.h"
#if DEBUG #if ENABLE_ASSERTIONS
static unsigned long long xlat_arch_get_max_supported_pa(void) static unsigned long long xlat_arch_get_max_supported_pa(void)
{ {
/* Physical address space size for long descriptor format. */ /* Physical address space size for long descriptor format. */
return (1ull << 40) - 1ull; return (1ull << 40) - 1ull;
} }
#endif /* DEBUG*/ #endif /* ENABLE_ASSERTIONS*/
int is_mmu_enabled(void) int is_mmu_enabled(void)
{ {
......
...@@ -77,7 +77,7 @@ static unsigned long long calc_physical_addr_size_bits( ...@@ -77,7 +77,7 @@ static unsigned long long calc_physical_addr_size_bits(
return TCR_PS_BITS_4GB; return TCR_PS_BITS_4GB;
} }
#if DEBUG #if ENABLE_ASSERTIONS
/* Physical Address ranges supported in the AArch64 Memory Model */ /* Physical Address ranges supported in the AArch64 Memory Model */
static const unsigned int pa_range_bits_arr[] = { static const unsigned int pa_range_bits_arr[] = {
PARANGE_0000, PARANGE_0001, PARANGE_0010, PARANGE_0011, PARANGE_0100, PARANGE_0000, PARANGE_0001, PARANGE_0010, PARANGE_0011, PARANGE_0100,
...@@ -94,7 +94,7 @@ unsigned long long xlat_arch_get_max_supported_pa(void) ...@@ -94,7 +94,7 @@ unsigned long long xlat_arch_get_max_supported_pa(void)
return (1ull << pa_range_bits_arr[pa_range]) - 1ull; return (1ull << pa_range_bits_arr[pa_range]) - 1ull;
} }
#endif /* DEBUG*/ #endif /* ENABLE_ASSERTIONS*/
int is_mmu_enabled(void) int is_mmu_enabled(void)
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment