hardware 0.0.9

A no_std bare-metal hardware abstraction layer — all port I/O, memory and swap allocations are guarded at runtime. Do not consider this dependency stable before x.1.x
Documentation
pub fn scan_lpu_devices(out: &mut [(u8, u8, u8, u16, u16)]) -> usize {
    let mut found = 0usize;
    for bus in 0u8..=255u8 {
        for dev in 0u8..32u8 {
            for func in 0u8..8u8 {
                if let Some((vendor, device_id)) = super::super::gpu::pci::read_ids(bus, dev, func)
                {
                    let (class, subclass, prog_if) =
                        super::super::gpu::pci::read_class(bus, dev, func);
                    if class == super::LPU_PCI_CLASS
                        && subclass == super::LPU_PCI_SUBCLASS
                        && prog_if < 0xFF
                    {
                        if found < out.len() {
                            out[found] = (bus, dev, func, vendor, device_id);
                            found += 1;
                        } else {
                            return found;
                        }
                    }
                }
            }
        }
    }
    found
}

pub fn read_subsystem_id(bus: u8, dev: u8, func: u8) -> u32 {
    crate::bus::pci::api::read_config_u32(bus, dev, func, 0x2C).unwrap_or(0)
}

pub fn read_revision(bus: u8, dev: u8, func: u8) -> u8 {
    let val = crate::bus::pci::api::read_config_u32(bus, dev, func, 0x08).unwrap_or(0);
    (val & 0xFF) as u8
}