summaryrefslogtreecommitdiffstats
path: root/test/dm
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-09-22 12:44:56 -0600
committerBin Meng <bmeng.cn@gmail.com>2020-09-25 11:27:13 +0800
commite0a896b88f2e517b10c67a4f85f3846a0312041d (patch)
tree37d262b871bb50c74139da14c8f2844661883789 /test/dm
parent99e555a79ab882eb8b38886fa5dab053d4d64bfa (diff)
downloadu-boot-e0a896b88f2e517b10c67a4f85f3846a0312041d.tar.gz
u-boot-e0a896b88f2e517b10c67a4f85f3846a0312041d.tar.xz
u-boot-e0a896b88f2e517b10c67a4f85f3846a0312041d.zip
acpi: Add support for writing a _PRW
A 'Power Resource for Wake' list the resources a device depends on for wake. Add a function to generate this. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'test/dm')
-rw-r--r--test/dm/acpigen.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/test/dm/acpigen.c b/test/dm/acpigen.c
index 1b2767e732..1dc064ffbc 100644
--- a/test/dm/acpigen.c
+++ b/test/dm/acpigen.c
@@ -1097,3 +1097,33 @@ static int dm_test_acpi_write_name(struct unit_test_state *uts)
return 0;
}
DM_TEST(dm_test_acpi_write_name, 0);
+
+/* Test emitting a _PRW component */
+static int dm_test_acpi_write_prw(struct unit_test_state *uts)
+{
+ struct acpi_ctx *ctx;
+ u8 *ptr;
+
+ ut_assertok(alloc_context(&ctx));
+
+ ptr = acpigen_get_current(ctx);
+ acpigen_write_prw(ctx, 5, 3);
+ ut_asserteq(NAME_OP, *ptr++);
+
+ ut_asserteq_strn("_PRW", (char *)ptr);
+ ptr += 4;
+ ut_asserteq(PACKAGE_OP, *ptr++);
+ ut_asserteq(8, acpi_test_get_length(ptr));
+ ptr += 3;
+ ut_asserteq(2, *ptr++);
+ ut_asserteq(BYTE_PREFIX, *ptr++);
+ ut_asserteq(5, *ptr++);
+ ut_asserteq(BYTE_PREFIX, *ptr++);
+ ut_asserteq(3, *ptr++);
+ ut_asserteq_ptr(ptr, ctx->current);
+
+ free_context(&ctx);
+
+ return 0;
+}
+DM_TEST(dm_test_acpi_write_prw, 0);