class Device

Defined at line 57 of file ../../src/devices/pci/drivers/pci/device.h

Forward declaration to avoid device.h

Public Methods

void AddRef ()

Bridge or DeviceImpl will need to implement refcounting

zx::result<uint32_t> QueryIrqMode (fuchsia_hardware_pci::InterruptMode mode)

These methods handle IRQ configuration and are generally called by the

PciProtocol methods, though they may be used to disable IRQs on

initialization as well.

Defined at line 25 of file ../../src/devices/pci/drivers/pci/device_irqs.cc

pci_interrupt_modes_t GetInterruptModes ()

Defined at line 50 of file ../../src/devices/pci/drivers/pci/device_irqs.cc

zx_status_t SetIrqMode (fuchsia_hardware_pci::InterruptMode mode, uint32_t irq_cnt)

Defined at line 66 of file ../../src/devices/pci/drivers/pci/device_irqs.cc

template <typename V, typename R>
zx::result<V> ReadConfig (uint16_t offset)

Templated helpers to assist with differently sized protocol reads and writes.

TODO(91513): Move these back to a .cc after we no longer have both Banjo and FIDL callers for

them.

Defined at line 94 of file ../../src/devices/pci/drivers/pci/device.h

template <typename V, typename R>
zx_status_t WriteConfig (uint16_t offset, V value)

Defined at line 103 of file ../../src/devices/pci/drivers/pci/device.h

zx_status_t DisableInterrupts ()

Defined at line 106 of file ../../src/devices/pci/drivers/pci/device_irqs.cc

void Device (const Device & )

Disallow copying, assigning and moving.

Defined at line 127 of file ../../src/devices/pci/drivers/pci/device.h

void Device (Device && )

Disallow copying, assigning and moving.

Defined at line 127 of file ../../src/devices/pci/drivers/pci/device.h

zx_status_t Create (zx_device_t * parent, std::unique_ptr<Config> && config, UpstreamNode * upstream, BusDeviceInterface * bdi, bool has_acpi, bool has_devicetree)

Create, but do not initialize, a device.

Defined at line 134 of file ../../src/devices/pci/drivers/pci/device.cc

void ~Device ()

Defined at line 121 of file ../../src/devices/pci/drivers/pci/device.cc

void Adopt ()

Bridge or DeviceImpl will need to implement refcounting

bool Release ()

Bridge or DeviceImpl will need to implement refcounting

Device & operator= (const Device & )

Disallow copying, assigning and moving.

Defined at line 127 of file ../../src/devices/pci/drivers/pci/device.h

Device & operator= (Device && )

Disallow copying, assigning and moving.

Defined at line 127 of file ../../src/devices/pci/drivers/pci/device.h

zx::result<zx::interrupt> MapInterrupt (uint32_t which_irq)

Defined at line 131 of file ../../src/devices/pci/drivers/pci/device_irqs.cc

fbl::Mutex * dev_lock ()

Defined at line 159 of file ../../src/devices/pci/drivers/pci/device.h

UpstreamNode * upstream ()

Defined at line 160 of file ../../src/devices/pci/drivers/pci/device.h

bool plugged_in ()

Defined at line 162 of file ../../src/devices/pci/drivers/pci/device.h

bool disabled ()

Defined at line 163 of file ../../src/devices/pci/drivers/pci/device.h

bool quirks_done ()

Defined at line 164 of file ../../src/devices/pci/drivers/pci/device.h

bool has_acpi ()

Defined at line 165 of file ../../src/devices/pci/drivers/pci/device.h

bool has_devicetree ()

Defined at line 166 of file ../../src/devices/pci/drivers/pci/device.h

bool is_bridge ()

Defined at line 167 of file ../../src/devices/pci/drivers/pci/device.h

bool is_pcie ()

Defined at line 168 of file ../../src/devices/pci/drivers/pci/device.h

uint16_t vendor_id ()

Defined at line 169 of file ../../src/devices/pci/drivers/pci/device.h

uint16_t device_id ()

Defined at line 170 of file ../../src/devices/pci/drivers/pci/device.h

uint8_t class_id ()

Defined at line 171 of file ../../src/devices/pci/drivers/pci/device.h

uint8_t subclass ()

Defined at line 172 of file ../../src/devices/pci/drivers/pci/device.h

uint8_t prog_if ()

Defined at line 173 of file ../../src/devices/pci/drivers/pci/device.h

uint8_t rev_id ()

Defined at line 174 of file ../../src/devices/pci/drivers/pci/device.h

uint8_t bus_id ()

Defined at line 175 of file ../../src/devices/pci/drivers/pci/device.h

uint8_t dev_id ()

Defined at line 176 of file ../../src/devices/pci/drivers/pci/device.h

uint8_t func_id ()

Defined at line 177 of file ../../src/devices/pci/drivers/pci/device.h

uint16_t segment_group ()

