From f2362b2b789a6516e208c85a0c0124edf3d8b077 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sun, 2 Apr 2023 05:34:58 +0300 Subject: [PATCH] Kernel: ATA controller waits now before read/write until disk is ready Qemu used to freeze on disk writes but now it seems fine --- kernel/kernel/Storage/ATAController.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/kernel/Storage/ATAController.cpp b/kernel/kernel/Storage/ATAController.cpp index 240df780..b358045f 100644 --- a/kernel/kernel/Storage/ATAController.cpp +++ b/kernel/kernel/Storage/ATAController.cpp @@ -216,6 +216,7 @@ namespace Kernel if (lba < (1 << 28)) { // LBA28 + TRY(device->wait(false)); device->io_write(ATA_PORT_DRIVE_SELECT, 0xE0 | device->m_slave_bit | ((lba >> 24) & 0x0F)); device->io_write(ATA_PORT_SECTOR_COUNT, sector_count); device->io_write(ATA_PORT_LBA0, (uint8_t)(lba >> 0)); @@ -248,6 +249,7 @@ namespace Kernel if (lba < (1 << 28)) { // LBA28 + TRY(device->wait(false)); device->io_write(ATA_PORT_DRIVE_SELECT, 0xE0 | device->m_slave_bit | ((lba >> 24) & 0x0F)); device->io_write(ATA_PORT_SECTOR_COUNT, sector_count); device->io_write(ATA_PORT_LBA0, (uint8_t)(lba >> 0));