summaryrefslogtreecommitdiff
path: root/Kernel/Graphics
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2021-07-03 10:24:28 +0300
committerGunnar Beutner <gunnar@beutner.name>2021-07-03 16:28:49 +0200
commit3fae7ca113995fae7964d188780671c63e0a2e57 (patch)
tree457132f99334666efda6fe3a3013e3b91a51175a /Kernel/Graphics
parentb4e230a7bbb1147553530bad5b87dce306064c35 (diff)
downloadserenity-3fae7ca113995fae7964d188780671c63e0a2e57.zip
Kernel: Clarify and make it easy to not use raw numbers
Let's put the PCI IDs as enums in the PCI namespace so they're free to pollute that namespace, but it's also more easier to use them.
Diffstat (limited to 'Kernel/Graphics')
-rw-r--r--Kernel/Graphics/BochsGraphicsAdapter.cpp3
-rw-r--r--Kernel/Graphics/GraphicsManagement.cpp8
-rw-r--r--Kernel/Graphics/VirtIOGPU/VirtIOGraphicsAdapter.cpp2
3 files changed, 7 insertions, 6 deletions
diff --git a/Kernel/Graphics/BochsGraphicsAdapter.cpp b/Kernel/Graphics/BochsGraphicsAdapter.cpp
index 531412231a..0070bcff98 100644
--- a/Kernel/Graphics/BochsGraphicsAdapter.cpp
+++ b/Kernel/Graphics/BochsGraphicsAdapter.cpp
@@ -8,6 +8,7 @@
#include <AK/Checked.h>
#include <AK/Singleton.h>
#include <Kernel/Bus/PCI/Access.h>
+#include <Kernel/Bus/PCI/IDs.h>
#include <Kernel/Debug.h>
#include <Kernel/Graphics/Bochs.h>
#include <Kernel/Graphics/BochsGraphicsAdapter.h>
@@ -47,7 +48,7 @@ struct [[gnu::packed]] BochsDisplayMMIORegisters {
UNMAP_AFTER_INIT NonnullRefPtr<BochsGraphicsAdapter> BochsGraphicsAdapter::initialize(PCI::Address address)
{
PCI::ID id = PCI::get_id(address);
- VERIFY((id.vendor_id == 0x1234 && id.device_id == 0x1111) || (id.vendor_id == 0x80ee && id.device_id == 0xbeef));
+ VERIFY((id.vendor_id == PCI::VendorID::QEMUOld && id.device_id == 0x1111) || (id.vendor_id == PCI::VendorID::VirtualBox && id.device_id == 0xbeef));
return adopt_ref(*new BochsGraphicsAdapter(address));
}
diff --git a/Kernel/Graphics/GraphicsManagement.cpp b/Kernel/Graphics/GraphicsManagement.cpp
index a3a11b4ab1..c9500e7e6f 100644
--- a/Kernel/Graphics/GraphicsManagement.cpp
+++ b/Kernel/Graphics/GraphicsManagement.cpp
@@ -82,18 +82,18 @@ UNMAP_AFTER_INIT bool GraphicsManagement::determine_and_initialize_graphics_devi
RefPtr<GraphicsDevice> adapter;
switch (id.vendor_id) {
- case 0x1234:
+ case PCI::VendorID::QEMUOld:
if (id.device_id == 0x1111)
adapter = BochsGraphicsAdapter::initialize(address);
break;
- case 0x80ee:
+ case PCI::VendorID::VirtualBox:
if (id.device_id == 0xbeef)
adapter = BochsGraphicsAdapter::initialize(address);
break;
- case 0x8086:
+ case PCI::VendorID::Intel:
adapter = IntelNativeGraphicsAdapter::initialize(address);
break;
- case static_cast<u16>(PCIVendorID::VirtIO):
+ case PCI::VendorID::VirtIO:
dmesgln("Graphics: Using VirtIO console");
adapter = Graphics::VirtIOGraphicsAdapter::initialize(address);
break;
diff --git a/Kernel/Graphics/VirtIOGPU/VirtIOGraphicsAdapter.cpp b/Kernel/Graphics/VirtIOGPU/VirtIOGraphicsAdapter.cpp
index 6219a357a1..b41f1f5606 100644
--- a/Kernel/Graphics/VirtIOGPU/VirtIOGraphicsAdapter.cpp
+++ b/Kernel/Graphics/VirtIOGPU/VirtIOGraphicsAdapter.cpp
@@ -14,7 +14,7 @@ namespace Kernel::Graphics {
NonnullRefPtr<VirtIOGraphicsAdapter> VirtIOGraphicsAdapter::initialize(PCI::Address base_address)
{
- VERIFY(PCI::get_id(base_address).vendor_id == static_cast<u16>(PCIVendorID::VirtIO));
+ VERIFY(PCI::get_id(base_address).vendor_id == PCI::VendorID::VirtIO);
return adopt_ref(*new VirtIOGraphicsAdapter(base_address));
}