Commit 5c0e8efa authored by ntfreak's avatar ntfreak
Browse files

- Fixed bug in pathmove for XScale

- added virtual address to working_area.
- Improved error messages in a number of places
- Added ERROR_COMMAND_SYNTAX_ERROR that commands can return to have syntax printed
- Added help for some config commands
- Added verification of sw breakpoints with ERROR() message
- Removed a couple of exit()'s and replaced with error message
- cosmetic fix to armv4_5.c, easier to read
- added polymorphic(with default) virt2phys and mmu enable query function to target.h
- added virt2phys command that uses target->type->virt2phys() fn
Thanks to Øyvind Harboe

git-svn-id: svn://svn.berlios.de/openocd/trunk@310 b42882b7-edfa-0310-969c-e2dbd0fdcd60
parent b02d64a1
...@@ -87,7 +87,7 @@ int flash_register_commands(struct command_context_s *cmd_ctx) ...@@ -87,7 +87,7 @@ int flash_register_commands(struct command_context_s *cmd_ctx)
{ {
flash_cmd = register_command(cmd_ctx, NULL, "flash", NULL, COMMAND_ANY, NULL); flash_cmd = register_command(cmd_ctx, NULL, "flash", NULL, COMMAND_ANY, NULL);
register_command(cmd_ctx, flash_cmd, "bank", handle_flash_bank_command, COMMAND_CONFIG, NULL); register_command(cmd_ctx, flash_cmd, "bank", handle_flash_bank_command, COMMAND_CONFIG, "flash_bank <driver> <base> <size> <chip_width> <bus_width> <target> [driver_options ...]");
register_command(cmd_ctx, flash_cmd, "auto_erase", handle_flash_auto_erase_command, COMMAND_ANY, register_command(cmd_ctx, flash_cmd, "auto_erase", handle_flash_auto_erase_command, COMMAND_ANY,
"auto erase flash sectors <on|off>"); "auto erase flash sectors <on|off>");
return ERROR_OK; return ERROR_OK;
...@@ -160,8 +160,6 @@ flash_bank_t *get_flash_bank_by_num(int num) ...@@ -160,8 +160,6 @@ flash_bank_t *get_flash_bank_by_num(int num)
return p; return p;
} }
/* flash_bank <driver> <base> <size> <chip_width> <bus_width> <target> [driver_options ...]
*/
int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc) int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc)
{ {
int i; int i;
...@@ -170,9 +168,7 @@ int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char ...@@ -170,9 +168,7 @@ int handle_flash_bank_command(struct command_context_s *cmd_ctx, char *cmd, char
if (argc < 6) if (argc < 6)
{ {
WARNING("incomplete flash_bank configuration"); return ERROR_COMMAND_SYNTAX_ERROR;
WARNING("flash_bank <driver> <base> <size> <chip_width> <bus_width> <target> [driver_options ...]");
return ERROR_OK;
} }
if ((target = get_target_by_num(strtoul(args[5], NULL, 0))) == NULL) if ((target = get_target_by_num(strtoul(args[5], NULL, 0))) == NULL)
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
void command_print_help_line(command_context_t* context, struct command_s *command, int indent);
int handle_sleep_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int handle_sleep_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int build_unique_lengths(command_context_t *context, command_t *commands) int build_unique_lengths(command_context_t *context, command_t *commands)
...@@ -345,7 +347,13 @@ int find_and_run_command(command_context_t *context, command_t *commands, char * ...@@ -345,7 +347,13 @@ int find_and_run_command(command_context_t *context, command_t *commands, char *
} }
else else
{ {
return c->handler(context, c->name, words + start_word + 1, num_words - start_word - 1); int retval = c->handler(context, c->name, words + start_word + 1, num_words - start_word - 1);
if (retval == ERROR_COMMAND_SYNTAX_ERROR)
{
command_print(context, "Syntax error:");
command_print_help_line(context, c, 0);
}
return retval;
} }
} }
else else
......
...@@ -63,5 +63,6 @@ extern int command_run_file(command_context_t *context, FILE *file, enum command ...@@ -63,5 +63,6 @@ extern int command_run_file(command_context_t *context, FILE *file, enum command
#define ERROR_COMMAND_CLOSE_CONNECTION (-600) #define ERROR_COMMAND_CLOSE_CONNECTION (-600)
#define ERROR_COMMAND_SYNTAX_ERROR (-601)
#endif /* COMMAND_H */ #endif /* COMMAND_H */
...@@ -186,17 +186,33 @@ int arm7_9_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint) ...@@ -186,17 +186,33 @@ int arm7_9_set_breakpoint(struct target_s *target, breakpoint_t *breakpoint)
{ {
if (breakpoint->length == 4) if (breakpoint->length == 4)
{ {
u32 verify = 0xffffffff;
/* keep the original instruction in target endianness */ /* keep the original instruction in target endianness */
target->type->read_memory(target, breakpoint->address, 4, 1, breakpoint->orig_instr); target->type->read_memory(target, breakpoint->address, 4, 1, breakpoint->orig_instr);
/* write the breakpoint instruction in target endianness (arm7_9->arm_bkpt is host endian) */ /* write the breakpoint instruction in target endianness (arm7_9->arm_bkpt is host endian) */
target_write_u32(target, breakpoint->address, arm7_9->arm_bkpt); target_write_u32(target, breakpoint->address, arm7_9->arm_bkpt);
target->type->read_memory(target, breakpoint->address, 4, 1, (u8 *)&verify);
if (verify != arm7_9->arm_bkpt)
{
ERROR("Unable to set 32 bit software breakpoint at address %08x", breakpoint->address);
return ERROR_OK;
}
} }
else else
{ {
u16 verify = 0xffff;
/* keep the original instruction in target endianness */ /* keep the original instruction in target endianness */
target->type->read_memory(target, breakpoint->address, 2, 1, breakpoint->orig_instr); target->type->read_memory(target, breakpoint->address, 2, 1, breakpoint->orig_instr);
/* write the breakpoint instruction in target endianness (arm7_9->thumb_bkpt is host endian) */ /* write the breakpoint instruction in target endianness (arm7_9->thumb_bkpt is host endian) */
target_write_u16(target, breakpoint->address, arm7_9->thumb_bkpt); target_write_u16(target, breakpoint->address, arm7_9->thumb_bkpt);
target->type->read_memory(target, breakpoint->address, 2, 1, (u8 *)&verify);
if (verify != arm7_9->thumb_bkpt)
{
ERROR("Unable to set thumb software breakpoint at address %08x", breakpoint->address);
return ERROR_OK;
}
} }
breakpoint->set = 1; breakpoint->set = 1;
} }
...@@ -1914,7 +1930,7 @@ int arm7_9_read_memory(struct target_s *target, u32 address, u32 size, u32 count ...@@ -1914,7 +1930,7 @@ int arm7_9_read_memory(struct target_s *target, u32 address, u32 size, u32 count
if ((retval = jtag_execute_queue()) != ERROR_OK) if ((retval = jtag_execute_queue()) != ERROR_OK)
{ {
ERROR("JTAG error while reading cpsr"); ERROR("JTAG error while reading cpsr");
exit(-1); return ERROR_TARGET_DATA_ABORT;
} }
if (((cpsr & 0x1f) == ARMV4_5_MODE_ABT) && (armv4_5->core_mode != ARMV4_5_MODE_ABT)) if (((cpsr & 0x1f) == ARMV4_5_MODE_ABT) && (armv4_5->core_mode != ARMV4_5_MODE_ABT))
...@@ -1943,7 +1959,9 @@ int arm7_9_write_memory(struct target_s *target, u32 address, u32 size, u32 coun ...@@ -1943,7 +1959,9 @@ int arm7_9_write_memory(struct target_s *target, u32 address, u32 size, u32 coun
int retval; int retval;
int last_reg = 0; int last_reg = 0;
#ifdef _DEBUG_ARM7_9_
DEBUG("address: 0x%8.8x, size: 0x%8.8x, count: 0x%8.8x", address, size, count); DEBUG("address: 0x%8.8x, size: 0x%8.8x, count: 0x%8.8x", address, size, count);
#endif
if (target->state != TARGET_HALTED) if (target->state != TARGET_HALTED)
{ {
...@@ -2079,7 +2097,7 @@ int arm7_9_write_memory(struct target_s *target, u32 address, u32 size, u32 coun ...@@ -2079,7 +2097,7 @@ int arm7_9_write_memory(struct target_s *target, u32 address, u32 size, u32 coun
if ((retval = jtag_execute_queue()) != ERROR_OK) if ((retval = jtag_execute_queue()) != ERROR_OK)
{ {
ERROR("JTAG error while reading cpsr"); ERROR("JTAG error while reading cpsr");
exit(-1); return ERROR_TARGET_DATA_ABORT;
} }
if (((cpsr & 0x1f) == ARMV4_5_MODE_ABT) && (armv4_5->core_mode != ARMV4_5_MODE_ABT)) if (((cpsr & 0x1f) == ARMV4_5_MODE_ABT) && (armv4_5->core_mode != ARMV4_5_MODE_ABT))
......
...@@ -174,14 +174,14 @@ int armv4_5_mode_to_number(enum armv4_5_mode mode) ...@@ -174,14 +174,14 @@ int armv4_5_mode_to_number(enum armv4_5_mode mode)
{ {
switch (mode) switch (mode)
{ {
case 16: return 0; break; case ARMV4_5_MODE_USR: return 0; break;
case 17: return 1; break; case ARMV4_5_MODE_FIQ: return 1; break;
case 18: return 2; break; case ARMV4_5_MODE_IRQ: return 2; break;
case 19: return 3; break; case ARMV4_5_MODE_SVC: return 3; break;
case 23: return 4; break; case ARMV4_5_MODE_ABT: return 4; break;
case 27: return 5; break; case ARMV4_5_MODE_UND: return 5; break;
case 31: return 6; break; case ARMV4_5_MODE_SYS: return 6; break;
case -1: return 0; break; /* map MODE_ANY to user mode */ case ARMV4_5_MODE_ANY: return 0; break; /* map MODE_ANY to user mode */
default: default:
ERROR("invalid mode value encountered"); ERROR("invalid mode value encountered");
return -1; return -1;
......
...@@ -54,12 +54,14 @@ u32 armv4_5_mmu_translate_va(target_t *target, armv4_5_mmu_common_t *armv4_5_mmu ...@@ -54,12 +54,14 @@ u32 armv4_5_mmu_translate_va(target_t *target, armv4_5_mmu_common_t *armv4_5_mmu
if ((first_lvl_descriptor & 0x3) == 0) if ((first_lvl_descriptor & 0x3) == 0)
{ {
*type = -1; *type = -1;
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; *type = -1;
ERROR("Address translation failure");
return ERROR_TARGET_TRANSLATION_FAULT; return ERROR_TARGET_TRANSLATION_FAULT;
} }
...@@ -97,6 +99,7 @@ u32 armv4_5_mmu_translate_va(target_t *target, armv4_5_mmu_common_t *armv4_5_mmu ...@@ -97,6 +99,7 @@ u32 armv4_5_mmu_translate_va(target_t *target, armv4_5_mmu_common_t *armv4_5_mmu
if ((second_lvl_descriptor & 0x3) == 0) if ((second_lvl_descriptor & 0x3) == 0)
{ {
*type = -1; *type = -1;
ERROR("Address translation failure");
return ERROR_TARGET_TRANSLATION_FAULT; return ERROR_TARGET_TRANSLATION_FAULT;
} }
...@@ -129,6 +132,7 @@ u32 armv4_5_mmu_translate_va(target_t *target, armv4_5_mmu_common_t *armv4_5_mmu ...@@ -129,6 +132,7 @@ u32 armv4_5_mmu_translate_va(target_t *target, armv4_5_mmu_common_t *armv4_5_mmu
/* should not happen */ /* should not happen */
*type = -1; *type = -1;
ERROR("Address translation failure");
return ERROR_TARGET_TRANSLATION_FAULT; return ERROR_TARGET_TRANSLATION_FAULT;
} }
......
...@@ -74,6 +74,7 @@ int handle_bp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, ...@@ -74,6 +74,7 @@ int handle_bp_command(struct command_context_s *cmd_ctx, char *cmd, char **args,
int handle_rbp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int handle_rbp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_wp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int handle_wp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_rwp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc); int handle_rwp_command(struct command_context_s *cmd_ctx, char *cmd, char **args, int argc);
int handle_virt2phys_command(command_context_t *cmd_ctx, char *cmd, char **args, int argc);
/* targets /* targets
*/ */
...@@ -376,6 +377,19 @@ int target_process_reset(struct command_context_s *cmd_ctx) ...@@ -376,6 +377,19 @@ int target_process_reset(struct command_context_s *cmd_ctx)
return retval; return retval;
} }
static int default_virt2phys(struct target_s *target, u32 virtual, u32 *physical)
{
*physical = virtual;
return ERROR_OK;
}
static int default_mmu(struct target_s *target, int *enabled)
{
USER("No MMU present");
*enabled = 0;
return ERROR_OK;
}
int target_init(struct command_context_s *cmd_ctx) int target_init(struct command_context_s *cmd_ctx)
{ {
target_t *target = targets; target_t *target = targets;
...@@ -387,6 +401,16 @@ int target_init(struct command_context_s *cmd_ctx) ...@@ -387,6 +401,16 @@ int target_init(struct command_context_s *cmd_ctx)
ERROR("target '%s' init failed", target->type->name); ERROR("target '%s' init failed", target->type->name);
exit(-1); exit(-1);
} }
/* Set up default functions if none are provided by target */
if (target->type->virt2phys == NULL)
{
target->type->virt2phys = default_virt2phys;
}
if (target->type->mmu == NULL)
{
target->type->mmu = default_mmu;
}
target = target->next; target = target->next;
} }
...@@ -583,6 +607,26 @@ int target_alloc_working_area(struct target_s *target, u32 size, working_area_t ...@@ -583,6 +607,26 @@ int target_alloc_working_area(struct target_s *target, u32 size, working_area_t
working_area_t *c = target->working_areas; working_area_t *c = target->working_areas;
working_area_t *new_wa = NULL; working_area_t *new_wa = NULL;
/* Reevaluate working area address based on MMU state*/
if (target->working_areas == NULL)
{
int retval;
int enabled;
retval = target->type->mmu(target, &enabled);
if (retval != ERROR_OK)
{
return retval;
}
if (enabled)
{
target->working_area = target->working_area_virt;
}
else
{
target->working_area = target->working_area_phys;
}
}
/* only allocate multiples of 4 byte */ /* only allocate multiples of 4 byte */
if (size % 4) if (size % 4)
{ {
...@@ -621,7 +665,7 @@ int target_alloc_working_area(struct target_s *target, u32 size, working_area_t ...@@ -621,7 +665,7 @@ int target_alloc_working_area(struct target_s *target, u32 size, working_area_t
if (free_size < size) if (free_size < size)
{ {
WARNING("not enough working area available"); WARNING("not enough working area available(requested %d, free %d)", size, free_size);
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE; return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
} }
...@@ -700,7 +744,8 @@ int target_register_commands(struct command_context_s *cmd_ctx) ...@@ -700,7 +744,8 @@ int target_register_commands(struct command_context_s *cmd_ctx)
register_command(cmd_ctx, NULL, "daemon_startup", handle_daemon_startup_command, COMMAND_CONFIG, NULL); register_command(cmd_ctx, NULL, "daemon_startup", handle_daemon_startup_command, COMMAND_CONFIG, NULL);
register_command(cmd_ctx, NULL, "target_script", handle_target_script_command, COMMAND_CONFIG, NULL); register_command(cmd_ctx, NULL, "target_script", handle_target_script_command, COMMAND_CONFIG, NULL);
register_command(cmd_ctx, NULL, "run_and_halt_time", handle_run_and_halt_time_command, COMMAND_CONFIG, NULL); register_command(cmd_ctx, NULL, "run_and_halt_time", handle_run_and_halt_time_command, COMMAND_CONFIG, NULL);
register_command(cmd_ctx, NULL, "working_area", handle_working_area_command, COMMAND_ANY, NULL); register_command(cmd_ctx, NULL, "working_area", handle_working_area_command, COMMAND_ANY, "working_area <target#> <address> <size> <'backup'|'nobackup'> [virtual address]");
register_command(cmd_ctx, NULL, "virt2phys", handle_virt2phys_command, COMMAND_ANY, "virt2phys <virtual address>");
return ERROR_OK; return ERROR_OK;
} }
...@@ -1221,10 +1266,9 @@ int handle_working_area_command(struct command_context_s *cmd_ctx, char *cmd, ch ...@@ -1221,10 +1266,9 @@ int handle_working_area_command(struct command_context_s *cmd_ctx, char *cmd, ch
{ {
target_t *target = NULL; target_t *target = NULL;
if (argc < 4) if ((argc < 4) || (argc > 5))
{ {
ERROR("incomplete working_area command. usage: working_area <target#> <address> <size> <'backup'|'nobackup'>"); return ERROR_COMMAND_SYNTAX_ERROR;
exit(-1);
} }
target = get_target_by_num(strtoul(args[0], NULL, 0)); target = get_target_by_num(strtoul(args[0], NULL, 0));
...@@ -1236,7 +1280,11 @@ int handle_working_area_command(struct command_context_s *cmd_ctx, char *cmd, ch ...@@ -1236,7 +1280,11 @@ int handle_working_area_command(struct command_context_s *cmd_ctx, char *cmd, ch
} }
target_free_all_working_areas(target); target_free_all_working_areas(target);
target->working_area = strtoul(args[1], NULL, 0); target->working_area_phys = target->working_area_virt = strtoul(args[1], NULL, 0);
if (argc == 5)
{
target->working_area_virt = strtoul(args[4], NULL, 0);
}
target->working_area_size = strtoul(args[2], NULL, 0); target->working_area_size = strtoul(args[2], NULL, 0);
if (strcmp(args[3], "backup") == 0) if (strcmp(args[3], "backup") == 0)
...@@ -1250,7 +1298,7 @@ int handle_working_area_command(struct command_context_s *cmd_ctx, char *cmd, ch ...@@ -1250,7 +1298,7 @@ int handle_working_area_command(struct command_context_s *cmd_ctx, char *cmd, ch
else else
{ {
ERROR("unrecognized <backup|nobackup> argument (%s)", args[3]); ERROR("unrecognized <backup|nobackup> argument (%s)", args[3]);
exit(-1); return ERROR_COMMAND_SYNTAX_ERROR;
} }
return ERROR_OK; return ERROR_OK;
...@@ -2247,3 +2295,30 @@ int handle_rwp_command(struct command_context_s *cmd_ctx, char *cmd, char **args ...@@ -2247,3 +2295,30 @@ int handle_rwp_command(struct command_context_s *cmd_ctx, char *cmd, char **args
return ERROR_OK; return ERROR_OK;
} }
int handle_virt2phys_command(command_context_t *cmd_ctx, char *cmd, char **args, int argc)
{
int retval;
target_t *target = get_current_target(cmd_ctx);
u32 va;
u32 pa;
if (argc != 1)
{
return ERROR_COMMAND_SYNTAX_ERROR;
}
va = strtoul(args[0], NULL, 0);
retval = target->type->virt2phys(target, va, &pa);
if (retval == ERROR_OK)
{
command_print(cmd_ctx, "Physical address 0x%08x", pa);
}
else
{
/* lower levels will have logged a detailed error which is
* forwarded to telnet/GDB session.
*/
}
return retval;
}
...@@ -147,6 +147,9 @@ typedef struct target_type_s ...@@ -147,6 +147,9 @@ typedef struct target_type_s
int (*init_target)(struct command_context_s *cmd_ctx, struct target_s *target); int (*init_target)(struct command_context_s *cmd_ctx, struct target_s *target);
int (*quit)(void); int (*quit)(void);
int (*virt2phys)(struct target_s *target, u32 address, u32 *physical);
int (*mmu)(struct target_s *target, int *enabled);
} target_type_t; } target_type_t;
typedef struct target_s typedef struct target_s
...@@ -158,7 +161,11 @@ typedef struct target_s ...@@ -158,7 +161,11 @@ typedef struct target_s
char *post_halt_script; /* script file to execute after the target halted */ char *post_halt_script; /* script file to execute after the target halted */
char *pre_resume_script; /* script file to execute before the target resumed */ char *pre_resume_script; /* script file to execute before the target resumed */
char *gdb_program_script; /* script file to execute before programming vis gdb */ char *gdb_program_script; /* script file to execute before programming vis gdb */
u32 working_area; /* working area (initialized RAM) */ u32 working_area; /* working area (initialized RAM). Evaluated
upon first allocation from virtual/physical address.
*/
u32 working_area_virt; /* virtual address */
u32 working_area_phys; /* physical address */
u32 working_area_size; /* size in bytes */ u32 working_area_size; /* size in bytes */
u32 backup_working_area; /* whether the content of the working area has to be preserved */ u32 backup_working_area; /* whether the content of the working area has to be preserved */
struct working_area_s *working_areas;/* list of allocated working areas */ struct working_area_s *working_areas;/* list of allocated working areas */
......
...@@ -84,6 +84,8 @@ int xscale_add_watchpoint(struct target_s *target, watchpoint_t *watchpoint); ...@@ -84,6 +84,8 @@ int xscale_add_watchpoint(struct target_s *target, watchpoint_t *watchpoint);
int xscale_remove_watchpoint(struct target_s *target, watchpoint_t *watchpoint); int xscale_remove_watchpoint(struct target_s *target, watchpoint_t *watchpoint);
void xscale_enable_watchpoints(struct target_s *target); void xscale_enable_watchpoints(struct target_s *target);
void xscale_enable_breakpoints(struct target_s *target); void xscale_enable_breakpoints(struct target_s *target);
static int xscale_virt2phys(struct target_s *target, u32 virtual, u32 *physical);
static int xscale_mmu(struct target_s *target, int *enabled);
int xscale_read_trace(target_t *target); int xscale_read_trace(target_t *target);
...@@ -122,7 +124,10 @@ target_type_t xscale_target = ...@@ -122,7 +124,10 @@ target_type_t xscale_target =
.register_commands = xscale_register_commands, .register_commands = xscale_register_commands,
.target_command = xscale_target_command, .target_command = xscale_target_command,
.init_target = xscale_init_target, .init_target = xscale_init_target,
.quit = xscale_quit .quit = xscale_quit,
.virt2phys = xscale_virt2phys,
.mmu = xscale_mmu
}; };
char* xscale_reg_list[] = char* xscale_reg_list[] =
...@@ -189,11 +194,13 @@ int xscale_get_arch_pointers(target_t *target, armv4_5_common_t **armv4_5_p, xsc ...@@ -189,11 +194,13 @@ int xscale_get_arch_pointers(target_t *target, armv4_5_common_t **armv4_5_p, xsc
if (armv4_5->common_magic != ARMV4_5_COMMON_MAGIC) if (armv4_5->common_magic != ARMV4_5_COMMON_MAGIC)
{ {
ERROR("target isn't an XScale target");
return -1; return -1;
} }
if (xscale->common_magic != XSCALE_COMMON_MAGIC) if (xscale->common_magic != XSCALE_COMMON_MAGIC)
{ {
ERROR("target isn't an XScale target");
return -1; return -1;
} }
...@@ -436,7 +443,7 @@ int xscale_read_tx(target_t *target, int consume) ...@@ -436,7 +443,7 @@ int xscale_read_tx(target_t *target, int consume)
armv4_5_common_t *armv4_5 = target->arch_info; armv4_5_common_t *armv4_5 = target->arch_info;
xscale_common_t *xscale = armv4_5->arch_info; xscale_common_t *xscale = armv4_5->arch_info;
enum tap_state path[3]; enum tap_state path[3];
enum tap_state noconsume_path[7]; enum tap_state noconsume_path[9];
int retval; int retval;
struct timeval timeout, now; struct timeval timeout, now;
...@@ -461,8 +468,10 @@ int xscale_read_tx(target_t *target, int consume) ...@@ -461,8 +468,10 @@ int xscale_read_tx(target_t *target, int consume)
noconsume_path[2] = TAP_E1D; noconsume_path[2] = TAP_E1D;
noconsume_path[3] = TAP_PD; noconsume_path[3] = TAP_PD;
noconsume_path[4] = TAP_E2D; noconsume_path[4] = TAP_E2D;
noconsume_path[5] = TAP_CD; noconsume_path[5] = TAP_UD;
noconsume_path[6] = TAP_SD; noconsume_path[6] = TAP_SDS;
noconsume_path[7] = TAP_CD;
noconsume_path[8] = TAP_SD;
fields[0].device = xscale->jtag_info.chain_pos; fields[0].device = xscale->jtag_info.chain_pos;
fields[0].num_bits = 3; fields[0].num_bits = 3;
...@@ -502,7 +511,7 @@ int xscale_read_tx(target_t *target, int consume) ...@@ -502,7 +511,7 @@ int xscale_read_tx(target_t *target, int consume)
if (consume) if (consume)
jtag_add_pathmove(3, path); jtag_add_pathmove(3, path);
else else
jtag_add_pathmove(7, noconsume_path); jtag_add_pathmove(sizeof(noconsume_path)/sizeof(*noconsume_path), noconsume_path);
jtag_add_dr_scan(3, fields, TAP_RTI, NULL); jtag_add_dr_scan(3, fields, TAP_RTI, NULL);
...@@ -3142,7 +3151,6 @@ int xscale_handle_debug_handler_command(struct command_context_s *cmd_ctx, char ...@@ -3142,7 +3151,6 @@ int xscale_handle_debug_handler_command(struct command_context_s *cmd_ctx, char
if (xscale_get_arch_pointers(target, &armv4_5, &xscale) != ERROR_OK) if (xscale_get_arch_pointers(target, &armv4_5, &xscale) != ERROR_OK)
{ {
command_print(cmd_ctx, "target isn't an ARM920t target");
return ERROR_OK; return ERROR_OK;
} }
...@@ -3183,7 +3191,6 @@ int xscale_handle_cache_clean_address_command(struct command_context_s *cmd_ctx, ...@@ -3183,7 +3191,6 @@ int xscale_handle_cache_clean_address_command(struct command_context_s *cmd_ctx,
if (xscale_get_arch_pointers(target, &armv4_5, &xscale) != ERROR_OK) if (xscale_get_arch_pointers(target, &armv4_5, &xscale) != ERROR_OK)
{ {
command_print(cmd_ctx, "target isn't an XScale target");
return ERROR_OK; return ERROR_OK;
} }
...@@ -3209,32 +3216,49 @@ int xscale_handle_cache_info_command(struct command_context_s *cmd_ctx, char *cm ...@@ -3209,32 +3216,49 @@ int xscale_handle_cache_info_command(struct command_context_s *cmd_ctx, char *cm
if (xscale_get_arch_pointers(target, &armv4_5, &xscale) != ERROR_OK) if (xscale_get_arch_pointers(target, &armv4_5, &xscale) != ERROR_OK)
{ {
command_print(cmd_ctx, "target isn't an XScale target");