Skip to content

fwmanager: Add device-table schema; declare a mock board in target/mock - #367

Merged
rusty1968 merged 5 commits into
OpenPRoT:mainfrom
9elements:add-config
Jul 28, 2026
Merged

fwmanager: Add device-table schema; declare a mock board in target/mock#367
rusty1968 merged 5 commits into
OpenPRoT:mainfrom
9elements:add-config

Conversation

@chrysh

@chrysh chrysh commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

fwmanager-api gains the schema for the per-board device table: DeviceConfig (name, reset line, boot timeout), CommitPolicy, and a const validate() so a bad table fails the build. All values are board config and live in the new target/mock/devices.rs — a mock board with one device per archetype (direct-flash SPI "bmc", PLDM "nic") whose declaration order is the boot order; hardware targets declare their own tables later. Kept out of config.rs, which belongs to the kernel.

Part of 9elements#1 (the downstream device definitions; partitioning schemes and verification keys remain open there).

@chrysh
chrysh force-pushed the add-config branch 2 times, most recently from 836b01b to f9b8233 Compare July 24, 2026 18:05
@chrysh

chrysh commented Jul 24, 2026

Copy link
Copy Markdown
Contributor Author

@FerralCoder @rusty1968 @embediver @leongross Can you have a look at a possible target config for the attached downstream and upstream devices?

@chrysh
chrysh marked this pull request as ready for review July 24, 2026 18:10
fwmanager-api gains the schema for the per-board device table:
DeviceConfig (name, reset line, boot timeout), CommitPolicy, and a
const validate() so a bad table fails the build. All values are board
config and live in the new target/mock/devices.rs — a mock board with
one device per archetype (direct-flash SPI "bmc", PLDM "nic") whose
declaration order is the boot order; hardware targets declare their
own tables later. Kept out of config.rs, which belongs to the kernel.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Christina Quast <christina.quast@9elements.com>
Refs: #1
Comment thread services/fwmanager/api/src/config.rs Outdated
Comment thread services/fwmanager/api/src/config.rs

@FerralCoder FerralCoder left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

am I correct to assume this is just a starting point showing the concept, and that more config parameters are intended to be added in future commits?

Comment thread services/fwmanager/api/src/config.rs Outdated
chrysh added 4 commits July 28, 2026 12:06
HalBootControl is generic over its controller's ResetId, so a hardcoded
u8 only fits controllers whose id type happens to be u8 — and reset may
not even be line-addressed. Parameterize the table over the board's
reset signal type so a mismatch fails to compile, and call the field
reset_signal rather than reset_line. The mock board uses u8.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Christina Quast <christina.quast@9elements.com>
Refs: #1
Everything builds in one tree, so a new CommitPolicy variant should
break the orchestrator's match instead of falling into a wildcard arm —
and board tables construct DeviceConfig by literal, which
#[non_exhaustive] would forbid.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Christina Quast <christina.quast@9elements.com>
Refs: #1
Liveness can be more than one timeout: a device may pass several boot
checkpoints, and the signal may be polled or queried rather than
device-pushed. Replace boot_timeout with an ordered checkpoint list,
each pairing a BootSignal (boot-complete GPIO, heartbeat, MCTP ready,
version query) with its own window: last checkpoint reached means
booted, an expired window fails the boot. BootSignal is generic over
the id its boot monitor reads a boot-complete line by, as DeviceConfig
is over its reset signal. The mock nic exercises the multi-checkpoint
path.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Christina Quast <christina.quast@9elements.com>
Refs: #1
Board tables run validate() at compile time, where a rejection is a
build error nobody can assert on — a vacuous loop would pass every
const check silently. Call it at runtime instead and prove each reject
path fires: empty device name, empty checkpoint list, empty checkpoint
name, zero window.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Christina Quast <christina.quast@9elements.com>
Refs: #1
@chrysh
chrysh requested review from FerralCoder and rusty1968 July 28, 2026 10:58
@rusty1968

rusty1968 commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Possible follow ups: #375, #377

@rusty1968
rusty1968 merged commit 708c8f9 into OpenPRoT:main Jul 28, 2026
5 checks passed
@leongross leongross linked an issue Jul 29, 2026 that may be closed by this pull request
4 tasks
@chrysh
chrysh deleted the add-config branch August 4, 2026 09:42
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.

Assumption of hard coded config

4 participants