Browse Source

crate: update sbi-spec to 0.0.4

luojia65 2 years ago
parent
commit
9fbc8c8345
6 changed files with 7 additions and 8 deletions
  1. 1 1
      CHANGELOG.md
  2. 2 2
      Cargo.toml
  3. 1 1
      src/ecall/base.rs
  4. 2 2
      src/ecall/time.rs
  5. 0 1
      src/hsm.rs
  6. 1 1
      src/pmu.rs

+ 1 - 1
CHANGELOG.md

@@ -16,7 +16,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 ### Modified
 
 - Probe function now returns if legacy extensions are available
-- Update to `riscv` crate 0.9.0, sbi-spec crate version 0.0.3
+- Update to `riscv` crate 0.9.0, sbi-spec crate version 0.0.4
 - Rename `send_ipi_many` to `send_ipi`
 
 ### Removed

+ 2 - 2
Cargo.toml

@@ -17,12 +17,12 @@ edition = "2021"
 
 [dependencies]
 riscv = "0.9.0"
-sbi-spec = "0.0.3"
+sbi-spec = "0.0.4"
 
 [features]
 default = []
 # Support legacy extension; this feature is not included by default.
-legacy = []
+legacy = ["sbi-spec/legacy"]
 
 [package.metadata.docs.rs]
 default-target = "riscv64imac-unknown-none-elf"

+ 1 - 1
src/ecall/base.rs

@@ -23,5 +23,5 @@ pub(super) fn handle_ecall(function: usize, param0: usize) -> SbiRet {
         GET_MIMPID => mimpid::read().map(|r| r.bits()).unwrap_or(0),
         _ => return SbiRet::not_supported(),
     };
-    SbiRet::ok(value)
+    SbiRet::success(value)
 }

+ 2 - 2
src/ecall/time.rs

@@ -8,7 +8,7 @@ pub(super) fn handle_ecall(function: usize, param0: usize) -> SbiRet {
     match function {
         SET_TIMER => {
             if set_timer(param0 as _) {
-                SbiRet::ok(0)
+                SbiRet::success(0)
             } else {
                 SbiRet::not_supported()
             }
@@ -26,7 +26,7 @@ pub(super) fn handle_ecall_timer(function: usize, param0: usize, param1: usize)
     match function {
         SET_TIMER => {
             if set_timer(concat_u32(a1, a0)) {
-                SbiRet::ok(0)
+                SbiRet::success(0)
             } else {
                 SbiRet::not_supported()
             }

+ 0 - 1
src/hsm.rs

@@ -233,7 +233,6 @@ pub(crate) fn hart_get_status(hartid: usize) -> SbiRet {
 #[inline]
 pub(crate) fn hart_suspend(suspend_type: u32, resume_addr: usize, opaque: usize) -> SbiRet {
     if let Some(obj) = HSM.get() {
-        let suspend_type = suspend_type as u32;
         return obj.hart_suspend(suspend_type, resume_addr, opaque);
     }
     SbiRet::not_supported()

+ 1 - 1
src/pmu.rs

@@ -217,7 +217,7 @@ pub(crate) fn num_counters() -> SbiRet {
     if let Some(obj) = PMU.get() {
         // Returns the number of counters (both hardware and firmware) in sbiret.value
         // and always returns SBI_SUCCESS in sbiret.error.
-        return SbiRet::ok(obj.num_counters());
+        return SbiRet::success(obj.num_counters());
     }
     SbiRet::not_supported()
 }