"""READ-ONLY survey of the UMC (memory controller) register space. Why: the RAS TA refuses to aim error injection at the PSP TMR (proved page-exact). But UMC's registers are directly host-reachable over SMN. If the host can program the inject registers itself, that check is bypassable -- which would be a TMR compromise rather than a firmware bug. THIS SCRIPT WRITES NOTHING. It only reads, and every value is classified by regguard (MIRROR / ALIAS / DEAD / UNSTABLE / REAL) so we don't repeat the "confident wrong answer from a dead path" mistake. """ import sys, time 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)} umc_hw=NAME['UMC'] bases=adev.regs_offset[umc_hw] print("UMC ip_ver=%s, %d instances"%(adev.ip_ver.get(umc_hw),len(bases))) for inst,b in sorted(bases.items()): print(" inst %d: %s"%(inst, ", ".join(hex(x) for x in b))) # SMN read via the index/data pair, same path smn_survey.py used IDX, DAT = 14, 15 # PCIE_INDEX2 / PCIE_DATA2 as dword indices in BAR5 def smn_read(addr): adev.wreg(IDX, addr & 0xffffffff) return adev.rreg(DAT) print("\n--- sanity: regguard classification of a KNOWN-GOOD and a KNOWN-DEAD area ---") known_good=[0x16600, 0x16604, 0x16608] # THM, previously confirmed live res=regguard.classify_read(smn_read, known_good) print(" THM 0x16600..: %s"%{hex(k) if isinstance(k,int) else k:v for k,v in res.items()}) print("\n--- UMC instance 0 base sweep (read-only, 16 dwords per base) ---") b0=bases[0] for base in b0: addrs=[base+4*i for i in range(6)] res=regguard.classify_read(smn_read, addrs) path=res.get('_path') vals=[] for a in addrs[:6]: try: vals.append("%08x"%smn_read(a)) except Exception: vals.append("ERR") print(" base %#011x path=%-9s %s"%(base, path, " ".join(vals))) print("\nMEMSIZE=%s sos_alive=%s"%(hex(adev.rreg(0xde3)), adev.psp.is_sos_alive()))