mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
e606ff3751
According to the VirtIO 1.0 specification: "Non-transitional devices SHOULD have a PCI Device ID in the range 0x1040 to 0x107f. Non-transitional devices SHOULD have a PCI Revision ID of 1 or higher. Non-transitional devices SHOULD have a PCI Subsystem Device ID of 0x40 or higher." It also says that: "Transitional devices MUST have a PCI Revision ID of 0. Transitional devices MUST have the PCI Subsystem Device ID matching the Virtio Device ID, as indicated in section 5. Transitional devices MUST have the Transitional PCI Device ID in the range 0x1000 to 0x103f." So, for legacy devices, we know that revision ID in the PCI header won't be 1, so we probe for PCI_SUBSYSTEM_ID value. Instead of using the subsystem device ID, we can probe the DEVICE_ID value directly in case it's not a legacy device. This should cover all possibilities for identifying VirtIO devices, both per the specification of 0.9.5, and future revisions from 1.0 onwards.
29 lines
488 B
C++
29 lines
488 B
C++
/*
|
|
* Copyright (c) 2021, Gunnar Beutner <gbeutner@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
namespace Kernel::PCI {
|
|
|
|
enum VendorID {
|
|
VirtIO = 0x1af4,
|
|
Intel = 0x8086,
|
|
WCH = 0x1c00,
|
|
RedHat = 0x1b36,
|
|
Realtek = 0x10ec,
|
|
QEMUOld = 0x1234,
|
|
VirtualBox = 0x80ee
|
|
};
|
|
|
|
enum DeviceID {
|
|
VirtIONetAdapter = 0x1000,
|
|
VirtIOBlockDevice = 0x1001,
|
|
VirtIOConsole = 0x1003,
|
|
VirtIOEntropy = 0x1005,
|
|
VirtIOGPU = 0x1050,
|
|
};
|
|
|
|
}
|