Skip to content
DenseChip
Learn
PracticeCode labInterview

DenseChip

Navigate

Menu

LearnPracticeCode labInterview

Tools

All toolsSV editorCode repoResume
DenseChip

Practice, courses, and chip-design tools in one focused workspace.

LearnPracticeCode labInterviewToolsLearning paths

© 2026 DenseChip

AboutContactPrivacyTerms
Skip to lesson

Course contents

  • How to Use This Course
  • Reading Paths
  • Concept Map
  • How to Read the Diagrams
  • Part 0: What Is a Protocol?10
  • Part 1: Timing and Clocking11
  • Part 2: Encoding and Framing12
  • Part 3: Handshakes13
  • Part 4: Flow Control17
  • Part 5: Transactions19
  • Part 6: Concurrency and Performance17
  • Part 7: Ordering13
  • Part 8: Sharing and Arbitration12
  • Part 9: Deadlock and Liveness13
  • Part 10: Reliability and Recovery20
  • Part 11: Bring-Up and Link Management10
    • Reset Semantics
    • Reset Sequencing Across Interfaces
    • Presence and Hot-Plug
    • Link Training
    • Capability Negotiation
    • Enumeration and Discovery
    • Link State Machines
    • Versioning and Compatibility
    • Protocols Compared: Bring-Up and Link Management
    • Drills: Bring-Up and Link Management
  • Part 12: Power8
  • Part 13: Shared State and Coherence9
  • Part 14: Security and Isolation7
  • Part 15: Specifying and Verifying11
  • Part 16: Protocols Dissected17
  • Part 17: Capstones5
  • Part 18: Interview Preparation6
Loading lesson

‹Part 11: Bring-Up and Link Management
  1. Topics
  2. First Principles of Hardware Protocols
  3. Part 11: Bring-Up and Link Management
  4. Enumeration and Discovery

Part 11 · Bring-Up and Link Management · Working (W)

Enumeration and Discovery

Once a link is up, the host must find out what is attached, what it is, and how to reach it. Discovery through a default address and self-describing descriptors, address assignment, and why every device must answer a few questions the same way.

On this page

    Note

    Level: Working (W) · Answers: How do the two sides agree at start-up?

    Before this: Capability Negotiation

    A computer boots with a network card, two drives and a USB hub with a keyboard on it. Nobody told the operating system any of this. Before the first driver loads, the system has to discover what is attached, find out what each thing is, and give each one an address it can be reached at. A working link is only a wire; enumeration turns it into a known device.

    How does a host find out what is attached and how to talk to it?

    The obvious answer, and why it breaks

    The obvious answer is a fixed table: device X at address Y, written into firmware. That works for a fixed embedded system and nothing else. Any system with slots, ports or options has an unknown set of devices, and two identical devices cannot both have the same fixed address. Discovery has to work with no prior knowledge.

    The idea: a known place to ask, and self-describing answers

    • A default way to reach an unconfigured device: a default address (USB address 0), or a position in a hierarchy (PCI bus, device and function numbers derived from where it sits).

    • Self-description: every device answers a few standard questions in a standard format: who made it, what kind of device it is, what resources it needs.

    • Assignment: the host gives each device its unique address or its place in the address map, and records it.

    • Configuration: the host enables the device's features and hands it to a driver chosen from its self-description.

    The host reaches the unconfigured device at a default address, learns what it is from its descriptors, gives it a unique address, configures it and binds a driver.

    Two ways to give out addresses

    Approach

    How

    Example

    Hierarchical (position-based)

    Walk the tree from the root: each bridge or hub is given a number range, each device found below it is numbered in turn

    PCI Express bus numbers assigned depth-first; memory windows sized from the device's BARs

    Default address, then assign

    Talk to one new device at a time at a shared default address, then move it to a unique address

    USB: address 0, then SET_ADDRESS

    Memory-mapped devices also need a place in the address map. PCI Express finds how much each device needs with a simple trick: software writes all 1s to a Base Address Register and reads it back; the bits that stay 0 reveal the size of the window, which software then places in the map.

    How real protocols chose

    Protocol

    Enumeration

    PCI Express

    Each function has configuration space (256 bytes, extended to 4 KB) with vendor and device IDs, class code and BARs; software scans depth-first, assigning bus numbers to bridges and sizing each BAR.

    USB

    A new device answers at address 0; the host reads its descriptors, assigns a unique address with SET_ADDRESS and selects a configuration.

    On-chip buses

    Usually a fixed map in the design, sometimes with a discovery ROM listing the blocks present

    What breaks

    A device (illustrative) reported a BAR size of 1 MB but decoded only the bottom 64 KB of it, mirroring its registers through the rest. Enumeration placed another device's window inside the mirrored region on one machine, and writes to one device occasionally landed in the other. The fix was to report the size the device actually decodes, and to decode exactly that.

    Why this matters

    Senior lens. Configuration space and descriptors are a contract with every operating system that will ever see the device. Make them exact: report precisely the resources you decode, keep IDs and class codes correct, and make every register behave as specified even in corner cases such as all-1s writes. Enumeration bugs show up only on some machines, which makes them expensive to find.

    Interview

    Asked: "How does software size a BAR?"

    Weak answer: It reads the size from a register.

    Strong answer: It writes all 1s to the BAR and reads it back. The device hard-wires the low address bits it doesn't decode to 0, so the read-back value shows the window size: invert the address bits and add 1. Software then places the window in the address map and writes the chosen base address. The low bits also say whether it's memory or I/O space, 32 or 64 bits, and prefetchable.

    Follow-ups: (1) Why must a device decode exactly what it reports? (2) How does USB give out addresses?

    Check yourself Why can two identical USB devices coexist even though both start at address 0?

    The host enumerates one new device at a time and moves each to a unique address before talking to the next.

    Check yourself A BAR reads back 0xFFFF0000 after writing all 1s (memory, 32-bit). What size is the window?

    64 KB: the low 16 bits are 0, so the window is 2^16 bytes.

    Key takeaways

    • Enumeration discovers what is attached with no prior knowledge.

    • It needs a default way to reach a new device, self-describing answers, and address assignment.

    • Report exactly the resources a device decodes; enumeration bugs appear only on some machines.

    Keep going

    Next: Lesson 11.7, Link State Machines. The state machine that runs a link: down, training, active, recovery, low power.

    Related topics

    • Part 11 overview: Bring-Up and Link Management

    Previous

    167 / 234

    Next: Link State Machines

    Up next

    Up nextLink State Machines

    Sign in to save progress

    Practice this lessonReport an error

    See also

    • Reset Semantics
    • Reset Sequencing Across Interfaces
    • Presence and Hot-Plug