summaryrefslogtreecommitdiff
path: root/platform/generic
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2020-11-24 09:29:05 +0300
committerAnup Patel <anup@brainfault.org>2020-12-01 14:40:31 +0300
commit5c429ae2133e1a82b81403146a3e38e2b4b8350e (patch)
tree09b02a0042a7ba5697e2f44082d08d05db147b3f /platform/generic
parentda074796df871f6323d052f123b7668d390980dc (diff)
downloadopensbi-5c429ae2133e1a82b81403146a3e38e2b4b8350e.tar.xz
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>
Diffstat (limited to 'platform/generic')
-rw-r--r--platform/generic/include/platform_override.h5
-rw-r--r--platform/generic/platform.c23
2 files changed, 22 insertions, 6 deletions
diff --git a/platform/generic/include/platform_override.h b/platform/generic/include/platform_override.h
index 8a53cdf..77a90d6 100644
--- a/platform/generic/include/platform_override.h
+++ b/platform/generic/include/platform_override.h
@@ -20,7 +20,10 @@ struct platform_override {
int (*final_init)(bool cold_boot, const struct fdt_match *match);
void (*early_exit)(const struct fdt_match *match);
void (*final_exit)(const struct fdt_match *match);
- int (*system_reset)(u32 reset_type, const struct fdt_match *match);
+ int (*system_reset_check)(u32 reset_type, u32 reset_reason,
+ const struct fdt_match *match);
+ void (*system_reset)(u32 reset_type, u32 reset_reason,
+ const struct fdt_match *match);
int (*fdt_fixup)(void *fdt, const struct fdt_match *match);
};
diff --git a/platform/generic/platform.c b/platform/generic/platform.c
index d902e71..abb696a 100644
--- a/platform/generic/platform.c
+++ b/platform/generic/platform.c
@@ -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,
};