Go to the documentation of this file.
41 #include "debug/VIOIface.hh"
43 #include "params/PciVirtIO.hh"
46 :
PciDevice(params), queueNotify(0), interruptDeliveryPending(false),
68 const unsigned M5_VAR_USED size(pkt->
getSize());
72 panic(
"Invalid PCI memory access to unmapped memory.\n");
75 DPRINTF(VIOIface,
"Reading offset 0x%x [len: %i]\n",
offset, size);
87 DPRINTF(VIOIface,
" DEVICE_FEATURES request\n");
88 assert(size ==
sizeof(uint32_t));
93 DPRINTF(VIOIface,
" GUEST_FEATURES request\n");
94 assert(size ==
sizeof(uint32_t));
99 DPRINTF(VIOIface,
" QUEUE_ADDRESS request\n");
100 assert(size ==
sizeof(uint32_t));
105 DPRINTF(VIOIface,
" QUEUE_SIZE request\n");
106 assert(size ==
sizeof(uint16_t));
111 DPRINTF(VIOIface,
" QUEUE_SELECT\n");
112 assert(size ==
sizeof(uint16_t));
117 DPRINTF(VIOIface,
" QUEUE_NOTIFY request\n");
118 assert(size ==
sizeof(uint16_t));
123 DPRINTF(VIOIface,
" DEVICE_STATUS request\n");
124 assert(size ==
sizeof(uint8_t));
129 DPRINTF(VIOIface,
" ISR_STATUS\n");
130 assert(size ==
sizeof(uint8_t));
136 pkt->
setLE<uint8_t>(isr_status);
149 const unsigned M5_VAR_USED size(pkt->
getSize());
153 panic(
"Invalid PCI memory access to unmapped memory.\n");
156 DPRINTF(VIOIface,
"Writing offset 0x%x [len: %i]\n",
offset, size);
168 warn(
"Guest tried to write device features.");
172 DPRINTF(VIOIface,
" WRITE GUEST_FEATURES request\n");
173 assert(size ==
sizeof(uint32_t));
178 DPRINTF(VIOIface,
" WRITE QUEUE_ADDRESS\n");
179 assert(size ==
sizeof(uint32_t));
184 panic(
"Guest tried to write queue size.");
188 DPRINTF(VIOIface,
" WRITE QUEUE_SELECT\n");
189 assert(size ==
sizeof(uint16_t));
194 DPRINTF(VIOIface,
" WRITE QUEUE_NOTIFY\n");
195 assert(size ==
sizeof(uint16_t));
201 assert(size ==
sizeof(uint8_t));
208 warn(
"Guest tried to write ISR status.");
221 DPRINTF(VIOIface,
"kick(): Sending interrupt...\n");
227 PciVirtIOParams::create()
void onNotify(QueueID index)
Driver is requesting service.
static const Addr BAR0_SIZE_BASE
virtual void readConfig(PacketPtr pkt, Addr cfgOffset)
Read from the configuration space of a device.
static const Addr OFF_QUEUE_NOTIFY
uint64_t alignToPowerOfTwo(uint64_t val)
Align to the next highest power of two.
PciVirtIO(const Params *params)
DeviceStatus getDeviceStatus() const
Retrieve the device status.
uint64_t Tick
Tick count type.
static const Addr OFF_QUEUE_SELECT
PCIConfig config
The current config space.
static const Addr OFF_ISR_STATUS
uint32_t getQueueAddress() const
Get the host physical address of the currently active queue.
FeatureBits getGuestFeatures() const
Get features accepted by the guest driver.
const FeatureBits deviceFeatures
Feature set offered by the device.
VirtIODeviceBase::QueueID queueNotify
Tick write(PacketPtr pkt)
Pure virtual function that the device must implement.
void setQueueAddress(uint32_t address)
Change the host physical address of the currently active queue.
QueueID getQueueSelect() const
Get the currently active queue.
static const Addr OFF_VIO_DEVICE
uint32_t BARSize[6]
The size of the BARs.
const size_t configSize
Size of the device's configuration space.
static const Addr OFF_QUEUE_SIZE
uint16_t getQueueSize() const
Get the size (descriptors) of the currently active queue.
static const Addr OFF_DEVICE_FEATURES
Offsets into VirtIO header (BAR0 relative).
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
void setGuestFeatures(FeatureBits features)
Set feature bits accepted by the guest driver.
static const Addr OFF_QUEUE_ADDRESS
static const Addr OFF_DEVICE_STATUS
void setQueueSelect(QueueID idx)
Change currently active queue.
const DeviceId deviceId
Device ID (sometimes known as subsystem ID)
T getLE() const
Get the data in the packet byte swapped from little endian to host endian.
void setDeviceStatus(DeviceStatus status)
Update device status and optionally reset device.
bool interruptDeliveryPending
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
void setLE(T v)
Set the value in the data pointer to v as little endian.
static const Addr OFF_GUEST_FEATURES
int getBAR(Addr addr)
Which base address register (if any) maps the given address?
Tick read(PacketPtr pkt)
Pure virtual function that the device must implement.
PCI device, base implementation is only config space.
void registerKickCallback(const std::function< void()> &callback)
Register a callback to kick the guest through the transport interface.
#define panic(...)
This implements a cprintf based panic() function.
virtual void writeConfig(PacketPtr pkt, Addr cfgOffset)
Write to the configuration space of a device.
Generated on Wed Sep 30 2020 14:02:11 for gem5 by doxygen 1.8.17