1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
"""READ-ONLY survey of the Data Fabric (DF) register space, with regguard controls.
DF is interesting because (a) it is unexplored, and (b) UMC sits behind it --
so if UMC is reachable at all, the route is through DF routing/aperture config.
DF also programs the address apertures that the TMR fence rides on.
WRITES NOTHING. Every base gets control addresses so a non-decoding window
cannot masquerade as data (see FINDING-UMC-NOT-REACHABLE-VIA-SMN.md).
"""
import sys
sys.path.insert(0,"/Users/user/src/tinygrad"); sys.path.insert(0,"/Users/user/dev/amd-psp-re/psp_out")
from tinygrad import Device
from tinygrad.runtime.autogen.am import am
import regguard
d=Device["AMD"]; adev=d.iface.dev_impl
NAME={k[:-5]:v for k,v in vars(am).items() if k.endswith('_HWIP') and isinstance(v,int)}
def rd(a):
adev.wreg(14,a&0xffffffff); return adev.rreg(15)
for blk in ('DF','ATHUB','MMHUB'):
hw=NAME[blk]; off=adev.regs_offset[hw]
print("\n"+"="*100)
print("%s ip_ver=%s instances=%d"%(blk, adev.ip_ver.get(hw), len(off)))
print("="*100)
for inst in sorted(off):
for base in off[inst]:
if base < 0x100: continue # skip tiny pseudo-bases
addrs=[base+4*i for i in (0,1,3,4)]
ctrls=[base-0x1000, base+0x1000, 0x0badf000]
r=regguard.classify_read(rd, addrs, controls=ctrls)
path=r['_path']
vals=" ".join("%08x"%rd(a) for a in addrs)
tag="REAL" if path.startswith("USABLE") else path.split()[0]
print(" inst%-2d %#011x %-6s %s [%s]"%(inst, base, tag, vals, path[:46]))
print()
print("MEMSIZE=%s sos_alive=%s"%(hex(adev.rreg(0xde3)), adev.psp.is_sos_alive()))
|