Focuses on PCIe Configuration Space, Type0/Type1 headers, BARs, capability registers, and advanced configuration features.
1. PCIe Configuration Space Overview
PCIe devices include a configuration space to:
- Enable the system to discover devices
- Assign memory and I/O resources
- Configure capabilities like MSI, power management, and error reporting
Standard Size: 256 bytes for legacy PCI, 4KB for PCIe extended configuration space.
ASCII Layout:
+----------------+-----------------+
| Offset 0x00 | Vendor ID |
| Offset 0x02 | Device ID |
| Offset 0x04 | Command/Status |
| Offset 0x08 | Revision/ Class |
| Offset 0x0C-0x3F| Header / BARs |
| Offset 0x40+ | Capabilities |
+----------------+-----------------+
2. Type0 & Type1 Headers
2.1 Type0 Header
- Used by endpoint devices
- Contains BARs, latency timer, interrupt lines, and capabilities
ASCII Type0 Header Example:
+---------+---------+---------+
| VendorID| DeviceID| Command |
+---------+---------+---------+
| Status | Revision| Class |
+---------+---------+---------+
| BAR0 | BAR1 | BAR2 |
+---------+---------+---------+
| BAR3 | BAR4 | BAR5 |
+---------+---------+---------+
| CapPtr | Interrupt Line | Interrupt Pin |
+------------------------------------------+
2.2 Type1 Header
- Used by PCIe bridges / switches
- Adds secondary/subordinate bus numbers
- Manages IO/memory ranges for downstream devices
ASCII Type1 Header Example:
+---------+---------+---------+
| VendorID| DeviceID| Command |
+---------+---------+---------+
| Status | Revision| Class |
+---------+---------+---------+
| BAR0 | BAR1 | Primary Bus Num |
+---------+---------+---------+
| Secondary Bus Num | Subordinate Bus Num |
+----------------------------------------+
| I/O Base | I/O Limit | Memory Base | Memory Limit |
+----------------------------------------+
3. Base Address Registers (BARs)
- BARs define memory or I/O regions for a device
- Up to 6 BARs per endpoint
- BARs specify address range size, type (I/O vs memory), and 64-bit support
ASCII BAR Example:
BAR0: Memory 0x80000000 – 0x8000FFFF (64KB)
BAR1: I/O 0x0000C000 – 0x0000C0FF (256B)
BARs enable software to map device registers into system memory space.
4. Capability Registers
PCIe devices support capabilities beyond basic configuration:
| Capability | Purpose |
|---|---|
| MSI / MSI-X | Interrupt vectors |
| Power Management | ASPM, device states |
| Advanced Error Reporting | Layer-wise error handling |
| Virtual Channel | QoS and traffic class |
| Address Translation Services (ATS) | Virtualization support |
ASCII Example: Capability List
Offset 0x40: PCI Express Capability
Offset 0x44: MSI Capability
Offset 0x50: Power Management
Offset 0x60: Vendor-specific
5. L0s Updates
- L0s is a low-power link state
- Devices can negotiate L0s behavior via configuration space
- Ensures link enters/exits low-power states efficiently
Example: L0s Timing Configuration
Offset: L0s Entry Latency / L0s Exit Latency
System uses this info to prevent data loss during sleep
6. Advanced Configuration Concepts
- Extended configuration space (4KB) supports more capabilities for modern PCIe features
- Hot-plug and multi-function devices utilize Type1 header and capabilities
- BARs + Capability Registers combined allow efficient device initialization, resource allocation, and power management
ASCII Example: Endpoint Initialization Flow
[System BIOS] -> Reads VendorID/DeviceID -> Allocates BARs
-> Configures Capabilities (MSI, Power, ATS)
-> Enables Device -> Device ready for transactions
7. Summary – PCIe Configuration Space & Advanced Features
Responsibilities:
- Discover devices and assign resources via Type0/Type1 headers
- Configure BARs for memory and I/O access
- Enable capabilities: MSI, power management, error reporting, virtual channels
- Manage L0s and other low-power link features
- Support extended configuration space for modern PCIe features

