PCIe Chapter 0: From the System View to Your First Specification Query
PCI Express (PCIe) carries requests and data between the host and peripheral devices. This chapter locates the system roles, then follows a capability list to read supported Link speeds separately from the current operating result.
Full Chinese tutorial and diagrams · Course roadmap · 繁體中文
What must happen after a device is connected?
A Root Complex connects the CPU/memory subsystem to the I/O hierarchy. A Root Port establishes an outward Link, a Switch extends the connection paths, and an Endpoint provides device functionality. A Link connects two adjacent ends; Lanes make up that Link. x4 means four Lanes, not four devices.
The basic object identified and configured by software is a Function. One card can expose multiple Functions. The example notation 0000:03:00.0 identifies a Segment, Bus, Device, and Function; Bus, Device, and Function are commonly abbreviated as BDF (Bus, Device, and Function identifier). A Segment is a logical grouping, not an additional hardware component, and this identifier is not a memory address.
- BDF
- Bus/Device/Function
Hardware at both ends must first meet the conditions for establishing a Link. System software discovers Functions and assigns resources; the device driver prepares the device-specific working interface. This is a teaching model of dependencies, and a platform may perform the work in stages. Firmware 3.3 §3.5 requires firmware to configure the complete paths to boot and console devices, as well as all Host Bridges. It does not guarantee that every Endpoint has been configured.
| Purpose | Information to locate |
|---|---|
| Identify a Function or query PCIe capabilities | The headers and Capability structures in Configuration Space. |
| Operate the device interface from the CPU | Resources described by BARs and the device's register definitions. Access through memory mapping is MMIO (Memory-Mapped I/O). |
| Move working data through device-initiated accesses | DMA (Direct Memory Access) buffers, device-visible addresses, and access conditions. The CPU still prepares the work. |
A BAR is a Base Address Register in Configuration Space, not the data buffer itself. Readable Configuration Space alone does not establish that MMIO or DMA is ready.
- MMIO
- Memory-Mapped I/O, mapped device-register access
- DMA
- Direct Memory Access, device access to memory
Specification locations for the system context
Base 6.0 §1.2–§1.4, pp.100–109 (Figure 1-2: p.103); §2.1.1, pp.116–117; BARs: §7.5.1.2.1, pp.928–930. Firmware 3.3 §1.3, pp.8–9; §3.1–§3.2, pp.32–33; handoff requirements: §3.5, pp.34–35.
Why examine one read through three layers?
Continue the earlier memory read: an Endpoint sends a Request through a Switch to its target and waits for a Completion. Figure 1-4 separates send and receive responsibilities into three logical layers; Figure 1-5 illustrates the packet's conceptual path. This structure helps readers navigate the specification; it does not prescribe three separate hardware blocks.
On a phone, scroll the table horizontally to see all columns.
| Layer | First question | Role in this example |
|---|---|---|
| Transaction Layer | What is requested, where does it go, and which Request does the response match? | Forms and interprets Transaction Layer Packets (TLPs) and manages TLP Flow Control. |
| Data Link Layer | Was information delivered intact across this Link? | Handles per-Link integrity, acknowledgment and retry. Each side of a Switch has its own Link. |
| Physical Layer | How do the partners establish a Link and use its Lanes? | Handles Link initialization, Lane operation and signal transmission. |
A useful path is: identify the observed Link → inspect the physical connection and Link state → check that segment's transmission and Flow Control → match the Request and Completion. Successful delivery on one Link establishes a local result; the read is confirmed only by checking the response received by the Requester.
Figure 1-5 illustrates layers conceptually. Check the applicable Non-Flit or Flit Mode chapter for actual carrying and protection details instead of applying every detail of the figure to both modes.
Adjacent layers also exchange data boundaries, transfer handshakes, power and Link state information. Section 1.5.4.4 describes the information passed at each interface; the conceptual layer diagram does not prescribe the internal implementation.
Base 6.0 §1.5, Figures 1-4 and 1-5, pp.109–110; §§1.5.1–1.5.4.4, pp.110–114. The read and Switch path are a teaching scenario.
Why does current speed not tell us which speeds are supported?
Capability fields describe supported behavior, control fields provide settings, and status fields report the current result. Follow the local Port query in that order of purpose: first locate the supported-speed set, then inspect the Link status. A control-setting query is a separate next step.
Each Function has 4096 bytes of PCIe Configuration Space. The PCI Express Capability is in the conventional Capability list within the first 256 bytes. Its name does not mean that it belongs to the separate Extended Capability list. (Base 6.0 §7.2 / Figure 7-3, pp.905–906; §7.5.3, p.951.)
| Step | Assumed read and interpretation | Base 6.0 reading location |
|---|---|---|
| Identify the header | An 8-bit read at 0x0E returns 0x00; 0x00 & 0x7F = 0 selects Type 0. A 16-bit read at 0x06 returns 0x0010, with Status bit 4 set. | Figure 7-8 / Table 7-7, pp.924–925; Figure 7-10, p.928; Figure 7-6 / Table 7-5, pp.921–922. |
| Find the list entry | An 8-bit read at 0x34 returns 0x40. Mask the low two bits first: 0x40 & 0xFC = 0x40. | §7.5.1.1.11, p.926. |
| Pass the PM Capability | A 16-bit read at 0x40 returns 0x7001: the low-byte ID is 0x01 and the high-byte Next Pointer is 0x70. | Figure 7-18 / Table 7-14, p.945. |
| Find the PCIe Capability | A 16-bit read at 0x70 returns 0x0010: the ID is 0x10 and the Next Pointer is zero. Record cap_base = 0x70. | Figure 7-22 / Table 7-18, p.953. |
| Check version and type | A 16-bit read at 0x72 returns 0x0002: the low four bits give Version 2, and bits 7:4 give type 0, a PCI Express Endpoint. | Figure 7-23 / Table 7-19, pp.953–954. |
Configuration Space uses little-endian formatting, so the lower-addressed byte of 0x7001 is 0x01 (Base 6.0 §7.5.1.1, p.916). List locations and ordering can differ; 0x70 is not a universal constant.
If the list ends without the target, or a read fails, there is no basis for interpreting an arbitrary location as that structure. An unsuccessful read is not a valid response declaring lack of support.
Capability Version 2 does not mean PCIe Gen2, and by itself does not guarantee that older hardware implements the speed vector. Implementation is a separate assumption here. Using Base 6.0 to interpret the fields also does not mean that the device must support 64 GT/s. For older hardware, see the implementation note in §7.5.3.18 (p.1000).
How do the register values become an answer?
Start with Figure 7-21 (p.952) and add each register's relative offset to the Capability base. Then consult the capability definition in Figure 7-38 / Table 7-35 (pp.998–1000), followed by the status definition in Figure 7-29 / Table 7-26 (pp.978–979). The question determines the reading order. Figures locate fields; tables and surrounding requirements explain their interpretation. Check the revision and applicable component at every step rather than inferring meaning from a field name alone.
Link Capabilities 2: 0x70 + 0x2C = 0x9C; read 32 bits → 0x0180001E
Link Status: 0x70 + 0x12 = 0x82; read 16 bits → 0x0043
The Supported Link Speeds Vector occupies register bits 7:1. Mask those positions, then shift the field down:
(0x0180001E & 0x000000FE) >> 1 = 0x0F
Field bits 0–3 are all set, indicating support for 2.5, 5, 8, and 16 GT/s. Bits 4–5 are clear, so 32 and 64 GT/s are not advertised; bit 6 is reserved. Field bit 0 was originally register bit 1, so these two numbering systems must remain distinct. The full read value keeps register bits 23 and 24 set to meet Table 7-35's detection-capability requirements for devices supporting 16 GT/s or above. Those bits do not prove that Retimers are present in the path.
Link Status instead contains an encoded value, not another supported-speed bitmap:
Current Link Speed: 0x0043 & 0x000F = 3
Negotiated Link Width: (0x0043 & 0x03F0) >> 4 = 4
Code 3 selects field bit 2 of the speed vector, meaning 8 GT/s; width 4 means x4. These masks assume the stated read widths. They cannot be applied directly to a 32-bit value read at a different offset.
Table 7-26 makes both fields undefined when the Link is not up. The value 0x0043 does not itself establish that the Link is up. Nor does a clear bit 13 alone establish that the Link is down: implementation of that status bit depends on reporting capability (Table 7-23 and Table 7-26, pp.969 and 979).
Does operating at only 8 GT/s prove a fault?
Figure 7-21 (p.952) locates the fields relative to the Capability base. Read Figure 7-38/Table 7-35 (pp.998–1000) to interpret the supported-speed vector, then Figure 7-29/Table 7-26 (pp.978–979) for the current speed and width. At each step the table supplies the encoding and applicability that the layout alone cannot provide.
Does the same conclusion survive a changed condition?
The complete query selects a Function, follows its list, checks the structure, and interprets two separate fields. The following variations show which part of that route must be checked again.
If the Capability base moves to 0x90, can the capability still be read at 0x9C?
No. From Figure 7-21 (p.952), Link Capabilities 2 moves to 0x90 + 0x2C = 0xBC, and Link Status to 0x90 + 0x12 = 0xA2. The new base is a teaching assumption; the relative offsets stay the same.
If Current Link Speed is 4, does that mean two speeds are supported simultaneously?
No. With valid Link-state conditions, code 4 means a current speed of 16 GT/s. The supported set still requires a separate vector read. (Table 7-26 and Table 7-35, pp.978 and 998.)
If the Link is down and a previously obtained value is 0x0043, can it describe the current speed and width?
No. Table 7-26 (p.978) defines speed and width as undefined when the Link is not up. Plausible numbers do not replace the required validity condition.
The next step is to clarify topology, Functions, and identification scope before studying Configuration Space in depth. See the full Chapter 0 Chinese tutorial for field diagrams, the expanded example, and source references. Chapter 1 is now available; Chapters 2–13 are available, and Chapters 14–19 remain planned.


Comments