mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:48:12 +00:00

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.
55 lines
1.8 KiB
C++
55 lines
1.8 KiB
C++
/*
|
|
* 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;
|
|
};
|
|
}
|