Expand description
PCI bus enumeration and device discovery.
This module provides utilities for scanning the PCI bus to find VirtIO and other network devices. Supports both:
- ECAM (Enhanced Configuration Access Mechanism) - Modern PCIe
- Legacy I/O ports - Older PCI (0xCF8/0xCFC)
§Usage
ⓘ
use morpheus_network::device::pci::{PciScanner, EcamAccess};
// For QEMU with PCIe ECAM at 0xB000_0000
let ecam = unsafe { EcamAccess::new(0xB000_0000 as *mut u8) };
let scanner = PciScanner::new(ecam);
for device in scanner.scan_bus(0) {
if device.is_virtio_net() {
// Found VirtIO network device!
}
}Modules§
- Diagnostic utilities for PCI debugging.
- Common ECAM base addresses for different platforms.
Structs§
- PCI device/function identifier.
- ECAM (PCIe Enhanced Configuration Access Mechanism) implementation.
- Legacy I/O port PCI configuration access (0xCF8/0xCFC).
- PCI device information from configuration space.
- PCI bus scanner.
Constants§
- PCIe extended configuration space size.
- PCI configuration space size for a single function.
- VirtIO device ID range for transitional devices.
- VirtIO device ID for modern network device.
- PCI vendor ID for VirtIO devices.
Traits§
- Trait for PCI configuration space access.
Functions§
- Read 32-bit value from PCI configuration space. Args: bus, device, function, offset (must be 4-byte aligned)
- Write 32-bit value to PCI configuration space. Args: bus, device, function, offset, value
- Test if PCI I/O ports are accessible. Returns the value read back from 0xCF8 (should have bit 31 set).
- Read CPU timestamp counter. Returns 64-bit TSC value.
- Delay for approximately the given number of microseconds using TSC. Assumes ~2.5 GHz CPU (adjust TSC_MHZ for your platform).