ide: yield instead of spin

This commit is contained in:
Jeremy Soller
2022-12-02 10:45:11 -07:00
parent 5874776304
commit 970cfd2862
+2 -13
View File
@@ -1,6 +1,7 @@
use std::{
convert::TryInto,
sync::{Arc, Mutex},
thread,
};
use syscall::{
error::{Error, Result, EIO},
@@ -9,18 +10,6 @@ use syscall::{
use crate::ata::AtaCommand;
#[cfg(target_arch = "aarch64")]
#[inline(always)]
pub(crate) unsafe fn pause() { std::arch::aarch64::__yield(); }
#[cfg(target_arch = "x86")]
#[inline(always)]
pub(crate) unsafe fn pause() { std::arch::x86::_mm_pause(); }
#[cfg(target_arch = "x86_64")]
#[inline(always)]
pub(crate) unsafe fn pause() { std::arch::x86_64::_mm_pause(); }
#[repr(packed)]
struct PrdtEntry {
phys: u32,
@@ -129,7 +118,7 @@ impl Channel {
loop {
let status = self.check_status()?;
if status & 0x80 != 0 {
unsafe { pause(); }
thread::yield_now();
} else {
if read && status & 0x08 == 0 {
log::error!("IDE data not ready");