Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions cmd/console-proxy/src/posix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ impl<'a> UartConsoleHandler<'a> {
let op = self.hubris.get_idol_command("ControlPlaneAgent.uart_read")?;

let v = humility_hiffy::hiffy_call::<u32>(
self.hubris,
self.core,
&mut self.context,
&op,
Expand All @@ -67,7 +66,6 @@ impl<'a> UartConsoleHandler<'a> {
let buf = &buf[..usize::min(buf.len(), HIFFY_BUF_SIZE)];

let v = humility_hiffy::hiffy_call::<u32>(
self.hubris,
self.core,
&mut self.context,
&op,
Expand Down Expand Up @@ -159,7 +157,6 @@ impl<'a> UartConsoleHandler<'a> {
.get_idol_command("ControlPlaneAgent.set_humility_uart_client")?;

humility_hiffy::hiffy_call::<()>(
self.hubris,
self.core,
&mut self.context,
&op,
Expand All @@ -176,7 +173,6 @@ impl<'a> UartConsoleHandler<'a> {
.get_idol_command("ControlPlaneAgent.get_uart_client")?;

let value = humility_hiffy::hiffy_call::<humility::reflect::Enum>(
self.hubris,
self.core,
&mut self.context,
&op,
Expand Down
9 changes: 4 additions & 5 deletions cmd/hiffy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,22 +124,22 @@ pub fn hiffy_list(hubris: &HubrisArchive, filter: Vec<String>) -> Result<()> {
}

match idol::lookup_reply(hubris, module, op.0) {
Ok((_, idol::IdolError::CLike(e))) => match &op.1.reply {
Ok((_, idol::IdolErrorType::CLike(e))) => match &op.1.reply {
Reply::Result { ok, .. } => {
println!("{}{:<27} {}", margin, "<ok>", ok.ty);
println!("{}{:<27} {}", margin, "<error>", e.name);
}
_ => warn!("mismatch on reply: found {op:?}"),
},
Ok((_, idol::IdolError::Complex(t))) => match &op.1.reply {
Ok((_, idol::IdolErrorType::Complex(t))) => match &op.1.reply {
Reply::Result { ok, .. } => {
println!("{}{:<27} {}", margin, "<ok>", ok.ty);
println!("{}{:<27} {}", margin, "<error>", t.name);
}
_ => warn!("mismatch on reply: found {op:?}"),
},

Ok((_, idol::IdolError::None)) => match &op.1.reply {
Ok((_, idol::IdolErrorType::None)) => match &op.1.reply {
Reply::Result { ok, .. } => {
//
// This is possible if the only error is ServerDeath
Expand Down Expand Up @@ -312,7 +312,6 @@ fn hiffy(subargs: HiffyArgs, context: &mut ExecutionContext) -> Result<()> {

(
match hiffy_call(
hubris,
core,
&mut context,
&op,
Expand All @@ -328,7 +327,7 @@ fn hiffy(subargs: HiffyArgs, context: &mut ExecutionContext) -> Result<()> {
)
};

hiffy_print_result(hubris, &op, return_code)?;
hiffy_print_result(hubris, &op, &return_code)?;
if let Some(data) = output {
if let Some(out) = &subargs.output {
std::fs::write(out, &data)
Expand Down
4 changes: 1 addition & 3 deletions cmd/host/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,6 @@ fn host_post_codes(
)?;
let op = hubris.get_idol_command("Sequencer.post_code_buffer_len")?;
let count = humility_hiffy::hiffy_call::<u32>(
hubris,
core,
&mut context,
&op,
Expand Down Expand Up @@ -417,7 +416,7 @@ fn host_post_codes(
ops.push(Op::Done); // Finish

for r in context.run(core, ops.as_slice(), None)? {
let v = humility_hiffy::hiffy_decode::<u32>(hubris, &op, r)?;
let v = op.decode(&r)?;
handle_value(v);
}
}
Expand All @@ -438,7 +437,6 @@ fn host_last_post_code(
)?;
let op = hubris.get_idol_command("Sequencer.last_post_code")?;
let v = humility_hiffy::hiffy_call::<u32>(
hubris,
core,
&mut context,
&op,
Expand Down
35 changes: 8 additions & 27 deletions cmd/monorail/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ use humility::core::Core;
use humility::hubris::*;
use humility::reflect::*;
use humility_cli::{ExecutionContext, humility_cmd};
use humility_hiffy::{HiffyContext, HiffyError};
use humility_idol::{HubrisIdol, IdolArgument};
use humility_hiffy::HiffyContext;
use humility_idol::{HubrisIdol, IdolArgument, IdolDecodeError, IdolError};

use anyhow::{Result, anyhow};

Expand Down Expand Up @@ -310,7 +310,6 @@ fn monorail_read(

let op = hubris.get_idol_command("Monorail.read_vsc7448_reg")?;
let value = humility_hiffy::hiffy_call::<u32>(
hubris,
core,
context,
&op,
Expand Down Expand Up @@ -345,7 +344,6 @@ fn monorail_write(

let op = hubris.get_idol_command("Monorail.write_vsc7448_reg")?;
humility_hiffy::hiffy_call::<()>(
hubris,
core,
context,
&op,
Expand Down Expand Up @@ -423,7 +421,6 @@ fn monorail_phy_read(
println!("Reading from port {} PHY, register {}", port, reg.name);
let op = hubris.get_idol_command("Monorail.read_phy_reg")?;
let value = humility_hiffy::hiffy_call::<u16>(
hubris,
core,
context,
&op,
Expand Down Expand Up @@ -456,7 +453,6 @@ fn monorail_phy_write(
pretty_print_fields(value as u32, &reg.fields, 0);
let op = hubris.get_idol_command("Monorail.write_phy_reg")?;
humility_hiffy::hiffy_call::<()>(
hubris,
core,
context,
&op,
Expand Down Expand Up @@ -599,7 +595,7 @@ fn monorail_dump(
let results = context.run(core, ops.as_slice(), None)?;
results
.into_iter()
.map(move |r| humility_hiffy::hiffy_decode(hubris, &op_read, r))
.map(move |r| op_read.decode(&r))
.collect::<Result<Vec<u32>, _>>()?
};
for (i, value) in results.iter().enumerate() {
Expand Down Expand Up @@ -674,19 +670,11 @@ fn monorail_status(

let port_results = port_results
.into_iter()
.map(move |r| {
humility_hiffy::hiffy_decode::<humility::reflect::Struct>(
hubris, &op_port, r,
)
})
.map(move |r| op_port.decode::<humility::reflect::Struct>(&r))
.collect::<Vec<_>>();
let phy_results = phy_results
.into_iter()
.map(move |r| {
humility_hiffy::hiffy_decode::<humility::reflect::Struct>(
hubris, &op_phy, r,
)
})
.map(move |r| op_phy.decode::<humility::reflect::Struct>(&r))
.collect::<Vec<_>>();

// Decode the port and phy status values into reflect::Value
Expand Down Expand Up @@ -775,7 +763,7 @@ fn monorail_status(
)
}
Err(e) => {
if let HiffyError::Hiffy(e) = &e
if let IdolDecodeError::Idol(IdolError::Named(e)) = &e
&& e == "UnconfiguredPort"
{
print!(
Expand All @@ -799,7 +787,7 @@ fn monorail_status(
)
}
Err(e) => {
if let HiffyError::Hiffy(e) = &e
if let IdolDecodeError::Idol(IdolError::Named(e)) = &e
&& (e == "UnconfiguredPort" || e == "NoPhy")
{
println!("{}", "-- -- --".dimmed());
Expand All @@ -824,7 +812,6 @@ fn monorail_mac_table(
// - Read the number of entries in the MAC table
// - Loop over the table that many times, reading entries
let mac_count = humility_hiffy::hiffy_call::<u32>(
hubris,
core,
context,
&op_mac_count,
Expand Down Expand Up @@ -864,11 +851,7 @@ fn monorail_mac_table(
let results = context.run(core, ops.as_slice(), None)?;
let results = results
.into_iter()
.map(move |r| {
humility_hiffy::hiffy_decode::<humility::reflect::Struct>(
hubris, &op, r,
)
})
.map(move |r| op.decode::<humility::reflect::Struct>(&r))
.collect::<Vec<Result<_, _>>>();

let mut mac_table: BTreeMap<u16, Vec<[u8; 6]>> = BTreeMap::new();
Expand Down Expand Up @@ -917,7 +900,6 @@ fn monorail_reset_counters(
) -> Result<()> {
let op = hubris.get_idol_command("Monorail.reset_port_counters")?;
humility_hiffy::hiffy_call::<()>(
hubris,
core,
context,
&op,
Expand All @@ -936,7 +918,6 @@ fn monorail_counters(
) -> Result<()> {
let op = hubris.get_idol_command("Monorail.get_port_counters")?;
let s = humility_hiffy::hiffy_call::<humility::reflect::Struct>(
hubris,
core,
context,
&op,
Expand Down
10 changes: 1 addition & 9 deletions cmd/net/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ fn net_ip(
let op = hubris.get_idol_command("Net.get_mac_address")?;

let v = humility_hiffy::hiffy_call::<humility::reflect::Tuple>(
hubris,
core,
&mut hiffy_context,
&op,
Expand Down Expand Up @@ -147,7 +146,6 @@ fn net_mac_table(
// - Read the number of entries in the MAC table
// - Loop over the table that many times, reading entries
let mac_count = humility_hiffy::hiffy_call::<u32>(
hubris,
core,
&mut hiffy_context,
&op_mac_count,
Expand Down Expand Up @@ -198,11 +196,7 @@ fn net_mac_table(
let results = hiffy_context.run(core, ops.as_slice(), None)?;
let results = results
.into_iter()
.map(move |r| {
humility_hiffy::hiffy_decode::<humility::reflect::Struct>(
hubris, &op, r,
)
})
.map(move |r| op.decode::<humility::reflect::Struct>(&r))
.collect::<Vec<_>>();

let mut mac_table: BTreeMap<u16, Vec<[u8; 6]>> = BTreeMap::new();
Expand Down Expand Up @@ -254,7 +248,6 @@ fn net_status(
let op = hubris.get_idol_command("Net.management_link_status")?;

let s = humility_hiffy::hiffy_call::<humility::reflect::Struct>(
hubris,
core,
&mut hiffy_context,
&op,
Expand Down Expand Up @@ -318,7 +311,6 @@ fn net_counters(
let op = hubris.get_idol_command("Net.management_counters")?;

let s = humility_hiffy::hiffy_call::<humility::reflect::Struct>(
hubris,
core,
&mut hiffy_context,
&op,
Expand Down
19 changes: 8 additions & 11 deletions cmd/powershelf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use humility::hubris::HubrisArchive;
use humility::hubris::HubrisEnum;
use humility_cli::{ExecutionContext, humility_cmd};
use humility_hiffy::*;
use humility_idol::{self as idol, HubrisIdol};
use humility_idol::{self as idol, HubrisIdol, IdolDecodeError};

#[derive(Parser, Debug)]
#[clap(name = "powershelf", about = env!("CARGO_PKG_DESCRIPTION"))]
Expand Down Expand Up @@ -165,20 +165,17 @@ fn powershelf_run(
let results = context.run(core, ops.as_slice(), None)?;

for (ndx, variant) in operation.variants.iter().enumerate() {
let result = match hiffy_decode::<humility::reflect::Value>(
hubris,
&idol_cmd,
results[ndx].clone(),
) {
Ok(s) => Ok(s),
Err(HiffyError::Hiffy(s)) => Err(s),
Err(HiffyError::Other(e)) => return Err(e),
};
let result =
match idol_cmd.decode::<humility::reflect::Value>(&results[ndx]) {
Ok(s) => Ok(s),
Err(IdolDecodeError::Idol(s)) => Err(s),
Err(IdolDecodeError::DecodeFailed(e)) => return Err(e.into()),
};

println!(
"{:<20} => {}",
variant.name,
hiffy_format_result(hubris, result.clone())
hiffy_format_result(hubris, &result)
);

if subargs.verbose {
Expand Down
2 changes: 0 additions & 2 deletions cmd/qspi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,6 @@ fn qspi(subargs: QspiArgs, context: &mut ExecutionContext) -> Result<()> {
let s = s.unwrap();
humility::msg!("Setting slot to {s}");
hiffy_call::<()>(
hubris,
core,
&mut context,
&hubris.get_idol_command("HostFlash.set_dev")?,
Expand Down Expand Up @@ -1025,7 +1024,6 @@ fn qspi(subargs: QspiArgs, context: &mut ExecutionContext) -> Result<()> {
_ => bail!("dev_select must be 0 or 1"),
};
hiffy_call::<()>(
hubris,
core,
&mut context,
&hubris.get_idol_command("HostFlash.write_persistent_data")?,
Expand Down
Loading
Loading