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

Kernel: Send IDE flush command after writing sectors.

This commit is contained in:
Andreas Kling 2019-04-23 03:16:47 +02:00
parent 11e7ce60e5
commit 37498c1566

View file

@ -19,6 +19,7 @@ enum IDECommand : byte {
IDENTIFY_DRIVE = 0xEC,
READ_SECTORS = 0x21,
WRITE_SECTORS = 0x30,
FLUSH_CACHE = 0xe7,
};
enum IDEStatus : byte {
@ -257,5 +258,11 @@ bool IDEDiskDevice::write_sectors(dword start_sector, word count, const byte* da
enable_irq();
wait_for_irq();
disable_irq();
IO::out8(IDE0_COMMAND, FLUSH_CACHE);
while (IO::in8(IDE0_STATUS) & BUSY);
enable_irq();
wait_for_irq();
return !m_device_error;
}