summaryrefslogtreecommitdiff
path: root/Kernel/Graphics
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2021-07-03 05:11:29 +0300
committerGunnar Beutner <gunnar@beutner.name>2021-07-03 16:28:49 +0200
commitb4e230a7bbb1147553530bad5b87dce306064c35 (patch)
tree393bf61e9fa3386f888a8c8eb2e2c457320bab94 /Kernel/Graphics
parent053a832fac2cd560b929a9894acfa5dea03e8f4b (diff)
downloadserenity-b4e230a7bbb1147553530bad5b87dce306064c35.zip
Kernel/Graphics: Assert if trying to initialize with the wrong driver
Diffstat (limited to 'Kernel/Graphics')
-rw-r--r--Kernel/Graphics/BochsGraphicsAdapter.cpp2
-rw-r--r--Kernel/Graphics/VirtIOGPU/VirtIOGraphicsAdapter.cpp2
2 files changed, 4 insertions, 0 deletions
diff --git a/Kernel/Graphics/BochsGraphicsAdapter.cpp b/Kernel/Graphics/BochsGraphicsAdapter.cpp
index ea8d1b23ce..531412231a 100644
--- a/Kernel/Graphics/BochsGraphicsAdapter.cpp
+++ b/Kernel/Graphics/BochsGraphicsAdapter.cpp
@@ -46,6 +46,8 @@ 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));
return adopt_ref(*new BochsGraphicsAdapter(address));
}
diff --git a/Kernel/Graphics/VirtIOGPU/VirtIOGraphicsAdapter.cpp b/Kernel/Graphics/VirtIOGPU/VirtIOGraphicsAdapter.cpp
index a7740480af..6219a357a1 100644
--- a/Kernel/Graphics/VirtIOGPU/VirtIOGraphicsAdapter.cpp
+++ b/Kernel/Graphics/VirtIOGPU/VirtIOGraphicsAdapter.cpp
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
+#include <Kernel/Bus/PCI/IDs.h>
#include <Kernel/Graphics/Console/GenericFramebufferConsole.h>
#include <Kernel/Graphics/GraphicsManagement.h>
#include <Kernel/Graphics/VirtIOGPU/VirtIOGPU.h>
@@ -13,6 +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));
return adopt_ref(*new VirtIOGraphicsAdapter(base_address));
}