class Device

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

Forward declaration to avoid device.h

Public Methods

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

Create, but do not initialize, a device.

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

void ~Device ()

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

void AddRef ()

Bridge or DeviceImpl will need to implement refcounting

void Adopt ()

Bridge or DeviceImpl will need to implement refcounting

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.

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/bus/drivers/pci/device_irqs.cc

pci_interrupt_modes_t GetInterruptModes ()

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

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

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

zx_status_t DisableInterrupts ()

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

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

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

void Device (const Device & )

Disallow copying, assigning and moving.

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

void Device (Device && )

Disallow copying, assigning and moving.

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

bool Release ()

Bridge or DeviceImpl will need to implement refcounting

Device & operator= (const Device & )

Disallow copying, assigning and moving.

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

Device & operator= (Device && )

Disallow copying, assigning and moving.

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

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

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

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

fbl::Mutex * dev_lock ()

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

UpstreamNode * upstream ()

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

bool plugged_in ()

Defined at line 228 of file ../../src/devices/bus/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 228 of file ../../src/devices/bus/drivers/pci/device.cc

bool disabled ()

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

bool quirks_done ()

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

bool has_acpi ()

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

bool has_devicetree ()

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

bool is_bridge ()

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

bool is_pcie ()

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

uint16_t vendor_id ()

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

uint16_t device_id ()

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

uint8_t class_id ()

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

uint8_t subclass ()

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

zx_status_t EnableLegacy (bool needs_ack)

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

void EnableLegacyIrq ()

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

void DisableLegacyIrq ()

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

uint8_t prog_if ()

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

uint8_t rev_id ()

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

uint8_t bus_id ()

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

uint8_t dev_id ()

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

uint8_t func_id ()

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

uint32_t bar_count ()

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

const Capabilities & capabilities ()

Defined at line 245 of file ../../src/devices/bus/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 275 of file ../../src/devices/bus/drivers/pci/device.cc

void Unplug ()

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

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

uint32_t legacy_vector ()

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

const zx::msi & msi_allocation ()

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

zx_status_t EnableMsi (uint32_t irq_cnt)

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

Irqs & irqs ()

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

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

BusDeviceInterface * bdi ()

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

zx_status_t EnableMsix (uint32_t irq_cnt)

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

zx_status_t DisableLegacy ()

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

void DisableMsiCommon ()

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

zx_status_t DisableMsi ()

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

zx_status_t DisableMsix ()

Defined at line 377 of file ../../src/devices/bus/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 199 of file ../../src/devices/bus/drivers/pci/device_irqs.cc

zx_status_t AckLegacyIrq ()

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

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

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

Protected Methods

void Device (zx_device_t * parent, std::unique_ptr<Config> && config, UpstreamNode * upstream, BusDeviceInterface * bdi, inspect::Node node, 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 89 of file ../../src/devices/bus/drivers/pci/device.cc

zx_status_t Init ()

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

zx_status_t InitLocked ()

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

zx_status_t InitInterrupts ()

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

void ModifyCmdLocked (uint16_t clr_bits, uint16_t set_bits)

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

uint16_t ReadCmdLocked ()

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

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

void AssignCmdLocked (uint16_t value)

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

zx_status_t ProbeCapabilities ()

Parse PCI Standard Capabilities starting with the pointer in the PCI

config header.

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

zx_status_t ParseCapabilities ()

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

zx_status_t ParseExtendedCapabilities ()

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

bool IoEnabled ()

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

bool MmioEnabled ()

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

Records

Friends

class Root
class Bridge
class UpstreamNode