summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/acpi/acpigen.c50
-rw-r--r--src/include/acpi/acpigen.h4
2 files changed, 54 insertions, 0 deletions
diff --git a/src/acpi/acpigen.c b/src/acpi/acpigen.c
index b6a409eb96..63953b86b1 100644
--- a/src/acpi/acpigen.c
+++ b/src/acpi/acpigen.c
@@ -1369,6 +1369,14 @@ void acpigen_write_store_int_to_namestr(uint64_t src, const char *dst)
acpigen_emit_namestring(dst);
}
+/* Store ("namestr", dst) */
+void acpigen_write_store_namestr_to_op(const char *src, uint8_t dst)
+{
+ acpigen_write_store();
+ acpigen_emit_namestring(src);
+ acpigen_emit_byte(dst);
+}
+
/* Store (src, dst) */
void acpigen_write_store_int_to_op(uint64_t src, uint8_t dst)
{
@@ -1528,6 +1536,20 @@ void acpigen_write_if_lequal_op_op(uint8_t op1, uint8_t op2)
}
/*
+ * Generates ACPI code for checking if operand1 is greater than operand2.
+ * Both operand1 and operand2 are ACPI ops.
+ *
+ * If (Lgreater (op1 op2))
+ */
+void acpigen_write_if_lgreater_op_op(uint8_t op1, uint8_t op2)
+{
+ acpigen_write_if();
+ acpigen_emit_byte(LGREATER_OP);
+ acpigen_emit_byte(op1);
+ acpigen_emit_byte(op2);
+}
+
+/*
* Generates ACPI code for checking if operand1 and operand2 are equal, where,
* operand1 is ACPI op and operand2 is an integer.
*
@@ -1542,6 +1564,20 @@ void acpigen_write_if_lequal_op_int(uint8_t op, uint64_t val)
}
/*
+ * Generates ACPI code for checking if operand is greater than the value, where,
+ * operand is ACPI op and val is an integer.
+ *
+ * If (Lgreater (op, val))
+ */
+void acpigen_write_if_lgreater_op_int(uint8_t op, uint64_t val)
+{
+ acpigen_write_if();
+ acpigen_emit_byte(LGREATER_OP);
+ acpigen_emit_byte(op);
+ acpigen_write_integer(val);
+}
+
+/*
* Generates ACPI code for checking if operand1 and operand2 are equal, where,
* operand1 is namestring and operand2 is an integer.
*
@@ -1556,6 +1592,20 @@ void acpigen_write_if_lequal_namestr_int(const char *namestr, uint64_t val)
}
/*
+ * Generates ACPI code for checking if operand1 and operand2 are equal, where,
+ * operand1 is namestring and operand2 is an integer.
+ *
+ * If (Lgreater ("namestr", val))
+ */
+void acpigen_write_if_lgreater_namestr_int(const char *namestr, uint64_t val)
+{
+ acpigen_write_if();
+ acpigen_emit_byte(LGREATER_OP);
+ acpigen_emit_namestring(namestr);
+ acpigen_write_integer(val);
+}
+
+/*
* Generates ACPI code to check at runtime if an object named `namestring`
* exists, and leaves the If scope open to continue execute code when this
* is true. NOTE: Requires matching acpigen_write_if_end().
diff --git a/src/include/acpi/acpigen.h b/src/include/acpi/acpigen.h
index dff5a1f82f..0b21938f05 100644
--- a/src/include/acpi/acpigen.h
+++ b/src/include/acpi/acpigen.h
@@ -487,6 +487,7 @@ void acpigen_write_store_int_to_namestr(uint64_t src, const char *dst);
void acpigen_write_store_int_to_op(uint64_t src, uint8_t dst);
void acpigen_write_store_ops(uint8_t src, uint8_t dst);
void acpigen_write_store_op_to_namestr(uint8_t src, const char *dst);
+void acpigen_write_store_namestr_to_op(const char *src, uint8_t dst);
void acpigen_write_or(uint8_t arg1, uint8_t arg2, uint8_t res);
void acpigen_write_xor(uint8_t arg1, uint8_t arg2, uint8_t res);
void acpigen_write_and(uint8_t arg1, uint8_t arg2, uint8_t res);
@@ -506,8 +507,11 @@ void acpigen_write_debug_concatenate_string_op(const char *str1, uint8_t res, ui
void acpigen_write_if(void);
void acpigen_write_if_and(uint8_t arg1, uint8_t arg2);
void acpigen_write_if_lequal_op_op(uint8_t op, uint8_t val);
+void acpigen_write_if_lgreater_op_op(uint8_t op1, uint8_t op2);
void acpigen_write_if_lequal_op_int(uint8_t op, uint64_t val);
+void acpigen_write_if_lgreater_op_int(uint8_t op, uint64_t val);
void acpigen_write_if_lequal_namestr_int(const char *namestr, uint64_t val);
+void acpigen_write_if_lgreater_namestr_int(const char *namestr, uint64_t val);
__always_inline void acpigen_write_if_end(void)
{
acpigen_pop_len();