zyp@odyssey:~/rust_pcie_test$ lspci -s 01: -vv
01:00.0 Unassigned class [ff00]: Device 1234:5678
	Control: I/O- Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B- DisINTx-
	Status: Cap+ 66MHz- UDF- FastB2B- ParErr- DEVSEL=fast >TAbort- <TAbort- <MAbort- >SERR- <PERR- INTx-
	IOMMU group: 18
	Region 0: Memory at a1100000 (32-bit, non-prefetchable) [size=1M]
	Capabilities: <access denied>
	Kernel driver in use: vfio-pci

zyp@odyssey:~/rust_pcie_test$ cat src/bin/ident.rs 
use anyhow::{anyhow, Context};

use pci_driver::backends::vfio::VfioPciDevice;
use pci_driver::device::PciDevice;
use pci_driver::regions::PciRegion;

fn main() -> anyhow::Result<()> {
    let device = VfioPciDevice::open("/sys/bus/pci/devices/0000:01:00.0")
        .context("Failed to open PCIe device")?;

    let bar0 = device.bar(0).ok_or(anyhow!("Failed to open BAR0"))?;

    let mut buf = Vec::new();
    let mut offset = 0x2000;

    loop {
        let value = bar0.read_u8(offset)
            .context("Failed to read from BAR0")?;

        match value {
            0x00 => break,
            0xff => break,
            _ => (),
        }

        buf.push(value);
        offset += 4;
    }

    let str = String::from_utf8(buf)?;

    println!("{}", str);

    Ok(())
}
zyp@odyssey:~/rust_pcie_test$ cargo run --bin ident
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
     Running `target/debug/ident`
LiteX SoC on Versa ECP5 2026-04-05 18:28:53