From 7fb8da4ce1b22c8f077e6d4fe6e0d88e3fd9206d Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Tue, 7 Jul 2020 13:11:45 -0600 Subject: acpi: Support string output Add support for output of strings and streams of bytes. Signed-off-by: Simon Glass Reviewed-by: Wolfgang Wallner Reviewed-by: Bin Meng --- lib/acpi/acpigen.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'lib') diff --git a/lib/acpi/acpigen.c b/lib/acpi/acpigen.c index a42ae26494..671f1d0eea 100644 --- a/lib/acpi/acpigen.c +++ b/lib/acpi/acpigen.c @@ -37,3 +37,17 @@ void acpigen_emit_dword(struct acpi_ctx *ctx, uint data) acpigen_emit_byte(ctx, (data >> 16) & 0xff); acpigen_emit_byte(ctx, (data >> 24) & 0xff); } + +void acpigen_emit_stream(struct acpi_ctx *ctx, const char *data, int size) +{ + int i; + + for (i = 0; i < size; i++) + acpigen_emit_byte(ctx, data[i]); +} + +void acpigen_emit_string(struct acpi_ctx *ctx, const char *str) +{ + acpigen_emit_stream(ctx, str, str ? strlen(str) : 0); + acpigen_emit_byte(ctx, '\0'); +} -- cgit