1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:07:35 +00:00

Kernel: Use a WaitQueue in PATAChannel

Instead of waking up repeatedly to check if a disk operation has
finished, use a WaitQueue and wake it up in the IRQ handler.

This simplifies the device driver a bit, and makes it more responsive
as well :^)
This commit is contained in:
Andreas Kling 2019-12-01 12:47:53 +01:00
parent 9ed272ce98
commit 8b129476b1
3 changed files with 17 additions and 40 deletions

View file

@ -17,6 +17,7 @@
#include <Kernel/PCI.h>
#include <Kernel/VM/PhysicalAddress.h>
#include <Kernel/VM/PhysicalPage.h>
#include <Kernel/WaitQueue.h>
struct PhysicalRegionDescriptor {
PhysicalAddress offset;
@ -49,7 +50,7 @@ private:
void initialize(bool force_pio);
void detect_disks();
bool wait_for_irq();
void wait_for_irq();
bool ata_read_sectors_with_dma(u32, u16, u8*, bool);
bool ata_write_sectors_with_dma(u32, u16, const u8*, bool);
bool ata_read_sectors(u32, u16, u8*, bool);
@ -60,7 +61,8 @@ private:
u16 m_io_base { 0x1F0 };
u16 m_control_base { 0 };
volatile u8 m_device_error { 0 };
volatile bool m_interrupted { false };
WaitQueue m_irq_queue;
PCI::Address m_pci_address;
PhysicalRegionDescriptor m_prdt;