summaryrefslogtreecommitdiff
path: root/include/sbi/sbi_platform.h
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2020-11-24 09:29:05 +0300
committerAnup Patel <anup@brainfault.org>2020-12-01 14:40:31 +0300
commit5c429ae2133e1a82b81403146a3e38e2b4b8350e (patch)
tree09b02a0042a7ba5697e2f44082d08d05db147b3f /include/sbi/sbi_platform.h
parentda074796df871f6323d052f123b7668d390980dc (diff)
downloadopensbi-5c429ae2133e1a82b81403146a3e38e2b4b8350e.tar.xz
lib: sbi: Improve system reset platform operations
To implement the SBI SRST extension, we need two platform operations for system reset: 1) system_reset_check() - This operation will check whether given reset type and reason are supported by the platform 2) system_reset() - This operation will do the actual platform system reset and it will not return if reset type and reason are supported by the platform This patch updates system reset related code everywhere as-per above. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'include/sbi/sbi_platform.h')
-rw-r--r--include/sbi/sbi_platform.h35
1 files changed, 28 insertions, 7 deletions
diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h
index b06aaa6..ee72323 100644
--- a/include/sbi/sbi_platform.h
+++ b/include/sbi/sbi_platform.h
@@ -137,8 +137,10 @@ struct sbi_platform_operations {
*/
int (*hart_stop)(void);
+ /* Check whether reset type and reason supported by the platform */
+ int (*system_reset_check)(u32 reset_type, u32 reset_reason);
/** Reset the platform */
- int (*system_reset)(u32 reset_type);
+ void (*system_reset)(u32 reset_type, u32 reset_reason);
/** platform specific SBI extension implementation probe function */
int (*vendor_ext_check)(long extid);
@@ -653,22 +655,41 @@ static inline void sbi_platform_timer_exit(const struct sbi_platform *plat)
}
/**
- * Reset the platform
+ * Check whether reset type and reason supported by the platform
*
* @param plat pointer to struct sbi_platform
* @param reset_type type of reset
+ * @param reset_reason reason for reset
*
- * @return 0 on success and negative error code on failure
+ * @return 0 if reset type and reason not supported and 1 if supported
*/
-static inline int sbi_platform_system_reset(const struct sbi_platform *plat,
- u32 reset_type)
+static inline int sbi_platform_system_reset_check(
+ const struct sbi_platform *plat,
+ u32 reset_type, u32 reset_reason)
{
- if (plat && sbi_platform_ops(plat)->system_reset)
- return sbi_platform_ops(plat)->system_reset(reset_type);
+ if (plat && sbi_platform_ops(plat)->system_reset_check)
+ return sbi_platform_ops(plat)->system_reset_check(reset_type,
+ reset_reason);
return 0;
}
/**
+ * Reset the platform
+ *
+ * This function will not return for supported reset type and reset reason
+ *
+ * @param plat pointer to struct sbi_platform
+ * @param reset_type type of reset
+ * @param reset_reason reason for reset
+ */
+static inline void sbi_platform_system_reset(const struct sbi_platform *plat,
+ u32 reset_type, u32 reset_reason)
+{
+ if (plat && sbi_platform_ops(plat)->system_reset)
+ sbi_platform_ops(plat)->system_reset(reset_type, reset_reason);
+}
+
+/**
* Check if a vendor extension is implemented or not.
*
* @param plat pointer to struct sbi_platform