1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 20:17:44 +00:00

Kernel: Move PCI vendor and device IDs into Kernel/PCI/IDs.h

This commit is contained in:
Gunnar Beutner 2021-04-27 10:54:22 +02:00 committed by Andreas Kling
parent eaf8fc90e7
commit bf703ee553
6 changed files with 27 additions and 12 deletions

View file

@ -5,6 +5,7 @@
*/
#include <Kernel/CommandLine.h>
#include <Kernel/PCI/IDs.h>
#include <Kernel/VirtIO/VirtIO.h>
#include <Kernel/VirtIO/VirtIOConsole.h>
#include <Kernel/VirtIO/VirtIORNG.h>
@ -18,14 +19,14 @@ void VirtIO::detect()
PCI::enumerate([&](const PCI::Address& address, PCI::ID id) {
if (address.is_null() || id.is_null())
return;
if (id.vendor_id != VIRTIO_PCI_VENDOR_ID)
if (id.vendor_id != (u16)PCIVendorID::VirtIO)
return;
switch (id.device_id) {
case VIRTIO_CONSOLE_PCI_DEVICE_ID: {
case (u16)PCIDeviceID::VirtIOConsole: {
[[maybe_unused]] auto& unused = adopt_ref(*new VirtIOConsole(address)).leak_ref();
break;
}
case VIRTIO_ENTROPY_PCI_DEVICE_ID: {
case (u16)PCIDeviceID::VirtIOEntropy: {
[[maybe_unused]] auto& unused = adopt_ref(*new VirtIORNG(address)).leak_ref();
break;
}

View file

@ -17,8 +17,6 @@
namespace Kernel {
#define VIRTIO_PCI_VENDOR_ID 0x1AF4
#define REG_DEVICE_FEATURES 0x0
#define REG_GUEST_FEATURES 0x4
#define REG_QUEUE_ADDRESS 0x8

View file

@ -11,8 +11,6 @@
namespace Kernel {
#define VIRTIO_CONSOLE_PCI_DEVICE_ID 0x1003
#define VIRTIO_CONSOLE_F_SIZE (1 << 0)
#define VIRTIO_CONSOLE_F_MULTIPORT (1 << 1)
#define VIRTIO_CONSOLE_F_EMERG_WRITE (1 << 2)

View file

@ -12,8 +12,6 @@
namespace Kernel {
#define VIRTIO_ENTROPY_PCI_DEVICE_ID 0x1005
#define REQUESTQ 0
class VirtIORNG final : public CharacterDevice