Defined at line 178 of file ../../src/devices/pci/drivers/pci/device.h

uint32_t bar_count ()

Defined at line 179 of file ../../src/devices/pci/drivers/pci/device.h

const Capabilities & capabilities ()

Defined at line 180 of file ../../src/devices/pci/drivers/pci/device.h

uint32_t legacy_vector ()

Defined at line 182 of file ../../src/devices/pci/drivers/pci/device.h

const zx::msi & msi_allocation ()

Defined at line 186 of file ../../src/devices/pci/drivers/pci/device.h

uint32_t packed_addr ()

A packed version of the BDF addr used for BTI identifiers by the IOMMU implementation.

Defined at line 189 of file ../../src/devices/pci/drivers/pci/device.h

zx_status_t SetBusMastering (bool enabled)

Enable or disable bus mastering in a device's configuration.

Parameters

enable If true, allow the device to access main system memory as a busmaster.

Returns

A zx_status_t indicating success or failure of the operation.

Defined at line 362 of file ../../src/devices/pci/drivers/pci/device.cc

zx_status_t EnablePio (bool enabled)

Enable or disable PIO access in a device's configuration.

Parameters

enable If true, allow the device to access its PIO mapped registers.

Returns

A zx_status_t indicating success or failure of the operation.

zx_status_t EnableMmio (bool enabled)

Enable or disable MMIO access in a device's configuration.

Parameters

enable If true, allow the device to access its MMIO mapped registers.

Returns

A zx_status_t indicating success or failure of the operation.

const std::unique_ptr<Config> & config ()

TODO(cja): port void SetQuirksDone() __TA_REQUIRES(dev_lock_) { quirks_done_ = true; }

Defined at line 157 of file ../../src/devices/pci/drivers/pci/device.h

void Unplug ()

Requests a device unplug itself from its UpstreamNode and the Bus list.

Defined at line 736 of file ../../src/devices/pci/drivers/pci/device.cc

zx_status_t EnableLegacy ()

Defined at line 231 of file ../../src/devices/pci/drivers/pci/device_irqs.cc

zx_status_t EnableMsi (uint32_t irq_cnt)

Defined at line 251 of file ../../src/devices/pci/drivers/pci/device_irqs.cc

zx_status_t EnableMsix (uint32_t irq_cnt)

Defined at line 305 of file ../../src/devices/pci/drivers/pci/device_irqs.cc

zx_status_t DisableLegacy ()

Defined at line 332 of file ../../src/devices/pci/drivers/pci/device_irqs.cc

void DisableMsiCommon ()

Defined at line 376 of file ../../src/devices/pci/drivers/pci/device_irqs.cc

zx_status_t DisableMsi ()

Defined at line 378 of file ../../src/devices/pci/drivers/pci/device_irqs.cc

zx_status_t DisableMsix ()

Defined at line 390 of file ../../src/devices/pci/drivers/pci/device_irqs.cc

zx_status_t SignalLegacyIrq (zx_instant_boot_t timestamp)

Signals the device's zx::interrupt, effectively triggering an interrupt for the device

driver.

Defined at line 189 of file ../../src/devices/pci/drivers/pci/device_irqs.cc

zx_status_t AckLegacyIrq ()

Legacy IRQs are automatically re-armed via ZX_VIRTUAL_INTERRUPT_UNTRIGGERED;

AckLegacyIrq is a no-op.

Defined at line 193 of file ../../src/devices/pci/drivers/pci/device_irqs.cc

void EnableLegacyIrq ()

Defined at line 204 of file ../../src/devices/pci/drivers/pci/device_irqs.cc

void DisableLegacyIrq ()

Defined at line 210 of file ../../src/devices/pci/drivers/pci/device_irqs.cc

zx::result<PowerManagementCapability::PowerState> GetPowerState ()

Defined at line 727 of file ../../src/devices/pci/drivers/pci/device.cc

void DdkRelease ()

DDK device lifecycle methods

Defined at line 752 of file ../../src/devices/pci/drivers/pci/device.cc

void DdkUnbind (ddk::UnbindTxn txn)

Defined at line 750 of file ../../src/devices/pci/drivers/pci/device.cc

void Bind (fidl::ServerEnd<fuchsia_hardware_pci::Device> request)

Defined at line 762 of file ../../src/devices/pci/drivers/pci/device.cc

void GetDeviceInfo (GetDeviceInfoCompleter::Sync & completer)

fidl::WireServer

<fuchsia

_hardware_pci::Device> implementations

Defined at line 766 of file ../../src/devices/pci/drivers/pci/device.cc

void GetBar (GetBarRequestView request, GetBarCompleter::Sync & completer)

Defined at line 779 of file ../../src/devices/pci/drivers/pci/device.cc

void SetBusMastering (SetBusMasteringRequestView request, SetBusMasteringCompleter::Sync & completer)

