mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:32:46 +00:00 
			
		
		
		
	Kernel/Graphics: Assert if trying to initialize with the wrong driver
This commit is contained in:
		
							parent
							
								
									053a832fac
								
							
						
					
					
						commit
						b4e230a7bb
					
				
					 2 changed files with 4 additions and 0 deletions
				
			
		|  | @ -46,6 +46,8 @@ struct [[gnu::packed]] BochsDisplayMMIORegisters { | ||||||
| 
 | 
 | ||||||
| UNMAP_AFTER_INIT NonnullRefPtr<BochsGraphicsAdapter> BochsGraphicsAdapter::initialize(PCI::Address address) | 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)); |     return adopt_ref(*new BochsGraphicsAdapter(address)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -4,6 +4,7 @@ | ||||||
|  * SPDX-License-Identifier: BSD-2-Clause |  * SPDX-License-Identifier: BSD-2-Clause | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
|  | #include <Kernel/Bus/PCI/IDs.h> | ||||||
| #include <Kernel/Graphics/Console/GenericFramebufferConsole.h> | #include <Kernel/Graphics/Console/GenericFramebufferConsole.h> | ||||||
| #include <Kernel/Graphics/GraphicsManagement.h> | #include <Kernel/Graphics/GraphicsManagement.h> | ||||||
| #include <Kernel/Graphics/VirtIOGPU/VirtIOGPU.h> | #include <Kernel/Graphics/VirtIOGPU/VirtIOGPU.h> | ||||||
|  | @ -13,6 +14,7 @@ namespace Kernel::Graphics { | ||||||
| 
 | 
 | ||||||
| NonnullRefPtr<VirtIOGraphicsAdapter> VirtIOGraphicsAdapter::initialize(PCI::Address base_address) | 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)); |     return adopt_ref(*new VirtIOGraphicsAdapter(base_address)); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Liav A
						Liav A