forked from Bananymous/banan-os
Kernel: ATA controller waits now before read/write until disk is ready
Qemu used to freeze on disk writes but now it seems fine
This commit is contained in:
parent
471ac80420
commit
f2362b2b78
|
@ -216,6 +216,7 @@ namespace Kernel
|
||||||
if (lba < (1 << 28))
|
if (lba < (1 << 28))
|
||||||
{
|
{
|
||||||
// LBA28
|
// 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_DRIVE_SELECT, 0xE0 | device->m_slave_bit | ((lba >> 24) & 0x0F));
|
||||||
device->io_write(ATA_PORT_SECTOR_COUNT, sector_count);
|
device->io_write(ATA_PORT_SECTOR_COUNT, sector_count);
|
||||||
device->io_write(ATA_PORT_LBA0, (uint8_t)(lba >> 0));
|
device->io_write(ATA_PORT_LBA0, (uint8_t)(lba >> 0));
|
||||||
|
@ -248,6 +249,7 @@ namespace Kernel
|
||||||
if (lba < (1 << 28))
|
if (lba < (1 << 28))
|
||||||
{
|
{
|
||||||
// LBA28
|
// 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_DRIVE_SELECT, 0xE0 | device->m_slave_bit | ((lba >> 24) & 0x0F));
|
||||||
device->io_write(ATA_PORT_SECTOR_COUNT, sector_count);
|
device->io_write(ATA_PORT_SECTOR_COUNT, sector_count);
|
||||||
device->io_write(ATA_PORT_LBA0, (uint8_t)(lba >> 0));
|
device->io_write(ATA_PORT_LBA0, (uint8_t)(lba >> 0));
|
||||||
|
|
Loading…
Reference in New Issue