49 #ifndef __DEV_PCI_DEVICE_HH__ 50 #define __DEV_PCI_DEVICE_HH__ 58 #include "params/PciDevice.hh" 61 #define BAR_IO_MASK 0x3 62 #define BAR_MEM_MASK 0xF 63 #define BAR_IO_SPACE_BIT 0x1 64 #define BAR_IO_SPACE(x) ((x) & BAR_IO_SPACE_BIT) 65 #define BAR_NUMBER(x) (((x) - PCI0_BASE_ADDR0) >> 0x2); 134 assert(bar >= 0 && bar < 6);
135 return BARAddrs[bar] <= addr && addr < BARAddrs[bar] + BARSize[bar];
145 for (
int i = 0;
i <= 5; ++
i)
168 offs = addr - BARAddrs[
b];
199 return hostInterface.
dmaAddr(pci_addr);
236 #endif // __DEV_PCI_DEVICE_HH__
void unserialize(CheckpointIn &cp) override
Reconstruct the state of this object from a checkpoint.
Addr pciToDma(Addr pci_addr) const
Defines the PCI Express capability register and its associated bitfields for a PCIe device...
PCI device, base implementation is only config space.
const int MSIXCAP_MXC_OFFSET
const PciBusAddr _busAddr
Defines the MSI Capability register and its associated bitfields for the a PCI/PCIe device...
const int PMCAP_PC_OFFSET
const int MSIXCAP_MPBA_OFFSET
PciDevice(const PciDeviceParams *params)
Constructor for PCI Dev.
bool isLargeBAR(int bar) const
Does the given BAR represent 32 lower bits of a 64-bit address?
const PciBusAddr & busAddr() const
bool isBAR(Addr addr, int bar) const
Does the given address lie within the space mapped by the given base address register?
const int MSIXCAP_ID_OFFSET
Defines the Power Management capability register and all its associated bitfields for a PCIe device...
bool legacyIO[6]
Whether the BARs are really hardwired legacy IO locations.
void clearInt()
Clear a posted PCI interrupt.
uint64_t Tick
Tick count type.
virtual Tick writeConfig(PacketPtr pkt)
Write to the PCI config space data that is stored locally.
uint8_t interruptLine() const
Addr dmaAddr(Addr addr) const
Calculate the physical address of a prefetchable memory location in the PCI address space...
virtual Tick readConfig(PacketPtr pkt)
Read from the PCI config space data that is stored locally.
int getBAR(Addr addr)
Which base address register (if any) maps the given address?
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
bool getBAR(Addr addr, int &bar, Addr &offs)
Which base address register (if any) maps the given address?
std::vector< MSIXTable > msix_table
MSIX Table and PBA Structures.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Addr BARAddrs[6]
The current address mapping of the BARs.
const Params * params() const
AddrRangeList getAddrRanges() const override
Determine the address ranges that this device responds to.
std::ostream CheckpointOut
Callback interface from PCI devices to the host.
const int PMCAP_ID_OFFSET
std::vector< MSIXPbaEntry > msix_pba
const int PMCAP_BASE
The capability list structures and base addresses.
const int PMCAP_PMCS_OFFSET
PciHost::DeviceInterface hostInterface
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it...
void postInt()
Post a PCI interrupt to the CPU.
PCIConfig config
The current config space.
void serialize(CheckpointOut &cp) const override
Serialize this object to the given output stream.
uint32_t BARSize[6]
The size of the BARs.
const int MSIXCAP_MTAB_OFFSET