Kernel: Add small wait in ATA driver before reading/writing

This allows bochs to boot again
This commit is contained in:
Bananymous 2023-04-09 21:54:11 +03:00
parent 641ed23380
commit 32359df939
1 changed files with 4 additions and 0 deletions

View File

@ -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);