Browse Source

sbi-testing: small fixes

Signed-off-by: Zhouqi Jiang <[email protected]>
Zhouqi Jiang 1 year ago
parent
commit
bddbb123d7
3 changed files with 7 additions and 6 deletions
  1. 1 1
      sbi-testing/src/base.rs
  2. 4 4
      sbi-testing/src/hsm.rs
  3. 2 1
      sbi-testing/src/spi.rs

+ 1 - 1
sbi-testing/src/base.rs

@@ -8,7 +8,7 @@ use sbi_spec::base::impl_id;
 pub enum Case {
     /// Can't procceed test for base extension does not exist.
     NotExist,
-    /// Test begin
+    /// Test begin.
     Begin,
     /// Test process for getting SBI specification version.
     GetSbiSpecVersion(Version),

+ 4 - 4
sbi-testing/src/hsm.rs

@@ -1,7 +1,7 @@
 //! Hart state monitor extension test suite.
 
 use core::sync::atomic::{AtomicU32, Ordering};
-use sbi::SbiRet;
+use sbi::{HartMask, SbiRet};
 use sbi_spec::hsm::hart_state;
 
 /// Hart state monitor extension test cases.
@@ -9,7 +9,7 @@ use sbi_spec::hsm::hart_state;
 pub enum Case<'a> {
     /// Can't procceed test for Hart state monitor extension does not exist.
     NotExist,
-    /// Test begin
+    /// Test begin.
     Begin,
     /// Test failed for hart started before test begin.
     ///
@@ -202,7 +202,7 @@ fn test_batch(batch: &[usize], mut f: impl FnMut(Case)) -> bool {
     for hartid in &batch[1..] {
         mask |= 1 << (hartid - batch[0]);
     }
-    sbi::send_ipi(sbi_spec::binary::HartMask::from_mask_base(mask, batch[0]));
+    sbi::send_ipi(HartMask::from_mask_base(mask, batch[0]));
     // 测试可恢复休眠
     for (i, hartid) in batch.iter().copied().enumerate() {
         let item = unsafe { &mut STACK[i] };
@@ -221,7 +221,7 @@ fn test_batch(batch: &[usize], mut f: impl FnMut(Case)) -> bool {
         }
         f(Case::HartSuspendedRetentive(hartid));
         // 单独恢复
-        sbi::send_ipi(sbi_spec::binary::HartMask::from_mask_base(1, hartid));
+        sbi::send_ipi(HartMask::from_mask_base(1, hartid));
         // 等待关闭
         while sbi::hart_get_status(hartid) != STOPPED {
             core::hint::spin_loop();

+ 2 - 1
sbi-testing/src/spi.rs

@@ -6,6 +6,7 @@ use riscv::register::{
     scause::{self, Trap},
     sie,
 };
+use sbi::HartMask;
 
 /// Inter-processor Interrupt extension test cases.
 #[derive(Clone, Debug)]
@@ -30,7 +31,7 @@ pub fn test(hart_id: usize, mut f: impl FnMut(Case)) {
     }
 
     fn ipi(hart_id: usize) -> ! {
-        sbi::send_ipi(sbi_spec::binary::HartMask::from_mask_base(1 << hart_id, 0));
+        sbi::send_ipi(HartMask::from_mask_base(1 << hart_id, 0));
         // 必须立即触发中断,即使是一个指令的延迟,也会触发另一个异常
         unsafe { core::arch::asm!("unimp", options(noreturn, nomem)) };
     }