mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 17:12:43 +00:00 
			
		
		
		
	 0c5d6c6c47
			
		
	
	
		0c5d6c6c47
		
	
	
	
	
		
			
			Add a helper initialize_interrupt_queue() helper to enable_irq instead of doing it as part of its object construction as it can fail. This is similar to how AHCI initializes its interrupt as well.
		
			
				
	
	
		
			30 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			30 lines
		
	
	
	
		
			1.3 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2022, Pankaj R <pankydev8@gmail.com>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <Kernel/Interrupts/PCIIRQHandler.h>
 | |
| #include <Kernel/Storage/NVMe/NVMeQueue.h>
 | |
| 
 | |
| namespace Kernel {
 | |
| 
 | |
| class NVMeInterruptQueue : public NVMeQueue
 | |
|     , public PCIIRQHandler {
 | |
| public:
 | |
|     static ErrorOr<NonnullLockRefPtr<NVMeInterruptQueue>> try_create(PCI::Device& device, NonnullOwnPtr<Memory::Region> rw_dma_region, NonnullRefPtr<Memory::PhysicalPage> rw_dma_page, u16 qid, u8 irq, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Memory::TypedMapping<DoorbellRegister volatile> db_regs);
 | |
|     void submit_sqe(NVMeSubmission& submission) override;
 | |
|     virtual ~NVMeInterruptQueue() override {};
 | |
|     virtual StringView purpose() const override { return "NVMe"sv; };
 | |
|     void initialize_interrupt_queue();
 | |
| 
 | |
| protected:
 | |
|     NVMeInterruptQueue(PCI::Device& device, NonnullOwnPtr<Memory::Region> rw_dma_region, NonnullRefPtr<Memory::PhysicalPage> rw_dma_page, u16 qid, u8 irq, u32 q_depth, OwnPtr<Memory::Region> cq_dma_region, OwnPtr<Memory::Region> sq_dma_region, Memory::TypedMapping<DoorbellRegister volatile> db_regs);
 | |
| 
 | |
| private:
 | |
|     virtual void complete_current_request(u16 cmdid, u16 status) override;
 | |
|     bool handle_irq(RegisterState const&) override;
 | |
| };
 | |
| }
 |