diff --git a/src/acpi/acpigen.c b/src/acpi/acpigen.c index 308cf5ac85..eaf95e018f 100644 --- a/src/acpi/acpigen.c +++ b/src/acpi/acpigen.c @@ -1596,6 +1596,25 @@ void acpigen_write_if_lequal_op_op(uint8_t op1, uint8_t op2) acpigen_emit_byte(op2); } +/* + * Generates ACPI code for checking if operand1 and operand2 are not equal. + * Both operand1 and operand2 are ACPI ops. + * + * If (Lnotequal (op1, op2)) + * + * This is equivalent to + * + * If (Lnot (Lequal (op1, op2))) + */ +void acpigen_write_if_lnotequal_op_op(uint8_t op1, uint8_t op2) +{ + acpigen_write_if(); + acpigen_emit_byte(LNOT_OP); + acpigen_emit_byte(LEQUAL_OP); + acpigen_emit_byte(op1); + acpigen_emit_byte(op2); +} + /* * Generates ACPI code for checking if operand1 is greater than operand2. * Both operand1 and operand2 are ACPI ops. @@ -1624,6 +1643,25 @@ void acpigen_write_if_lequal_op_int(uint8_t op, uint64_t val) acpigen_write_integer(val); } +/* + * Generates ACPI code for checking if operand1 and operand2 are not equal, where, + * operand1 is ACPI op and operand2 is an integer. + * + * If (Lnotequal (op, val)) + * + * This is equivalent to + * + * If (Lnot (Lequal (op, val))) + */ +void acpigen_write_if_lnotequal_op_int(uint8_t op, uint64_t val) +{ + acpigen_write_if(); + acpigen_emit_byte(LNOT_OP); + acpigen_emit_byte(LEQUAL_OP); + acpigen_emit_byte(op); + acpigen_write_integer(val); +} + /* * Generates ACPI code for checking if operand is greater than the value, where, * operand is ACPI op and val is an integer. @@ -1652,6 +1690,25 @@ void acpigen_write_if_lequal_namestr_int(const char *namestr, uint64_t val) acpigen_write_integer(val); } +/* + * Generates ACPI code for checking if operand1 and operand2 are not equal, where, + * operand1 is namestring and operand2 is an integer. + * + * If (Lnotequal ("namestr", val)) + * + * * This is equivalent to + * + * If (Lnot (Lequal ("namestr", val))) + */ +void acpigen_write_if_lnotequal_namestr_int(const char *namestr, uint64_t val) +{ + acpigen_write_if(); + acpigen_emit_byte(LNOT_OP); + acpigen_emit_byte(LEQUAL_OP); + acpigen_emit_namestring(namestr); + acpigen_write_integer(val); +} + /* * Generates ACPI code for checking if operand1 and operand2 are equal, where, * operand1 is namestring and operand2 is an integer. diff --git a/src/include/acpi/acpigen.h b/src/include/acpi/acpigen.h index 8129263475..56b4f780f7 100644 --- a/src/include/acpi/acpigen.h +++ b/src/include/acpi/acpigen.h @@ -506,10 +506,13 @@ void acpigen_write_debug_sprintf(const char *fmt, ...) __printf(1, 2); 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_lnotequal_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_lnotequal_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_lnotequal_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) {