*/
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);
}
/**
- * 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;
}
#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
int htif_getc(void);
-int htif_system_down(u32 type);
+int htif_system_reset(u32 type);
#endif
#include <sbi/sbi_error.h>
#include <sbi/sbi_hsm.h>
#include <sbi/sbi_ipi.h>
+#include <sbi/sbi_platform.h>
#include <sbi/sbi_system.h>
#include <sbi/sbi_timer.h>
#include <sbi/sbi_tlb.h>
}
break;
case SBI_EXT_0_1_SHUTDOWN:
- sbi_system_shutdown(0);
+ sbi_system_reset(SBI_PLATFORM_RESET_SHUTDOWN);
break;
default:
ret = SBI_ENOTSUPP;
#include <sbi/sbi_ipi.h>
#include <sbi/sbi_init.h>
-void __noreturn sbi_system_reboot(u32 type)
+void __noreturn sbi_system_reset(u32 platform_reset_type)
{
ulong hbase = 0, hmask;
u32 cur_hartid = current_hartid();
/* Stop current HART */
sbi_hsm_hart_stop(scratch, FALSE);
- /* Platform specific reooot */
- sbi_platform_system_reboot(sbi_platform_ptr(scratch), type);
+ /* Platform specific reset */
+ sbi_platform_system_reset(sbi_platform_ptr(scratch),
+ platform_reset_type);
- /* If platform specific reboot did not work then do sbi_exit() */
- sbi_exit(scratch);
-}
-
-void __noreturn sbi_system_shutdown(u32 type)
-{
- ulong hbase = 0, hmask;
- u32 cur_hartid = current_hartid();
- struct sbi_scratch *scratch = sbi_scratch_thishart_ptr();
-
- /* Send HALT IPI to every hart other than the current hart */
- while (!sbi_hsm_hart_started_mask(hbase, &hmask)) {
- if (hbase <= cur_hartid)
- hmask &= ~(1UL << (cur_hartid - hbase));
- if (hmask)
- sbi_ipi_send_halt(hmask, hbase);
- hbase += BITS_PER_LONG;
- }
-
- /* Stop current HART */
- sbi_hsm_hart_stop(scratch, FALSE);
-
- /* Platform specific shutdown */
- sbi_platform_system_shutdown(sbi_platform_ptr(scratch), type);
-
- /* If platform specific shutdown did not work then do sbi_exit() */
+ /* If platform specific reset did not work then do sbi_exit() */
sbi_exit(scratch);
}
return ch - 1;
}
-int htif_system_down(u32 type)
+int htif_system_reset(u32 type)
{
while (1) {
fromhost = 0;
return plmt_warm_timer_init();
}
-/* Reboot the platform. */
-static int ae350_system_reboot(u32 type)
+/* Reset the platform. */
+static int ae350_system_reset(u32 type)
{
/* For now nothing to do. */
- sbi_printf("System reboot\n");
- return 0;
-}
-
-/* Shutdown or poweroff the platform. */
-static int ae350_system_shutdown(u32 type)
-{
- /* For now nothing to do. */
- sbi_printf("System shutdown\n");
+ sbi_printf("System reset\n");
return 0;
}
.timer_event_start = plmt_timer_event_start,
.timer_event_stop = plmt_timer_event_stop,
- .system_reboot = ae350_system_reboot,
- .system_shutdown = ae350_system_shutdown
+ .system_reset = ae350_system_reset
};
const struct sbi_platform platform = {
}
/*
- * Reboot the ariane.
+ * Reset the ariane.
*/
-static int ariane_system_reboot(u32 type)
+static int ariane_system_reset(u32 type)
{
/* For now nothing to do. */
- sbi_printf("System reboot\n");
- return 0;
-}
-
-/*
- * Shutdown or poweroff the ariane.
- */
-static int ariane_system_shutdown(u32 type)
-{
- /* For now nothing to do. */
- sbi_printf("System shutdown\n");
+ sbi_printf("System reset\n");
return 0;
}
.timer_value = clint_timer_value,
.timer_event_start = clint_timer_event_start,
.timer_event_stop = clint_timer_event_stop,
- .system_reboot = ariane_system_reboot,
- .system_shutdown = ariane_system_shutdown
+ .system_reset = ariane_system_reset
};
const struct sbi_platform platform = {
}
/*
- * Reboot the openpiton.
+ * Reset the openpiton.
*/
-static int openpiton_system_reboot(u32 type)
+static int openpiton_system_reset(u32 type)
{
/* For now nothing to do. */
- sbi_printf("System reboot\n");
- return 0;
-}
-
-/*
- * Shutdown or poweroff the openpiton.
- */
-static int openpiton_system_shutdown(u32 type)
-{
- /* For now nothing to do. */
- sbi_printf("System shutdown\n");
+ sbi_printf("System reset\n");
return 0;
}
.timer_value = clint_timer_value,
.timer_event_start = clint_timer_event_start,
.timer_event_stop = clint_timer_event_stop,
- .system_reboot = openpiton_system_reboot,
- .system_shutdown = openpiton_system_shutdown
+ .system_reset = openpiton_system_reset
};
const struct sbi_platform platform = {
return clint_warm_timer_init();
}
-static int k210_system_reboot(u32 type)
+static int k210_system_reset(u32 type)
{
/* For now nothing to do. */
- sbi_printf("System reboot\n");
-
- return 0;
-}
-
-static int k210_system_shutdown(u32 type)
-{
- /* For now nothing to do. */
- sbi_printf("System shutdown\n");
+ sbi_printf("System reset\n");
return 0;
}
.timer_event_stop = clint_timer_event_stop,
.timer_event_start = clint_timer_event_start,
- .system_reboot = k210_system_reboot,
- .system_shutdown = k210_system_shutdown
+ .system_reset = k210_system_reset
};
const struct sbi_platform platform = {
return clint_warm_timer_init();
}
-static int virt_system_down(u32 type)
+static int virt_system_reset(u32 type)
{
/* Tell the "finisher" that the simulation
* was successful so that QEMU exits
.timer_event_stop = clint_timer_event_stop,
.timer_event_start = clint_timer_event_start,
.timer_init = virt_timer_init,
- .system_reboot = virt_system_down,
- .system_shutdown = virt_system_down
+ .system_reset = virt_system_reset,
};
const struct sbi_platform platform = {
[3] = 4,
};
-static int fu540_system_down(u32 type)
+static int fu540_system_reset(u32 type)
{
/* For now nothing to do. */
return 0;
.timer_event_stop = clint_timer_event_stop,
.timer_event_start = clint_timer_event_start,
.timer_init = fu540_timer_init,
- .system_reboot = fu540_system_down,
- .system_shutdown = fu540_system_down
+ .system_reset = fu540_system_reset
};
const struct sbi_platform platform = {
.timer_event_stop = clint_timer_event_stop,
.timer_event_start = clint_timer_event_start,
.timer_init = spike_timer_init,
- .system_reboot = htif_system_down,
- .system_shutdown = htif_system_down
+ .system_reset = htif_system_reset
};
const struct sbi_platform platform = {
}
/*
- * Reboot the platform.
+ * Reset the platform.
*/
-static int platform_system_reboot(u32 type)
-{
- return 0;
-}
-
-/*
- * Shutdown or poweroff the platform.
- */
-static int platform_system_shutdown(u32 type)
+static int platform_system_reset(u32 type)
{
return 0;
}
.timer_event_stop = platform_timer_event_stop,
.timer_event_start = platform_timer_event_start,
.timer_init = platform_timer_init,
- .system_reboot = platform_system_reboot,
- .system_shutdown = platform_system_shutdown
+ .system_reset = platform_system_reset
};
const struct sbi_platform platform = {
.opensbi_version = OPENSBI_VERSION,
return clint_warm_timer_init();
}
-static int c910_system_shutdown(u32 type)
+static int c910_system_reset(u32 type)
{
asm volatile ("ebreak");
return 0;
.timer_init = c910_timer_init,
.timer_event_start = clint_timer_event_start,
- .system_shutdown = c910_system_shutdown,
+ .system_reset = c910_system_reset,
.hart_start = c910_hart_start,
};