浏览代码

Add documents on init_* functions

luojia65 2 年之前
父节点
当前提交
7015e7a11f
共有 8 个文件被更改,包括 7 次插入8 次删除
  1. 1 0
      CHANGELOG.md
  2. 0 2
      Cargo.toml
  3. 1 0
      src/hsm.rs
  4. 1 5
      src/ipi.rs
  5. 1 1
      src/lib.rs
  6. 1 0
      src/pmu.rs
  7. 1 0
      src/rfence.rs
  8. 1 0
      src/timer.rs

+ 1 - 0
CHANGELOG.md

@@ -9,6 +9,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
 
 ### Added
 - Feature `legacy` to gate SBI legacy extension
+- Expose `init_*` functions on instance based RustSBI implementation
 
 ### Modified
 - Remove dependency on crate alloc; RustSBI now works without heap

+ 0 - 2
Cargo.toml

@@ -23,8 +23,6 @@ sbi-spec = "0.0.1"
 default = []
 # Support legacy extension; this feature is not included by default.
 legacy = []
-# Dynamic pointer widths on SBI implementations; useful for developing hypervisors
-guest = []
 
 [package.metadata.docs.rs]
 default-target = "riscv64imac-unknown-none-elf"

+ 1 - 0
src/hsm.rs

@@ -194,6 +194,7 @@ use crate::util::AmoOnceRef;
 
 static HSM: AmoOnceRef<dyn Hsm> = AmoOnceRef::new();
 
+/// Init HSM module
 pub fn init_hsm(hsm: &'static dyn Hsm) {
     if !HSM.try_call_once(hsm) {
         panic!("load sbi module when already loaded")

+ 1 - 5
src/ipi.rs

@@ -11,15 +11,11 @@ pub trait Ipi: Send + Sync {
     ///
     /// Should return error code `SBI_SUCCESS` if IPI was sent to all the targeted harts successfully.
     fn send_ipi_many(&self, hart_mask: HartMask) -> SbiRet;
-    #[doc(hidden)]
-    /// Get the maximum hart id available by this IPI support module
-    fn max_hart_id(&self) -> usize {
-        unimplemented!("remained for compatibility, should remove in 0.3.0")
-    }
 }
 
 static IPI: AmoOnceRef<dyn Ipi> = AmoOnceRef::new();
 
+/// Init IPI module
 pub fn init_ipi(ipi: &'static dyn Ipi) {
     if !IPI.try_call_once(ipi) {
         panic!("load sbi module when already loaded")

+ 1 - 1
src/lib.rs

@@ -214,7 +214,7 @@ const LOGO: &str = r"
 |  |\  \----.|  `--'  |.----)   |      |  |  .----)   |   |  |_)  ||  |
 | _| `._____| \______/ |_______/       |__|  |_______/    |______/ |__|";
 
-/// The rustsbi logo.
+/// The RustSBI logo with blank line at the beginning
 pub fn logo() -> &'static str {
     // rust raw text 无法在保持格式的情况下去除头上的换行
     // include_str("logo.txt") 会由于 vscode 的自动格式化在末尾多一个换行

+ 1 - 0
src/pmu.rs

@@ -200,6 +200,7 @@ use crate::util::AmoOnceRef;
 
 static PMU: AmoOnceRef<dyn Pmu> = AmoOnceRef::new();
 
+/// Init PMU module
 pub fn init_pmu(pmu: &'static dyn Pmu) {
     if !PMU.try_call_once(pmu) {
         panic!("load sbi module when already loaded")

+ 1 - 0
src/rfence.rs

@@ -139,6 +139,7 @@ use crate::util::AmoOnceRef;
 
 static RFENCE: AmoOnceRef<dyn Rfence> = AmoOnceRef::new();
 
+/// Init RFENCE module
 pub fn init_rfence(rfence: &'static dyn Rfence) {
     if !RFENCE.try_call_once(rfence) {
         panic!("load sbi module when already loaded")

+ 1 - 0
src/timer.rs

@@ -14,6 +14,7 @@ pub trait Timer: Send + Sync {
 
 static TIMER: AmoOnceRef<dyn Timer> = AmoOnceRef::new();
 
+/// Init TIMER module
 pub fn init_timer(timer: &'static dyn Timer) {
     if !TIMER.try_call_once(timer) {
         panic!("load sbi module when already loaded")