summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAntonio Nino Diaz <antonio.ninodiaz@arm.com>2017-03-22 15:48:51 +0000
committerAntonio Nino Diaz <antonio.ninodiaz@arm.com>2017-04-20 09:59:12 +0100
commitaa61368eb554e9910c503f78560153805a2d6859 (patch)
treeffcdb0f2665acbfebd1d866cefb0724600162ce0 /drivers
parent044bb2faabd7981af4ef419e1037fec28e5b3f8b (diff)
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: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/arm/cci/cci.c6
-rw-r--r--drivers/arm/ccn/ccn.c6
-rw-r--r--drivers/arm/tzc/tzc_common_private.h5
-rw-r--r--drivers/arm/tzc/tzc_dmc500.c4
-rw-r--r--drivers/io/io_storage.c9
5 files changed, 16 insertions, 14 deletions
diff --git a/drivers/arm/cci/cci.c b/drivers/arm/cci/cci.c
index 2e773a98..dd39051f 100644
--- a/drivers/arm/cci/cci.c
+++ b/drivers/arm/cci/cci.c
@@ -1,5 +1,5 @@
/*
- * 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
* modification, are permitted provided that the following conditions are met:
@@ -39,7 +39,7 @@ static uintptr_t g_cci_base;
static unsigned int g_max_master_id;
static const int *g_cci_slave_if_map;
-#if DEBUG
+#if ENABLE_ASSERTIONS
static int validate_cci_map(const int *map)
{
unsigned int valid_cci_map = 0;
@@ -73,7 +73,7 @@ static int validate_cci_map(const int *map)
return 1;
}
-#endif /* DEBUG */
+#endif /* ENABLE_ASSERTIONS */
void cci_init(uintptr_t cci_base,
const int *map,
diff --git a/drivers/arm/ccn/ccn.c b/drivers/arm/ccn/ccn.c
index ca061827..16c8f607 100644
--- a/drivers/arm/ccn/ccn.c
+++ b/drivers/arm/ccn/ccn.c
@@ -81,7 +81,7 @@ static inline void ccn_reg_write(uintptr_t periphbase,
mmio_write_64(region_base + register_offset, value);
}
-#if DEBUG
+#if ENABLE_ASSERTIONS
typedef struct rn_info {
unsigned char node_desc[MAX_RN_NODES];
@@ -224,7 +224,7 @@ static void ccn_validate_plat_params(const ccn_desc_t *plat_desc)
info.node_desc[node_id]--;
}
}
-#endif /* DEBUG */
+#endif /* ENABLE_ASSERTIONS */
/*******************************************************************************
* 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)
******************************************************************************/
void ccn_init(const ccn_desc_t *plat_desc)
{
-#if DEBUG
+#if ENABLE_ASSERTIONS
ccn_validate_plat_params(plat_desc);
#endif
diff --git a/drivers/arm/tzc/tzc_common_private.h b/drivers/arm/tzc/tzc_common_private.h
index df10a1ee..ee278ec9 100644
--- a/drivers/arm/tzc/tzc_common_private.h
+++ b/drivers/arm/tzc/tzc_common_private.h
@@ -193,7 +193,8 @@
nsaid_permissions); \
}
-#if DEBUG
+#if ENABLE_ASSERTIONS
+
static inline unsigned int _tzc_read_peripheral_id(uintptr_t base)
{
unsigned int id;
@@ -235,6 +236,6 @@ static inline unsigned long long _tzc_get_max_top_addr(int addr_width)
(UINT64_MAX >> (64 - (addr_width)))
#endif /* AARCH32 */
-#endif
+#endif /* ENABLE_ASSERTIONS */
#endif /* __TZC_COMMON_PRIVATE_H__ */
diff --git a/drivers/arm/tzc/tzc_dmc500.c b/drivers/arm/tzc/tzc_dmc500.c
index 93ae9202..d696dfd9 100644
--- a/drivers/arm/tzc/tzc_dmc500.c
+++ b/drivers/arm/tzc/tzc_dmc500.c
@@ -257,7 +257,7 @@ void tzc_dmc500_set_action(tzc_action_t action)
static void validate_plat_driver_data(
const tzc_dmc500_driver_data_t *plat_driver_data)
{
-#if DEBUG
+#if ENABLE_ASSERTIONS
int i;
unsigned int dmc_id;
uintptr_t dmc_base;
@@ -273,7 +273,7 @@ static void validate_plat_driver_data(
dmc_id = _tzc_read_peripheral_id(dmc_base);
assert(dmc_id == DMC500_PERIPHERAL_ID);
}
-#endif /* DEBUG */
+#endif /* ENABLE_ASSERTIONS */
}
diff --git a/drivers/io/io_storage.c b/drivers/io/io_storage.c
index 7cb1a6aa..de8c3bf6 100644
--- a/drivers/io/io_storage.c
+++ b/drivers/io/io_storage.c
@@ -1,5 +1,5 @@
/*
- * 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
* modification, are permitted provided that the following conditions are met:
@@ -51,8 +51,8 @@ static const io_dev_info_t *devices[MAX_IO_DEVICES];
/* Number of currently registered devices */
static unsigned int dev_count;
-
-#if DEBUG /* Extra validation functions only used in debug builds */
+/* Extra validation functions only used when asserts are enabled */
+#if ENABLE_ASSERTIONS
/* Return a boolean value indicating whether a device connector is valid */
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)
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 */