hsm.rs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //! Chapter 9. Hart State Management Extension (EID #0x48534D "HSM").
  2. /// Extension ID for Hart State Management extension.
  3. pub const EID_HSM: usize = crate::eid_from_str("HSM") as _;
  4. pub use fid::*;
  5. /// Hart states.
  6. ///
  7. /// Declared in Table 1 at §9.
  8. pub mod hart_state {
  9. /// The hart is physically powered-up and executing normally.
  10. pub const STARTED: usize = 0;
  11. /// The hart is not executing in supervisor-mode or any lower privilege mode.
  12. ///
  13. /// It is probably powered-down by the SBI implementation if the underlying platform
  14. /// has a mechanism to physically power-down harts.
  15. pub const STOPPED: usize = 1;
  16. /// The hart is pending before being started
  17. ///
  18. /// Some other hart has requested to start (or power-up) the hart from the STOPPED state
  19. /// and the SBI implementation is still working to get the hart in the STARTED state.
  20. pub const START_PENDING: usize = 2;
  21. /// The hart is pending before being stopped.
  22. ///
  23. /// The hart has requested to stop (or power-down) itself from the STARTED state
  24. /// and the SBI implementation is still working to get the hart in the STOPPED state.
  25. pub const STOP_PENDING: usize = 3;
  26. /// The hart is in a platform specific suspend (or low power) state.
  27. pub const SUSPENDED: usize = 4;
  28. /// The hart is pending before being suspended.
  29. ///
  30. /// The hart has requested to put itself in a platform specific low power state
  31. /// from the STARTED state and the SBI implementation is still working to get
  32. /// the hart in the platform specific SUSPENDED state.
  33. pub const SUSPEND_PENDING: usize = 5;
  34. /// The hart is pending before being resumed.
  35. ///
  36. /// An interrupt or platform specific hardware event has caused the hart to resume
  37. /// normal execution from the SUSPENDED state and the SBI implementation is still
  38. /// working to get the hart in the STARTED state.
  39. pub const RESUME_PENDING: usize = 6;
  40. }
  41. /// Hart suspend types.
  42. pub mod suspend_type {
  43. /// Default retentive hart suspend type.
  44. pub const RETENTIVE: u32 = 0;
  45. /// Default non-retentive hart suspend type.
  46. pub const NON_RETENTIVE: u32 = 0x8000_0000;
  47. }
  48. /// Declared in §9.5.
  49. mod fid {
  50. /// Function ID to start executing the given hart at specified address in supervisor-mode.
  51. ///
  52. /// Declared in §9.1.
  53. pub const HART_START: usize = 0;
  54. /// Function ID to stop executing the calling hart in supervisor-mode.
  55. ///
  56. /// Declared in §9.2.
  57. pub const HART_STOP: usize = 1;
  58. /// Function ID to get the current status (or HSM state id) of the given hart.
  59. ///
  60. /// Declared in §9.3.
  61. pub const HART_GET_STATUS: usize = 2;
  62. /// Function ID to put the calling hart into suspend or platform specific lower power states.
  63. ///
  64. /// Declared in §9.4.
  65. pub const HART_SUSPEND: usize = 3;
  66. }