summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJuan Castillo <juan.castillo@arm.com>2014-06-05 09:45:36 +0100
committerJuan Castillo <juan.castillo@arm.com>2014-07-28 12:20:16 +0100
commitd3280beb700321b0ef47b4f61d84667ba501bc61 (patch)
tree8a6c3f70a6f8d289256ac3fb940ea07a339072a1 /drivers
parent592dd7cbe658cc33ae2818c9ed543ac57e97f784 (diff)
Rework incorrect use of assert() and panic() in codebase
Assert a valid security state using the macro sec_state_is_valid(). Replace assert() with panic() in those cases that might arise because of runtime errors and not programming errors. Replace panic() with assert() in those cases that might arise because of programming errors. Fixes ARM-software/tf-issues#96 Change-Id: I51e9ef0439fd5ff5e0edfef49050b69804bf14d5
Diffstat (limited to 'drivers')
-rw-r--r--drivers/arm/gic/arm_gic.c2
-rw-r--r--drivers/arm/tzc400/tzc400.c9
2 files changed, 9 insertions, 2 deletions
diff --git a/drivers/arm/gic/arm_gic.c b/drivers/arm/gic/arm_gic.c
index 636348ba..86aaa9a1 100644
--- a/drivers/arm/gic/arm_gic.c
+++ b/drivers/arm/gic/arm_gic.c
@@ -322,7 +322,7 @@ uint32_t arm_gic_interrupt_type_to_line(uint32_t type,
type == INTR_TYPE_EL3 ||
type == INTR_TYPE_NS);
- assert(security_state == NON_SECURE || security_state == SECURE);
+ assert(sec_state_is_valid(security_state));
/*
* We ignore the security state parameter under the assumption that
diff --git a/drivers/arm/tzc400/tzc400.c b/drivers/arm/tzc400/tzc400.c
index c1716db4..715ea6c0 100644
--- a/drivers/arm/tzc400/tzc400.c
+++ b/drivers/arm/tzc400/tzc400.c
@@ -103,7 +103,7 @@ static uint32_t tzc_get_gate_keeper(uint64_t base, uint8_t filter)
tmp = (tzc_read_gate_keeper(base) >> GATE_KEEPER_OS_SHIFT) &
GATE_KEEPER_OS_MASK;
- return tmp >> filter;
+ return (tmp >> filter) & GATE_KEEPER_FILTER_MASK;
}
/* This function is not MP safe. */
@@ -241,6 +241,13 @@ void tzc_enable_filters(const tzc_instance_t *controller)
for (filter = 0; filter < controller->num_filters; filter++) {
state = tzc_get_gate_keeper(controller->base, filter);
if (state) {
+ /* The TZC filter is already configured. Changing the
+ * programmer's view in an active system can cause
+ * unpredictable behavior therefore panic for now rather
+ * than try to determine whether this is safe in this
+ * instance. See:
+ * http://infocenter.arm.com/help/index.jsp?\
+ * topic=/com.arm.doc.ddi0504c/CJHHECBF.html */
ERROR("TZC : Filter %d Gatekeeper already enabled.\n",
filter);
panic();