Skip to content

Commit fa2925c

Browse files
committed
lot fishing
1 parent c01bc55 commit fa2925c

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

swadm/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ oxnet.workspace = true
1818
slog.workspace = true
1919
tabwriter.workspace = true
2020
tokio.workspace = true
21+
tofino.workspace = true

swadm/src/main.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ enum Commands {
9191
#[command(subcommand)]
9292
cmd: compliance::Compliance,
9393
},
94+
Identifiers,
9495
}
9596

9697
// A LinkPath or "loopback", used when either is appropriate.
@@ -231,5 +232,20 @@ async fn main_impl() -> anyhow::Result<()> {
231232
Commands::Compliance { cmd: compliance } => {
232233
compliance::compliance_cmd(&client, compliance).await
233234
}
235+
Commands::Identifiers => identifiers(),
234236
}
235237
}
238+
239+
fn identifiers() -> anyhow::Result<()> {
240+
/*
241+
let t = tofino::get_tofino().unwrap().unwrap();
242+
let pci = t.open_pci().unwrap();
243+
*/
244+
let pci =
245+
tofino::pci::Pci::new("/dev/tofino/1", tofino::REGISTER_SIZE).unwrap();
246+
let fuse = tofino::fuse::Fuse::read(&pci).unwrap();
247+
let chip_id: tofino::fuse::ChipId = fuse.chip_id.into();
248+
println!("chip id: {:016x}", fuse.chip_id);
249+
println!("{}", chip_id);
250+
Ok(())
251+
}

0 commit comments

Comments
 (0)