summaryrefslogtreecommitdiff
path: root/include/sbi
diff options
context:
space:
mode:
Diffstat (limited to 'include/sbi')
-rw-r--r--include/sbi/sbi_ecall_interface.h8
-rw-r--r--include/sbi/sbi_system.h26
2 files changed, 34 insertions, 0 deletions
diff --git a/include/sbi/sbi_ecall_interface.h b/include/sbi/sbi_ecall_interface.h
index 9d6f474..4c378c3 100644
--- a/include/sbi/sbi_ecall_interface.h
+++ b/include/sbi/sbi_ecall_interface.h
@@ -30,6 +30,7 @@
#define SBI_EXT_SRST 0x53525354
#define SBI_EXT_PMU 0x504D55
#define SBI_EXT_DBCN 0x4442434E
+#define SBI_EXT_SUSP 0x53555350
/* SBI function IDs for BASE extension*/
#define SBI_EXT_BASE_GET_SPEC_VERSION 0x0
@@ -236,6 +237,13 @@ enum sbi_pmu_ctr_type {
#define SBI_EXT_DBCN_CONSOLE_READ 0x1
#define SBI_EXT_DBCN_CONSOLE_WRITE_BYTE 0x2
+/* SBI function IDs for SUSP extension */
+#define SBI_EXT_SUSP_SUSPEND 0x0
+
+#define SBI_SUSP_SLEEP_TYPE_SUSPEND 0x0
+#define SBI_SUSP_SLEEP_TYPE_LAST SBI_SUSP_SLEEP_TYPE_SUSPEND
+#define SBI_SUSP_PLATFORM_SLEEP_START 0x80000000
+
/* SBI base specification related macros */
#define SBI_SPEC_VERSION_MAJOR_OFFSET 24
#define SBI_SPEC_VERSION_MAJOR_MASK 0x7f
diff --git a/include/sbi/sbi_system.h b/include/sbi/sbi_system.h
index 84c2813..11d3d6f 100644
--- a/include/sbi/sbi_system.h
+++ b/include/sbi/sbi_system.h
@@ -43,4 +43,30 @@ bool sbi_system_reset_supported(u32 reset_type, u32 reset_reason);
void __noreturn sbi_system_reset(u32 reset_type, u32 reset_reason);
+/** System suspend device */
+struct sbi_system_suspend_device {
+ /** Name of the system suspend device */
+ char name[32];
+
+ /* Check whether sleep type is supported by the device */
+ int (*system_suspend_check)(u32 sleep_type);
+
+ /**
+ * Suspend the system
+ *
+ * @sleep_type: The sleep type identifier passed to the SBI call.
+ * @mmode_resume_addr:
+ * This is the same as sbi_scratch.warmboot_addr. Some platforms
+ * may not be able to return from system_suspend(), so they will
+ * jump directly to this address instead. Platforms which can
+ * return from system_suspend() may ignore this parameter.
+ */
+ int (*system_suspend)(u32 sleep_type, unsigned long mmode_resume_addr);
+};
+
+const struct sbi_system_suspend_device *sbi_system_suspend_get_device(void);
+void sbi_system_suspend_set_device(struct sbi_system_suspend_device *dev);
+bool sbi_system_suspend_supported(u32 sleep_type);
+int sbi_system_suspend(u32 sleep_type, ulong resume_addr, ulong opaque);
+
#endif