diff options
author | Simon Glass <sjg@chromium.org> | 2020-07-07 13:12:00 -0600 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2020-07-17 14:32:24 +0800 |
commit | f9189d5ada8d48932463dc1d56ea4d44c050ebbd (patch) | |
tree | ac8c5c634ce28b5f31a35ab4586163df375d1ab9 /lib/acpi | |
parent | 9c70e7e556339ce9fa864782445f7927fafc5c03 (diff) | |
download | u-boot-f9189d5ada8d48932463dc1d56ea4d44c050ebbd.tar.gz u-boot-f9189d5ada8d48932463dc1d56ea4d44c050ebbd.tar.bz2 u-boot-f9189d5ada8d48932463dc1d56ea4d44c050ebbd.zip |
acpi: Add support for writing a Power Resource
These are used in ACPI to disable power to various pats of the system when
in sleep. Add a way to create a power resource, with the caller finishing
off the details.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'lib/acpi')
-rw-r--r-- | lib/acpi/acpigen.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/acpi/acpigen.c b/lib/acpi/acpigen.c index 4fd29ccb81..70d734245b 100644 --- a/lib/acpi/acpigen.c +++ b/lib/acpi/acpigen.c @@ -328,6 +328,28 @@ int acpigen_write_uuid(struct acpi_ctx *ctx, const char *uuid) return 0; } +void acpigen_write_power_res(struct acpi_ctx *ctx, const char *name, uint level, + uint order, const char *const dev_states[], + size_t dev_states_count) +{ + size_t i; + + for (i = 0; i < dev_states_count; i++) { + acpigen_write_name(ctx, dev_states[i]); + acpigen_write_package(ctx, 1); + acpigen_emit_simple_namestring(ctx, name); + acpigen_pop_len(ctx); /* Package */ + } + + acpigen_emit_ext_op(ctx, POWER_RES_OP); + + acpigen_write_len_f(ctx); + + acpigen_emit_simple_namestring(ctx, name); + acpigen_emit_byte(ctx, level); + acpigen_emit_word(ctx, order); +} + /* Sleep (ms) */ void acpigen_write_sleep(struct acpi_ctx *ctx, u64 sleep_ms) { |