diff options
| author | Andrew Jones <[email protected]> | 2023-02-27 11:31:06 +0100 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2023-02-27 19:50:51 +0530 |
| commit | 5ccebf0a7ec79d0bbef36d6dcdc2717f25d40767 (patch) | |
| tree | 71c3f8bcaacef745452db2f8c7032913b72e05c3 /platform/generic/platform.c | |
| parent | 37558dccbedbb571150630a910547a93d7ec8822 (diff) | |
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 <[email protected]>
Reviewed-by: Anup Patel <[email protected]>
Diffstat (limited to 'platform/generic/platform.c')
| -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 0b90fd7c..eeefef4c 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) |
