diff options
author | Andrew Jones <ajones@ventanamicro.com> | 2023-02-27 13:31:06 +0300 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2023-02-27 17:20:51 +0300 |
commit | 5ccebf0a7ec79d0bbef36d6dcdc2717f25d40767 (patch) | |
tree | 71c3f8bcaacef745452db2f8c7032913b72e05c3 /platform | |
parent | 37558dccbedbb571150630a910547a93d7ec8822 (diff) | |
download | opensbi-5ccebf0a7ec79d0bbef36d6dcdc2717f25d40767.tar.xz |
platform: generic: Add system suspend test
When the system-suspend-test property is present in the domain config
node as shown below, implement system suspend with a simple 5 second
delay followed by a WFI. This allows testing system suspend when the
low-level firmware doesn't support it.
/ {
chosen {
opensbi-domains {
compatible = "opensbi,domain,config";
system-suspend-test;
};
Signed-off-by: Andrew Jones <ajones@ventanamicro.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'platform')
-rw-r--r-- | platform/generic/platform.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/platform/generic/platform.c b/platform/generic/platform.c index 0b90fd7..eeefef4 100644 --- a/platform/generic/platform.c +++ b/platform/generic/platform.c @@ -13,6 +13,7 @@ #include <sbi/sbi_hartmask.h> #include <sbi/sbi_platform.h> #include <sbi/sbi_string.h> +#include <sbi/sbi_system.h> #include <sbi_utils/fdt/fdt_domain.h> #include <sbi_utils/fdt/fdt_fixup.h> #include <sbi_utils/fdt/fdt_helper.h> @@ -219,7 +220,24 @@ static int generic_extensions_init(struct sbi_hart_features *hfeatures) static int generic_domains_init(void) { - return fdt_domains_populate(fdt_get_address()); + void *fdt = fdt_get_address(); + int offset, ret; + + ret = fdt_domains_populate(fdt); + if (ret < 0) + return ret; + + offset = fdt_path_offset(fdt, "/chosen"); + + if (offset >= 0) { + offset = fdt_node_offset_by_compatible(fdt, offset, + "opensbi,domain,config"); + if (offset >= 0 && + fdt_get_property(fdt, offset, "system-suspend-test", NULL)) + sbi_system_suspend_test_enable(); + } + + return 0; } static u64 generic_tlbr_flush_limit(void) |