diff options
author | Simon Glass <sjg@chromium.org> | 2020-07-07 13:11:51 -0600 |
---|---|---|
committer | Bin Meng <bmeng.cn@gmail.com> | 2020-07-17 14:32:24 +0800 |
commit | 03967ce2e5e4332edd1e023360707a1086f42242 (patch) | |
tree | b2b38e054b8a3a2bc35b81851d8186be1a9879e2 /lib/acpi | |
parent | 7e148f2ed365c89f50701ed45acd6e36138de447 (diff) |
acpigen: Support writing a package
A package collects together several elements. Add an easy way of writing
a package header and updating its length later.
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 | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/acpi/acpigen.c b/lib/acpi/acpigen.c index 11fc38419a..9043c2bc72 100644 --- a/lib/acpi/acpigen.c +++ b/lib/acpi/acpigen.c @@ -71,6 +71,18 @@ void acpigen_pop_len(struct acpi_ctx *ctx) p[2] = len >> 12 & 0xff; } +char *acpigen_write_package(struct acpi_ctx *ctx, int nr_el) +{ + char *p; + + acpigen_emit_byte(ctx, PACKAGE_OP); + acpigen_write_len_f(ctx); + p = ctx->current; + acpigen_emit_byte(ctx, nr_el); + + return p; +} + void acpigen_emit_stream(struct acpi_ctx *ctx, const char *data, int size) { int i; |