tree: d1e805841932b2aaed714ef8edc1162cbf9878e7 [path history] [tgz]
  1. bin/
  2. lib/
  3. testing/
  4. BUILD.gn
  5. METADATA.textproto
  6. OWNERS
  7. README.md
src/devices/pci/README.md

PCI

The PCI bus driver provides management of the PCI bus in applicable systems and allows device drivers to be written for and bind to PCI devices in the system.

Architecture

Source

Location

Organization

Bus level operations are handled in bus.cc. Device specific operations are in device_*.cc, and FIDL / Banjo protocol implementations are in fidl.cc and banjo.cc respectively. The interface between a Device and the Bus is the BusDeviceInterface specified in bus_device_interface.h. The service implementation fuchsia.hardware.pci/Service used by lspci is in device_service.cc.

Build Targets

FIDL

Dependent Protocols

The PCI bus driver binds to fuchsia.hardware.pciroot/Pciroot and receives platform level information for ACPI (if applicable), interrupts, interrupt routing, and bus configuration.

Implemented Protocols

Libraries

  • //src/devices/pci/lib/device-protocol-pci:device-protocol-pci
    • Provides helper methods MapMmio and ConfigureInterruptMode for use with drivers, as well as convenience methods for constructing a client end for fuchsia.hardware.pci/Device calls.
  • //src/devices/pci/lib/pci:pci
    • Provides base implementations for the PciRootHost interface which provides a way for a platform to implement a backing driver that can service multiple fuchsia.hardware.pciroot/Pciroot instances to support multiple PCI buses in the system.
  • //src/devices/pci/testing:pci-protocol-fake
    • Provides a fake fuchsia.hardware.pci/Device implementation for use in unit testing, allowing users to create fake PCI devices that match the configuration of their real hardware.

Testing

Tests

Fakes

Fakes exist for most major classes in the PCI bus driver and can be found in //src/devices/bus/drivers/pci/test/fakes/

Debugging

Inspect

Inspect data for both the Bus and all devices are exported via bootstrap/driver_manager under class/pci/*.inspect:

$ ffx inspect show bootstrap/driver_manager --file class/pci/000.inspect
bootstrap/driver_manager:
  metadata:
    filename = class/pci/000.inspect
    component_url = fuchsia-boot:///driver_manager#meta/driver_manager.cm
    timestamp = 1382682707618
  payload:
    root:
      Bus:
        acpi devices = ["00:1f.0", "00:1f.3", "00:00.0", "00:01.0", "00:02.0", "00:03.0", "00:04.0", "00:05.0", "00:06.0"]
        bus end = 0xff
        bus start = 0x0
        ecam = 0x1047cbaa000
        name = PCI0
        segment group = 0x0
        vectors = ["0x13", "0x12", "0x11", "0x17", "0x16", "0x10", "0x15", "0x14"]
        irq routing entries:
          0x0:
            device id = 0x0
            pins = ["0x14", "0x15", "0x16", "0x17"]
            port device id = 0xff
            port function id = 0xff
[...]
          0xf:
            device id = 0xf
            pins = ["0x17", "0x14", "0x15", "0x16"]
            port device id = 0xff
            port function id = 0xff
      Devices:
        00:00.0:
        00:01.0:
          BARs:
            0:
              0. Initial = 0xc000
              1. Probed = IO (non-prefetchable) [size=128B]
              2. Configured = 0xc000
            1:
              0. Initial = 0xfebc0000
              1. Probed = MMIO (non-prefetchable) [size=4K]
              2. Configured = 0xfebc0000
            4:
              0. Initial = 0xfebe8000
              1. Probed = MMIO (64-bit, prefetchable) [size=16K]
              2. Configured = 0xfebe8000
          Interrupts:
            Allocated = 2
            Base Vector = 44
            Mode = MSI-X
[...]
        00:1f.3:
          BARs:
            4:
              0. Initial = 0x700
              1. Probed = IO (non-prefetchable) [size=64B]
              2. Configured = 0x700

Tools