Bus driver

On this page 7

A bus driver is the operating system component that manages a hardware bus or controller and discovers, configures and reports the devices attached to it, so that each device can receive its own function driver. In the Drivers & devices area of operating systems, bus drivers sit beneath ordinary device drivers in the driver stack and form the foundation of plug and play.

Typical examples include drivers for PCI Express, USB, SATA host controllers, I2C and SPI. A bus driver rarely implements what a device does; instead it answers the questions every other driver depends on: which devices exist, where their resources are, and how to reach them.

What a bus driver does

A bus driver performs device enumeration, resource assignment and power control for every child device on its bus. When the bus is initialized or a device is hot-plugged, the bus driver scans it, reads identifying information such as vendor and device IDs, and reports each device to the operating system’s plug and play manager.

The operating system then matches each reported device to a function driver using its identifiers. From that point the bus driver continues to serve as the device’s gateway: it forwards configuration requests, handles power state transitions on the bus and notifies the system when a device is removed.

ResponsibilityWhat it involvesExample
EnumerationDetecting devices and reading their IDsScanning PCI configuration space
Resource assignmentAllocating address ranges and interruptsProgramming PCIe base address registers
Child device reportingCreating objects for each detected devicePhysical device objects in Windows
Power managementMoving the bus and children between statesSuspending an idle USB port
Hot-plug handlingReacting to insertion and removalReporting a USB stick being unplugged
Core responsibilities of a bus driver

Bus drivers in the driver stack

In a layered driver model, the bus driver is the lowest software layer that owns a device. Above it sit the function driver, which implements the device’s actual behavior, and optional filter drivers, which observe or modify requests passing between layers.

The Windows Driver Model makes this explicit: a bus driver creates a physical device object (PDO) for each child, a function driver attaches a functional device object (FDO), and filters attach filter device objects around them. A bus driver is itself a function driver for its own controller, so drivers stack recursively, for example a USB host controller on PCI Express with USB devices on top.

Driver roleMain taskOwns the device object
Bus driverEnumerates and powers child devicesPhysical device object
Function driverImplements device behavior and interfaceFunctional device object
Upper filter driverModifies requests above the function driverFilter device object
Lower filter driverAdjusts requests before the bus driverFilter device object
Driver roles in a layered stack

Linux uses different terminology but the same idea. Its driver model represents each bus type with a bus_type structure that defines how devices and drivers are matched, while a host controller driver manages the physical controller and registers discovered devices on that bus. macOS achieves the same separation through I/O Kit nub objects, which represent detected devices and start matching for drivers.

Common bus types and their drivers

Each bus has its own discovery method and resource model, and this shapes what its bus driver must do. Self-describing buses such as PCI Express and USB report their devices automatically, while simple embedded buses often rely on firmware descriptions such as ACPI tables or a device tree.

BusDiscovery methodHot-plug support
PCI ExpressConfiguration space scan by bus, device, functionYes, with hot-plug capable slots
USBPort status change and descriptor requestsYes, by design
ThunderboltTunneled PCIe and USB enumerationYes, with security approval
I2CDevice tree or ACPI descriptionGenerally no
SPIDevice tree or ACPI descriptionNo
How bus drivers discover devices

The difference matters for reliability. On non-enumerable buses, a wrong firmware description leaves a device invisible or misconfigured even though the hardware works, and the bus driver cannot detect the error on its own.

A bus driver is easily confused with other low-level components because all of them deal with hardware access. The distinction rests on scope: a bus driver manages a set of devices on a shared interconnect, rather than one device or the whole platform.

ComponentScopeTypical role
Bus driverOne bus and its child devicesEnumeration, resources, power
Function driverA single deviceReading, writing and controlling it
Filter driverRequests to one device stackEncryption, logging, quirks
Hardware abstraction layerThe whole platformHiding chipset and interrupt differences
Bus driver versus neighboring concepts

Failure modes and practical concerns

Because every device on a bus depends on it, a faulty bus driver affects many devices at once. Problems in this layer tend to appear as whole groups of devices disappearing, failing to wake or showing resource conflicts.

  • Enumeration failures leave devices absent from the device list even though the hardware is present.
  • Resource conflicts occur when address ranges or interrupts are assigned incorrectly, often due to firmware errors.
  • Power management bugs cause devices to fail after sleep or to drain power by staying active.
  • Hot-plug security risks arise on buses with direct memory access, which is why IOMMU protection matters for Thunderbolt.

Most systems ship bus drivers supplied by the operating system vendor, because standard buses follow public specifications such as PCI Express and USB. Custom bus drivers are mainly written for proprietary interconnects, embedded controllers and virtualization, where a hypervisor exposes a virtual bus for paravirtualized devices.

The simple explanation

Think of a large office building with a front desk. The front desk does not do anyone’s job. It knows who is in the building and on which floor. It hands out room keys and tells visitors where to go.

A bus driver is that front desk for a computer’s hardware. It finds the devices plugged into a connection like USB. It gives each one what it needs. Then it introduces each device to the right driver, which does the real work.

How it is used in practice

A video editor connects a Thunderbolt dock to a laptop. The dock contains a PCI Express switch, a USB controller, an Ethernet adapter and an external SSD. The Thunderbolt and PCI Express bus drivers detect the new devices, assign them memory ranges and interrupts, and report each one to the plug and play manager.

The USB bus driver then enumerates the keyboard and card reader attached to the dock, while function drivers load for the SSD and network adapter. Within a few seconds, all devices appear and work. When the editor unplugs the dock, the bus drivers report surprise removal, and the system tears down each device stack cleanly instead of crashing.