The Pedigree Project 0.1
modules/drivers/common/virtio-rng/main.cc
1/* Copyright (c) 2026, Pedigree Developers. SPDX-License-Identifier: ISC */
2#include "pedigree/kernel/machine/Device.h"
3#include "pedigree/kernel/utilities/List.h"
4
5#include "VirtioRng.h"
6#include "modules/Module.h"
7
8namespace {
9List<Device*> candidates;
10
11void collect(Device* pci) {
12 candidates.pushBack(pci);
13}
14
15bool entry() {
16 Device::searchByVendorIdAndDeviceId(0x1af4, 0x1044, collect);
17 Device::searchByVendorIdAndDeviceId(0x1af4, 0x1005, collect);
18 bool seeded = false;
19 while (candidates.count()) {
20 VirtioRng rng(candidates.popFront());
21 seeded |= rng.seedKernel();
22 }
23 return seeded;
24}
25
26void exit() {}
27} // namespace
28
29MODULE_INFO("virtio-rng", &entry, &exit, "pci", "virtio-pci");
Definition List.h:61
T popFront()
Definition List.h:330
size_t count() const
Definition List.h:212
void pushBack(const T &value)
Definition List.h:216