forked from Mirrors/opensbi
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>
This commit is contained in:
@@ -177,12 +177,24 @@ static u64 generic_tlbr_flush_limit(void)
|
||||
return SBI_PLATFORM_TLB_RANGE_FLUSH_LIMIT_DEFAULT;
|
||||
}
|
||||
|
||||
static int generic_system_reset(u32 reset_type)
|
||||
static int generic_system_reset_check(u32 reset_type, u32 reset_reason)
|
||||
{
|
||||
if (generic_plat && generic_plat->system_reset)
|
||||
return generic_plat->system_reset(reset_type,
|
||||
generic_plat_match);
|
||||
return fdt_system_reset(reset_type);
|
||||
if (generic_plat && generic_plat->system_reset_check)
|
||||
return generic_plat->system_reset_check(reset_type,
|
||||
reset_reason,
|
||||
generic_plat_match);
|
||||
return fdt_system_reset_check(reset_type, reset_reason);
|
||||
}
|
||||
|
||||
static void generic_system_reset(u32 reset_type, u32 reset_reason)
|
||||
{
|
||||
if (generic_plat && generic_plat->system_reset) {
|
||||
generic_plat->system_reset(reset_type, reset_reason,
|
||||
generic_plat_match);
|
||||
return;
|
||||
}
|
||||
|
||||
fdt_system_reset(reset_type, reset_reason);
|
||||
}
|
||||
|
||||
const struct sbi_platform_operations platform_ops = {
|
||||
@@ -205,6 +217,7 @@ const struct sbi_platform_operations platform_ops = {
|
||||
.timer_event_start = fdt_timer_event_start,
|
||||
.timer_init = fdt_timer_init,
|
||||
.timer_exit = fdt_timer_exit,
|
||||
.system_reset_check = generic_system_reset_check,
|
||||
.system_reset = generic_system_reset,
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user