From e84a2e57273f2c972eb9a51b84e942cdda1309b7 Mon Sep 17 00:00:00 2001 From: Julien CLEMENT Date: Fri, 16 Dec 2022 21:12:28 +0100 Subject: [PATCH] Remove second await in read block because it somehow works now Signed-off-by: Julien CLEMENT --- src/drivers/atapi/interrupt.rs | 1 + src/drivers/atapi/mod.rs | 11 +++-------- src/interrupts/pic/disk.rs | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/drivers/atapi/interrupt.rs b/src/drivers/atapi/interrupt.rs index d2ab98d..3c8768d 100644 --- a/src/drivers/atapi/interrupt.rs +++ b/src/drivers/atapi/interrupt.rs @@ -1,3 +1,4 @@ +use crate::println; use core::future::Future; use core::pin::Pin; diff --git a/src/drivers/atapi/mod.rs b/src/drivers/atapi/mod.rs index 7708c3c..e3ff635 100644 --- a/src/drivers/atapi/mod.rs +++ b/src/drivers/atapi/mod.rs @@ -245,6 +245,7 @@ impl ATABus { complete = self.sector_count.read(); } } + self.wait_command_end(); } pub async fn read_block(&mut self, lba: u32) { @@ -256,13 +257,9 @@ impl ATABus { self.send_packet(packet); - println!("Waiting packet send"); - // Wait packet is transmitted (*INTERRUPT_FUTURE).await; - println!("Packet sent"); - let mut _size: usize = 0; unsafe { _size = ((self.address3.read() as usize) << 8) | self.address2.read() as usize; @@ -276,10 +273,8 @@ impl ATABus { } } - println!("Waiting command send"); // Wait command end - (*INTERRUPT_FUTURE).await; - println!("Command sent"); + //(*INTERRUPT_FUTURE).await; self.wait_command_end(); } @@ -325,6 +320,6 @@ impl ATABus { pub async fn print_block() { - DRIVE.lock().as_mut().unwrap().read_block(0).await; + DRIVE.lock().as_mut().unwrap().read_block(500).await; serial_println!("{:x?}", DRIVE.lock().as_mut().unwrap().block); } \ No newline at end of file diff --git a/src/interrupts/pic/disk.rs b/src/interrupts/pic/disk.rs index 405a5cf..f2d91dc 100644 --- a/src/interrupts/pic/disk.rs +++ b/src/interrupts/pic/disk.rs @@ -5,7 +5,7 @@ use x86_64::structures::idt::InterruptStackFrame; fn disk_interrupt_handler(disk: u16) { crate::drivers::atapi::interrupt::mark_interrupt(); - println!("Received disk {} interrupt", disk); + // println!("Received disk {} interrupt", disk); } pub extern "x86-interrupt" fn disk1_interrupt_handler(_stack_frame: InterruptStackFrame) {