summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2022-04-01 20:52:37 +0300
committerIdan Horowitz <idan.horowitz@gmail.com>2022-07-08 01:06:47 +0300
commit9416dede547b536948b84de2c06bf0beaa772ce5 (patch)
tree210080aa16e8127c000c639d98306f391db493d2
parentd771ca327865e74bd563adbcde830dbc6a501a69 (diff)
downloadserenity-9416dede547b536948b84de2c06bf0beaa772ce5.zip
Kernel/AHCI: Don't use UNMAP_AFTER_INIT in header files
Instead, declare such methods and functions in the code itself.
-rw-r--r--Kernel/Storage/ATA/AHCIController.cpp8
-rw-r--r--Kernel/Storage/ATA/AHCIController.h8
-rw-r--r--Kernel/Storage/ATA/AHCIPort.cpp6
-rw-r--r--Kernel/Storage/ATA/AHCIPort.h6
-rw-r--r--Kernel/Storage/ATA/AHCIPortHandler.cpp4
-rw-r--r--Kernel/Storage/ATA/AHCIPortHandler.h4
6 files changed, 18 insertions, 18 deletions
diff --git a/Kernel/Storage/ATA/AHCIController.cpp b/Kernel/Storage/ATA/AHCIController.cpp
index 8ce6d1a8b9..b377ad5c70 100644
--- a/Kernel/Storage/ATA/AHCIController.cpp
+++ b/Kernel/Storage/ATA/AHCIController.cpp
@@ -16,7 +16,7 @@
namespace Kernel {
-NonnullRefPtr<AHCIController> AHCIController::initialize(PCI::DeviceIdentifier const& pci_device_identifier)
+UNMAP_AFTER_INIT NonnullRefPtr<AHCIController> AHCIController::initialize(PCI::DeviceIdentifier const& pci_device_identifier)
{
auto controller = adopt_ref_if_nonnull(new (nothrow) AHCIController(pci_device_identifier)).release_nonnull();
controller->initialize_hba(pci_device_identifier);
@@ -86,7 +86,7 @@ volatile AHCI::HBA& AHCIController::hba() const
return static_cast<volatile AHCI::HBA&>(*(volatile AHCI::HBA*)(m_hba_region->vaddr().as_ptr()));
}
-AHCIController::AHCIController(PCI::DeviceIdentifier const& pci_device_identifier)
+UNMAP_AFTER_INIT AHCIController::AHCIController(PCI::DeviceIdentifier const& pci_device_identifier)
: ATAController()
, PCI::Device(pci_device_identifier.address())
, m_hba_region(default_hba_region())
@@ -131,14 +131,14 @@ AHCI::HBADefinedCapabilities AHCIController::capabilities() const
};
}
-NonnullOwnPtr<Memory::Region> AHCIController::default_hba_region() const
+UNMAP_AFTER_INIT NonnullOwnPtr<Memory::Region> AHCIController::default_hba_region() const
{
return MM.allocate_kernel_region(PhysicalAddress(PCI::get_BAR5(pci_address())).page_base(), Memory::page_round_up(sizeof(AHCI::HBA)).release_value_but_fixme_should_propagate_errors(), "AHCI HBA", Memory::Region::Access::ReadWrite).release_value();
}
AHCIController::~AHCIController() = default;
-void AHCIController::initialize_hba(PCI::DeviceIdentifier const& pci_device_identifier)
+UNMAP_AFTER_INIT void AHCIController::initialize_hba(PCI::DeviceIdentifier const& pci_device_identifier)
{
if (!reset()) {
dmesgln("{}: AHCI controller reset failed", pci_address());
diff --git a/Kernel/Storage/ATA/AHCIController.h b/Kernel/Storage/ATA/AHCIController.h
index 687a61537b..765b97c5a6 100644
--- a/Kernel/Storage/ATA/AHCIController.h
+++ b/Kernel/Storage/ATA/AHCIController.h
@@ -25,7 +25,7 @@ class AHCIController final : public ATAController
friend class AHCIPort;
public:
- UNMAP_AFTER_INIT static NonnullRefPtr<AHCIController> initialize(PCI::DeviceIdentifier const& pci_device_identifier);
+ static NonnullRefPtr<AHCIController> initialize(PCI::DeviceIdentifier const& pci_device_identifier);
virtual ~AHCIController() override;
virtual RefPtr<StorageDevice> device(u32 index) const override;
@@ -41,14 +41,14 @@ private:
void disable_global_interrupts() const;
void enable_global_interrupts() const;
- UNMAP_AFTER_INIT explicit AHCIController(PCI::DeviceIdentifier const&);
- UNMAP_AFTER_INIT void initialize_hba(PCI::DeviceIdentifier const&);
+ explicit AHCIController(PCI::DeviceIdentifier const&);
+ void initialize_hba(PCI::DeviceIdentifier const&);
AHCI::HBADefinedCapabilities capabilities() const;
RefPtr<StorageDevice> device_by_port(u32 index) const;
volatile AHCI::PortRegisters& port(size_t port_number) const;
- UNMAP_AFTER_INIT NonnullOwnPtr<Memory::Region> default_hba_region() const;
+ NonnullOwnPtr<Memory::Region> default_hba_region() const;
volatile AHCI::HBA& hba() const;
NonnullOwnPtr<Memory::Region> m_hba_region;
diff --git a/Kernel/Storage/ATA/AHCIPort.cpp b/Kernel/Storage/ATA/AHCIPort.cpp
index 7e4add1fd2..6eb5d74b8f 100644
--- a/Kernel/Storage/ATA/AHCIPort.cpp
+++ b/Kernel/Storage/ATA/AHCIPort.cpp
@@ -20,7 +20,7 @@
namespace Kernel {
-ErrorOr<NonnullRefPtr<AHCIPort>> AHCIPort::create(AHCIPortHandler const& handler, volatile AHCI::PortRegisters& registers, u32 port_index)
+UNMAP_AFTER_INIT ErrorOr<NonnullRefPtr<AHCIPort>> AHCIPort::create(AHCIPortHandler const& handler, volatile AHCI::PortRegisters& registers, u32 port_index)
{
auto port = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) AHCIPort(handler, registers, port_index)));
TRY(port->allocate_resources_and_initialize_ports());
@@ -53,7 +53,7 @@ ErrorOr<void> AHCIPort::allocate_resources_and_initialize_ports()
return {};
}
-AHCIPort::AHCIPort(AHCIPortHandler const& handler, volatile AHCI::PortRegisters& registers, u32 port_index)
+UNMAP_AFTER_INIT AHCIPort::AHCIPort(AHCIPortHandler const& handler, volatile AHCI::PortRegisters& registers, u32 port_index)
: m_port_index(port_index)
, m_port_registers(registers)
, m_parent_handler(handler)
@@ -282,7 +282,7 @@ bool AHCIPort::reset()
return initialize();
}
-bool AHCIPort::initialize_without_reset()
+UNMAP_AFTER_INIT bool AHCIPort::initialize_without_reset()
{
MutexLocker locker(m_lock);
SpinlockLocker lock(m_hard_lock);
diff --git a/Kernel/Storage/ATA/AHCIPort.h b/Kernel/Storage/ATA/AHCIPort.h
index 90ab7f0b68..70cc1d1f45 100644
--- a/Kernel/Storage/ATA/AHCIPort.h
+++ b/Kernel/Storage/ATA/AHCIPort.h
@@ -37,7 +37,7 @@ class AHCIPort
friend class AHCIController;
public:
- UNMAP_AFTER_INIT static ErrorOr<NonnullRefPtr<AHCIPort>> create(AHCIPortHandler const&, volatile AHCI::PortRegisters&, u32 port_index);
+ static ErrorOr<NonnullRefPtr<AHCIPort>> create(AHCIPortHandler const&, volatile AHCI::PortRegisters&, u32 port_index);
u32 port_index() const { return m_port_index; }
u32 representative_port_index() const { return port_index() + 1; }
@@ -47,7 +47,7 @@ public:
RefPtr<StorageDevice> connected_device() const { return m_connected_device; }
bool reset();
- UNMAP_AFTER_INIT bool initialize_without_reset();
+ bool initialize_without_reset();
void handle_interrupt();
private:
@@ -56,7 +56,7 @@ private:
bool is_phy_enabled() const { return (m_port_registers.ssts & 0xf) == 3; }
bool initialize();
- UNMAP_AFTER_INIT AHCIPort(AHCIPortHandler const&, volatile AHCI::PortRegisters&, u32 port_index);
+ AHCIPort(AHCIPortHandler const&, volatile AHCI::PortRegisters&, u32 port_index);
ALWAYS_INLINE void clear_sata_error_register() const;
diff --git a/Kernel/Storage/ATA/AHCIPortHandler.cpp b/Kernel/Storage/ATA/AHCIPortHandler.cpp
index 78ab3042df..d9a639fcca 100644
--- a/Kernel/Storage/ATA/AHCIPortHandler.cpp
+++ b/Kernel/Storage/ATA/AHCIPortHandler.cpp
@@ -9,7 +9,7 @@
namespace Kernel {
-ErrorOr<NonnullRefPtr<AHCIPortHandler>> AHCIPortHandler::create(AHCIController& controller, u8 irq, AHCI::MaskedBitField taken_ports)
+UNMAP_AFTER_INIT ErrorOr<NonnullRefPtr<AHCIPortHandler>> AHCIPortHandler::create(AHCIController& controller, u8 irq, AHCI::MaskedBitField taken_ports)
{
auto port_handler = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) AHCIPortHandler(controller, irq, taken_ports)));
// FIXME: Propagate errors from this method too.
@@ -43,7 +43,7 @@ void AHCIPortHandler::allocate_resources_and_initialize_ports()
}
}
-AHCIPortHandler::AHCIPortHandler(AHCIController& controller, u8 irq, AHCI::MaskedBitField taken_ports)
+UNMAP_AFTER_INIT AHCIPortHandler::AHCIPortHandler(AHCIController& controller, u8 irq, AHCI::MaskedBitField taken_ports)
: IRQHandler(irq)
, m_parent_controller(controller)
, m_taken_ports(taken_ports)
diff --git a/Kernel/Storage/ATA/AHCIPortHandler.h b/Kernel/Storage/ATA/AHCIPortHandler.h
index 30e69bf82b..c95047fb71 100644
--- a/Kernel/Storage/ATA/AHCIPortHandler.h
+++ b/Kernel/Storage/ATA/AHCIPortHandler.h
@@ -31,7 +31,7 @@ class AHCIPortHandler final : public RefCounted<AHCIPortHandler>
friend class AHCIController;
public:
- UNMAP_AFTER_INIT static ErrorOr<NonnullRefPtr<AHCIPortHandler>> create(AHCIController&, u8 irq, AHCI::MaskedBitField taken_ports);
+ static ErrorOr<NonnullRefPtr<AHCIPortHandler>> create(AHCIController&, u8 irq, AHCI::MaskedBitField taken_ports);
virtual ~AHCIPortHandler() override;
RefPtr<StorageDevice> device_at_port(size_t port_index) const;
@@ -44,7 +44,7 @@ public:
bool is_responsible_for_port_index(u32 port_index) const { return m_taken_ports.is_set_at(port_index); }
private:
- UNMAP_AFTER_INIT AHCIPortHandler(AHCIController&, u8 irq, AHCI::MaskedBitField taken_ports);
+ AHCIPortHandler(AHCIController&, u8 irq, AHCI::MaskedBitField taken_ports);
void allocate_resources_and_initialize_ports();