summaryrefslogtreecommitdiff
path: root/Kernel/Storage/AHCIPort.h
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2021-03-19 01:32:42 +0200
committerAndreas Kling <kling@serenityos.org>2021-03-21 13:41:09 +0100
commit0b1fa97b30fe3f8941a92ebded9f7bc12367b508 (patch)
treee713b040a9b50a490e2046ab417dbd0fb00a3b32 /Kernel/Storage/AHCIPort.h
parent21bb7fd5c92a7b4e22d346958c23cd6b7e46c94c (diff)
downloadserenity-0b1fa97b30fe3f8941a92ebded9f7bc12367b508.zip
Kernel/AHCI: Use interrupts for IO operations
Instead of polling if the device ended the operation, we can just use interrupts for signalling about end of IO operation. In similar way, we use interrupts during device detection. Also, we use the new Work Queue mechanism introduced by @tomuta to allow better performance and stability :)
Diffstat (limited to 'Kernel/Storage/AHCIPort.h')
-rw-r--r--Kernel/Storage/AHCIPort.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/Kernel/Storage/AHCIPort.h b/Kernel/Storage/AHCIPort.h
index 929e1640f7..42ed9b4464 100644
--- a/Kernel/Storage/AHCIPort.h
+++ b/Kernel/Storage/AHCIPort.h
@@ -34,6 +34,7 @@
#include <Kernel/Lock.h>
#include <Kernel/PhysicalAddress.h>
#include <Kernel/Random.h>
+#include <Kernel/SpinLock.h>
#include <Kernel/Storage/AHCI.h>
#include <Kernel/Storage/AHCIPortHandler.h>
#include <Kernel/Storage/StorageDevice.h>
@@ -83,7 +84,7 @@ public:
private:
bool is_phy_enabled() const { return (m_port_registers.ssts & 0xf) == 3; }
- bool initialize();
+ bool initialize(ScopedSpinLock<SpinLock<u8>>&);
UNMAP_AFTER_INIT AHCIPort(const AHCIPortHandler&, volatile AHCI::PortRegisters&, u32 port_index);
@@ -94,7 +95,7 @@ private:
const char* try_disambiguate_sata_status();
void try_disambiguate_sata_error();
- bool initiate_sata_reset();
+ bool initiate_sata_reset(ScopedSpinLock<SpinLock<u8>>&);
void rebase();
void recover_from_fatal_error();
bool shutdown();
@@ -111,7 +112,7 @@ private:
bool spin_until_ready() const;
- bool identify_device();
+ bool identify_device(ScopedSpinLock<SpinLock<u8>>&);
ALWAYS_INLINE void start_command_list_processing() const;
ALWAYS_INLINE void mark_command_header_ready_to_process(u8 command_header_index) const;
@@ -132,11 +133,12 @@ private:
// Data members
EntropySource m_entropy_source;
- AsyncBlockDeviceRequest* m_current_request { nullptr };
- u32 m_current_request_block_index { 0 };
- bool m_current_request_uses_dma { false };
- bool m_current_request_flushing_cache { false };
- SpinLock<u8> m_lock;
+ RefPtr<AsyncBlockDeviceRequest> m_current_request;
+ SpinLock<u8> m_hard_lock;
+ Lock m_lock { "AHCIPort" };
+
+ mutable bool m_wait_for_completion { false };
+ bool m_wait_connect_for_completion { false };
NonnullRefPtrVector<PhysicalPage> m_dma_buffers;
NonnullRefPtrVector<PhysicalPage> m_command_table_pages;