1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 15:17:36 +00:00

Kernel/VirtIO: Introduce the concept of transport options

The VirtIO specification defines many types of devices with different
purposes, and it also defines 3 possible transport mediums where devices
could be connected to the host machine.

We only care about the PCIe transport, but this commit puts the actual
foundations for supporting the lean MMIO transport too in the future.

To ensure things are kept abstracted but still functional, the VirtIO
transport code is responsible for what is deemed as related to an actual
transport type - allocation of interrupt handlers and tinkering with low
level transport-related registers, etc.
This commit is contained in:
Liav A 2023-06-10 14:46:47 +03:00 committed by Andrew Kaster
parent 68c3f9aa5a
commit d61c23569e
24 changed files with 732 additions and 429 deletions

View file

@ -19,16 +19,14 @@ class RNG final
: public AtomicRefCounted<RNG>
, public VirtIO::Device {
public:
static NonnullLockRefPtr<RNG> must_create(PCI::DeviceIdentifier const&);
virtual StringView purpose() const override { return class_name(); }
virtual StringView device_name() const override { return class_name(); }
static NonnullLockRefPtr<RNG> must_create_for_pci_instance(PCI::DeviceIdentifier const&);
virtual ~RNG() override = default;
virtual ErrorOr<void> initialize_virtio_resources() override;
private:
virtual StringView class_name() const override { return "VirtIORNG"sv; }
explicit RNG(PCI::DeviceIdentifier const&);
explicit RNG(NonnullOwnPtr<TransportEntity>);
virtual bool handle_device_config_change() override;
virtual void handle_queue_update(u16 queue_index) override;
void request_entropy_from_host();