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>
This commit is contained in:
parent
dcc7de4f9b
commit
ce58ab9a4e
|
@ -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);
|
int retval = armv4_5_mmu_translate_va(target, &arm720t->armv4_5_mmu, virtual, &type, &cb, &domain, &ap, &ret);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
if (type == -1)
|
|
||||||
{
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
*physical = ret;
|
*physical = ret;
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -519,10 +519,6 @@ static int arm920_virt2phys(struct target *target,
|
||||||
&arm920t->armv4_5_mmu, virt, &type, &cb, &domain, &ap, &ret);
|
&arm920t->armv4_5_mmu, virt, &type, &cb, &domain, &ap, &ret);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
if (type == -1)
|
|
||||||
{
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
*phys = ret;
|
*phys = ret;
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -596,8 +592,6 @@ int arm920t_write_memory(struct target *target, uint32_t address,
|
||||||
address, &type, &cb, &domain, &ap, &pa);
|
address, &type, &cb, &domain, &ap, &pa);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
if (type == -1)
|
|
||||||
return pa;
|
|
||||||
|
|
||||||
if (arm920t->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled)
|
if (arm920t->armv4_5_mmu.armv4_5_cache.d_u_cache_enabled)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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);
|
int retval = armv4_5_mmu_translate_va(target, &arm926ejs->armv4_5_mmu, virtual, &type, &cb, &domain, &ap, &ret);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
if (type == -1)
|
|
||||||
{
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
*physical = ret;
|
*physical = ret;
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
if ((first_lvl_descriptor & 0x3) == 0)
|
||||||
{
|
{
|
||||||
*type = -1;
|
|
||||||
LOG_ERROR("Address translation failure");
|
LOG_ERROR("Address translation failure");
|
||||||
return ERROR_TARGET_TRANSLATION_FAULT;
|
return ERROR_TARGET_TRANSLATION_FAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!armv4_5_mmu->has_tiny_pages && ((first_lvl_descriptor & 0x3) == 3))
|
if (!armv4_5_mmu->has_tiny_pages && ((first_lvl_descriptor & 0x3) == 3))
|
||||||
{
|
{
|
||||||
*type = -1;
|
|
||||||
LOG_ERROR("Address translation failure");
|
LOG_ERROR("Address translation failure");
|
||||||
return ERROR_TARGET_TRANSLATION_FAULT;
|
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)
|
if ((second_lvl_descriptor & 0x3) == 0)
|
||||||
{
|
{
|
||||||
*type = -1;
|
|
||||||
LOG_ERROR("Address translation failure");
|
LOG_ERROR("Address translation failure");
|
||||||
return ERROR_TARGET_TRANSLATION_FAULT;
|
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 */
|
/* should not happen */
|
||||||
*type = -1;
|
|
||||||
LOG_ERROR("Address translation failure");
|
LOG_ERROR("Address translation failure");
|
||||||
return ERROR_TARGET_TRANSLATION_FAULT;
|
return ERROR_TARGET_TRANSLATION_FAULT;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 */
|
/* Reset the flag. We don't want someone else to use it by error */
|
||||||
cortex_a8->current_address_mode = ARM_MODE_ANY;
|
cortex_a8->current_address_mode = ARM_MODE_ANY;
|
||||||
|
|
||||||
if (type == -1)
|
|
||||||
{
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
*phys = ret;
|
*phys = ret;
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
int retval = armv4_5_mmu_translate_va(target, &xscale->armv4_5_mmu, virtual, &type, &cb, &domain, &ap, &ret);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
if (type == -1)
|
|
||||||
{
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
*physical = ret;
|
*physical = ret;
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue