1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:57:45 +00:00

Kernel: Update PATAChannel class to use the PCI::Device class

PATAChannel class will inherit from the PCI::Device class, thus,
can still implement IRQ handling.
This commit is contained in:
Liav A 2020-02-22 20:08:20 +02:00 committed by Andreas Kling
parent 12dbb7ca49
commit 83aa868c17

View file

@ -38,9 +38,9 @@
#include <AK/OwnPtr.h> #include <AK/OwnPtr.h>
#include <AK/RefPtr.h> #include <AK/RefPtr.h>
#include <Kernel/IRQHandler.h>
#include <Kernel/Lock.h> #include <Kernel/Lock.h>
#include <Kernel/PCI/Access.h> #include <Kernel/PCI/Access.h>
#include <Kernel/PCI/Device.h>
#include <Kernel/VM/PhysicalPage.h> #include <Kernel/VM/PhysicalPage.h>
#include <Kernel/WaitQueue.h> #include <Kernel/WaitQueue.h>
#include <LibBareMetal/Memory/PhysicalAddress.h> #include <LibBareMetal/Memory/PhysicalAddress.h>
@ -54,7 +54,7 @@ struct PhysicalRegionDescriptor {
}; };
class PATADiskDevice; class PATADiskDevice;
class PATAChannel final : public IRQHandler { class PATAChannel final : public PCI::Device {
friend class PATADiskDevice; friend class PATADiskDevice;
AK_MAKE_ETERNAL AK_MAKE_ETERNAL
public: public:
@ -65,7 +65,7 @@ public:
public: public:
static OwnPtr<PATAChannel> create(ChannelType type, bool force_pio); static OwnPtr<PATAChannel> create(ChannelType type, bool force_pio);
PATAChannel(ChannelType type, bool force_pio); PATAChannel(PCI::Address address, ChannelType type, bool force_pio);
virtual ~PATAChannel() override; virtual ~PATAChannel() override;
RefPtr<PATADiskDevice> master_device() { return m_master; }; RefPtr<PATADiskDevice> master_device() { return m_master; };
@ -73,7 +73,7 @@ public:
private: private:
//^ IRQHandler //^ IRQHandler
virtual void handle_irq() override; virtual void handle_irq(RegisterState&) override;
void initialize(bool force_pio); void initialize(bool force_pio);
void detect_disks(); void detect_disks();
@ -92,7 +92,6 @@ private:
WaitQueue m_irq_queue; WaitQueue m_irq_queue;
PCI::Address m_pci_address;
PhysicalRegionDescriptor& prdt() { return *reinterpret_cast<PhysicalRegionDescriptor*>(m_prdt_page->paddr().offset(0xc0000000).as_ptr()); } PhysicalRegionDescriptor& prdt() { return *reinterpret_cast<PhysicalRegionDescriptor*>(m_prdt_page->paddr().offset(0xc0000000).as_ptr()); }
RefPtr<PhysicalPage> m_prdt_page; RefPtr<PhysicalPage> m_prdt_page;
RefPtr<PhysicalPage> m_dma_buffer_page; RefPtr<PhysicalPage> m_dma_buffer_page;
@ -102,5 +101,4 @@ private:
RefPtr<PATADiskDevice> m_master; RefPtr<PATADiskDevice> m_master;
RefPtr<PATADiskDevice> m_slave; RefPtr<PATADiskDevice> m_slave;
}; };
} }