Skip to content

services: Add the OCP recovery device dispatch - #36

Open
chrysh wants to merge 1 commit into
ocp-recovery-registersfrom
ocp-recovery-server
Open

chrysh wants to merge 1 commit into
ocp-recovery-registersfrom
ocp-recovery-server

Conversation

@chrysh

@chrysh chrysh commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

#35 holds the register layouts, and no code in the tree answers an access from the Recovery Agent.

dispatch answers one access: it takes a command byte, an optional write payload and a response buffer, serves the register bytes and drains INDIRECT_FIFO_DATA into a FifoSink. dispatch latches the protocol error of a refused access into DEVICE_STATUS byte 1, and the DEVICE_STATUS read clears it.

The dispatch decides no policy. An accepted RECOVERY_CTRL or DEVICE_RESET write sets the register, and the caller reads the command with take_activation and take_reset_request, which clear the field the device acted on.

RecoveryInterface holds one instance of every recovery register. The name follows Caliptra, which calls the same block the secure firmware recovery interface (sec_fw_recovery_if) in hardware. The instance is meant to live in the i2c server-runtime loop, because only that loop can answer a read within the clock-stretch budget. RamStaging implements ByteSource from util/io, the trait VerifySession::poll reads a candidate through, so the verifier reads a staged image with no adapter.

Stack, review in order:

  1. services: Add the OCP recovery register layouts #35, the register layouts
  2. this PR, the device dispatch
  3. services: Add the Recovery Agent sequence test for streaming boot #37, the Recovery Agent sequence test

The same commit is upstream as OpenPRoT#629.

RecoveryInterface holds the registers the eRoT serves to the Recovery
Agent, and the dispatch answers one access. The dispatch serves the
register bytes on a read, latches the protocol error of a refused access
into DEVICE_STATUS byte 1, and drains INDIRECT_FIFO_DATA payloads into a
FifoSink. The DEVICE_STATUS read is the only read that clears a value,
the protocol error.

Policy stays with the caller. An accepted RECOVERY_CTRL or DEVICE_RESET
write only sets the register, and the caller reads the command with
take_activation and take_reset_request, which clear the field under the
"Write 1, Device Clears" contract.

RamStaging backs the FIFO and implements ByteSource, the trait
VerifySession::poll reads a candidate through, so the verifier reads a
staged image with no adapter. ByteSource lives in util/io, a leaf crate,
so services/ocp-recovery/server takes no dependency on the orchestrator
driver. The inherent methods are staged_len and staged_is_empty,
because they answer for the bytes pushed so far, while the ByteSource
methods answer for the announced image.

services/ocp-recovery/server is host-testable with no kernel
dependencies, like services/i2c/server next to
services/i2c/server-runtime. The interface instance is meant to live in
the i2c server-runtime loop, because only that loop can answer an SMBus
read before the clock-stretch budget runs out.

Signed-off-by: Christina Quast <christina.quast@9elements.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

1 participant