Skip to content

fwmanager: Add BootControl trait and HAL adapter - #355

Merged
leongross merged 4 commits into
OpenPRoT:mainfrom
9elements:add-boot-reset-control_v2
Jul 23, 2026
Merged

fwmanager: Add BootControl trait and HAL adapter#355
leongross merged 4 commits into
OpenPRoT:mainfrom
9elements:add-boot-reset-control_v2

Conversation

@chrysh

@chrysh chrysh commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Introduce the Boot Orchestrator's actuation capability: the BootControl trait (hold_in_reset / release) and HalBootControl, which binds one HAL ResetControl line to a managed device. Includes a host unit test verifying that holding a device in reset asserts exactly its configured line.

Includes tests that release deasserts the device's configured line and that a controller error surfaces through BootControl unchanged. Extend the fake reset controller with opt-in failure injection to drive the error case.

Closes: 9elements#2

Assisted-by: Claude:claude-opus-4-8

@chrysh chrysh mentioned this pull request Jul 17, 2026
@chrysh
chrysh marked this pull request as ready for review July 17, 2026 10:23
@chrysh

chrysh commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@rusty1968 @leongross Can you have a look?

@chrysh
chrysh force-pushed the add-boot-reset-control_v2 branch from b6b55ae to d55e95f Compare July 17, 2026 13:54
Comment thread services/fwmanager/api/src/boot_control.rs Outdated
Comment thread services/fwmanager/api/src/boot_control.rs Outdated
Comment thread services/fwmanager/api/src/boot_control.rs Outdated
chrysh and others added 2 commits July 21, 2026 13:46
Introduce the Boot Orchestrator's actuation capability: the BootControl
trait (hold_in_reset / release) and HalBootControl, which binds one HAL
ResetControl line to a managed device. Includes a host unit test verifying
that holding a device in reset asserts exactly its configured line.

Includes tests that release deasserts the device's configured line and that a
controller error surfaces through BootControl unchanged. Extend the fake
reset controller with opt-in failure injection to drive the error case.

Closes: #2

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Christina Quast <christina.quast@9elements.com>
Co-authored-by: Marvin Gudel <marvin@gudel.org>
@chrysh
chrysh force-pushed the add-boot-reset-control_v2 branch from e10f4c6 to daa9aa7 Compare July 21, 2026 12:04
Tighten BootControl::Error from Debug-only to
`core::error::Error + system_control::Error` so the orchestrator gets
Display and a source() cause chain instead of just the Debug dump, and
so generic `BootControl` consumers can categorize failures via kind()
without downcasting to a concrete error type.

HAL reset controllers keep the existing Error/kind() pattern unchanged;
the new BootError adapter supplies the core::error::Error machinery over
any HAL error, so no per-implementation work is required.

Cover the combined bound with a compile-time fence and tests for Display
output, source(), dyn downcast, and kind() reached through a generic
BootControl.

Assisted-by: Claude:claude-opus-4-8
Signed-off-by: Christina Quast <christina.quast@9elements.com>
Comment thread services/fwmanager/api/src/boot_control.rs Outdated
Split the HAL-backed adapter out of fwmanager-api so the api crate is a
dependency-free leaf holding only the BootControl capability contract,
matching the layout of #20. HalBootControl and the
BootError wrapper move to the new fwmanager-hal-adapters crate, which
depends on //hal/blocking and the api crate.

Drop the system_control::Error bound from BootControl::Error, keeping
core::error::Error only: requiring the HAL error trait in the api crate
would keep the HAL dependency the split is meant to remove. BootError
still exposes kind(), and the generic-consumer test now recovers the
error category by downcasting the dyn core::error::Error instead of
relying on the removed bound.

Add impl From<E> for BootError<E> so implementations forwarding HAL
calls can use ? instead of .map_err(BootError), and switch
HalBootControl over to it.

Add api-side tests proving the contract stays implementable with no HAL
in sight, and cover the release error path in the adapter.

Assisted-by: Claude:claude-fable-5
Signed-off-by: Christina Quast <christina.quast@9elements.com>
@chrysh
chrysh force-pushed the add-boot-reset-control_v2 branch from e190335 to 19942a9 Compare July 22, 2026 09:50

@embediver embediver 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.

LGTM

@leongross
leongross merged commit 06ab198 into OpenPRoT:main Jul 23, 2026
5 checks passed
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.

Downstream device reset/boot control signaling

4 participants