diff --git a/src/drivers/atapi/mod.rs b/src/drivers/atapi/mod.rs index 6fc896c..590c24e 100644 --- a/src/drivers/atapi/mod.rs +++ b/src/drivers/atapi/mod.rs @@ -330,6 +330,8 @@ impl ATABus { // Wait command end (*INTERRUPT_FUTURE).await; println!("Command sent"); + + self.wait_command_end(); } fn wait_busy(&mut self) { @@ -360,6 +362,15 @@ impl ATABus { } } } + + fn wait_command_end(&mut self) { + let mut status = ATA_BSY; + while (status & ATA_BSY) != 0 && (status & ATA_DRQ) != 0 { + unsafe { + status = self.status.read(); + } + } + } }