@@ -357,7 +357,7 @@ static void decode_dmi(char *text, unsigned address, unsigned data)
357357 }
358358}
359359
360- static void dump_field (const struct scan_field * field )
360+ static void dump_field (int idle , const struct scan_field * field )
361361{
362362 static const char * const op_string [] = {"-" , "r" , "w" , "?" };
363363 static const char * const status_string [] = {"+" , "?" , "F" , "b" };
@@ -377,8 +377,8 @@ static void dump_field(const struct scan_field *field)
377377
378378 log_printf_lf (LOG_LVL_DEBUG ,
379379 __FILE__ , __LINE__ , "scan" ,
380- "%db %s %08x @%02x -> %s %08x @%02x" ,
381- field -> num_bits ,
380+ "%db %di % s %08x @%02x -> %s %08x @%02x" ,
381+ field -> num_bits , idle ,
382382 op_string [out_op ], out_data , out_address ,
383383 status_string [in_op ], in_data , in_address );
384384
@@ -498,7 +498,7 @@ static dmi_status_t dmi_scan(struct target *target, uint32_t *address_in,
498498 if (address_in )
499499 * address_in = buf_get_u32 (in , DTM_DMI_ADDRESS_OFFSET , info -> abits );
500500
501- dump_field (& field );
501+ dump_field (idle_count , & field );
502502
503503 return buf_get_u32 (in , DTM_DMI_OP_OFFSET , DTM_DMI_OP_LENGTH );
504504}
@@ -697,7 +697,24 @@ static int wait_for_idle(struct target *target, uint32_t *abstractcs)
697697static int execute_abstract_command (struct target * target , uint32_t command )
698698{
699699 RISCV013_INFO (info );
700- LOG_DEBUG ("command=0x%x" , command );
700+ if (debug_level >= LOG_LVL_DEBUG ) {
701+ switch (get_field (command , DMI_COMMAND_CMDTYPE )) {
702+ case 0 :
703+ LOG_DEBUG ("command=0x%x; access register, size=%d, postexec=%d, "
704+ "transfer=%d, write=%d, regno=0x%x" ,
705+ command ,
706+ 8 << get_field (command , AC_ACCESS_REGISTER_SIZE ),
707+ get_field (command , AC_ACCESS_REGISTER_POSTEXEC ),
708+ get_field (command , AC_ACCESS_REGISTER_TRANSFER ),
709+ get_field (command , AC_ACCESS_REGISTER_WRITE ),
710+ get_field (command , AC_ACCESS_REGISTER_REGNO ));
711+ break ;
712+ default :
713+ LOG_DEBUG ("command=0x%x" , command );
714+ break ;
715+ }
716+ }
717+
701718 dmi_write (target , DMI_COMMAND , command );
702719
703720 uint32_t abstractcs = 0 ;
@@ -2326,6 +2343,8 @@ static int read_memory_progbuf(struct target *target, target_addr_t address,
23262343 uint8_t * buffer_i = buffer ;
23272344
23282345 for (uint32_t i = 0 ; i < count ; i ++ , address_i += size_i , buffer_i += size_i ) {
2346+ /* TODO: This is much slower than it needs to be because we end up
2347+ * writing the address to read for every word we read. */
23292348 result = read_memory_progbuf_inner (target , address_i , size_i , count_i , buffer_i );
23302349
23312350 /* The read of a single word failed, so we will just return 0 for that instead */
0 commit comments