class PcieBusDriver

Defined at line 33 of file ../../zircon/kernel/dev/pcie/include/dev/pcie_bus_driver.h

Public Methods

void ~PcieBusDriver ()

Defined at line 48 of file ../../zircon/kernel/dev/pcie/pcie_bus_driver.cc

PciePlatformInterface & platform ()

Defined at line 60 of file ../../zircon/kernel/dev/pcie/include/dev/pcie_bus_driver.h

zx_status_t AddRoot (fbl::RefPtr<PcieRoot> && root)

Add a root bus to the driver and attempt to scan it for devices.

Defined at line 77 of file ../../zircon/kernel/dev/pcie/pcie_bus_driver.cc

zx_status_t AddBusRegion (uint64_t base, uint64_t size, PciAddrSpace aspace)

Address space (PIO and MMIO) allocation management

Note: Internally, regions held for MMIO address space allocation are

tracked in two different allocators; one for

<

4GB allocations usable by

32-bit or 64-bit BARs, and one for >4GB allocations usable only by 64-bit

BARs.

Users of Add/SubtractBusRegion are permitted to supply regions which span

the 4GB mark in the MMIO address space, but their operation will be

internally split into two different operations executed against the two

different allocators. The low memory portion of the operation will be

executed first. In the case that the first of the split operations

succeeds but the second fails, the first operation will not be rolled

back. If this behavior is unacceptable, users should be sure to submit

only MMIO address space operations which target regions either entirely

above or entirely below the 4GB mark.

Defined at line 81 of file ../../zircon/kernel/dev/pcie/include/dev/pcie_bus_driver.h

zx_status_t SubtractBusRegion (uint64_t base, uint64_t size, PciAddrSpace aspace)

Defined at line 85 of file ../../zircon/kernel/dev/pcie/include/dev/pcie_bus_driver.h

zx_status_t SetAddressTranslationProvider (ktl::unique_ptr<PcieAddressProvider> provider)

A PcieAddressProvider translates a BDF address to an address that the

system can use to access ECAMs.

Defined at line 99 of file ../../zircon/kernel/dev/pcie/pcie_bus_driver.cc

zx_status_t RescanDevices ()

Rescan looking for new devices

Defined at line 115 of file ../../zircon/kernel/dev/pcie/pcie_bus_driver.cc

const RegionAllocator::RegionPool::RefPtr & region_bookkeeping ()

Bus region allocation

Defined at line 132 of file ../../zircon/kernel/dev/pcie/include/dev/pcie_bus_driver.h

RegionAllocator & pf_mmio_regions ()

Defined at line 135 of file ../../zircon/kernel/dev/pcie/include/dev/pcie_bus_driver.h

RegionAllocator & mmio_lo_regions ()

Defined at line 136 of file ../../zircon/kernel/dev/pcie/include/dev/pcie_bus_driver.h

RegionAllocator & mmio_hi_regions ()

Defined at line 137 of file ../../zircon/kernel/dev/pcie/include/dev/pcie_bus_driver.h

RegionAllocator & pio_regions ()

Defined at line 138 of file ../../zircon/kernel/dev/pcie/include/dev/pcie_bus_driver.h

void PcieBusDriver (const PcieBusDriver & )

Disallow copying, assigning and moving.

Defined at line 145 of file ../../zircon/kernel/dev/pcie/include/dev/pcie_bus_driver.h

void PcieBusDriver (PcieBusDriver && )

Disallow copying, assigning and moving.

Defined at line 145 of file ../../zircon/kernel/dev/pcie/include/dev/pcie_bus_driver.h

PcieBusDriver & operator= (const PcieBusDriver & )

Disallow copying, assigning and moving.

Defined at line 145 of file ../../zircon/kernel/dev/pcie/include/dev/pcie_bus_driver.h

PcieBusDriver & operator= (PcieBusDriver && )

Disallow copying, assigning and moving.

Defined at line 145 of file ../../zircon/kernel/dev/pcie/include/dev/pcie_bus_driver.h

