feat(board): per-board command channel, power-rail primitives, thread telemetry types - #68
feat(board): per-board command channel, power-rail primitives, thread telemetry types#68recklessnode wants to merge 2 commits into
Conversation
c7dff91 to
78030bf
Compare
|
Series merge order (updated 2026-07-22) - four stacked PRs, all MERGEABLE, each green under
The order is the compile dependency chain (verified at import level - no PR references a symbol from a later one), not a preference. Merging #68 first collapses #69's visible diff to its own commits, and so down the stack. Later commits added today (the runtime-retune invalidation fix on #70, the serial hardening on #69) are folded into the PR whose code they touch, keeping each PR correct-from-first-commit rather than fixed-in-a-later-PR. |
…d telemetry types
Infrastructure groundwork usable by any board, no new dependencies:
- Wire the per-board command channel end to end: BackplaneConnector and
api::registry::BoardRegistration gain an optional
mpsc::Sender<BoardCommand>; the backplane forwards it at start_board.
BoardCommand::SetFanTarget and SetFanTargetRequest existed but nothing
wired them - PATCH /api/v0/boards/{name}/fans/{fan} now drives them
(boards opt in by populating command_tx; all current boards answer
"accepts no commands" until they grow a command loop).
- BoardRegistry::board(name) + command_tx(name) accessors with lazy
disconnect pruning; get_board refactored onto the former.
- board/power.rs: PowerRail trait (Tps546PowerRail, FilePowerRail file
adapters, FileGpioPin) + GpioResetLine (AsicEnable impl) +
VoltageStackBringupPlan for ordered multi-rail bring-up with settle
delays and reverse-order shutdown.
- hash_thread: HashThreadTemperatureReading/PowerReading/
TelemetryUpdate + HashThreadEvent::TelemetryUpdate (typed path for
thread-sourced sensor data; bitaxe's monitor TODO wants this) and
HashThreadError as a shared thread error vocabulary.
- Backplane::attach_configured_board: attach an env-configured virtual
board without synthesizing a transport event.
- BoardTelemetry.asics (serde-default) + AsicState/EngineCoordinate:
generic per-ASIC topology/diagnostics state for multi-ASIC boards.
- transport/serial: Clone derives on the Arc-backed reader/writer/
control halves.
- .gitattributes for LF normalization.
Applies the CODE_STYLE S.topdown/S.mod ordering rules added in e0e582f to the new power-rail module: - `pub trait PowerRail` now precedes `PowerRailTelemetry`, the supporting type that appears in its signature (S.topdown main-type-first). - `pub async fn pulse` now precedes the private `drive` it calls (S.topdown pub-before-private / caller-before-callee). - `impl AsicEnable for GpioResetLine` moves back next to `GpioResetLine` instead of being stranded below the unrelated `FileGpioPin` block (S.mod group order). - `VoltageStackBringupPlan` is reunited with its two impls, which had been split off below `FilePowerRail` (S.mod group order). Pure reordering: the file is line-for-line identical as a multiset apart from two blank lines rustfmt collapsed. cargo fmt + cargo check clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
78030bf to
5ff444c
Compare
|
Heads-up on a force-push just now across the whole series (#68 → #69 → #70 → #71). Two drivers, no functional change in either: 1. Rebased onto current 2. Applied the new Each style commit is pure reordering — every touched file is identical as a multiset of lines apart from a couple of blank lines Two notes for whoever picks this up:
|
Part 1 of a 4-PR series adding Intel BZM2 (Bonanza Mine 2) ASIC support. This first part is generic infrastructure with zero BZM2 code — each piece is useful to mujina on its own:
Per-board command channel, wired end to end
BoardCommand::SetFanTargetand theSetFanTargetRequestDTO existed but nothing connected them. This PR lands the missing plumbing along architecture.md's "new capabilities = new channels" rule:BackplaneConnectorandapi::registry::BoardRegistrationgain an optionalmpsc::Sender<BoardCommand>; the backplane forwards it instart_board.PATCH /api/v0/boards/{name}/fans/{fan}now drivesSetFanTargetwith a 5 s reply timeout. Boards opt in by populatingcommand_tx; all current boards answer "accepts no commands" (400) until they grow a command loop — wiring bitaxe's EMC2101 into this is a natural follow-up.BoardRegistrygainsboard(name)/command_tx(name)accessors with lazy disconnect pruning;get_boardnow uses the former instead of scanning the full snapshot list.Power-rail primitives (
board/power.rs)PowerRailtrait with three implementations —Tps546PowerRail(adapts the existing TPS546 driver to the trait and toVoltageRegulator),FilePowerRail/FileGpioPin(sysfs/hwmon file adapters for SBC-style regulator and GPIO files without I2C), andGpioResetLine(anAsicEnablewithpulse(assert, settle)). PlusVoltageStackBringupPlan: ordered multi-rail power-up with per-step settle delays and reverse-order shutdown. Bitaxe hand-rolls its TPS546 bring-up and EmberOne00 (12 ASICs) has no rail-sequencing primitives yet — this is the shared layer both can converge on. Tested, no new dependencies.Typed thread telemetry + shared thread errors
HashThreadTemperatureReading/HashThreadPowerReading/HashThreadTelemetryUpdateandHashThreadEvent::TelemetryUpdategive hash threads a typed path to report sensor data (the bitaxe monitor currently publishesthreads: Vec::new() // TODO: populate from hash thread telemetry).HashThreadErrorgives thread implementations a shared error vocabulary.Smaller pieces
Backplane::attach_configured_board(device_type, device_id)— attach an env-configured virtual board without synthesizing a transport event (the CPU miner's daemon-side syntheticCpuDeviceConnectedinjection could migrate to this).BoardTelemetry.asics(serde-default, hidden when empty) +AsicState/EngineCoordinate: generic per-ASIC topology/diagnostics state for multi-ASIC boards.Clonederives on the Arc-backed serial reader/writer/control halves, so a board can keep a stats handle while its thread owns the port..gitattributesfor LF normalization.Series
asic/bzm2protocol/thread layer → 3. BZM2 board driver + tuning planner → 4. HTTP diagnostics + hardware docs. Each part builds and tests green standalone. The series replaces Add experimental Blockscale BZM2 support and diagnostics #38 and Add BZM2 API parity and runtime retune safety #53 (rebuilt from scratch on current main — see those PRs for history).Gates:
cargo build(0 warnings),cargo test(330 passed / 0 failed),cargo fmtclean.🤖 Generated with Claude Code