Skip to content

rad1: audit the register model against its contract, name the offsets, fix two mismatches - #676

Open
jamesbraid wants to merge 2 commits into
audio/ice1724from
audio/rad1-audit
Open

jamesbraid wants to merge 2 commits into
audio/ice1724from
audio/rad1-audit

Conversation

@jamesbraid

Copy link
Copy Markdown
Collaborator

The RAD1 model gave a meaning to 0x88 and 0x8c that no source supported (the Onyx2 muted every other second because of it). That bug was found by a guest, not by reading the register contract. This PR reads the whole model against the contract register by register, so the next one is found on paper.

Two commits:

  • Name every BAR0 offset in one block. Offsets, ring layouts, fixed words and the status-slot layout move to rad1/regs.rs, named for what the register does. A register no source explains is named by offset and marked unsourced. No behaviour change.
  • Store 0x84, run the MediaIO counter from reset. The two mismatches the audit found. The MediaIO start-up writes 0x84, which the model dropped as an unsupported access. The MediaIO driver never writes the counter control word at 0x40 but needs 0x30 to advance, and the model's counter only ran after the Octane's control writes. Tests fail on the old model.

Audit result

Counts over the registers and fields the model reads, writes or acts on: 27 match, 2 fixed, 8 unsourced (kept, flagged in the module notes and the REG_UNSOURCED_* names).

  • Match: position bank 0x04-0x2c, counter 0x30, enables 0x44-0x58, status control 0x5c, relay and DAC words on the Octane card, the serial-line reading of 0x88 and 0x8c on MediaIO, clock generator 0xa0-0xb4, descriptor rings and RAM, subcode windows, status-slot layout.
  • Fixed: 0x84, MediaIO counter.
  • Unsourced: the 0x40 control values' meaning and the hold-before-run rule, 0x74, 0x78, 0xb8, 0xbc, 0x70 and 0x90 bit meanings, 0x34 polarity.

Scrutinise

  • The mute words stay as the earlier MediaIO fix left them; this PR is built on top of it.
  • Commit 1 should be a pure move: every value in regs.rs equals the old inline one, and STARTUP_OFFSETS keeps its order (0x84 is appended in commit 2, last).
  • Adding a start-up word grows the saved state's startup list by one; saves are for identical builds.

Verification

  • cargo check --tests -p iris, default and --features jitv2.
  • cargo test -p iris --lib rad1: 70 passed. Touched module list from the diff: dev::rad1 only.
  • With the two fixes reverted, the three new tests (0x84 read-back, MediaIO counter) fail.
  • Not run: an Onyx2 boot to watch the "UST not incrementing" alert go away.

The RAD1 model matched bare offsets in the start-up register list, the
descriptor rings, the position bank, the status-slot layout, the counter
control words and the control words it accepts to start a channel. A
reader could not tell a register from an arbitrary number, and a later
generated definitions header would have had nothing to replace one for
one.

The offsets, fixed words and slot layout now live in rad1/regs.rs, named
for what the register does. Registers whose meaning no source gives are
named by their offset and marked unsourced, and the module notes say so
instead of leaving the guess implicit: the counter's hold, run and stop
reading of 0x0e, 0x0a and 0x02 is the model's, as is taking run only
after hold. No behaviour changes; the module's tests pass unchanged.
Audit of the RAD1 model against its register contract found two
registers whose behaviour did not follow it.

The MediaIO start-up writes 0x84 with 0. The model had no such register
and dropped the write as an unsupported access. It now stores and reads
it back like the other start-up words, so a guest's start-up no longer
trips the unsupported-access log.

The MediaIO driver never writes the counter control word at 0x40, yet at
start-up reads the counter at 0x30 twice 10 us apart and raises "RAD UST
not incrementing" unless it advanced by 3. The model's counter ran only
after the Octane's 0x0e, 0x0a control writes, so on the Onyx2 it never
moved. The MediaIO card's counter now runs from reset and a card reset
does not stop it; the Octane's still waits for its control words. This is
the contract's reading, not a run: I did not boot the Onyx2 to see the
alert go.

The new tests fail on the old model: a nonzero write to 0x84 read back as
0, and the MediaIO counter did not advance with no control write.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant