The Pedigree Project 0.1
Classes | Public Member Functions | Static Public Member Functions | Static Private Attributes | List of all members
PciBus Class Reference

#include <Pci.h>

+ Collaboration diagram for PciBus:

Classes

struct  ConfigSpace
 
class  DmaMapping
 

Public Member Functions

void initialise ()
 
uint32_t readConfigSpace (Device *pDev, uint8_t offset)
 
uint32_t readConfigSpace (uint8_t bus, uint8_t device, uint8_t function, uint8_t offset)
 
void writeConfigSpace (Device *pDev, uint8_t offset, uint32_t data)
 
void writeConfigSpace (uint8_t bus, uint8_t device, uint8_t function, uint8_t offset, uint32_t data)
 
bool readConfig8 (Device *device, uint16_t offset, uint8_t &value)
 
bool readConfig16 (Device *device, uint16_t offset, uint16_t &value)
 
bool readConfig32 (Device *device, uint16_t offset, uint32_t &value)
 
bool writeConfig8 (Device *device, uint16_t offset, uint8_t value)
 
bool writeConfig16 (Device *device, uint16_t offset, uint16_t value)
 
bool writeConfig32 (Device *device, uint16_t offset, uint32_t value)
 
PciExtendedCapabilities::FindResult findExtendedCapability (Device *device, uint16_t id, PciExtendedCapabilities::Capability &result)
 
bool reserveLegacyInterrupt (uint8_t irq)
 
bool updateCommand (Device *device, uint16_t clearBits, uint16_t setBits)
 
bool inspectFunction (Device *device, PciFunctionState::State &state, bool requireLegacyInterrupt=true)
 
bool disableMessageInterrupts (Device *device, const PciFunctionState::State &state)
 
bool enableMsi (Device *device, uint64_t address, uint16_t data)
 
bool disableMsi (Device *device)
 
bool enableMsix (Device *device, uint64_t address, uint32_t data)
 
bool enableMsixVectors (Device *device, uint64_t address, const uint32_t *data, size_t count, bool *touched=nullptr, const uint64_t *addresses=nullptr)
 
bool setMsixVectorMask (Device *device, size_t index, bool masked)
 
bool disableMsix (Device *device)
 
bool resourcesUnchanged (Device *device, const PciFunctionState::State &state)
 
bool translateAddress (uint64_t pciAddress, uint64_t bytes, bool io, uint64_t &cpuPhysical)
 
bool busRange (uint8_t &first, uint8_t &last)
 
uint32_t interruptRoute (uint8_t bus, uint8_t device, uint8_t function, uint8_t pin)
 
bool assignBar (Device *device, uint8_t index, uint32_t low, uint32_t high, uint32_t maskLow, uint32_t maskHigh)
 
bool attachDmaRemapping (Device *device)
 
bool hasDmaRemapping (Device *device) const
 
bool attachIsolatedDma (Device *device)
 
bool detachIsolatedDma (Device *device)
 
bool isolatedDmaIdle (Device *device) const
 
bool detachDisabledIsolatedDma (Device *device)
 
bool hasDmaIsolation (Device *device) const
 
bool mapDmaPage (Device *device, physical_uintptr_t physical, size_t bytes, DmaMapping &mapping)
 
void unmapDmaPage (Device *device, uint16_t token)
 
struct PciBus::ConfigSpace __attribute__ ((packed))
 

Static Public Member Functions

static PciBus & instance ()
 

Static Private Attributes

static PciBus m_Instance
 

Detailed Description

Architecture-independent interface to a PCI bus

Definition at line 31 of file Pci.h.

Constructor & Destructor Documentation

◆ PciBus()

PciBus::PciBus ( )

Definition at line 176 of file mach_pc/Pci.cc.

◆ ~PciBus()

PciBus::~PciBus ( )
virtual

Definition at line 177 of file mach_pc/Pci.cc.

Member Function Documentation

◆ assignBar()

bool PciBus::assignBar ( Device *  device,
uint8_t  index,
uint32_t  low,
uint32_t  high,
uint32_t  maskLow,
uint32_t  maskHigh 
)

Assign an unconfigured BAR from a host bridge window.

Definition at line 360 of file mach_pc/Pci.cc.

◆ attachDmaRemapping()

bool PciBus::attachDmaRemapping ( Device *  device)

Attach a PCI function to a translated DMA domain before bus mastering.

Definition at line 364 of file mach_pc/Pci.cc.

◆ attachIsolatedDma()

bool PciBus::attachIsolatedDma ( Device *  device)

Restrict this function to explicitly mapped DMA pages before bus mastering.

Definition at line 382 of file mach_pc/Pci.cc.

◆ busRange()

bool PciBus::busRange ( uint8_t &  first,
uint8_t &  last 
)

The host bridge's enumerable bus range.

Definition at line 343 of file mach_pc/Pci.cc.

◆ detachDisabledIsolatedDma()

bool PciBus::detachDisabledIsolatedDma ( Device *  device)

PF owner has cleared VFE and waited for VF removal before this call.

Definition at line 409 of file mach_pc/Pci.cc.

◆ detachIsolatedDma()

bool PciBus::detachIsolatedDma ( Device *  device)

Revoke an idle isolated domain after bus mastering has been disabled.

Definition at line 391 of file mach_pc/Pci.cc.

◆ disableMessageInterrupts()

bool PciBus::disableMessageInterrupts ( Device *  device,
const PciFunctionState::State &  state 
)

Definition at line 266 of file mach_pc/Pci.cc.

◆ disableMsi()

bool PciBus::disableMsi ( Device *  device)

Definition at line 277 of file mach_pc/Pci.cc.

◆ disableMsix()

bool PciBus::disableMsix ( Device *  device)

Definition at line 320 of file mach_pc/Pci.cc.

◆ enableMsi()

bool PciBus::enableMsi ( Device *  device,
uint64_t  address,
uint16_t  data 
)

Definition at line 270 of file mach_pc/Pci.cc.

◆ enableMsix()

bool PciBus::enableMsix ( Device *  device,
uint64_t  address,
uint32_t  data 
)

Definition at line 284 of file mach_pc/Pci.cc.

◆ enableMsixVectors()

bool PciBus::enableMsixVectors ( Device *  device,
uint64_t  address,
const uint32_t *  data,
size_t  count,
bool *  touched = nullptr,
const uint64_t *  addresses = nullptr 
)

Definition at line 287 of file mach_pc/Pci.cc.

◆ findExtendedCapability()

PciExtendedCapabilities::FindResult PciBus::findExtendedCapability ( Device *  device,
uint16_t  id,
PciExtendedCapabilities::Capability &  result 
)
inline

Definition at line 187 of file Pci.h.

◆ hasDmaIsolation()

bool PciBus::hasDmaIsolation ( Device *  device) const

Definition at line 426 of file mach_pc/Pci.cc.

◆ hasDmaRemapping()

bool PciBus::hasDmaRemapping ( Device *  device) const

Definition at line 373 of file mach_pc/Pci.cc.

◆ initialise()

void PciBus::initialise ( )

Initialises the object for use.

Definition at line 179 of file mach_pc/Pci.cc.

Referenced by Pc::initialiseDeviceTree(), and VirtMachine::initialiseDeviceTree().

+ Here is the caller graph for this function:

◆ inspectFunction()

bool PciBus::inspectFunction ( Device *  device,
PciFunctionState::State &  state,
bool  requireLegacyInterrupt = true 
)

Definition at line 258 of file mach_pc/Pci.cc.

◆ instance()

static PciBus & PciBus::instance ( )
inlinestatic

Definition at line 57 of file Pci.h.

◆ interruptRoute()

uint32_t PciBus::interruptRoute ( uint8_t  bus,
uint8_t  device,
uint8_t  function,
uint8_t  pin 
)

Definition at line 356 of file mach_pc/Pci.cc.

◆ isolatedDmaIdle()

bool PciBus::isolatedDmaIdle ( Device *  device) const

Caller serializes VF lifecycle and prevents new mappings during teardown.

Definition at line 400 of file mach_pc/Pci.cc.

◆ mapDmaPage()

bool PciBus::mapDmaPage ( Device *  device,
physical_uintptr_t  physical,
size_t  bytes,
DmaMapping &  mapping 
)

Map one pinned physical page to a 32-bit device address for the mapping lifetime.

Definition at line 435 of file mach_pc/Pci.cc.

References TargetInfo::getPageSize().

Referenced by ScsiDisk::flushCachePage().

+ Here is the caller graph for this function:

◆ readConfig16()

