OpenOCD
arm946e.c File Reference
Include dependency graph for arm946e.c:

Go to the source code of this file.

Macros

#define CP15_CTL   0x02
 
#define CP15_CTL_DCACHE   (1<<2)
 
#define CP15_CTL_ICACHE   (1<<12)
 
#define GET_DCACHE_SIZE   18
 
#define GET_ICACHE_SIZE   6
 
#define NB_CACHE_WAYS   4
 

Functions

static uint32_t arm946e_cp15_get_csize (struct target *target, int idsel)
 
static void arm946e_deinit_target (struct target *target)
 
static int arm946e_init_arch_info (struct target *target, struct arm946e_common *arm946e, struct jtag_tap *tap)
 
static uint32_t arm946e_invalidate_dcache (struct target *target, uint32_t address, uint32_t size, uint32_t count)
 
static uint32_t arm946e_invalidate_icache (struct target *target, uint32_t address, uint32_t size, uint32_t count)
 
static uint32_t arm946e_invalidate_whole_dcache (struct target *target)
 
static uint32_t arm946e_invalidate_whole_icache (struct target *target)
 
static int arm946e_post_debug_entry (struct target *target)
 
static void arm946e_pre_restore_context (struct target *target)
 
static int arm946e_read_cp15 (struct target *target, int reg_addr, uint32_t *value)
 
static int arm946e_read_memory (struct target *target, target_addr_t address, uint32_t size, uint32_t count, uint8_t *buffer)
 
static int arm946e_target_create (struct target *target, Jim_Interp *interp)
 
static void arm946e_update_cp15_caches (struct target *target, uint32_t value)
 
static int arm946e_verify_pointer (struct command_invocation *cmd, struct arm946e_common *arm946e)
 
static int arm946e_write_cp15 (struct target *target, int reg_addr, uint32_t value)
 
static int arm946e_write_memory (struct target *target, target_addr_t address, uint32_t size, uint32_t count, const uint8_t *buffer)
 Writes a buffer, in the specified word size, with current MMU settings. More...
 
 COMMAND_HANDLER (arm946e_handle_cp15)
 
 COMMAND_HANDLER (arm946e_handle_idcache)
 

Variables

static const struct command_registration arm946e_command_handlers []
 
static const struct command_registration arm946e_exec_command_handlers []
 
static uint8_t arm946e_preserve_cache
 flag to give info about cache manipulation during debug : "0" - cache lines are invalidated "on the fly", for affected addresses. More...
 
struct target_type arm946e_target
 Holds methods for ARM946 targets. More...
 

Macro Definition Documentation

◆ CP15_CTL

#define CP15_CTL   0x02

Definition at line 30 of file arm946e.c.

◆ CP15_CTL_DCACHE

#define CP15_CTL_DCACHE   (1<<2)

Definition at line 31 of file arm946e.c.

◆ CP15_CTL_ICACHE

#define CP15_CTL_ICACHE   (1<<12)

Definition at line 32 of file arm946e.c.

◆ GET_DCACHE_SIZE

#define GET_DCACHE_SIZE   18

Definition at line 221 of file arm946e.c.

◆ GET_ICACHE_SIZE

#define GET_ICACHE_SIZE   6

Definition at line 220 of file arm946e.c.

◆ NB_CACHE_WAYS

#define NB_CACHE_WAYS   4

Definition at line 28 of file arm946e.c.

Function Documentation

◆ arm946e_cp15_get_csize()

static uint32_t arm946e_cp15_get_csize ( struct target target,
int  idsel 
)
static

◆ arm946e_deinit_target()

static void arm946e_deinit_target ( struct target target)
static

Definition at line 91 of file arm946e.c.

References arm7_9_deinit(), arm_free_reg_cache(), target_to_arm(), and target_to_arm946().

◆ arm946e_init_arch_info()

static int arm946e_init_arch_info ( struct target target,
struct arm946e_common arm946e,
struct jtag_tap tap 
)
static

The ARM946E-S implements the ARMv5TE architecture which has the BKPT instruction, so we don't have to use a watchpoint comparator

disabling linefills leads to lockups, so keep them enabled for now this doesn't affect correctness, but might affect timing issues, if important data is evicted from the cache during the debug session

Definition at line 47 of file arm946e.c.

References arm946e_common::arm7_9_common, ARM946E_COMMON_MAGIC, arm946e_post_debug_entry(), arm946e_pre_restore_context(), arm946e_preserve_cache, arm9tdmi_init_arch_info(), arm7_9_common::arm_bkpt, ARMV5_BKPT, ARMV5_T_BKPT, arm946e_common::common_magic, ERROR_OK, arm7_9_common::post_debug_entry, arm7_9_common::pre_restore_context, and arm7_9_common::thumb_bkpt.

Referenced by arm946e_target_create().

◆ arm946e_invalidate_dcache()

static uint32_t arm946e_invalidate_dcache ( struct target target,
uint32_t  address,
uint32_t  size,
uint32_t  count 
)
static

Find if the affected address is kept in the cache. Because JTAG Scan Chain 15 offers limited approach, we have to loop through all cache ways (segments) and read cache tags, then compare them with with address.

Definition at line 385 of file arm946e.c.

References arm946e_read_cp15(), arm946e_write_cp15(), count, ERROR_OK, LOG_DEBUG, NB_CACHE_WAYS, and size.

Referenced by arm946e_write_memory().

◆ arm946e_invalidate_icache()

static uint32_t arm946e_invalidate_icache ( struct target target,
uint32_t  address,
uint32_t  size,
uint32_t  count 
)
static

Definition at line 450 of file arm946e.c.

