aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/sbi/sbi_platform.h35
-rw-r--r--include/sbi/sbi_system.h4
-rw-r--r--include/sbi_utils/reset/fdt_reset.h7
-rw-r--r--include/sbi_utils/sys/htif.h4
-rw-r--r--include/sbi_utils/sys/sifive_test.h4
5 files changed, 42 insertions, 12 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
diff --git a/include/sbi/sbi_system.h b/include/sbi/sbi_system.h
index 309e263..34ba766 100644
--- a/include/sbi/sbi_system.h
+++ b/include/sbi/sbi_system.h
@@ -12,6 +12,8 @@
#include <sbi/sbi_types.h>
-void __noreturn sbi_system_reset(u32 reset_type);
+bool sbi_system_reset_supported(u32 reset_type, u32 reset_reason);
+
+void __noreturn sbi_system_reset(u32 reset_type, u32 reset_reason);
#endif
diff --git a/include/sbi_utils/reset/fdt_reset.h b/include/sbi_utils/reset/fdt_reset.h
index 789a6ac..cce441a 100644
--- a/include/sbi_utils/reset/fdt_reset.h
+++ b/include/sbi_utils/reset/fdt_reset.h
@@ -15,10 +15,13 @@
struct fdt_reset {
const struct fdt_match *match_table;
int (*init)(void *fdt, int nodeoff, const struct fdt_match *match);
- int (*system_reset)(u32 reset_type);
+ int (*system_reset_check)(u32 reset_type, u32 reset_reason);
+ void (*system_reset)(u32 reset_type, u32 reset_reason);
};
-int fdt_system_reset(u32 reset_type);
+int fdt_system_reset_check(u32 reset_type, u32 reset_reason);
+
+void fdt_system_reset(u32 reset_type, u32 reset_reason);
int fdt_reset_init(void);
diff --git a/include/sbi_utils/sys/htif.h b/include/sbi_utils/sys/htif.h
index 7384b48..a431723 100644
--- a/include/sbi_utils/sys/htif.h
+++ b/include/sbi_utils/sys/htif.h
@@ -14,6 +14,8 @@ void htif_putc(char ch);
int htif_getc(void);
-int htif_system_reset(u32 type);
+int htif_system_reset_check(u32 type, u32 reason);
+
+void htif_system_reset(u32 type, u32 reason);
#endif
diff --git a/include/sbi_utils/sys/sifive_test.h b/include/sbi_utils/sys/sifive_test.h
index 7e153d5..958622e 100644
--- a/include/sbi_utils/sys/sifive_test.h
+++ b/include/sbi_utils/sys/sifive_test.h
@@ -12,7 +12,9 @@
#include <sbi/sbi_types.h>
-int sifive_test_system_reset(u32 type);
+int sifive_test_system_reset_check(u32 type, u32 reason);
+
+void sifive_test_system_reset(u32 type, u32 reason);
int sifive_test_init(unsigned long base);