summaryrefslogtreecommitdiff
path: root/Kernel/Storage/ATA/GenericIDE/BusMasterChannel.h
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2021-11-19 11:52:07 +0200
committerLinus Groh <mail@linusgroh.de>2022-07-19 11:07:34 +0100
commitc001e3f567bb9ceae8b49476ee72a7e5a4b9f37a (patch)
tree08a30ce8838f76b65a209088cb5ecc3d385b5ab3 /Kernel/Storage/ATA/GenericIDE/BusMasterChannel.h
parenta70e1a0340e683f4e835a47dff843392e5028a4b (diff)
downloadserenity-c001e3f567bb9ceae8b49476ee72a7e5a4b9f37a.zip
Kernel/Storage: Move AHCI and IDE code into new subdirectories
We do that to increase clarity of the major and secondary components in the subsystem. To ensure it's even more understandable, we rename the files to better represent the class within them and to remove redundancy in the name. Also, some includes are removed from the general components of the ATA components' classes.
Diffstat (limited to 'Kernel/Storage/ATA/GenericIDE/BusMasterChannel.h')
-rw-r--r--Kernel/Storage/ATA/GenericIDE/BusMasterChannel.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/Kernel/Storage/ATA/GenericIDE/BusMasterChannel.h b/Kernel/Storage/ATA/GenericIDE/BusMasterChannel.h
new file mode 100644
index 0000000000..5757ab9aba
--- /dev/null
+++ b/Kernel/Storage/ATA/GenericIDE/BusMasterChannel.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2021, Liav A. <liavalb@hotmail.co.il>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/OwnPtr.h>
+#include <Kernel/Storage/ATA/GenericIDE/Channel.h>
+
+namespace Kernel {
+
+class AsyncBlockDeviceRequest;
+
+struct [[gnu::packed]] PhysicalRegionDescriptor {
+ u32 offset;
+ u16 size { 0 };
+ u16 end_of_table { 0 };
+};
+
+class IDEController;
+class BMIDEChannel final : public IDEChannel {
+ friend class IDEController;
+ friend class PATADiskDevice;
+
+public:
+ static NonnullRefPtr<BMIDEChannel> create(IDEController const&, IDEChannel::IOAddressGroup, IDEChannel::ChannelType type);
+ static NonnullRefPtr<BMIDEChannel> create(IDEController const&, u8 irq, IDEChannel::IOAddressGroup, IDEChannel::ChannelType type);
+ virtual ~BMIDEChannel() override {};
+
+ virtual bool is_dma_enabled() const override { return true; };
+
+private:
+ BMIDEChannel(IDEController const&, IDEChannel::IOAddressGroup, IDEChannel::ChannelType type);
+ BMIDEChannel(IDEController const&, u8 irq, IDEChannel::IOAddressGroup, IDEChannel::ChannelType type);
+ void initialize();
+
+ void complete_current_request(AsyncDeviceRequest::RequestResult);
+
+ //^ IRQHandler
+ virtual bool handle_irq(RegisterState const&) override;
+
+ //* IDEChannel
+ virtual void send_ata_io_command(LBAMode lba_mode, Direction direction) const override;
+ virtual void ata_read_sectors(bool, u16) override;
+ virtual void ata_write_sectors(bool, u16) override;
+
+ PhysicalRegionDescriptor& prdt() { return *reinterpret_cast<PhysicalRegionDescriptor*>(m_prdt_region->vaddr().as_ptr()); }
+ OwnPtr<Memory::Region> m_prdt_region;
+ OwnPtr<Memory::Region> m_dma_buffer_region;
+ RefPtr<Memory::PhysicalPage> m_prdt_page;
+ RefPtr<Memory::PhysicalPage> m_dma_buffer_page;
+};
+}