summaryrefslogtreecommitdiff
path: root/include/sbi/sbi_hsm.h
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2021-04-22 11:44:02 +0300
committerAnup Patel <anup@brainfault.org>2021-04-28 15:01:07 +0300
commita84a1ddbbabb2389b5af91473250d0aff90e40d7 (patch)
tree23d28621efd4573e17ded43bbb474600084e5b32 /include/sbi/sbi_hsm.h
parent043d088e3964ec64b091f739e2282f53f7d264fb (diff)
downloadopensbi-a84a1ddbbabb2389b5af91473250d0aff90e40d7.tar.xz
lib: sbi: Simplify HSM platform operations
Instead of having hsm_start(), hsm_stop() and hsm_suspend() callbacks in platform operations, it will be much simpler for HSM driver to directly register these operations as a device to the sbi_hsm implementation. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Diffstat (limited to 'include/sbi/sbi_hsm.h')
-rw-r--r--include/sbi/sbi_hsm.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/sbi/sbi_hsm.h b/include/sbi/sbi_hsm.h
index bf0c1a5..c16e871 100644
--- a/include/sbi/sbi_hsm.h
+++ b/include/sbi/sbi_hsm.h
@@ -12,9 +12,40 @@
#include <sbi/sbi_types.h>
+/** Hart state managment device */
+struct sbi_hsm_device {
+ /** Name of the hart state managment device */
+ char name[32];
+
+ /** Start (or power-up) the given hart */
+ int (*hart_start)(u32 hartid, ulong saddr);
+
+ /**
+ * Stop (or power-down) the current hart from running. This call
+ * doesn't expect to return if success.
+ */
+ int (*hart_stop)(void);
+
+ /**
+ * Put the current hart in platform specific suspend (or low-power)
+ * state.
+ *
+ * For successful retentive suspend, the call will return 0 when
+ * the hart resumes normal execution.
+ *
+ * For successful non-retentive suspend, the hart will resume from
+ * specified resume address
+ */
+ int (*hart_suspend)(u32 suspend_type, ulong raddr);
+};
+
struct sbi_domain;
struct sbi_scratch;
+const struct sbi_hsm_device *sbi_hsm_get_device(void);
+
+void sbi_hsm_set_device(const struct sbi_hsm_device *dev);
+
int sbi_hsm_init(struct sbi_scratch *scratch, u32 hartid, bool cold_boot);
void __noreturn sbi_hsm_exit(struct sbi_scratch *scratch);