Skip to content

Commit 8c16b1c

Browse files
author
Hellosun Wu
committed
[Bug-27263] dmi.tcl: Use dtmcs.abits in stead of hixed number
To support the trace interface, the DMI address has been expanded to 14 bits. For older implementations, we use a fixed number, 7, as the address bit, which does not support this feature.
1 parent 1c5a6ee commit 8c16b1c

File tree

1 file changed

+36
-6
lines changed

1 file changed

+36
-6
lines changed

iceman_adapter/dmi.tcl

+36-6
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,52 @@
11

2+
set _dmi_init_once 1
3+
set _abits 7
4+
proc dmi_init_once {tap} {
5+
global _dmi_init_once
6+
global _abits
7+
8+
set DTM_IR_DTMCS 0x10
9+
10+
irscan $tap $DTM_IR_DTMCS
11+
scan [drscan $tap 32 0x30000] "%x" dtmcs
12+
echo [format "dtmcs=0x%x" $dtmcs]
13+
14+
set _abits [expr {$dtmcs >> 4 & 0x3F}]
15+
echo [format "abits=0x%x" $_abits]
16+
17+
set _dmi_init_once 0
18+
}
19+
220
proc dmi_read {tap addr} {
21+
global _abits
22+
global _dmi_init_once
23+
if { $_dmi_init_once != 0 } {
24+
dmi_init_once $tap
25+
}
26+
327
set DTM_IR_DMI 0x11
428
irscan $tap $DTM_IR_DMI
529

6-
scan [drscan $tap 2 0x1 32 0x0 7 $addr] "%x %x %x" op rdata addr_out
7-
runtest 5
8-
scan [drscan $tap 2 0x0 32 0x0 7 $addr] "%x %x %x" op rdata addr_out
30+
scan [drscan $tap 2 0x1 32 0x0 $_abits $addr] "%x %x %x" op rdata addr_out
31+
runtest 7
32+
scan [drscan $tap 2 0x0 32 0x0 $_abits $addr] "%x %x %x" op rdata addr_out
933

1034
return $rdata
1135
}
1236

1337
proc dmi_write {tap addr wdata} {
38+
global _abits
39+
global _dmi_init_once
40+
if { $_dmi_init_once != 0 } {
41+
dmi_init_once $tap
42+
}
43+
1444
set DTM_IR_DMI 0x11
1545
irscan $tap $DTM_IR_DMI
1646

17-
scan [drscan $tap 2 0x2 32 $wdata 7 $addr] "%x %x %x" op rdata addr_out
18-
runtest 5
19-
scan [drscan $tap 2 0x1 32 $wdata 7 $addr] "%x %x %x" op rdata addr_out
47+
scan [drscan $tap 2 0x2 32 $wdata $_abits $addr] "%x %x %x" op rdata addr_out
48+
runtest 7
49+
scan [drscan $tap 2 0x1 32 $wdata $_abits $addr] "%x %x %x" op rdata addr_out
2050
}
2151

2252
proc reg_read_abstract {tap reg_num} {

0 commit comments

Comments
 (0)