38#ifndef __DEV_VIRTIO_FS9P_HH__
39#define __DEV_VIRTIO_FS9P_HH__
52struct VirtIO9PBaseParams;
68template <
typename T>
inline T
72template <
typename T>
inline T
75template <>
inline P9MsgHeader
84template <>
inline P9MsgHeader
136 {
nullptr, [](
void *
p){
operator delete(
p); }};
162 std::string
name()
const {
return parent.name() +
".queue"; }
210struct VirtIO9PProxyParams;
230 size_t size)
override;
291struct VirtIO9PDiodParams;
343struct VirtIO9PSocketParams;
This object is a proxy for a port or other object which implements the functional response protocol,...
VirtIO descriptor (chain) wrapper.
Virtqueue for 9p requests.
void onNotifyDescriptor(VirtDescriptor *desc)
Notify queue of pending incoming descriptor.
FSQueue(PortProxy &proxy, ByteOrder bo, uint16_t size, VirtIO9PBase &_parent)
VirtIO9PBase(const Params ¶ms)
void sendRMsg(const P9MsgHeader &header, const uint8_t *data, size_t size)
Send a 9p RPC message reply.
virtual void recvTMsg(const P9MsgHeader &header, const uint8_t *data, size_t size)=0
Handle incoming 9p RPC message.
std::unique_ptr< Config, void(*)(void *p)> config
Currently active configuration (host byte order)
void readConfig(PacketPtr pkt, Addr cfgOffset)
Read from the configuration space of a device.
void dumpMsg(const P9MsgHeader &header, const uint8_t *data, size_t size)
Dump a 9p RPC message on the debug output.
std::map< P9Tag, VirtDescriptor * > pendingTransactions
Map between 9p transaction tags and descriptors where they appeared.
static const DeviceId ID_9P
VirtIO device ID.
VirtIO9PBaseParams Params
static const FeatureBits F_MOUNT_TAG
Device provides a name of the resource in its configuration.
DiodDataEvent(VirtIO9PDiod &_parent, int fd, int event)
void startDiod()
Start diod and setup the communication pipes.
void startup()
startup() is the final initialization call before simulation.
int fd_from_diod
fd for data pipe coming from diod (read end)
int diod_pid
PID of diod process.
ssize_t read(uint8_t *data, size_t len)
Read data from the server behind the proxy.
VirtIO9PDiod(const Params ¶ms)
ssize_t write(const uint8_t *data, size_t len)
Write data to the server behind the proxy.
VirtIO9PDiodParams Params
int fd_to_diod
fd for data pipe going to diod (write end)
void terminateDiod()
Kill the diod child process at the end of the simulation.
std::unique_ptr< DiodDataEvent > dataEvent
virtual ssize_t read(uint8_t *data, size_t len)=0
Read data from the server behind the proxy.
virtual ssize_t write(const uint8_t *data, size_t len)=0
Write data to the server behind the proxy.
void recvTMsg(const P9MsgHeader &header, const uint8_t *data, size_t size) override
Handle incoming 9p RPC message.
void writeAll(const uint8_t *data, size_t len)
Convenience function that writes exactly len bytes.
void readAll(uint8_t *data, size_t len)
Convenience function that reads exactly len bytes.
bool deviceUsed
Bool to track if the device has been used or not.
VirtIO9PProxyParams Params
void unserialize(CheckpointIn &cp) override
Unserialize an object.
VirtIO9PProxy(const Params ¶ms)
void serverDataReady()
Notification of pending data from server.
void serialize(CheckpointOut &cp) const override
Serialize an object.
virtual ~SocketDataEvent()
SocketDataEvent(VirtIO9PSocket &_parent, int fd, int event)
virtual ~VirtIO9PSocket()
std::unique_ptr< SocketDataEvent > dataEvent
ssize_t read(uint8_t *data, size_t len)
Read data from the server behind the proxy.
VirtIO9PSocketParams Params
void startup()
startup() is the final initialization call before simulation.
void socketDisconnect()
9p server disconnect notification
int fdSocket
Socket connected to the 9p server.
VirtIO9PSocket(const Params ¶ms)
ssize_t write(const uint8_t *data, size_t len)
Write data to the server behind the proxy.
void connectSocket()
Try to resolve the server name and connect to the 9p server.
VirtIODeviceBase(const Params ¶ms, DeviceId id, size_t config_size, FeatureBits features)
uint16_t DeviceId
Device Type (sometimes known as subsystem ID)
VirtQueue(PortProxy &proxy, ByteOrder bo, uint16_t size)
Instantiate a new virtqueue.
PollEvent(int fd, int event)
const Params & params() const
Copyright (c) 2024 Arm Limited All rights reserved.
T htop9(T v)
Convert host byte order to p9 byte order (LE)
std::ostream CheckpointOut
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
T p9toh(T v)
Convert p9 byte order (LE) to host byte order.
VirtIO 9p configuration structure.