"""Probe the IP-discovery base addresses as SMN targets on the healthy card. Gap being closed: smn_survey.py only walked the 0x03?00000 MP-class family. The card's own IP discovery table lists 125 base addresses for SMUIO, THM, CLK, DF, UMC, GC, NBIO etc. Those were never probed through the SMN window. STRICTLY READ-ONLY: the only writes are to regBIF_BX0_PCIE_INDEX2, the address half of the standard indirect read the driver performs continuously. Every value is mirror-tested individually (value == byteswap(addr) means the fabric echoed the index and the address is not decoded for us). """ import struct, sys sys.path.insert(0, "/Users/user/src/tinygrad") sys.path.insert(0, "/Users/user/dev/amd-psp-re/psp_out") from regguard import byteswap from tinygrad.runtime.support.usb import USB3 from tinygrad.runtime.support.system import USBPCIDevice devs = [] for vid, pid in ((0x3801, 0x0001), (0xADD1, 0x0001)): devs += list(USB3.list_devices(vid, pid)) if not devs: sys.exit("no bridge") gpu = USBPCIDevice("AM", *devs[0]) usb = gpu.usb.usb lt = usb.control_read(0xE4, 1, value=0xB450)[0] if lt != 0x78: sys.exit("link down LTSSM=%#x" % lt) b5 = gpu.map_bar(5, fmt='B') rd = lambda o: struct.unpack('