class Device

Defined at line 56 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 24 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 96 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 105 of file ../../src/devices/pci/drivers/pci/device.h

void Device (const Device & )

Disallow copying, assigning and moving.

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

void Device (Device && )

Disallow copying, assigning and moving.

Defined at line 129 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 120 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 129 of file ../../src/devices/pci/drivers/pci/device.h

Device & operator= (Device && )

Disallow copying, assigning and moving.

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

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

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

zx_status_t DisableInterrupts ()

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

fbl::Mutex * dev_lock ()

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

UpstreamNode * upstream ()

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

bool plugged_in ()

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

bool disabled ()

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

bool quirks_done ()

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

bool has_acpi ()

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

bool has_devicetree ()

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

bool is_bridge ()

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

bool is_pcie ()

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

uint16_t vendor_id ()

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

uint16_t device_id ()

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

uint8_t class_id ()

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

uint8_t subclass ()

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

uint8_t prog_if ()

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

uint8_t rev_id ()

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

uint8_t bus_id ()

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

uint8_t dev_id ()

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

uint8_t func_id ()

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

uint16_t segment_group ()

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

uint32_t bar_count ()

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

const Capabilities & capabilities ()

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

uint32_t legacy_vector ()

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

const zx::msi & msi_allocation ()

Defined at line 199 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 202 of file ../../src/devices/pci/drivers/pci/device.h

zx_status_t ModifyCmd (uint16_t clr_bits, uint16_t set_bits)

Modify bits in the device's command register (in the device config space),

clearing the bits specified by clr_bits and setting the bits specified by set

bits. Specifically, the operation will be applied as...

WR(cmd, (RD(cmd)

&

~clr) | set)

Parameters

clr_bits The mask of bits to be cleared.
clr_bits The mask of bits to be set.

Returns

A zx_status_t indicating success or failure of the operation.

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

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 380 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 170 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 639 of file ../../src/devices/pci/drivers/pci/device.cc

zx_status_t EnableLegacy ()

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

zx_status_t EnableMsi (uint32_t irq_cnt)

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

zx_status_t EnableMsix (uint32_t irq_cnt)

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

zx_status_t DisableLegacy ()

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

void DisableMsiCommon ()

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

zx_status_t DisableMsi ()

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

zx_status_t DisableMsix ()

Defined at line 376 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 194 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 198 of file ../../src/devices/pci/drivers/pci/device_irqs.cc

void EnableLegacyIrq ()

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

void DisableLegacyIrq ()

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

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

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

void DdkRelease ()

DDK device lifecycle methods

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

void DdkUnbind (ddk::UnbindTxn txn)

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

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

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

void GetDeviceInfo (GetDeviceInfoCompleter::Sync & completer)

fidl::WireServer

<fuchsia

_hardware_pci::Device> implementations

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

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

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

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

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

void ResetDevice (ResetDeviceCompleter::Sync & completer)

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

void AckInterrupt (AckInterruptCompleter::Sync & completer)

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

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

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

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

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

void GetInterruptModes (GetInterruptModesCompleter::Sync & completer)

Defined at line 781 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 271 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 274 of file ../../src/devices/pci/drivers/pci/device.h

BusDeviceInterface * bdi ()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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 109 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 193 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

uint16_t ReadCmdLocked ()

Read the value of the Command register, requires the dev_lock.

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

void AssignCmdLocked (uint16_t value)

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

bool IoEnabled ()

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

bool MmioEnabled ()

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

void ModifyCmdLocked (uint16_t clr_bits, uint16_t set_bits)

Defined at line 351 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 314 of file ../../src/devices/pci/drivers/pci/device_caps.cc

zx_status_t ParseCapabilities ()

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

zx_status_t ParseExtendedCapabilities ()

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

Records

Friends

class Root
class Bridge
class UpstreamNode