diff options
author | Samuel Holland <samuel@sholland.org> | 2023-01-23 09:32:06 +0300 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2023-01-24 15:00:21 +0300 |
commit | 33bf9174602c900201481241e9ade31cf37fccd8 (patch) | |
tree | 0e93c78764f1343b232d359391a72bd4cb53849d /include/sbi_utils/fdt | |
parent | dea0922f867f3d681ad3191fb562a082ea4a339f (diff) | |
download | opensbi-33bf9174602c900201481241e9ade31cf37fccd8.tar.xz |
lib: utils: Add fdt_add_cpu_idle_states() helper function
Since the availability and latency properties of CPU idle states depend
on the specific SBI HSM implementation, it is appropriate that the idle
states are added to the devicetree at runtime by that implementation.
This helper function adds a platform-provided array of idle states to
the devicetree, following the SBI idle state binding.
Reviewed-by: Anup Patel <anup@brainfault.org>
Signed-off-by: Samuel Holland <samuel@sholland.org>
Diffstat (limited to 'include/sbi_utils/fdt')
-rw-r--r-- | include/sbi_utils/fdt/fdt_fixup.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/sbi_utils/fdt/fdt_fixup.h b/include/sbi_utils/fdt/fdt_fixup.h index fb076ba..cab3f0f 100644 --- a/include/sbi_utils/fdt/fdt_fixup.h +++ b/include/sbi_utils/fdt/fdt_fixup.h @@ -9,6 +9,29 @@ #ifndef __FDT_FIXUP_H__ #define __FDT_FIXUP_H__ +struct sbi_cpu_idle_state { + const char *name; + uint32_t suspend_param; + bool local_timer_stop; + uint32_t entry_latency_us; + uint32_t exit_latency_us; + uint32_t min_residency_us; + uint32_t wakeup_latency_us; +}; + +/** + * Add CPU idle states to cpu nodes in the DT + * + * Add information about CPU idle states to the devicetree. This function + * assumes that CPU idle states are not already present in the devicetree, and + * that all CPU states are equally applicable to all CPUs. + * + * @param fdt: device tree blob + * @param states: array of idle state descriptions, ending with empty element + * @return zero on success and -ve on failure + */ +int fdt_add_cpu_idle_states(void *dtb, const struct sbi_cpu_idle_state *state); + /** * Fix up the CPU node in the device tree * |