summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAntonio Borneo <borneo.antonio@gmail.com>2010-06-12 11:46:56 +0800
committerØyvind Harboe <oyvind.harboe@zylin.com>2010-06-12 12:08:06 +0200
commitce58ab9a4ef7f014eac4d2e30d2b54b2c3e53895 (patch)
treec77cbe47dd7e482ec8b7d35a2c0c0300109d2e28 /src
parentdcc7de4f9b4dfa58ed8a8712c4c146a3c83aba17 (diff)
downloadopenocd_libswd-ce58ab9a4ef7f014eac4d2e30d2b54b2c3e53895.tar.gz
openocd_libswd-ce58ab9a4ef7f014eac4d2e30d2b54b2c3e53895.tar.bz2
openocd_libswd-ce58ab9a4ef7f014eac4d2e30d2b54b2c3e53895.tar.xz
openocd_libswd-ce58ab9a4ef7f014eac4d2e30d2b54b2c3e53895.zip
TARGET: fix handling return code of MMU translation
Function armv4_5_mmu_translate_va() now properly signals errors in the return value. Remove former error handling by setting variable "type" to value "-1". Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/target/arm720t.c4
-rw-r--r--src/target/arm920t.c6
-rw-r--r--src/target/arm926ejs.c4
-rw-r--r--src/target/armv4_5_mmu.c4
-rw-r--r--src/target/cortex_a8.c4
-rw-r--r--src/target/xscale.c4
6 files changed, 0 insertions, 26 deletions
diff --git a/src/target/arm720t.c b/src/target/arm720t.c
index 867eb942..e7672b45 100644
--- a/src/target/arm720t.c
+++ b/src/target/arm720t.c
@@ -264,10 +264,6 @@ static int arm720_virt2phys(struct target *target,
int retval = armv4_5_mmu_translate_va(target, &arm720t->armv4_5_mmu, virtual, &type, &cb, &domain, &ap, &ret);
if (retval != ERROR_OK)
return retval;
- if (type == -1)
- {
- return ret;
- }
*physical = ret;
return ERROR_OK;
}
diff --git a/src/target/arm920t.c b/src/target/arm920t.c
index d7096486..fe2ff015 100644
--- a/src/target/arm920t.c
+++ b/src/target/arm920t.c
@@ -519,10 +519,6 @@ static int arm920_virt2phys(struct target *target,
&arm920t->armv4_5_mmu, virt, &type, &cb, &domain, &ap, &ret);
if (retval != ERROR_OK)
return retval;
- if (type == -1)
- {
- return ret;
- }
*phys = ret;
return ERROR_OK;
}
@@ -596,8 +592,6 @@ int arm920t_write_memory(struct target *target, uint32_t address,
address, &type, &cb, &domain, &ap, &pa);
if (retval != ERROR_OK)
return retval;
- if (type == -1)
- return pa;
if (arm920t->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled)
{
diff --git a/src/target/arm926ejs.c b/src/target/arm926ejs.c
index a7aac550..bfa2ab4a 100644
--- a/src/target/arm926ejs.c
+++ b/src/target/arm926ejs.c
@@ -730,10 +730,6 @@ static int arm926ejs_virt2phys(struct target *target, uint32_t virtual, uint32_t
int retval = armv4_5_mmu_translate_va(target, &arm926ejs->armv4_5_mmu, virtual, &type, &cb, &domain, &ap, &ret);
if (retval != ERROR_OK)
return retval;
- if (type == -1)
- {
- return ret;
- }
*physical = ret;
return ERROR_OK;
}
diff --git a/src/target/armv4_5_mmu.c b/src/target/armv4_5_mmu.c
index 6990d13f..52756c11 100644
--- a/src/target/armv4_5_mmu.c
+++ b/src/target/armv4_5_mmu.c
@@ -44,14 +44,12 @@ int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *a
if ((first_lvl_descriptor & 0x3) == 0)
{
- *type = -1;
LOG_ERROR("Address translation failure");
return ERROR_TARGET_TRANSLATION_FAULT;
}
if (!armv4_5_mmu->has_tiny_pages && ((first_lvl_descriptor & 0x3) == 3))
{
- *type = -1;
LOG_ERROR("Address translation failure");
return ERROR_TARGET_TRANSLATION_FAULT;
}
@@ -94,7 +92,6 @@ int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *a
if ((second_lvl_descriptor & 0x3) == 0)
{
- *type = -1;
LOG_ERROR("Address translation failure");
return ERROR_TARGET_TRANSLATION_FAULT;
}
@@ -130,7 +127,6 @@ int armv4_5_mmu_translate_va(struct target *target, struct armv4_5_mmu_common *a
}
/* should not happen */
- *type = -1;
LOG_ERROR("Address translation failure");
return ERROR_TARGET_TRANSLATION_FAULT;
}
diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c
index 2edb9e3e..f1541792 100644
--- a/src/target/cortex_a8.c
+++ b/src/target/cortex_a8.c
@@ -1825,10 +1825,6 @@ static int cortex_a8_virt2phys(struct target *target,
/* Reset the flag. We don't want someone else to use it by error */
cortex_a8->current_address_mode = ARM_MODE_ANY;
- if (type == -1)
- {
- return ret;
- }
*phys = ret;
return ERROR_OK;
}
diff --git a/src/target/xscale.c b/src/target/xscale.c
index ab7eee3d..d16f8ec1 100644
--- a/src/target/xscale.c
+++ b/src/target/xscale.c
@@ -3230,10 +3230,6 @@ static int xscale_virt2phys(struct target *target,
int retval = armv4_5_mmu_translate_va(target, &xscale->armv4_5_mmu, virtual, &type, &cb, &domain, &ap, &ret);
if (retval != ERROR_OK)
return retval;
- if (type == -1)
- {
- return ret;
- }
*physical = ret;
return ERROR_OK;
}