From 32359df93992324279139eb2c01e812ebde85bf9 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Sun, 9 Apr 2023 21:54:11 +0300 Subject: [PATCH] Kernel: Add small wait in ATA driver before reading/writing This allows bochs to boot again --- kernel/kernel/Storage/ATABus.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/kernel/Storage/ATABus.cpp b/kernel/kernel/Storage/ATABus.cpp index 268069b5..7557be31 100644 --- a/kernel/kernel/Storage/ATABus.cpp +++ b/kernel/kernel/Storage/ATABus.cpp @@ -265,6 +265,8 @@ namespace Kernel io_write(ATA_PORT_LBA2, (uint8_t)(lba >> 16)); io_write(ATA_PORT_COMMAND, ATA_COMMAND_READ_SECTORS); + PIT::sleep(1); + for (uint32_t sector = 0; sector < sector_count; sector++) { block_until_irq(); @@ -297,6 +299,8 @@ namespace Kernel io_write(ATA_PORT_LBA2, (uint8_t)(lba >> 16)); io_write(ATA_PORT_COMMAND, ATA_COMMAND_WRITE_SECTORS); + PIT::sleep(1); + for (uint32_t sector = 0; sector < sector_count; sector++) { write_buffer(ATA_PORT_DATA, (uint16_t*)buffer + sector * device->m_sector_words, device->m_sector_words);