summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2020-04-24 09:56:22 +0300
committerAnup Patel <anup@brainfault.org>2020-04-27 12:05:29 +0300
commita9eac67ad019200e9a281a6fc10e394353a026f2 (patch)
treebb99209d3573cfc5a6e0a2617163a160e5e452a7 /include
parent1bb00ab3aeabde78579774eef8eadc7b7e765924 (diff)
downloadopensbi-a9eac67ad019200e9a281a6fc10e394353a026f2.tar.xz
include: sbi_platform: Combine reboot and shutdown into one callback
We can achieve shutdown, cold reboot, and warm reboot using just one sbi_platform callback so we combine system_reboot() and system_shutdown() callbacks into one system_reset() callback. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'include')
-rw-r--r--include/sbi/sbi_platform.h37
-rw-r--r--include/sbi/sbi_system.h4
-rw-r--r--include/sbi_utils/sys/htif.h2
3 files changed, 13 insertions, 30 deletions
diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h
index fc2913d..9eaf82e 100644
--- a/include/sbi/sbi_platform.h
+++ b/include/sbi/sbi_platform.h
@@ -146,10 +146,11 @@ struct sbi_platform_operations {
*/
int (*hart_stop)(void);
- /** Reboot the platform */
- int (*system_reboot)(u32 type);
- /** Shutdown or poweroff the platform */
- int (*system_shutdown)(u32 type);
+ /** Reset the platform */
+#define SBI_PLATFORM_RESET_SHUTDOWN 0
+#define SBI_PLATFORM_RESET_COLD 1
+#define SBI_PLATFORM_RESET_WARM 2
+ int (*system_reset)(u32 reset_type);
/** platform specific SBI extension implementation probe function */
int (*vendor_ext_check)(long extid);
@@ -686,34 +687,18 @@ static inline void sbi_platform_timer_exit(const struct sbi_platform *plat)
}
/**
- * Reboot the platform
+ * Reset the platform
*
* @param plat pointer to struct sbi_platform
- * @param type type of reboot
+ * @param reset_type type of reset
*
* @return 0 on success and negative error code on failure
*/
-static inline int sbi_platform_system_reboot(const struct sbi_platform *plat,
- u32 type)
+static inline int sbi_platform_system_reset(const struct sbi_platform *plat,
+ u32 reset_type)
{
- if (plat && sbi_platform_ops(plat)->system_reboot)
- return sbi_platform_ops(plat)->system_reboot(type);
- return 0;
-}
-
-/**
- * Shutdown or poweroff the platform
- *
- * @param plat pointer to struct sbi_platform
- * @param type type of shutdown or poweroff
- *
- * @return 0 on success and negative error code on failure
- */
-static inline int sbi_platform_system_shutdown(const struct sbi_platform *plat,
- u32 type)
-{
- if (plat && sbi_platform_ops(plat)->system_shutdown)
- return sbi_platform_ops(plat)->system_shutdown(type);
+ if (plat && sbi_platform_ops(plat)->system_reset)
+ return sbi_platform_ops(plat)->system_reset(reset_type);
return 0;
}
diff --git a/include/sbi/sbi_system.h b/include/sbi/sbi_system.h
index 8d9c18b..d44ef12 100644
--- a/include/sbi/sbi_system.h
+++ b/include/sbi/sbi_system.h
@@ -12,8 +12,6 @@
#include <sbi/sbi_types.h>
-void __noreturn sbi_system_reboot(u32 type);
-
-void __noreturn sbi_system_shutdown(u32 type);
+void __noreturn sbi_system_reset(u32 platform_reset_type);
#endif
diff --git a/include/sbi_utils/sys/htif.h b/include/sbi_utils/sys/htif.h
index 42903e8..7384b48 100644
--- a/include/sbi_utils/sys/htif.h
+++ b/include/sbi_utils/sys/htif.h
@@ -14,6 +14,6 @@ void htif_putc(char ch);
int htif_getc(void);
-int htif_system_down(u32 type);
+int htif_system_reset(u32 type);
#endif