oxidecomputer / oxidecomputer/hubris
Consolidate how to look up a device in `Power` API
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3.6k
- Forks
- 239
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 23
Description
Selecting a device and/or rail in the Power API happens in several ways.
- By device + rail + offset into that filtered subset of
CONTROLLER_CONFIG:
"read_mode": (
doc: "reads the VOUT_MODE value for the given device",
encoding: Hubpack,
args: {
"dev": "Device",
"rail": "u8",
"index": "u32",
},
reply: Result(
ok: "u8",
err: CLike("ResponseCode"),
),
idempotent: true,
),
- By I2C address (hope it's unique!)
"rendmp_dma_read": (
doc: "reads a DMA register from a Renesas multiphase power controller",
args: {
"addr": "u8",
"reg": "u16",
},
reply: Result(
ok: "u32",
err: CLike("ResponseCode"),
),
idempotent: true,
),
- By voltage
SensorId:
"phase_current": (
doc: "reads phase current for the rail denoted by the specified voltage sensor",
args: {
"rail": (
type: "SensorId",
recv: From("u32", None),
),
"phase": "u8",
},
reply: Result(
ok: "f32",
err: CLike("ResponseCode"),
),
idempotent: true,
),
- By absolute index into
CONTROLLER_CONFIG
"raw_pmbus_read_byte": (
doc: "performs a raw pmbus read operation",
encoding: Hubpack,
args: {
"index": "u32",
"has_rail": "bool",
"op": "u8",
},
reply: Result(
ok: "u8",
err: CLike("ResponseCode"),
),
idempotent: true,
),
All of these except (4) require extra work on the Hubris side: we have to iterate over lists and find a matching sensor.
(4) requires extra work on the Humility side instead: Humility has to load CONTROLLER_CONFIG and decide itself what index it cares about. Note that option (1) should also be doing this, but right now, we're only using it to get the IBC voltage, which is a unique device.
Humility runs on the Bigger Computer, so we should consolidate to this method. We implemented code to get the index as part of https://github.com/oxidecomputer/humility/pull/382, so this is doable; we'd need to keep shims in Humility to support older Hubris archives.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the Power API definitions and the index-handling work in Humility PR 382, focusing on CONTROLLER_CONFIG and the existing device, rail, SensorId, and address lookup paths. Consolidate lookups around the absolute CONTROLLER_CONFIG index, while preserving Humility shims for older Hubris archives; done means the API no longer requires Hubris-side list searches.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- embedded-iot
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100