mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 05:05:00 +00:00
Kernel/Interrupts: Move PCIIRQHandler => PCI::IRQHandler
This class is part of the PCI code so let's move it to the PCI namespace like other handling code parts of the PCI bus.
This commit is contained in:
parent
4446858401
commit
68c3f9aa5a
8 changed files with 18 additions and 18 deletions
|
@ -10,7 +10,7 @@
|
||||||
namespace Kernel::Audio::IntelHDA {
|
namespace Kernel::Audio::IntelHDA {
|
||||||
|
|
||||||
InterruptHandler::InterruptHandler(Controller& controller)
|
InterruptHandler::InterruptHandler(Controller& controller)
|
||||||
: PCIIRQHandler(controller, controller.device_identifier().interrupt_line().value())
|
: PCI::IRQHandler(controller, controller.device_identifier().interrupt_line().value())
|
||||||
, m_controller(controller)
|
, m_controller(controller)
|
||||||
{
|
{
|
||||||
enable_irq();
|
enable_irq();
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Kernel::Audio::IntelHDA {
|
||||||
class Controller;
|
class Controller;
|
||||||
|
|
||||||
class InterruptHandler
|
class InterruptHandler
|
||||||
: public PCIIRQHandler
|
: public PCI::IRQHandler
|
||||||
, public RefCounted<InterruptHandler> {
|
, public RefCounted<InterruptHandler> {
|
||||||
public:
|
public:
|
||||||
static ErrorOr<NonnullRefPtr<InterruptHandler>> create(Controller& controller)
|
static ErrorOr<NonnullRefPtr<InterruptHandler>> create(Controller& controller)
|
||||||
|
@ -22,13 +22,13 @@ public:
|
||||||
return adopt_nonnull_ref_or_enomem(new (nothrow) InterruptHandler(controller));
|
return adopt_nonnull_ref_or_enomem(new (nothrow) InterruptHandler(controller));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ^PCIIRQHandler
|
// ^PCI::IRQHandler
|
||||||
virtual StringView purpose() const override { return "IntelHDA IRQ Handler"sv; }
|
virtual StringView purpose() const override { return "IntelHDA IRQ Handler"sv; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
InterruptHandler(Controller& controller);
|
InterruptHandler(Controller& controller);
|
||||||
|
|
||||||
// ^PCIIRQHandler
|
// ^PCI::IRQHandler
|
||||||
virtual bool handle_irq(RegisterState const&) override;
|
virtual bool handle_irq(RegisterState const&) override;
|
||||||
|
|
||||||
Controller& m_controller;
|
Controller& m_controller;
|
||||||
|
|
|
@ -23,7 +23,7 @@ void AHCIInterruptHandler::allocate_resources_and_initialize_ports()
|
||||||
}
|
}
|
||||||
|
|
||||||
UNMAP_AFTER_INIT AHCIInterruptHandler::AHCIInterruptHandler(AHCIController& controller, u8 irq, AHCI::MaskedBitField taken_ports)
|
UNMAP_AFTER_INIT AHCIInterruptHandler::AHCIInterruptHandler(AHCIController& controller, u8 irq, AHCI::MaskedBitField taken_ports)
|
||||||
: PCIIRQHandler(controller, irq)
|
: PCI::IRQHandler(controller, irq)
|
||||||
, m_parent_controller(controller)
|
, m_parent_controller(controller)
|
||||||
, m_taken_ports(taken_ports)
|
, m_taken_ports(taken_ports)
|
||||||
, m_pending_ports_interrupts(create_pending_ports_interrupts_bitfield())
|
, m_pending_ports_interrupts(create_pending_ports_interrupts_bitfield())
|
||||||
|
|
|
@ -25,7 +25,7 @@ class AsyncBlockDeviceRequest;
|
||||||
|
|
||||||
class AHCIController;
|
class AHCIController;
|
||||||
class AHCIPort;
|
class AHCIPort;
|
||||||
class AHCIInterruptHandler final : public PCIIRQHandler {
|
class AHCIInterruptHandler final : public PCI::IRQHandler {
|
||||||
friend class AHCIController;
|
friend class AHCIController;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -20,7 +20,7 @@ ErrorOr<NonnullLockRefPtr<NVMeInterruptQueue>> NVMeInterruptQueue::try_create(PC
|
||||||
|
|
||||||
UNMAP_AFTER_INIT NVMeInterruptQueue::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, Doorbell db_regs)
|
UNMAP_AFTER_INIT NVMeInterruptQueue::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, Doorbell db_regs)
|
||||||
: NVMeQueue(move(rw_dma_region), rw_dma_page, qid, q_depth, move(cq_dma_region), move(sq_dma_region), move(db_regs))
|
: NVMeQueue(move(rw_dma_region), rw_dma_page, qid, q_depth, move(cq_dma_region), move(sq_dma_region), move(db_regs))
|
||||||
, PCIIRQHandler(device, irq)
|
, PCI::IRQHandler(device, irq)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
namespace Kernel {
|
namespace Kernel {
|
||||||
|
|
||||||
class NVMeInterruptQueue : public NVMeQueue
|
class NVMeInterruptQueue : public NVMeQueue
|
||||||
, public PCIIRQHandler {
|
, public PCI::IRQHandler {
|
||||||
public:
|
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, Doorbell db_regs);
|
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, Doorbell db_regs);
|
||||||
void submit_sqe(NVMeSubmission& submission) override;
|
void submit_sqe(NVMeSubmission& submission) override;
|
||||||
|
|
|
@ -9,9 +9,9 @@
|
||||||
#include <Kernel/Debug.h>
|
#include <Kernel/Debug.h>
|
||||||
#include <Kernel/Interrupts/PCIIRQHandler.h>
|
#include <Kernel/Interrupts/PCIIRQHandler.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel::PCI {
|
||||||
|
|
||||||
PCIIRQHandler::PCIIRQHandler(PCI::Device& device, u8 irq)
|
IRQHandler::IRQHandler(PCI::Device& device, u8 irq)
|
||||||
: GenericInterruptHandler(irq)
|
: GenericInterruptHandler(irq)
|
||||||
, device(device)
|
, device(device)
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,7 @@ PCIIRQHandler::PCIIRQHandler(PCI::Device& device, u8 irq)
|
||||||
disable_irq();
|
disable_irq();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PCIIRQHandler::eoi()
|
bool IRQHandler::eoi()
|
||||||
{
|
{
|
||||||
dbgln_if(IRQ_DEBUG, "EOI IRQ {}", interrupt_number());
|
dbgln_if(IRQ_DEBUG, "EOI IRQ {}", interrupt_number());
|
||||||
if (m_shared_with_others)
|
if (m_shared_with_others)
|
||||||
|
@ -36,7 +36,7 @@ bool PCIIRQHandler::eoi()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PCIIRQHandler::enable_irq()
|
void IRQHandler::enable_irq()
|
||||||
{
|
{
|
||||||
dbgln_if(IRQ_DEBUG, "Enable IRQ {}", interrupt_number());
|
dbgln_if(IRQ_DEBUG, "Enable IRQ {}", interrupt_number());
|
||||||
if (!is_registered())
|
if (!is_registered())
|
||||||
|
@ -50,7 +50,7 @@ void PCIIRQHandler::enable_irq()
|
||||||
device.enable_interrupt(interrupt_number());
|
device.enable_interrupt(interrupt_number());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PCIIRQHandler::disable_irq()
|
void IRQHandler::disable_irq()
|
||||||
{
|
{
|
||||||
dbgln_if(IRQ_DEBUG, "Disable IRQ {}", interrupt_number());
|
dbgln_if(IRQ_DEBUG, "Disable IRQ {}", interrupt_number());
|
||||||
m_enabled = false;
|
m_enabled = false;
|
||||||
|
@ -63,7 +63,7 @@ void PCIIRQHandler::disable_irq()
|
||||||
device.disable_interrupt(interrupt_number());
|
device.disable_interrupt(interrupt_number());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PCIIRQHandler::handle_interrupt(RegisterState const& regs)
|
bool IRQHandler::handle_interrupt(RegisterState const& regs)
|
||||||
{
|
{
|
||||||
return handle_irq(regs);
|
return handle_irq(regs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,11 +12,11 @@
|
||||||
#include <Kernel/Interrupts/GenericInterruptHandler.h>
|
#include <Kernel/Interrupts/GenericInterruptHandler.h>
|
||||||
#include <Kernel/Library/LockRefPtr.h>
|
#include <Kernel/Library/LockRefPtr.h>
|
||||||
|
|
||||||
namespace Kernel {
|
namespace Kernel::PCI {
|
||||||
|
|
||||||
class PCIIRQHandler : public GenericInterruptHandler {
|
class IRQHandler : public GenericInterruptHandler {
|
||||||
public:
|
public:
|
||||||
virtual ~PCIIRQHandler() = default;
|
virtual ~IRQHandler() = default;
|
||||||
|
|
||||||
virtual bool handle_interrupt(RegisterState const& regs) override;
|
virtual bool handle_interrupt(RegisterState const& regs) override;
|
||||||
virtual bool handle_irq(RegisterState const&) = 0;
|
virtual bool handle_irq(RegisterState const&) = 0;
|
||||||
|
@ -35,7 +35,7 @@ public:
|
||||||
void set_shared_with_others(bool status) { m_shared_with_others = status; }
|
void set_shared_with_others(bool status) { m_shared_with_others = status; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PCIIRQHandler(PCI::Device& device, u8 irq);
|
IRQHandler(PCI::Device& device, u8 irq);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_shared_with_others { false };
|
bool m_shared_with_others { false };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue