diff options
author | Liav A <liavalb@gmail.com> | 2021-07-03 05:11:29 +0300 |
---|---|---|
committer | Gunnar Beutner <gunnar@beutner.name> | 2021-07-03 16:28:49 +0200 |
commit | b4e230a7bbb1147553530bad5b87dce306064c35 (patch) | |
tree | 393bf61e9fa3386f888a8c8eb2e2c457320bab94 /Kernel/Graphics | |
parent | 053a832fac2cd560b929a9894acfa5dea03e8f4b (diff) | |
download | serenity-b4e230a7bbb1147553530bad5b87dce306064c35.zip |
Kernel/Graphics: Assert if trying to initialize with the wrong driver
Diffstat (limited to 'Kernel/Graphics')
-rw-r--r-- | Kernel/Graphics/BochsGraphicsAdapter.cpp | 2 | ||||
-rw-r--r-- | Kernel/Graphics/VirtIOGPU/VirtIOGraphicsAdapter.cpp | 2 |
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)); } |