PCI Bus Driver
Peripheral Component Interconnect Device Enumeration
Overview
The PCI driver enumerates and configures devices on the PCI bus. Modern hardware connects via PCI, including network cards, AHCI storage controllers, and graphics cards.
PCI Configuration Space
Each PCI device has 256 bytes of configuration space accessible via I/O ports or memory-mapped I/O. AOS uses the port-based method:
| Port | Purpose |
|---|---|
| 0xCF8 | Address register (write device address) |
| 0xCFC | Data register (read/write 32-bit data) |
Device Enumeration
The kernel scans all PCI buses and devices:
- For each bus (0-255)
- For each device on bus (0-31)
- For each function (0-7)
- Read vendor/device ID
- If valid, record device info
- Initialize appropriate driver
Key Takeaways
- ✓ PCI uses configuration space ports
- ✓ Device enumeration finds all hardware
- ✓ Vendor/Device IDs identify devices
- ✓ Class codes determine driver type
- ✓ Interrupt distribution via MSI