class Device
Defined at line 61 of file ../../src/devices/bus/drivers/pci/device.h
A pci::Device represents a given PCI(e) device on a bus. It can be used
standalone for a regular PCI(e) device on the bus, or as the base class for a
Bridge. Most work a pci::Device does is limited to its own registers in
configuration space and are managed through their Config object handled to it
during creation. One of the biggest responsibilities of the pci::Device class
is fulfill the PCI protocol for the driver downstream operating the PCI
device this corresponds to.
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)
Create, but do not initialize, a device.
Defined at line 114 of file ../../src/devices/bus/drivers/pci/device.cc
void ~Device ()
Defined at line 100 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
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
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 23 of file ../../src/devices/bus/drivers/pci/device_irqs.cc
pci_interrupt_modes_t GetInterruptModes ()
Defined at line 49 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 65 of file ../../src/devices/bus/drivers/pci/device_irqs.cc
zx::result<zx::interrupt> MapInterrupt (uint32_t which_irq)
Defined at line 137 of file ../../src/devices/bus/drivers/pci/device_irqs.cc
zx_status_t DisableInterrupts ()
Defined at line 111 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 148 of file ../../src/devices/bus/drivers/pci/device.h
void Device (Device && )
Disallow copying, assigning and moving.
Defined at line 181 of file ../../src/devices/bus/drivers/pci/device.h
void Device (const Device & )
Disallow copying, assigning and moving.
Defined at line 181 of file ../../src/devices/bus/drivers/pci/device.h
bool Release ()
Bridge or DeviceImpl will need to implement refcounting
template <typename V, typename R>
zx_status_t WriteConfig (uint16_t offset, V value)
Defined at line 157 of file ../../src/devices/bus/drivers/pci/device.h
Device & operator= (Device && )
Disallow copying, assigning and moving.
Defined at line 181 of file ../../src/devices/bus/drivers/pci/device.h
Device & operator= (const Device & )
Disallow copying, assigning and moving.
Defined at line 181 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 222 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
Returns
A zx_status_t indicating success or failure of the operation.
Defined at line 223 of file ../../src/devices/bus/drivers/pci/device.cc
fbl::Mutex * dev_lock ()
Defined at line 224 of file ../../src/devices/bus/drivers/pci/device.h
UpstreamNode * upstream ()
Defined at line 225 of file ../../src/devices/bus/drivers/pci/device.h
bool plugged_in ()
Defined at line 227 of file ../../src/devices/bus/drivers/pci/device.h
bool disabled ()
Defined at line 228 of file ../../src/devices/bus/drivers/pci/device.h
bool quirks_done ()
Defined at line 229 of file ../../src/devices/bus/drivers/pci/device.h
bool has_acpi ()
Defined at line 230 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
Returns
A zx_status_t indicating success or failure of the operation.
Defined at line 270 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 525 of file ../../src/devices/bus/drivers/pci/device.cc
zx_status_t EnableLegacy (bool needs_ack)
Defined at line 236 of file ../../src/devices/bus/drivers/pci/device_irqs.cc
zx_status_t EnableMsi (uint32_t irq_cnt)
Defined at line 255 of file ../../src/devices/bus/drivers/pci/device_irqs.cc
zx_status_t EnableMsix (uint32_t irq_cnt)
Defined at line 291 of file ../../src/devices/bus/drivers/pci/device_irqs.cc
zx_status_t DisableLegacy ()
Defined at line 321 of file ../../src/devices/bus/drivers/pci/device_irqs.cc
void DisableMsiCommon ()
Defined at line 359 of file ../../src/devices/bus/drivers/pci/device_irqs.cc
zx_status_t DisableMsi ()
Defined at line 361 of file ../../src/devices/bus/drivers/pci/device_irqs.cc
zx_status_t DisableMsix ()
Defined at line 375 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 191 of file ../../src/devices/bus/drivers/pci/device_irqs.cc
zx_status_t AckLegacyIrq ()
Defined at line 196 of file ../../src/devices/bus/drivers/pci/device_irqs.cc
void EnableLegacyIrq ()
Defined at line 206 of file ../../src/devices/bus/drivers/pci/device_irqs.cc
void DisableLegacyIrq ()
Defined at line 211 of file ../../src/devices/bus/drivers/pci/device_irqs.cc
zx::result<PowerManagementCapability::PowerState> GetPowerState ()
Defined at line 516 of file ../../src/devices/bus/drivers/pci/device.cc
bool is_bridge ()
Defined at line 231 of file ../../src/devices/bus/drivers/pci/device.h
bool is_pcie ()
Defined at line 232 of file ../../src/devices/bus/drivers/pci/device.h
uint16_t vendor_id ()
Defined at line 233 of file ../../src/devices/bus/drivers/pci/device.h
uint16_t device_id ()
Defined at line 234 of file ../../src/devices/bus/drivers/pci/device.h
uint8_t class_id ()
Defined at line 235 of file ../../src/devices/bus/drivers/pci/device.h
uint8_t subclass ()
Defined at line 236 of file ../../src/devices/bus/drivers/pci/device.h
uint8_t prog_if ()
Defined at line 237 of file ../../src/devices/bus/drivers/pci/device.h
uint8_t rev_id ()
Defined at line 238 of file ../../src/devices/bus/drivers/pci/device.h
uint8_t bus_id ()
Defined at line 239 of file ../../src/devices/bus/drivers/pci/device.h
uint8_t dev_id ()
Defined at line 240 of file ../../src/devices/bus/drivers/pci/device.h
uint8_t func_id ()
Defined at line 241 of file ../../src/devices/bus/drivers/pci/device.h
uint32_t bar_count ()
Defined at line 242 of file ../../src/devices/bus/drivers/pci/device.h
const Capabilities & capabilities ()
Defined at line 243 of file ../../src/devices/bus/drivers/pci/device.h
uint32_t legacy_vector ()
Defined at line 245 of file ../../src/devices/bus/drivers/pci/device.h
const zx::msi & msi_allocation ()
Defined at line 249 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 252 of file ../../src/devices/bus/drivers/pci/device.h
Irqs & irqs ()
Provide Irq information to the Bus for handling situations with no ack.
Defined at line 284 of file ../../src/devices/bus/drivers/pci/device.h
std::array<std::optional<Bar>, (6U)> & bars ()
Info about the BARs computed and cached during the initial setup/probe,
indexed by starting BAR register index.
Defined at line 287 of file ../../src/devices/bus/drivers/pci/device.h
BusDeviceInterface * bdi ()
Defined at line 290 of file ../../src/devices/bus/drivers/pci/device.h
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)
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 87 of file ../../src/devices/bus/drivers/pci/device.cc
zx_status_t Init ()
Defined at line 120 of file ../../src/devices/bus/drivers/pci/device.cc
zx_status_t InitLocked ()
Defined at line 173 of file ../../src/devices/bus/drivers/pci/device.cc
zx_status_t InitInterrupts ()
Defined at line 138 of file ../../src/devices/bus/drivers/pci/device.cc
void ModifyCmdLocked (uint16_t clr_bits, uint16_t set_bits)
Defined at line 241 of file ../../src/devices/bus/drivers/pci/device.cc
zx_status_t ProbeCapabilities ()
Parse PCI Standard Capabilities starting with the pointer in the PCI
config header.
Defined at line 312 of file ../../src/devices/bus/drivers/pci/device_caps.cc
zx_status_t ParseCapabilities ()
Defined at line 142 of file ../../src/devices/bus/drivers/pci/device_caps.cc
zx_status_t ParseExtendedCapabilities ()
Defined at line 230 of file ../../src/devices/bus/drivers/pci/device_caps.cc
uint16_t ReadCmdLocked ()
Read the value of the Command register, requires the dev_lock.
Defined at line 304 of file ../../src/devices/bus/drivers/pci/device.h
void AssignCmdLocked (uint16_t value)
Defined at line 310 of file ../../src/devices/bus/drivers/pci/device.h
bool IoEnabled ()
Defined at line 314 of file ../../src/devices/bus/drivers/pci/device.h
bool MmioEnabled ()
Defined at line 315 of file ../../src/devices/bus/drivers/pci/device.h
Records
Friends
class Root
class Bridge
class UpstreamNode