42 #include "debug/VIOBlock.hh"
43 #include "params/VirtIOBlock.hh"
48 qRequests(params->
system->physProxy, params->queueSize, *this),
72 size_t off_data,
size_t size)
75 uint64_t sector(req.
sector);
77 DPRINTF(VIOBlock,
"Read request starting @ sector %i (size: %i)\n",
81 panic(
"Unexpected request/sector size relationship\n");
85 warn(
"Failed to read sector %i\n", sector);
98 size_t off_data,
size_t size)
101 uint64_t sector(req.
sector);
103 DPRINTF(VIOBlock,
"Write request starting @ sector %i (size: %i)\n",
107 panic(
"Unexpected request/sector size relationship\n");
110 desc_chain->
chainRead(off_data, data, size);
114 warn(
"Failed to write sector %i\n", sector);
127 DPRINTF(VIOBlock,
"Got input data descriptor (len: %i)\n",
134 desc->
chainRead(0, (uint8_t *)&req,
sizeof(req));
156 warn(
"Unsupported IO request: %i\n", req.type);
162 &status,
sizeof(status));
170 VirtIOBlockParams::create()
Base class for all VirtIO-based devices.
Status read(const BlkRequest &req, VirtDescriptor *desc_chain, size_t off_data, size_t size)
Device read request.
VirtIOBlock(Params *params)
DiskImage & image
Image backing this device.
static const RequestType T_FLUSH
Flush device buffers.
Block device configuration structure.
Status write(const BlkRequest &req, VirtDescriptor *desc_chain, size_t off_data, size_t size)
Device write request.
static const RequestType T_OUT
Write request.
VirtIO block device request as sent by guest.
void produceDescriptor(VirtDescriptor *desc, uint32_t len)
Send a descriptor chain to the guest.
virtual std::streampos size() const =0
T htov_legacy(T v)
Convert host endianness to legacy VirtIO endianness.
void chainRead(size_t offset, uint8_t *dst, size_t size) const
Read the contents of a descriptor chain.
void kick()
Inform the guest of available buffers.
static const RequestType T_IN
Read request.
void chainWrite(size_t offset, const uint8_t *src, size_t size)
Write to a descriptor chain.
virtual std::streampos write(const uint8_t *data, std::streampos offset)=0
VirtIO descriptor (chain) wrapper.
void onNotifyDescriptor(VirtDescriptor *desc)
Notify queue of pending incoming descriptor.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
size_t size() const
Retrieve the size of this descriptor.
void readConfig(PacketPtr pkt, Addr cfgOffset)
Read from the configuration space of a device.
void registerQueue(VirtQueue &queue)
Register a new VirtQueue with the device model.
static const Status S_IOERR
Request failed due to a device error.
virtual std::streampos read(uint8_t *data, std::streampos offset) const =0
size_t chainSize() const
Retrieve the size of this descriptor chain.
static const Status S_OK
Request succeeded.
RequestQueue qRequests
Device I/O request queue.
static const Status S_UNSUPP
Request not supported.
void readConfigBlob(PacketPtr pkt, Addr cfgOffset, const uint8_t *cfg)
Read configuration data from a device structure.