Go to the documentation of this file.
56 #include "debug/PciDevice.hh"
64 _busAddr(
p->pci_bus,
p->pci_dev,
p->pci_func),
65 PMCAP_BASE(
p->PMCAPBaseOffset),
66 PMCAP_ID_OFFSET(
p->PMCAPBaseOffset+
PMCAP_ID),
67 PMCAP_PC_OFFSET(
p->PMCAPBaseOffset+
PMCAP_PC),
69 MSICAP_BASE(
p->MSICAPBaseOffset),
70 MSIXCAP_BASE(
p->MSIXCAPBaseOffset),
75 PXCAP_BASE(
p->PXCAPBaseOffset),
77 hostInterface(
p->host->registerDevice(this, _busAddr,
79 pioDelay(
p->pio_latency),
80 configDelay(
p->config_latency)
83 "Invalid PCI interrupt '%i' specified.",
p->InterruptPin);
122 pmcap.
pid |= (uint16_t)
p->PMCAPNextCapability << 8;
128 msicap.
mid |= (uint16_t)
p->MSICAPNextCapability << 8;
138 msixcap.
mxid |= (uint16_t)
p->MSIXCAPNextCapability << 8;
150 uint16_t msixcap_mxc_ts =
msixcap.
mxc & 0x07ff;
152 int msix_vecs = msixcap_mxc_ts + 1;
165 (msixcap_mxc_ts + 1) *
sizeof(
MSIXTable);
176 pxcap.
pxid |= (uint16_t)
p->PXCAPNextCapability << 8;
201 for (
int i = 0;
i < 6; ++
i) {
223 warn_once(
"Device specific PCI config space "
224 "not implemented for %s!\n", this->
name());
226 case sizeof(uint8_t):
227 pkt->
setLE<uint8_t>(0);
229 case sizeof(uint16_t):
230 pkt->
setLE<uint16_t>(0);
232 case sizeof(uint32_t):
233 pkt->
setLE<uint32_t>(0);
236 panic(
"invalid access size(?) for PCI configspace!\n");
239 panic(
"Out-of-range access to PCI config space!\n");
243 case sizeof(uint8_t):
246 "readConfig: dev %#x func %#x reg %#x 1 bytes: data = %#x\n",
248 (uint32_t)pkt->
getLE<uint8_t>());
250 case sizeof(uint16_t):
253 "readConfig: dev %#x func %#x reg %#x 2 bytes: data = %#x\n",
255 (uint32_t)pkt->
getLE<uint16_t>());
257 case sizeof(uint32_t):
260 "readConfig: dev %#x func %#x reg %#x 4 bytes: data = %#x\n",
262 (uint32_t)pkt->
getLE<uint32_t>());
265 panic(
"invalid access size(?) for PCI configspace!\n");
277 for (
x = 0;
x < 6;
x++)
291 warn_once(
"Device specific PCI config space "
292 "not implemented for %s!\n", this->
name());
294 case sizeof(uint8_t):
295 case sizeof(uint16_t):
296 case sizeof(uint32_t):
299 panic(
"invalid access size(?) for PCI configspace!\n");
302 panic(
"Out-of-range access to PCI config space!\n");
306 case sizeof(uint8_t):
325 panic(
"writing to a read only register");
328 "writeConfig: dev %#x func %#x reg %#x 1 bytes: data = %#x\n",
330 (uint32_t)pkt->
getLE<uint8_t>());
332 case sizeof(uint16_t):
344 panic(
"writing to a read only register");
347 "writeConfig: dev %#x func %#x reg %#x 2 bytes: data = %#x\n",
349 (uint32_t)pkt->
getLE<uint16_t>());
351 case sizeof(uint32_t):
365 uint32_t he_new_bar =
letoh(pkt->
getLE<uint32_t>());
373 if (he_new_bar == 0xffffffff) {
374 he_new_bar = ~(
BARSize[barnum] - 1);
377 he_new_bar &= ~bar_mask;
381 warn(
"IO BARs can't be set as large BAR");
382 uint64_t he_large_bar =
384 he_large_bar = he_large_bar << 32;
385 he_large_bar += he_new_bar;
390 uint64_t he_large_bar = he_new_bar;
391 he_large_bar = he_large_bar << 32;
407 (he_old_bar & bar_mask));
413 if (
letoh(pkt->
getLE<uint32_t>()) == 0xfffffffe)
430 "writeConfig: dev %#x func %#x reg %#x 4 bytes: data = %#x\n",
432 (uint32_t)pkt->
getLE<uint32_t>());
435 panic(
"invalid access size(?) for PCI configspace!\n");
468 uint16_t msixcap_mxc_ts =
msixcap.
mxc & 0x07ff;
469 int msix_array_size = msixcap_mxc_ts + 1;
478 for (
int i = 0;
i < msix_array_size;
i++) {
488 for (
int i = 0;
i < pba_array_size;
i++) {
557 msix_pba.resize(pba_array_size, tmp2);
559 for (
int i = 0;
i < msix_array_size;
i++) {
569 for (
int i = 0;
i < pba_array_size;
i++) {
#define fatal(...)
This implements a cprintf based fatal() function.
void makeAtomicResponse()
AddrRangeList getAddrRanges() const override
Determine the address ranges that this device responds to.
#define PCI0_MINIMUM_GRANT
#define UNSERIALIZE_SCALAR(scalar)
virtual Tick writeConfig(PacketPtr pkt)
Write to the PCI config space data that is stored locally.
virtual Tick readConfig(PacketPtr pkt)
Read from the PCI config space data that is stored locally.
uint64_t Tick
Tick count type.
PCIConfig config
The current config space.
const PciBusAddr _busAddr
#define PCI_LATENCY_TIMER
std::vector< MSIXPbaEntry > msix_pba
void paramOut(CheckpointOut &cp, const string &name, ExtMachInst const &machInst)
#define PCI_DEVICE_SPECIFIC
#define PCI0_INTERRUPT_LINE
#define PCI0_ROM_BASE_ADDR
PciDevice(const PciDeviceParams *params)
Constructor for PCI Dev.
PciHost::DeviceInterface hostInterface
uint32_t BARSize[6]
The size of the BARs.
Addr memAddr(Addr addr) const
Calculate the physical address of a non-prefetchable memory location in the PCI address space.
Addr pioAddr(Addr addr) const
Calculate the physical address of an IO location on the PCI bus.
void serialize(CheckpointOut &cp) const override
Serialize this object to the given output stream.
AddrRange RangeSize(Addr start, Addr size)
void unserialize(CheckpointIn &cp) override
Reconstruct the state of this object from a checkpoint.
#define SERIALIZE_ARRAY(member, size)
bool isLargeBAR(int bar) const
Does the given BAR represent 32 lower bits of a 64-bit address?
uint16_t subsystemVendorID
#define PCI0_MAXIMUM_LATENCY
#define SERIALIZE_SCALAR(scalar)
virtual const std::string name() const
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
std::vector< MSIXTable > msix_table
MSIX Table and PBA Structures.
#define UNSERIALIZE_ARRAY(member, size)
#define PCI_CACHE_LINE_SIZE
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
void paramIn(CheckpointIn &cp, const string &name, ExtMachInst &machInst)
void setLE(T v)
Set the value in the data pointer to v as little endian.
std::ostream CheckpointOut
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
Addr BARAddrs[6]
The current address mapping of the BARs.
void sendRangeChange() const
Called by the owner to send a range change.
bool isPowerOf2(const T &n)
bool legacyIO[6]
Whether the BARs are really hardwired legacy IO locations.
std::string csprintf(const char *format, const Args &...args)
PCI device, base implementation is only config space.
#define PMCAP_ID
PCIe capability list offsets internal to the entry.
#define panic(...)
This implements a cprintf based panic() function.
PioPort< PioDevice > pioPort
The pioPort that handles the requests for us and provides us requests that it sees.
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it.
#define PCI0_INTERRUPT_PIN
Generated on Wed Sep 30 2020 14:02:08 for gem5 by doxygen 1.8.17