Defined at line 825 of file ../../src/devices/pci/drivers/pci/device.cc

void ResetDevice (ResetDeviceCompleter::Sync & completer)

Defined at line 838 of file ../../src/devices/pci/drivers/pci/device.cc

void AckInterrupt (AckInterruptCompleter::Sync & completer)

Defined at line 843 of file ../../src/devices/pci/drivers/pci/device.cc

void MapInterrupt (MapInterruptRequestView request, MapInterruptCompleter::Sync & completer)

Defined at line 853 of file ../../src/devices/pci/drivers/pci/device.cc

void SetInterruptMode (SetInterruptModeRequestView request, SetInterruptModeCompleter::Sync & completer)

Defined at line 864 of file ../../src/devices/pci/drivers/pci/device.cc

void GetInterruptModes (GetInterruptModesCompleter::Sync & completer)

Defined at line 878 of file ../../src/devices/pci/drivers/pci/device.cc

void ReadConfig8 (ReadConfig8RequestView request, ReadConfig8Completer::Sync & completer)

Defined at line 886 of file ../../src/devices/pci/drivers/pci/device.cc

void ReadConfig16 (ReadConfig16RequestView request, ReadConfig16Completer::Sync & completer)

Defined at line 897 of file ../../src/devices/pci/drivers/pci/device.cc

void ReadConfig32 (ReadConfig32RequestView request, ReadConfig32Completer::Sync & completer)

Defined at line 908 of file ../../src/devices/pci/drivers/pci/device.cc

void WriteConfig8 (WriteConfig8RequestView request, WriteConfig8Completer::Sync & completer)

Defined at line 919 of file ../../src/devices/pci/drivers/pci/device.cc

void WriteConfig16 (WriteConfig16RequestView request, WriteConfig16Completer::Sync & completer)

Defined at line 930 of file ../../src/devices/pci/drivers/pci/device.cc

void WriteConfig32 (WriteConfig32RequestView request, WriteConfig32Completer::Sync & completer)

Defined at line 942 of file ../../src/devices/pci/drivers/pci/device.cc

void GetCapabilities (GetCapabilitiesRequestView request, GetCapabilitiesCompleter::Sync & completer)

Defined at line 954 of file ../../src/devices/pci/drivers/pci/device.cc

void GetExtendedCapabilities (GetExtendedCapabilitiesRequestView request, GetExtendedCapabilitiesCompleter::Sync & completer)

Defined at line 970 of file ../../src/devices/pci/drivers/pci/device.cc

void GetBti (GetBtiRequestView request, GetBtiCompleter::Sync & completer)

Defined at line 986 of file ../../src/devices/pci/drivers/pci/device.cc

Irqs & irqs ()

Provide Irq information to the Bus for handling situations with no ack.

Defined at line 258 of file ../../src/devices/pci/drivers/pci/device.h

std::array<std::optional<Bar>, pci::kMaxBarCount> & bars ()

Info about the BARs computed and cached during the initial setup/probe,

indexed by starting BAR register index.

Defined at line 261 of file ../../src/devices/pci/drivers/pci/device.h

BusDeviceInterface * bdi ()

Defined at line 264 of file ../../src/devices/pci/drivers/pci/device.h

Protected Methods

void Device (zx_device_t * parent, std::unique_ptr<Config> && config, UpstreamNode * upstream, BusDeviceInterface * bdi, bool is_bridge, bool has_acpi, bool has_devicetree)

Devices need to exist in both the top level bus driver class, as well

as in a list for roots/bridges to track their downstream children. These

traits facilitate that for us.

Defined at line 110 of file ../../src/devices/pci/drivers/pci/device.cc

zx_status_t Init ()

Defined at line 140 of file ../../src/devices/pci/drivers/pci/device.cc

zx_status_t InitLocked ()

Defined at line 196 of file ../../src/devices/pci/drivers/pci/device.cc

zx_status_t InitInterrupts ()

Defined at line 158 of file ../../src/devices/pci/drivers/pci/device.cc

zx_status_t ProbeCapabilities ()

Parse PCI Standard Capabilities starting with the pointer in the PCI

config header.

Defined at line 259 of file ../../src/devices/pci/drivers/pci/device_caps.cc

zx_status_t ParseCapabilities ()

Defined at line 89 of file ../../src/devices/pci/drivers/pci/device_caps.cc

zx_status_t ParseExtendedCapabilities ()

Defined at line 177 of file ../../src/devices/pci/drivers/pci/device_caps.cc

hwreg::RegisterAddr<CommandReg> CommandRegLocked ()

Returns the Command register address, requiring cmd_reg_lock_ to be held.

NOLINTNEXTLINE(readability-convert-member-functions-to-static)

Defined at line 279 of file ../../src/devices/pci/drivers/pci/device.h

Records

Friends

class Root
class Bridge
class UpstreamNode