aboutsummaryrefslogtreecommitdiff
path: root/src/target
diff options
context:
space:
mode:
authorHsiangkai Wang <hsiangkai@gmail.com>2013-07-11 10:08:15 +0800
committerSpencer Oliver <spen@spen-soft.co.uk>2013-09-13 19:37:54 +0000
commit18c40eb9e53f559e089b6f745284cf42718182da (patch)
treeecc34310b812dcb68b9abb0e907f346ad1b0ae46 /src/target
parent586575c9dcc18154eeb4e893e554371c69ac0b9d (diff)
downloadriscv-openocd-18c40eb9e53f559e089b6f745284cf42718182da.zip
riscv-openocd-18c40eb9e53f559e089b6f745284cf42718182da.tar.gz
riscv-openocd-18c40eb9e53f559e089b6f745284cf42718182da.tar.bz2
nds32: Use DMA to access memory as no DCache
As GDB uses file-I/O protocol to access memory, use DMA to access if no DCache. This commit improves the performance of Andes Virtual Hosting. Change-Id: I36bb2154b9f497fc4237625836cf8c7115330a60 Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1580 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Diffstat (limited to 'src/target')
-rw-r--r--src/target/nds32_v3_common.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/target/nds32_v3_common.c b/src/target/nds32_v3_common.c
index e88430f..e01025f 100644
--- a/src/target/nds32_v3_common.c
+++ b/src/target/nds32_v3_common.c
@@ -555,19 +555,25 @@ int nds32_v3_write_buffer(struct target *target, uint32_t address,
return ERROR_FAIL;
if (nds32->hit_syscall) {
- /* Use bus mode to access memory during virtual hosting */
struct aice_port_s *aice = target_to_aice(target);
enum nds_memory_access origin_access_channel;
- int result;
-
origin_access_channel = memory->access_channel;
- memory->access_channel = NDS_MEMORY_ACC_BUS;
- aice_memory_access(aice, NDS_MEMORY_ACC_BUS);
+ /* If target has no cache, use BUS mode to access memory. */
+ if ((memory->dcache.line_size == 0)
+ || (memory->dcache.enable == false)) {
+ /* There is no Dcache or Dcache is disabled. */
+ memory->access_channel = NDS_MEMORY_ACC_BUS;
+ aice_memory_access(aice, NDS_MEMORY_ACC_BUS);
+ }
+
+ int result;
result = nds32_gdb_fileio_write_memory(nds32, address, size, buffer);
- memory->access_channel = origin_access_channel;
- aice_memory_access(aice, origin_access_channel);
+ if (NDS_MEMORY_ACC_CPU == origin_access_channel) {
+ memory->access_channel = NDS_MEMORY_ACC_CPU;
+ aice_memory_access(aice, NDS_MEMORY_ACC_CPU);
+ }
return result;
}