Kaynağa Gözat

feat: add some config flags with bitflags in chapter 11

Grassedge 5 ay önce
ebeveyn
işleme
e535c28e35
3 değiştirilmiş dosya ile 19 ekleme ve 17 silme
  1. 2 0
      sbi-spec/CHANGELOG.md
  2. 12 12
      sbi-spec/src/lib.rs
  3. 5 5
      sbi-spec/src/pmu.rs

+ 2 - 0
sbi-spec/CHANGELOG.md

@@ -7,10 +7,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
 ## [Unreleased]
 
 ### Added
+- Add config flags with bitflags in chapter 11
 
 ### Modified
 
 ### Fixed
+- Add missing impl_id: Xen: 7 and PolarFire: 8 in chapter4
 
 ## [0.0.7] - 2024-02-05
 

+ 12 - 12
sbi-spec/src/lib.rs

@@ -249,18 +249,18 @@ mod tests {
         const_assert_eq!(20, firmware_event::HFENCE_VVMA_ASID_SENT);
         const_assert_eq!(21, firmware_event::HFENCE_VVMA_ASID_RECEIVED);
         const_assert_eq!(65535, firmware_event::PLATFORM);
-        const_assert_eq!(1, counter_related::CounterCfgFlags::SKIP_MATCH.bits());
-        const_assert_eq!(2, counter_related::CounterCfgFlags::CLEAR_VALUE.bits());
-        const_assert_eq!(4, counter_related::CounterCfgFlags::AUTO_START.bits());
-        const_assert_eq!(8, counter_related::CounterCfgFlags::SET_VUINH.bits());
-        const_assert_eq!(16, counter_related::CounterCfgFlags::SET_VSINH.bits());
-        const_assert_eq!(32, counter_related::CounterCfgFlags::SET_UINH.bits());
-        const_assert_eq!(64, counter_related::CounterCfgFlags::SET_SINH.bits());
-        const_assert_eq!(128, counter_related::CounterCfgFlags::SET_MINH.bits());
-        const_assert_eq!(1, counter_related::CounterStartFlags::INIT_VALUE.bits());
-        const_assert_eq!(2, counter_related::CounterStartFlags::INIT_SNAPSHOT.bits());
-        const_assert_eq!(1, counter_related::CounterStopFlags::RESET.bits());
-        const_assert_eq!(2, counter_related::CounterStopFlags::TAKE_SNAPSHOT.bits());
+        const_assert_eq!(1, flags::CounterCfgFlags::SKIP_MATCH.bits());
+        const_assert_eq!(2, flags::CounterCfgFlags::CLEAR_VALUE.bits());
+        const_assert_eq!(4, flags::CounterCfgFlags::AUTO_START.bits());
+        const_assert_eq!(8, flags::CounterCfgFlags::SET_VUINH.bits());
+        const_assert_eq!(16, flags::CounterCfgFlags::SET_VSINH.bits());
+        const_assert_eq!(32, flags::CounterCfgFlags::SET_UINH.bits());
+        const_assert_eq!(64, flags::CounterCfgFlags::SET_SINH.bits());
+        const_assert_eq!(128, flags::CounterCfgFlags::SET_MINH.bits());
+        const_assert_eq!(1, flags::CounterStartFlags::INIT_VALUE.bits());
+        const_assert_eq!(2, flags::CounterStartFlags::INIT_SNAPSHOT.bits());
+        const_assert_eq!(1, flags::CounterStopFlags::RESET.bits());
+        const_assert_eq!(2, flags::CounterStopFlags::TAKE_SNAPSHOT.bits());
     }
     // §12
     #[test]

+ 5 - 5
sbi-spec/src/pmu.rs

@@ -190,14 +190,14 @@ pub mod firmware_event {
 /// Start a set of counters.
 /// Stop a set of counters.
 ///  
-/// Declared in §11.7 §11.8 §11.9.
-pub mod counter_related {
+/// Declared in §11.7, §11.8 and §11.9.
+pub mod flags {
     use bitflags::bitflags;
 
     bitflags! {
         #[derive(Clone, Copy, PartialEq, Eq)]
         /// Declared in Table 36.
-        pub struct CounterCfgFlags: usize{
+        pub struct CounterCfgFlags: usize {
             /// Skip the counter matching.
             const SKIP_MATCH = 1 << 0;
             /// Clear (or zero) the counter value in counter configuration.
@@ -220,7 +220,7 @@ pub mod counter_related {
     bitflags! {
         #[derive(Clone, Copy, PartialEq, Eq)]
         /// Declared in Table 38
-        pub struct CounterStartFlags: usize{
+        pub struct CounterStartFlags: usize {
             /// Set the value of counters based on the initial_value parameter.
             const INIT_VALUE = 1 << 0;
             /// Initialize the given counters from shared memory if available.
@@ -231,7 +231,7 @@ pub mod counter_related {
     bitflags! {
         #[derive(Clone, Copy, PartialEq, Eq)]
         /// Declared in Table 40.
-        pub struct CounterStopFlags: usize{
+        pub struct CounterStopFlags: usize {
             /// Reset the counter to event mapping.
             const RESET = 1 << 0;
             /// Save a snapshot of the given counter’s values in the shared memory if available.