gc_bba_test: report where ring frames actually are when t_dma fails

t_dma said "p1 len 0x0002 implausible (RWP=11)", which names the symptom but
not the cause: a length alone cannot distinguish an unwritten descriptor from a
shifted read from a frame written at a page other than the one RRP points at.

On failure it now walks all 15 ring pages, classifies each descriptor ('-'
all-zero/never written, 'o' plausible length, 'x' non-zero but implausible,
'?' read failed) and prints that map plus the 4 raw descriptor bytes at the RRP
page.  One run then shows which of those it is.

Diagnostic only; no change to the pass/fail criterion or to any gateware.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-10 10:09:27 +02:00
parent abab26232b
commit e20b34b5e9
+28 -2
View File
@@ -375,8 +375,34 @@ static int t_dma(char *m, size_t n)
buf[16], buf[17]);
return 0;
}
snprintf(m, n, "p%u len 0x%04X implausible (RWP=%u)", (unsigned)page,
(unsigned)dlen, (unsigned)(((u32)wp[1] << 8) | wp[0]));
/* Diagnostic: the length alone does not say WHERE the frames are. Walk
* all 15 ring pages and classify each descriptor, so one run shows
* whether the ring is empty, written at a different page than RRP says,
* or holding genuinely malformed descriptors:
* '-' all-zero (never written) 'o' plausible frame length
* 'x' non-zero but implausible '?' read failed
* Plus the raw 4 descriptor bytes at the RRP page. */
{
char map[16];
u32 pg;
u8 d[4];
for (pg = 1; pg <= 15; pg++) {
u32 dl;
if (bba_stream((u16)(pg << 8), d, 4) < 0) {
map[pg - 1] = '?';
continue;
}
dl = ((u32)d[2] << 8) | d[3];
if (d[0] == 0 && d[1] == 0 && dl == 0) map[pg - 1] = '-';
else if (dl > 4 && dl <= 1518) map[pg - 1] = 'o';
else map[pg - 1] = 'x';
}
map[15] = 0;
snprintf(m, n, "p%u len 0x%04X raw %02X %02X %02X %02X RWP=%u map %s",
(unsigned)page, (unsigned)dlen,
buf[0], buf[1], buf[2], buf[3],
(unsigned)(((u32)wp[1] << 8) | wp[0]), map);
}
return 1;
}