File tree Expand file tree Collapse file tree 2 files changed +26
-4
lines changed Expand file tree Collapse file tree 2 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -151,6 +151,7 @@ const char *jtag_tap_name(const struct jtag_tap *tap);
151151struct jtag_tap * jtag_tap_by_string (const char * dotted_name );
152152struct jtag_tap * jtag_tap_by_jim_obj (Jim_Interp * interp , Jim_Obj * obj );
153153struct jtag_tap * jtag_tap_by_position (unsigned int abs_position );
154+ /* FIXME: "jtag_tap_next_enabled()" should accept a const pointer. */
154155struct jtag_tap * jtag_tap_next_enabled (struct jtag_tap * p );
155156unsigned int jtag_tap_count_enabled (void );
156157unsigned int jtag_tap_count (void );
Original file line number Diff line number Diff line change @@ -357,10 +357,31 @@ static void select_dmi(struct target *target)
357357 select_dmi_via_bscan (target );
358358 return ;
359359 }
360- if (buf_eq (target -> tap -> cur_instr , select_dbus .out_value ,
361- target -> tap -> ir_length ))
362- return ;
363- jtag_add_ir_scan (target -> tap , & select_dbus , TAP_IDLE );
360+ if (!target -> tap -> enabled )
361+ LOG_TARGET_ERROR (target , "BUG: Target's TAP '%s' is disabled!" ,
362+ jtag_tap_name (target -> tap ));
363+
364+ bool need_ir_scan = false;
365+ /* FIXME: make "tap" a const pointer. */
366+ for (struct jtag_tap * tap = jtag_tap_next_enabled (NULL );
367+ tap ; tap = jtag_tap_next_enabled (tap )) {
368+ if (tap != target -> tap ) {
369+ /* Different TAP than ours - check if it is in bypass */
370+ if (!tap -> bypass ) {
371+ need_ir_scan = true;
372+ break ;
373+ }
374+ } else {
375+ /* Our TAP - check if the correct instruction is already loaded */
376+ if (!buf_eq (target -> tap -> cur_instr , select_dbus .out_value , target -> tap -> ir_length )) {
377+ need_ir_scan = true;
378+ break ;
379+ }
380+ }
381+ }
382+
383+ if (need_ir_scan )
384+ jtag_add_ir_scan (target -> tap , & select_dbus , TAP_IDLE );
364385}
365386
366387static int increase_dmi_busy_delay (struct target * target )
You can’t perform that action at this time.
0 commit comments