fbl::RefPtr<PcieBusDriver> GetDriver ()

Defined at line 147 of file ../../zircon/kernel/dev/pcie/include/dev/pcie_bus_driver.h

bool RescanLockIsHeld ()

Debug/ASSERT routine, used by devices and bridges to assert that the

rescan lock is currently being held.

Defined at line 158 of file ../../zircon/kernel/dev/pcie/include/dev/pcie_bus_driver.h

const PciConfig * GetConfig (uint bus_id, uint dev_id, uint func_id, paddr_t * out_cfg_phys)

*****************************************************************************

ECAM support

****************************************************************************

TODO(cja): The bus driver owns all configs as well as devices so the

lifecycle of both are already dependent. Should this still return a refptr?

Defined at line 512 of file ../../zircon/kernel/dev/pcie/pcie_bus_driver.cc

zx_status_t StartBusDriver ()

Start the driver

Notes about startup:

Before starting the bus driver, platforms must add all of the resources

to be used by the driver during operation. Once started, the set of

resources used by the driver may not be modified. Resources which must

be supplied include...

++ ECAM regions for memory mapped config sections. See AddEcamRegion

++ Bus regions for both MMIO and PIO bus access. See (Add|Subtract)BusRegion

++ Roots. See AddRoot

Resources may be added in any order.

Once all of the resources have been added, StartBusDriver will scan for

devices under each of the added roots, run all registered quirks and

attempt to allocated bus/IRQ resources for discovered devices.

Defined at line 167 of file ../../zircon/kernel/dev/pcie/pcie_bus_driver.cc

fbl::RefPtr<PcieDevice> GetNthDevice (uint32_t index)

TODO(johngro) : Remove this someday. Getting the "Nth" device is not a

concept which is going to carry over well to the world of hot-pluggable

devices.

Defined at line 215 of file ../../zircon/kernel/dev/pcie/pcie_bus_driver.cc

void LinkDeviceToUpstream (PcieDevice & dev, PcieUpstreamNode & upstream)

Topology related stuff

Defined at line 241 of file ../../zircon/kernel/dev/pcie/pcie_bus_driver.cc

void UnlinkDeviceFromUpstream (PcieDevice & dev)

Defined at line 255 of file ../../zircon/kernel/dev/pcie/pcie_bus_driver.cc

fbl::RefPtr<PcieUpstreamNode> GetUpstream (PcieDevice & dev)

Defined at line 271 of file ../../zircon/kernel/dev/pcie/pcie_bus_driver.cc

fbl::RefPtr<PcieDevice> GetDownstream (PcieUpstreamNode & upstream, uint ndx)

Defined at line 277 of file ../../zircon/kernel/dev/pcie/pcie_bus_driver.cc

fbl::RefPtr<PcieDevice> GetRefedDevice (uint bus_id, uint dev_id, uint func_id)

Defined at line 284 of file ../../zircon/kernel/dev/pcie/pcie_bus_driver.cc

fbl::RefPtr<SharedLegacyIrqHandler> FindLegacyIrqHandler (uint irq_id)

TODO(johngro) : Make this private when we can.

Defined at line 959 of file ../../zircon/kernel/dev/pcie/pcie_irqs.cc

void DisableBus ()

Workaround to disable all devices on the bus for mexec. This should not be

used for any other reason due to it intentionally leaving drivers in a bad

state (some may crash).

TODO(cja): The paradise serial workaround in particular may need a smarter

way of being handled in the future because it is not uncommon to have serial

bus devices initialized by the bios that we need to retain in zedboot/crash

situations.

Defined at line 570 of file ../../zircon/kernel/dev/pcie/pcie_bus_driver.cc

zx_status_t InitializeDriver (PciePlatformInterface & platform)

Defined at line 471 of file ../../zircon/kernel/dev/pcie/pcie_bus_driver.cc

void ShutdownDriver ()

Defined at line 493 of file ../../zircon/kernel/dev/pcie/pcie_bus_driver.cc

Friends

class PcieDebugConsole