1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-24 22:17:42 +00:00

Kernel/Storage: Rename AHCIPortHandler => AHCIInterruptHandler

This reflects better what this object is all about - handling interrupts
of AHCI ports, and nothing more than that.
This commit is contained in:
Liav A 2022-04-01 23:48:46 +03:00 committed by Idan Horowitz
parent cc734c106e
commit bf82c4b81b
6 changed files with 23 additions and 23 deletions

View file

@ -97,8 +97,8 @@ set(KERNEL_SOURCES
Graphics/VirtIOGPU/GraphicsAdapter.cpp
SanCov.cpp
Storage/ATA/AHCIController.cpp
Storage/ATA/AHCIInterruptHandler.cpp
Storage/ATA/AHCIPort.cpp
Storage/ATA/AHCIPortHandler.cpp
Storage/ATA/ATADevice.cpp
Storage/ATA/ATADiskDevice.cpp
Storage/ATA/ATAPIDiscDevice.cpp

View file

@ -13,7 +13,7 @@
#include <Kernel/CommandLine.h>
#include <Kernel/Memory/MemoryManager.h>
#include <Kernel/Storage/ATA/AHCIController.h>
#include <Kernel/Storage/ATA/AHCIPortHandler.h>
#include <Kernel/Storage/ATA/AHCIInterruptHandler.h>
namespace Kernel {
@ -159,7 +159,7 @@ UNMAP_AFTER_INIT void AHCIController::initialize_hba(PCI::DeviceIdentifier const
enable_global_interrupts();
auto implemented_ports = AHCI::MaskedBitField((u32 volatile&)(hba().control_regs.pi));
m_irq_handler = AHCIPortHandler::create(*this, pci_device_identifier.interrupt_line().value(), implemented_ports).release_value_but_fixme_should_propagate_errors();
m_irq_handler = AHCIInterruptHandler::create(*this, pci_device_identifier.interrupt_line().value(), implemented_ports).release_value_but_fixme_should_propagate_errors();
// FIXME: Use the number of ports to determine how many pages we should allocate.
for (size_t index = 0; index < (((size_t)AHCI::Limits::MaxPorts * 512) / PAGE_SIZE); index++) {
@ -181,7 +181,7 @@ UNMAP_AFTER_INIT void AHCIController::initialize_hba(PCI::DeviceIdentifier const
}
}
void AHCIController::handle_interrupt_for_port(Badge<AHCIPortHandler>, u32 port_index) const
void AHCIController::handle_interrupt_for_port(Badge<AHCIInterruptHandler>, u32 port_index) const
{
auto port = m_ports[port_index];
VERIFY(port);

View file

@ -17,11 +17,11 @@
namespace Kernel {
class AsyncBlockDeviceRequest;
class AHCIPortHandler;
class AHCIInterruptHandler;
class AHCIPort;
class AHCIController final : public ATAController
, public PCI::Device {
friend class AHCIPortHandler;
friend class AHCIInterruptHandler;
public:
static NonnullRefPtr<AHCIController> initialize(PCI::DeviceIdentifier const& pci_device_identifier);
@ -35,7 +35,7 @@ public:
virtual void complete_current_request(AsyncDeviceRequest::RequestResult) override;
PhysicalAddress get_identify_metadata_physical_region(Badge<AHCIPort>, u32 port_index) const;
void handle_interrupt_for_port(Badge<AHCIPortHandler>, u32 port_index) const;
void handle_interrupt_for_port(Badge<AHCIInterruptHandler>, u32 port_index) const;
private:
void disable_global_interrupts() const;
@ -57,6 +57,6 @@ private:
AHCI::HBADefinedCapabilities m_hba_capabilities;
// FIXME: There could be multiple IRQ (MSI) handlers for AHCI. Find a way to use all of them.
OwnPtr<AHCIPortHandler> m_irq_handler;
OwnPtr<AHCIInterruptHandler> m_irq_handler;
};
}

View file

@ -4,25 +4,25 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <Kernel/Storage/ATA/AHCIPortHandler.h>
#include <Kernel/Storage/ATA/AHCIInterruptHandler.h>
namespace Kernel {
UNMAP_AFTER_INIT ErrorOr<NonnullOwnPtr<AHCIPortHandler>> AHCIPortHandler::create(AHCIController& controller, u8 irq, AHCI::MaskedBitField taken_ports)
UNMAP_AFTER_INIT ErrorOr<NonnullOwnPtr<AHCIInterruptHandler>> AHCIInterruptHandler::create(AHCIController& controller, u8 irq, AHCI::MaskedBitField taken_ports)
{
auto port_handler = TRY(adopt_nonnull_own_or_enomem(new (nothrow) AHCIPortHandler(controller, irq, taken_ports)));
auto port_handler = TRY(adopt_nonnull_own_or_enomem(new (nothrow) AHCIInterruptHandler(controller, irq, taken_ports)));
port_handler->allocate_resources_and_initialize_ports();
return port_handler;
}
void AHCIPortHandler::allocate_resources_and_initialize_ports()
void AHCIInterruptHandler::allocate_resources_and_initialize_ports()
{
// Clear pending interrupts, if there are any!
m_pending_ports_interrupts.set_all();
enable_irq();
}
UNMAP_AFTER_INIT AHCIPortHandler::AHCIPortHandler(AHCIController& controller, u8 irq, AHCI::MaskedBitField taken_ports)
UNMAP_AFTER_INIT AHCIInterruptHandler::AHCIInterruptHandler(AHCIController& controller, u8 irq, AHCI::MaskedBitField taken_ports)
: IRQHandler(irq)
, m_parent_controller(controller)
, m_taken_ports(taken_ports)
@ -31,14 +31,14 @@ UNMAP_AFTER_INIT AHCIPortHandler::AHCIPortHandler(AHCIController& controller, u8
dbgln_if(AHCI_DEBUG, "AHCI Port Handler: IRQ {}", irq);
}
AHCI::MaskedBitField AHCIPortHandler::create_pending_ports_interrupts_bitfield() const
AHCI::MaskedBitField AHCIInterruptHandler::create_pending_ports_interrupts_bitfield() const
{
return AHCI::MaskedBitField((u32 volatile&)m_parent_controller->hba().control_regs.is, m_taken_ports.bit_mask());
}
AHCIPortHandler::~AHCIPortHandler() = default;
AHCIInterruptHandler::~AHCIInterruptHandler() = default;
bool AHCIPortHandler::handle_irq(RegisterState const&)
bool AHCIInterruptHandler::handle_irq(RegisterState const&)
{
dbgln_if(AHCI_DEBUG, "AHCI Port Handler: IRQ received");
if (m_pending_ports_interrupts.is_zeroed())

View file

@ -26,19 +26,19 @@ class AsyncBlockDeviceRequest;
class AHCIController;
class AHCIPort;
class AHCIPortHandler final : public IRQHandler {
class AHCIInterruptHandler final : public IRQHandler {
friend class AHCIController;
public:
static ErrorOr<NonnullOwnPtr<AHCIPortHandler>> create(AHCIController&, u8 irq, AHCI::MaskedBitField taken_ports);
virtual ~AHCIPortHandler() override;
static ErrorOr<NonnullOwnPtr<AHCIInterruptHandler>> create(AHCIController&, u8 irq, AHCI::MaskedBitField taken_ports);
virtual ~AHCIInterruptHandler() override;
virtual StringView purpose() const override { return "SATA Port Handler"sv; }
virtual StringView purpose() const override { return "SATA IRQ Handler"sv; }
bool is_responsible_for_port_index(u32 port_index) const { return m_taken_ports.is_set_at(port_index); }
private:
AHCIPortHandler(AHCIController&, u8 irq, AHCI::MaskedBitField taken_ports);
AHCIInterruptHandler(AHCIController&, u8 irq, AHCI::MaskedBitField taken_ports);
void allocate_resources_and_initialize_ports();

View file

@ -21,7 +21,7 @@
#include <Kernel/Random.h>
#include <Kernel/Sections.h>
#include <Kernel/Storage/ATA/AHCI.h>
#include <Kernel/Storage/ATA/AHCIPortHandler.h>
#include <Kernel/Storage/ATA/AHCIInterruptHandler.h>
#include <Kernel/Storage/ATA/ATADevice.h>
#include <Kernel/WaitQueue.h>
@ -29,7 +29,7 @@ namespace Kernel {
class AsyncBlockDeviceRequest;
class AHCIPortHandler;
class AHCIInterruptHandler;
class AHCIPort
: public RefCounted<AHCIPort>
, public Weakable<AHCIPort> {