Tim Wawrzynczak has uploaded this change for review.

View Change

acpi: Add function to simplify If (CondRefOf (..)) sequences

The new function is called acpigen_write_if_cond_refof(), and it must
be paired with a following acpigen_write_if_end() call.

Change-Id: I6e192a569f550ecb77ad264275d52f219eacaca1
Signed-off-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
---
M src/acpi/acpigen.c
M src/include/acpi/acpigen.h
2 files changed, 12 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/coreboot refs/changes/03/56003/1
diff --git a/src/acpi/acpigen.c b/src/acpi/acpigen.c
index 9818dc2..515c3bb 100644
--- a/src/acpi/acpigen.c
+++ b/src/acpi/acpigen.c
@@ -2245,3 +2245,12 @@
acpigen_emit_byte(LOCAL7_OP);
acpigen_pop_len(); /* While */
}
+
+/* Requires matching acpigen_write_if_end() */
+void acpigen_write_if_cond_refof(const char *namestring)
+{
+ acpigen_write_if();
+ acpigen_emit_ext_op(COND_REFOF_OP);
+ acpigen_emit_namestring(namestring);
+ acpigen_emit_byte(ZERO_OP); /* ignore COND_REFOF_OP destination */
+}
diff --git a/src/include/acpi/acpigen.h b/src/include/acpi/acpigen.h
index 2d0bb77..cf1b1e9 100644
--- a/src/include/acpi/acpigen.h
+++ b/src/include/acpi/acpigen.h
@@ -586,4 +586,7 @@
/* Emits Notify(namestr, value) */
void acpigen_notify(const char *namestr, int value);

+/* Emits If (CondRefOf(NAME)) */
+void acpigen_write_if_cond_refof(const char *namestring);
+
#endif /* __ACPI_ACPIGEN_H__ */

To view, visit change 56003. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-Change-Id: I6e192a569f550ecb77ad264275d52f219eacaca1
Gerrit-Change-Number: 56003
Gerrit-PatchSet: 1
Gerrit-Owner: Tim Wawrzynczak <twawrzynczak@chromium.org>
Gerrit-MessageType: newchange