forked from Mirrors/opensbi
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>
This commit is contained in:
@@ -110,19 +110,11 @@ static int ae350_timer_init(bool cold_boot)
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -145,8 +137,7 @@ const struct sbi_platform_operations platform_ops = {
|
||||
.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 = {
|
||||
|
@@ -150,22 +150,12 @@ static int ariane_timer_init(bool cold_boot)
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
@@ -186,8 +176,7 @@ const struct sbi_platform_operations platform_ops = {
|
||||
.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 = {
|
||||
|
@@ -182,22 +182,12 @@ static int openpiton_timer_init(bool cold_boot)
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
|
||||
@@ -218,8 +208,7 @@ const struct sbi_platform_operations platform_ops = {
|
||||
.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 = {
|
||||
|
@@ -96,18 +96,10 @@ static int k210_timer_init(bool cold_boot)
|
||||
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;
|
||||
}
|
||||
@@ -128,8 +120,7 @@ const struct sbi_platform_operations platform_ops = {
|
||||
.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 = {
|
||||
|
@@ -100,7 +100,7 @@ static int virt_timer_init(bool cold_boot)
|
||||
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
|
||||
@@ -123,8 +123,7 @@ const struct sbi_platform_operations platform_ops = {
|
||||
.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 = {
|
||||
|
@@ -138,7 +138,7 @@ static u32 fu540_hart_index2id[FU540_HART_COUNT - 1] = {
|
||||
[3] = 4,
|
||||
};
|
||||
|
||||
static int fu540_system_down(u32 type)
|
||||
static int fu540_system_reset(u32 type)
|
||||
{
|
||||
/* For now nothing to do. */
|
||||
return 0;
|
||||
@@ -158,8 +158,7 @@ const struct sbi_platform_operations platform_ops = {
|
||||
.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 = {
|
||||
|
@@ -72,8 +72,7 @@ const struct sbi_platform_operations platform_ops = {
|
||||
.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 = {
|
||||
|
@@ -162,17 +162,9 @@ static void platform_timer_event_stop(void)
|
||||
}
|
||||
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
@@ -194,8 +186,7 @@ const struct sbi_platform_operations platform_ops = {
|
||||
.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,
|
||||
|
@@ -100,7 +100,7 @@ static int c910_timer_init(bool cold_boot)
|
||||
return clint_warm_timer_init();
|
||||
}
|
||||
|
||||
static int c910_system_shutdown(u32 type)
|
||||
static int c910_system_reset(u32 type)
|
||||
{
|
||||
asm volatile ("ebreak");
|
||||
return 0;
|
||||
@@ -127,7 +127,7 @@ const struct sbi_platform_operations platform_ops = {
|
||||
.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,
|
||||
};
|
||||
|
Reference in New Issue
Block a user