References arm946e_read_cp15(), arm946e_write_cp15(), count, ERROR_OK, LOG_DEBUG, NB_CACHE_WAYS, and size.

Referenced by arm946e_write_memory().

◆ arm946e_invalidate_whole_dcache()

static uint32_t arm946e_invalidate_whole_dcache ( struct target target)
static

◆ arm946e_invalidate_whole_icache()

static uint32_t arm946e_invalidate_whole_icache ( struct target target)
static

Invalidate (flush) I$ mcr 15, 0, r0, cr7, cr5, {0}

Definition at line 298 of file arm946e.c.

References arm946e_cp15_get_csize(), arm946e_write_cp15(), ERROR_OK, ERROR_TARGET_RESOURCE_NOT_AVAILABLE, GET_ICACHE_SIZE, and LOG_DEBUG.

Referenced by arm946e_post_debug_entry().

◆ arm946e_post_debug_entry()

◆ arm946e_pre_restore_context()

static void arm946e_pre_restore_context ( struct target target)
static

Read-modify-write CP15 control to reenable I/D-cache operation NOTE: It is not possible to disable cache by CP15. if arm946e_preserve_cache debugging flag enabled.

Definition at line 360 of file arm946e.c.

References arm946e_preserve_cache, arm946e_read_cp15(), arm946e_write_cp15(), arm946e_common::cp15_control_reg, CP15_CTL, CP15_CTL_DCACHE, CP15_CTL_ICACHE, ERROR_OK, LOG_DEBUG, and target_to_arm946().

Referenced by arm946e_init_arch_info().

◆ arm946e_read_cp15()

◆ arm946e_read_memory()

static int arm946e_read_memory ( struct target target,
target_addr_t  address,
uint32_t  size,
uint32_t  count,
uint8_t *  buffer 
)
static

Definition at line 549 of file arm946e.c.

References arm7_9_read_memory(), buffer, count, ERROR_OK, LOG_DEBUG, and size.

◆ arm946e_target_create()

static int arm946e_target_create ( struct target target,
Jim_Interp *  interp 
)
static

Definition at line 82 of file arm946e.c.

References arm946e_init_arch_info(), ERROR_OK, and target::tap.

◆ arm946e_update_cp15_caches()

static void arm946e_update_cp15_caches ( struct target target,
uint32_t  value 
)
static

◆ arm946e_verify_pointer()

static int arm946e_verify_pointer ( struct command_invocation cmd,
struct arm946e_common arm946e 
)
static

◆ arm946e_write_cp15()

◆ arm946e_write_memory()

static int arm946e_write_memory ( struct target target,
target_addr_t  address,
uint32_t  size,
uint32_t  count,
const uint8_t *  buffer 
)
static

Writes a buffer, in the specified word size, with current MMU settings.

Write memory

Definition at line 501 of file arm946e.c.

References arm7_9_write_memory_opt(), arm946e_invalidate_dcache(), arm946e_invalidate_icache(), arm946e_preserve_cache, buffer, count, arm946e_common::cp15_control_reg, CP15_CTL_DCACHE, CP15_CTL_ICACHE, ERROR_OK, LOG_DEBUG, size, and target_to_arm946().

◆ COMMAND_HANDLER() [1/2]

◆ COMMAND_HANDLER() [2/2]

COMMAND_HANDLER ( arm946e_handle_idcache  )

Definition at line 613 of file arm946e.c.

Variable Documentation

◆ arm946e_command_handlers

const struct command_registration arm946e_command_handlers[]
static
Initial value:
= {
{
},
{
.name = "arm946e",
.mode = COMMAND_ANY,
.help = "arm946e command group",
.usage = "",
},
}
static const struct command_registration arm946e_exec_command_handlers[]
Definition: arm946e.c:698
const struct command_registration arm9tdmi_command_handlers[]
Definition: arm9tdmi.c:873
#define COMMAND_REGISTRATION_DONE
Use this as the last entry in an array of command_registration records.
Definition: command.h:253
@ COMMAND_ANY
Definition: command.h:42
const char * name
Definition: command.h:235

Definition at line 613 of file arm946e.c.

◆ arm946e_exec_command_handlers

const struct command_registration arm946e_exec_command_handlers[]
static
Initial value:
= {
{
.name = "cp15",
.handler = arm946e_handle_cp15,
.mode = COMMAND_EXEC,
.usage = "regnum [value]",
.help = "read/modify cp15 register",
},
{
.name = "icache",
.handler = arm946e_handle_idcache,
.mode = COMMAND_EXEC,
.usage = "['enable'|'disable'|'flush']",
.help = "I-cache info and operations",
},
{
.name = "dcache",
.handler = arm946e_handle_idcache,
.mode = COMMAND_EXEC,
.usage = "['enable'|'disable'|'flush']",
.help = "D-cache info and operations",
},
}
@ COMMAND_EXEC
Definition: command.h:40

Definition at line 613 of file arm946e.c.

◆ arm946e_preserve_cache

uint8_t arm946e_preserve_cache
static

flag to give info about cache manipulation during debug : "0" - cache lines are invalidated "on the fly", for affected addresses.

This is preferred from performance point of view. "1" - cache is invalidated and switched off on debug_entry, and switched back on on restore. It is kept off during debugging.

Definition at line 41 of file arm946e.c.

Referenced by arm946e_init_arch_info(), arm946e_post_debug_entry(), arm946e_pre_restore_context(), and arm946e_write_memory().

◆ arm946e_target

struct target_type arm946e_target

Holds methods for ARM946 targets.

Definition at line 613 of file arm946e.c.