summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2021-02-05 15:17:48 +0300
committerAnup Patel <anup@brainfault.org>2021-03-03 07:49:24 +0300
commit807d71c4ff11b8dd9a6366819314db704e0f6aca (patch)
treefb729cd791d13c3cf43b58cde9a9a611a9c1572a
parent4b05df6700adbc71cfa5f681bf9263447c9140c4 (diff)
downloadopensbi-807d71c4ff11b8dd9a6366819314db704e0f6aca.tar.xz
include: sbi: Add hart_suspend() platform callback
We add hart_suspend() callback in platform operations which will be used by HSM implementation to enter retentive or non-retentive suspend state. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
-rw-r--r--include/sbi/sbi_platform.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h
index cc7e3ff..dadbc1e 100644
--- a/include/sbi/sbi_platform.h
+++ b/include/sbi/sbi_platform.h
@@ -139,6 +139,11 @@ struct sbi_platform_operations {
* return if success.
*/
int (*hart_stop)(void);
+ /**
+ * Put the current hart in platform specific suspend (or low-power)
+ * state.
+ */
+ int (*hart_suspend)(u32 suspend_type, ulong raddr);
/* Check whether reset type and reason supported by the platform */
int (*system_reset_check)(u32 reset_type, u32 reset_reason);
@@ -371,6 +376,31 @@ static inline int sbi_platform_hart_stop(const struct sbi_platform *plat)
}
/**
+ * 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
+ *
+ * @param plat pointer to struct sbi_platform
+ * @param suspend_type the type of suspend
+ * @param raddr physical address where the hart can resume in M-mode after
+ * non-retantive suspend
+ *
+ * @return 0 if successful and negative error code on failure
+ */
+static inline int sbi_platform_hart_suspend(const struct sbi_platform *plat,
+ u32 suspend_type, ulong raddr)
+{
+ if (plat && sbi_platform_ops(plat)->hart_suspend)
+ return sbi_platform_ops(plat)->hart_suspend(suspend_type,
+ raddr);
+ return SBI_ENOTSUPP;
+}
+
+/**
* Early initialization for current HART
*
* @param plat pointer to struct sbi_platform