bool PciBus::readConfig16 ( Device *  device,
uint16_t  offset,
uint16_t &  value 
)

Definition at line 223 of file mach_pc/Pci.cc.

◆ readConfig32()

bool PciBus::readConfig32 ( Device *  device,
uint16_t  offset,
uint32_t &  value 
)

Definition at line 230 of file mach_pc/Pci.cc.

◆ readConfig8()

bool PciBus::readConfig8 ( Device *  device,
uint16_t  offset,
uint8_t &  value 
)

Definition at line 216 of file mach_pc/Pci.cc.

◆ readConfigSpace() [1/2]

uint32_t PciBus::readConfigSpace ( Device *  pDev,
uint8_t  offset 
)

Reads from the configuration space

Parameters
pDevthe device to read configuration space for
offsetthe dword index into the configuration space to read

Definition at line 191 of file mach_pc/Pci.cc.

Referenced by PciAtaController::PciAtaController().

+ Here is the caller graph for this function:

◆ readConfigSpace() [2/2]

uint32_t PciBus::readConfigSpace ( uint8_t  bus,
uint8_t  device,
uint8_t  function,
uint8_t  offset 
)

Reads from the configuration space

Parameters
busbus number for the read address
devicedevice number for the read address
functionfunction number for the read address
offsetthe dword index into the configuration space to read

Definition at line 196 of file mach_pc/Pci.cc.

◆ reserveLegacyInterrupt()

bool PciBus::reserveLegacyInterrupt ( uint8_t  irq)

Definition at line 477 of file mach_pc/Pci.cc.

◆ resourcesUnchanged()

bool PciBus::resourcesUnchanged ( Device *  device,
const PciFunctionState::State &  state 
)

Definition at line 332 of file mach_pc/Pci.cc.

◆ setMsixVectorMask()

bool PciBus::setMsixVectorMask ( Device *  device,
size_t  index,
bool  masked 
)

Definition at line 307 of file mach_pc/Pci.cc.

◆ translateAddress()

bool PciBus::translateAddress ( uint64_t  pciAddress,
uint64_t  bytes,
bool  io,
uint64_t &  cpuPhysical 
)

Translate a PCI BAR address into the CPU's physical address space.

Definition at line 338 of file mach_pc/Pci.cc.

◆ unmapDmaPage()

void PciBus::unmapDmaPage ( Device *  device,
uint16_t  token 
)

Definition at line 466 of file mach_pc/Pci.cc.

◆ updateCommand()

bool PciBus::updateCommand ( Device *  device,
uint16_t  clearBits,
uint16_t  setBits 
)

Definition at line 242 of file mach_pc/Pci.cc.

◆ writeConfig16()

bool PciBus::writeConfig16 ( Device *  device,
uint16_t  offset,
uint16_t  value 
)

Definition at line 236 of file mach_pc/Pci.cc.

◆ writeConfig32()

bool PciBus::writeConfig32 ( Device *  device,
uint16_t  offset,
uint32_t  value 
)

Definition at line 239 of file mach_pc/Pci.cc.

◆ writeConfig8()

bool PciBus::writeConfig8 ( Device *  device,
uint16_t  offset,
uint8_t  value 
)

Definition at line 233 of file mach_pc/Pci.cc.

◆ writeConfigSpace() [1/2]

void PciBus::writeConfigSpace ( Device *  pDev,
uint8_t  offset,
uint32_t  data 
)

Writes to the configuration space

Parameters
pDevthe device to write configuration space for
offsetthe dword index into the configuration space to write
datathe data to write

Definition at line 205 of file mach_pc/Pci.cc.

Referenced by PciAtaController::PciAtaController().

+ Here is the caller graph for this function:

◆ writeConfigSpace() [2/2]

void PciBus::writeConfigSpace ( uint8_t  bus,
uint8_t  device,
uint8_t  function,
uint8_t  offset,
uint32_t  data 
)

Writes to the configuration space

Parameters
busbus number for the write address
devicedevice number for the write address
functionfunction number for the write address
offsetthe dword index into the configuration space to write
datathe data to write

Definition at line 208 of file mach_pc/Pci.cc.

Member Data Documentation

◆ m_Instance

PciBus PciBus::m_Instance
staticprivate

Definition at line 175 of file Pci.h.


The documentation for this class was generated from the following files: