Expand description
PCI (Peripheral Component Interconnect) bus module.
This module provides support for PCI device discovery and management. It implements PCI configuration space access, device enumeration, and integration with the device manager.
§Overview
PCI is a standard bus for connecting peripheral devices to a computer system. This implementation focuses on PCIe (PCI Express) using ECAM (Enhanced Configuration Access Mechanism) which is commonly used on RISC-V and ARM platforms.
§Architecture
The PCI subsystem consists of several components:
- Configuration Space Access: Reading and writing PCI configuration registers
- Device Enumeration: Scanning the PCI bus tree to discover devices
- Device Information: Representing PCI device properties (vendor, device ID, etc.)
- Driver Matching: Matching PCI devices with appropriate drivers
§Integration with DeviceManager
PCI devices are discovered and registered with the DeviceManager, similar to platform devices. The PCI subsystem provides:
PciDeviceInfo: Device information structure implementingDeviceInfotraitPciDeviceDriver: Driver structure implementingDeviceDrivertrait
§Usage
use crate::device::pci::PciBus;
use crate::device::manager::DeviceManager;
// Initialize PCI bus with ECAM base address from device tree
let pci_bus = PciBus::new(ecam_base_addr, ecam_size);
// Scan for devices and register with DeviceManager
pci_bus.scan_and_register();§Configuration Space Layout
PCI configuration space is 256 bytes (4KB for PCIe) per function:
- 0x00-0x3F: Standard PCI configuration header
- 0x40-0xFF: Device-specific configuration
- 0x100-0xFFF: PCIe extended configuration (PCIe only)
Modules§
- config
- PCI configuration space access.
- device
- PCI device information.
- driver
- PCI device driver support.
- scan
- PCI device scanning and enumeration.
Structs§
- PciAddress
- PCI device address components
- PciBus
- PCI bus manager