[coreboot-gerrit] New patch to review for coreboot: arch/x86/acpigen: Fix acpigen for If (Lequal (...))

Furquan Shaikh (furquan@google.com) gerrit at coreboot.org
Mon Nov 14 23:58:03 CET 2016


Furquan Shaikh (furquan at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/17421

-gerrit

commit 312076d75706beb0c75953bb8829a3965679dfd1
Author: Furquan Shaikh <furquan at chromium.org>
Date:   Mon Nov 14 14:16:26 2016 -0800

    arch/x86/acpigen: Fix acpigen for If (Lequal (...))
    
    acpigen_write_if_lequal is used to generate ACPI code to check if two
    operands are equal, where operand1 is an ACPI op and operand2 is an
    integer. Update name of function to reflect this and fix code to write
    integer instead of emitting byte for operand2.
    
    TEST=Verified by disassembling SSDT on reef that ACPI code generated for
    If with operand2 greater than 1 is correct.
    
    If ((Local1 == 0x02))
    {
    	Return (0x01)
    }
    Else
    {
    	Return (Buffer (One)
    	{
    		0x00                          /* . */
    	})
    }
    
    Change-Id: If643c078b06d4e2e5a084b51c458dd612d565acc
    Reported-by: Naresh G Solanki <naresh.solanki at intel.com>
    Signed-off-by: Furquan Shaikh <furquan at chromium.org>
---
 src/arch/x86/acpigen.c              | 14 ++++++++++----
 src/arch/x86/acpigen_dsm.c          |  4 ++--
 src/arch/x86/include/arch/acpigen.h |  2 +-
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/arch/x86/acpigen.c b/src/arch/x86/acpigen.c
index 0c5a10c..7115bdb 100644
--- a/src/arch/x86/acpigen.c
+++ b/src/arch/x86/acpigen.c
@@ -1103,12 +1103,18 @@ void acpigen_write_if_and(uint8_t arg1, uint8_t arg2)
 	acpigen_emit_byte(arg2);
 }
 
-void acpigen_write_if_lequal(uint8_t arg1, uint8_t arg2)
+/*
+ * Generates ACPI code for checking if operand1 and operand2 are equal, where,
+ * operand1 is ACPI op and operand2 is an integer.
+ *
+ * If (Lequal (op, val))
+ */
+void acpigen_write_if_lequal_op_int(uint8_t op, uint64_t val)
 {
 	acpigen_write_if();
 	acpigen_emit_byte(LEQUAL_OP);
-	acpigen_emit_byte(arg1);
-	acpigen_emit_byte(arg2);
+	acpigen_emit_byte(op);
+	acpigen_write_integer(val);
 }
 
 void acpigen_write_else(void)
@@ -1217,7 +1223,7 @@ void acpigen_write_dsm(const char *uuid, void (*callbacks[])(void *),
 
 	for (i = 0; i < count; i++) {
 		/*   If (Lequal (Local1, i)) */
-		acpigen_write_if_lequal(LOCAL1_OP, i);
+		acpigen_write_if_lequal_op_int(LOCAL1_OP, i);
 
 		/*     Callback to write if handler. */
 		if (callbacks[i])
diff --git a/src/arch/x86/acpigen_dsm.c b/src/arch/x86/acpigen_dsm.c
index c6d614a..1aab90b 100644
--- a/src/arch/x86/acpigen_dsm.c
+++ b/src/arch/x86/acpigen_dsm.c
@@ -26,14 +26,14 @@ static void i2c_hid_func0_cb(void *arg)
 	/* ToInteger (Arg1, Local2) */
 	acpigen_write_to_integer(ARG1_OP, LOCAL2_OP);
 	/* If (LEqual (Local2, 0x0)) */
-	acpigen_write_if_lequal(LOCAL2_OP, 0x0);
+	acpigen_write_if_lequal_op_int(LOCAL2_OP, 0x0);
 	/*   Return (Buffer (One) { 0x1f }) */
 	acpigen_write_return_singleton_buffer(0x1f);
 	acpigen_pop_len();	/* Pop : If */
 	/* Else */
 	acpigen_write_else();
 	/*   If (LEqual (Local2, 0x1)) */
-	acpigen_write_if_lequal(LOCAL2_OP, 0x1);
+	acpigen_write_if_lequal_op_int(LOCAL2_OP, 0x1);
 	/*     Return (Buffer (One) { 0x3f }) */
 	acpigen_write_return_singleton_buffer(0x3f);
 	acpigen_pop_len();	/* Pop : If */
diff --git a/src/arch/x86/include/arch/acpigen.h b/src/arch/x86/include/arch/acpigen.h
index 4169fdf..572ae6c 100644
--- a/src/arch/x86/include/arch/acpigen.h
+++ b/src/arch/x86/include/arch/acpigen.h
@@ -219,7 +219,7 @@ void acpigen_write_debug_integer(uint64_t val);
 void acpigen_write_debug_op(uint8_t op);
 void acpigen_write_if(void);
 void acpigen_write_if_and(uint8_t arg1, uint8_t arg2);
-void acpigen_write_if_lequal(uint8_t arg1, uint8_t arg2);
+void acpigen_write_if_lequal_op_int(uint8_t op, uint64_t val);
 void acpigen_write_else(void);
 void acpigen_write_to_buffer(uint8_t src, uint8_t dst);
 void acpigen_write_to_integer(uint8_t src, uint8_t dst);



More information about the coreboot-gerrit mailing list